diff --git a/src/ui/avatardd/ADDArtifact.java b/src/ui/avatardd/ADDArtifact.java index cebf2879f57e0c3a82d843899a042ca9813c9e8d..6b75d5e29f80f4b6a44865df70f834212e7b1da8 100755 --- a/src/ui/avatardd/ADDArtifact.java +++ b/src/ui/avatardd/ADDArtifact.java @@ -1,48 +1,48 @@ /**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille -ludovic.apvrille AT enst.fr - -This software is a computer program whose purpose is to allow the -edition of TURTLE analysis, design and deployment diagrams, to -allow the generation of RT-LOTOS or Java code from this diagram, -and at last to allow the analysis of formal validation traces -obtained from external tools, e.g. RTL from LAAS-CNRS and CADP -from INRIA Rhone-Alpes. - -This software is governed by the CeCILL license under French law and -abiding by the rules of distribution of free software. You can use, -modify and/ or redistribute the software under the terms of the CeCILL -license as circulated by CEA, CNRS and INRIA at the following URL -"http://www.cecill.info". - -As a counterpart to the access to the source code and rights to copy, -modify and redistribute granted by the license, users are provided only -with a limited warranty and the software's author, the holder of the -economic rights, and the successive licensors have only limited -liability. - -In this respect, the user's attention is drawn to the risks associated -with loading, using, modifying and/or developing or reproducing the -software by the user in light of its specific status of free software, -that may mean that it is complicated to manipulate, and that also -therefore means that it is reserved for developers and experienced -professionals having in-depth computer knowledge. Users are therefore -encouraged to load and test the software's suitability as regards their -requirements in conditions enabling the security of their systems and/or -data to be ensured and, more generally, to use and operate it in the -same conditions as regards security. - -The fact that you are presently reading this means that you have had -knowledge of the CeCILL license and that you accept its terms. - -/** - * Class ADDArtifact - * Artifact of an avatar deployment diagram - * Creation: 30/06/2014 - * @version 1.0 30/06/2014 - * @author Ludovic APVRILLE - * @see - */ + ludovic.apvrille AT enst.fr + + This software is a computer program whose purpose is to allow the + edition of TURTLE analysis, design and deployment diagrams, to + allow the generation of RT-LOTOS or Java code from this diagram, + and at last to allow the analysis of formal validation traces + obtained from external tools, e.g. RTL from LAAS-CNRS and CADP + from INRIA Rhone-Alpes. + + This software is governed by the CeCILL license under French law and + abiding by the rules of distribution of free software. You can use, + modify and/ or redistribute the software under the terms of the CeCILL + license as circulated by CEA, CNRS and INRIA at the following URL + "http://www.cecill.info". + + As a counterpart to the access to the source code and rights to copy, + modify and redistribute granted by the license, users are provided only + with a limited warranty and the software's author, the holder of the + economic rights, and the successive licensors have only limited + liability. + + In this respect, the user's attention is drawn to the risks associated + with loading, using, modifying and/or developing or reproducing the + software by the user in light of its specific status of free software, + that may mean that it is complicated to manipulate, and that also + therefore means that it is reserved for developers and experienced + professionals having in-depth computer knowledge. Users are therefore + encouraged to load and test the software's suitability as regards their + requirements in conditions enabling the security of their systems and/or + data to be ensured and, more generally, to use and operate it in the + same conditions as regards security. + + The fact that you are presently reading this means that you have had + knowledge of the CeCILL license and that you accept its terms. + + /** + * Class ADDArtifact + * Artifact of an avatar deployment diagram + * Creation: 30/06/2014 + * @version 1.0 30/06/2014 + * @author Ludovic APVRILLE + * @see + */ package ui.avatardd; @@ -65,47 +65,47 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe protected int fileX = 20; protected int fileY = 25; protected int cran = 5; - + protected String oldValue = ""; protected String referenceTaskName = "referenceToBlock"; - protected String taskName = "name"; - + protected String taskName = "name"; + public ADDArtifact(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - + width = 75; height = 40; minWidth = 75; - + nbConnectingPoint = 0; addTGConnectingPointsComment(); - + moveable = true; editable = true; removable = true; - + value = "TMLDesign::task"; taskName = "name"; - referenceTaskName = "TMLTask"; - + referenceTaskName = "TMLTask"; + makeFullValue(); - + myImageIcon = IconManager.imgic702; } - - + + public void internalDrawing(Graphics g) { - + if (oldValue.compareTo(value) != 0) { setValue(value, g); } - + g.drawRect(x, y, width, height); - Color c = g.getColor(); - g.setColor(ColorManager.CPU_BOX_2); - g.fillRect(x+1, y+1, width-1, height-1); + Color c = g.getColor(); + g.setColor(ColorManager.CPU_BOX_2); + g.fillRect(x+1, y+1, width-1, height-1); g.setColor(c); - + //g.drawRoundRect(x, y, width, height, arc, arc); g.drawLine(x+width-space-fileX, y + space, x+width-space-fileX, y+space+fileY); g.drawLine(x+width-space-fileX, y + space, x+width-space-cran, y+space); @@ -114,26 +114,26 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe g.drawLine(x+width-space, y+space+fileY, x+width-space-fileX, y+space+fileY); g.drawLine(x+width-space-cran, y+space, x+width-space-cran, y+space+cran); g.drawLine(x+width-space-cran, y+space+cran, x + width-space, y+space+cran); - - g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null); - + + g.drawImage(IconManager.img9, x+width-space-fileX + 3, y + space + 7, null); + g.drawString(value, x + textX , y + textY); - + } - + public void setValue(String val, Graphics g) { oldValue = value; int w = g.getFontMetrics().stringWidth(value); - int w1 = Math.max(minWidth, w + 2 * textX + fileX + space); - + int w1 = Math.max(minWidth, w + 2 * textX + fileX + space); + //System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value); - if (w1 != width) { + if (w1 != width) { width = w1; resizeWithFather(); } //System.out.println("width=" + width + " w1=" + w1 + " value=" + value); } - + public void resizeWithFather() { if ((father != null) && ((father instanceof ADDCPUNode))) { //System.out.println("cdRect comp"); @@ -142,72 +142,72 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe setMoveCd(x, y); } } - - - public boolean editOndoubleClick(JFrame frame) { - String tmp; - boolean error = false; - - /*JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed - - if (!dialog.isRegularClose()) { - return false; - } - - if (dialog.getReferenceTaskName() == null) { - return false; - } - - if (dialog.getReferenceTaskName().length() != 0) { - tmp = dialog.getReferenceTaskName(); - referenceTaskName = tmp; - - - } - - if (dialog.getTaskName().length() != 0) { - tmp = dialog.getTaskName(); - - if (!TAttribute.isAValidId(tmp, false, false)) { - error = true; - } else { - taskName = tmp; - } - } - - priority = dialog.getPriority(); - - if (error) { - JOptionPane.showMessageDialog(frame, - "Name is non-valid", - "Error", - JOptionPane.INFORMATION_MESSAGE); - } - - makeFullValue();*/ - - return !error; - + + + public boolean editOndoubleClick(JFrame frame) { + String tmp; + boolean error = false; + + /*JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this); + dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getReferenceTaskName() == null) { + return false; + } + + if (dialog.getReferenceTaskName().length() != 0) { + tmp = dialog.getReferenceTaskName(); + referenceTaskName = tmp; + + + } + + if (dialog.getTaskName().length() != 0) { + tmp = dialog.getTaskName(); + + if (!TAttribute.isAValidId(tmp, false, false)) { + error = true; + } else { + taskName = tmp; + } + } + + priority = dialog.getPriority(); + + if (error) { + JOptionPane.showMessageDialog(frame, + "Name is non-valid", + "Error", + JOptionPane.INFORMATION_MESSAGE); + } + + makeFullValue();*/ + + return !error; + } - + private void makeFullValue() { value = referenceTaskName + "::" + taskName; } - + public TGComponent isOnMe(int _x, int _y) { if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { return this; } return null; } - + public int getType() { return TGComponentManager.ADD_ARTIFACT; } - + protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<info value=\"" + value + "\" taskName=\"" + taskName + "\" referenceTaskName=\""); @@ -216,18 +216,18 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe sb.append("</extraparam>\n"); return new String(sb); } - + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ //System.out.println("*** load extra synchro ***"); try { - + NodeList nli; Node n1, n2; Element elt; int t1id; String svalue = null, sname = null, sreferenceTask = null; - String prio; - + String prio; + for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); @@ -245,7 +245,7 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe } if (svalue != null) { value = svalue; - } + } if (sname != null){ taskName = sname; } @@ -256,35 +256,30 @@ public class ADDArtifact extends TGCWithoutInternalComponent implements Swallowe } } } - + } catch (Exception e) { throw new MalformedModelingException(); } makeFullValue(); } - - public DesignPanel getDesignPanel() { - return tdp.getGUI().getDesignPanel(value); - } - - public String getReferenceTaskName() { + + + public String getReferenceTaskName() { return referenceTaskName; } - - public void setReferenceTaskName(String _referenceTaskName) { + + public void setReferenceTaskName(String _referenceTaskName) { referenceTaskName = _referenceTaskName; - makeFullValue(); + makeFullValue(); } - + public String getTaskName() { return taskName; } - - public String getAttributes() { - return ""; - } - - - - + + public String getAttributes() { + return ""; + } + + }