diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java index e961268acc38ce199bcf12c123209db7b3cf2ca9..3c6958dbcd3345f45fe5e7eda119c70282703233 100755 --- a/src/ui/ColorManager.java +++ b/src/ui/ColorManager.java @@ -117,6 +117,7 @@ public class ColorManager { public static Color BUS_BOX = new Color(215, 188, 128); public static Color BRIDGE_BOX = new Color(215, 166, 72); public static Color MEMORY_BOX = new Color(172, 234, 211); + public static Color MEMORY_BOX_2 = new Color(172, 226, 211); public static Color DMA_BOX = new Color(172, 234, 211); public static Color HWA_BOX = new Color(144, 201, 211); diff --git a/src/ui/tmldd/TMLArchiArtifact.java b/src/ui/tmldd/TMLArchiArtifact.java index 8f053ff4b17d904ee1aa846fb6a66fcdf6c04c23..e3f5da973008fb1d2a8e6e616443e95c3c72b1f7 100755 --- a/src/ui/tmldd/TMLArchiArtifact.java +++ b/src/ui/tmldd/TMLArchiArtifact.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 TMLArchiArtifact - * Artifact of a deployment diagram - * Creation: 02/05/2005 - * @version 1.0 02/05/2005 - * @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 TMLArchiArtifact + * Artifact of a deployment diagram + * Creation: 02/05/2005 + * @version 1.0 02/05/2005 + * @author Ludovic APVRILLE + * @see + */ package ui.tmldd; @@ -69,55 +69,55 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa protected String oldValue = ""; protected String referenceTaskName = "referenceToTask"; - protected String taskName = "name"; - protected int priority = 0; // Between 0 and 10 - protected String operation = "VOID"; + protected String taskName = "name"; + protected int priority = 0; // Between 0 and 10 + protected String operation = "VOID"; + + private ArchUnitMEC fatherArchUnitMECType = new CpuMEC(); - private ArchUnitMEC fatherArchUnitMECType = new CpuMEC(); - public String status=""; public String lastTransaction=""; public TMLArchiArtifact(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 = 100; height = 40; minWidth = 100; - + nbConnectingPoint = 0; addTGConnectingPointsComment(); - + moveable = true; editable = true; removable = true; userResizable=true; value = "TMLDesign::task "; taskName = "name"; - referenceTaskName = "TMLTask"; - + referenceTaskName = "TMLTask"; + makeFullValue(); - + myImageIcon = IconManager.imgic702; } - - public int getPriority() { - return priority; - } - - /*public String getOperation() { - return operation; - }*/ - + + public int getPriority() { + return priority; + } + + /*public String getOperation() { + return operation; + }*/ + public void internalDrawing(Graphics g) { - + if (oldValue.compareTo(value) != 0) { setValue(value, g); } - g.drawString(value, x + textX , y + textY); + g.drawString(value, x + textX , y + textY); g.drawRect(x, y, width, height); - Color c = g.getColor(); + Color c = g.getColor(); - if (runningStatus.compareTo("running") == 0) { + if (runningStatus.compareTo("running") == 0) { g.setColor(ColorManager.CURRENT_COMMAND_RUNNING); } else if (runningStatus.compareTo("runnable") == 0) { g.setColor(ColorManager.CURRENT_COMMAND_RUNNABLE); @@ -126,9 +126,9 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa } else if (runningStatus.compareTo("terminated") == 0) { g.setColor(ColorManager.CURRENT_COMMAND_TERMINATED); } else { - g.setColor(ColorManager.CPU_BOX_2); + g.setColor(ColorManager.CPU_BOX_2); } - g.fillRect(x+1, y+1, width-1, height-1); + g.fillRect(x+1, y+1, width-1, height-1); g.setColor(c); g.drawString(value, x + textX , y + textY); @@ -141,23 +141,23 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa 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.drawString(value, x + textX , y + textY); - //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); } - + 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 TMLArchiCPUNode) || (father instanceof TMLArchiHWANode))) { //System.out.println("cdRect comp"); @@ -166,98 +166,98 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa setMoveCd(x, y); } } - - - public boolean editOndoubleClick(JFrame frame) { - String tmp; - boolean error = false; - if (father!=null){ - fatherArchUnitMECType = ((TMLArchiNode)father).getMECType(); - } - JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this, operation, fatherArchUnitMECType); - dialog.setSize(400, 350); - GraphicLib.centerOnParent(dialog); - dialog.show(); // blocked until dialog has been closed - operation = dialog.getOperation(); - - 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; + + + public boolean editOndoubleClick(JFrame frame) { + String tmp; + boolean error = false; + if (father!=null){ + fatherArchUnitMECType = ((TMLArchiNode)father).getMECType(); + } + JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this, operation, fatherArchUnitMECType); + dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + operation = dialog.getOperation(); + + 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; - + 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.TMLARCHI_ARTIFACT; } - + protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append( "<info value=\"" + value + "\" taskName=\"" + taskName + "\" referenceTaskName=\"" ); sb.append( referenceTaskName ); - sb.append( "\" priority=\"" ); - sb.append( priority ); - sb.append( "\" operation=\"" ); - sb.append( operation ); - sb.append( "\" fatherComponentMECType=\"" + fatherArchUnitMECType.getIndex() ); + sb.append( "\" priority=\"" ); + sb.append( priority ); + sb.append( "\" operation=\"" ); + sb.append( operation ); + sb.append( "\" fatherComponentMECType=\"" + fatherArchUnitMECType.getIndex() ); sb.append( "\" />\n" ); 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); @@ -272,23 +272,23 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa svalue = elt.getAttribute("value"); sname = elt.getAttribute("taskName"); sreferenceTask = elt.getAttribute("referenceTaskName"); - prio = elt.getAttribute("priority"); - if (elt != null) { - priority = Integer.decode(prio).intValue(); - } - operation = elt.getAttribute("operation"); - if( (elt.getAttribute("fatherComponentMECType") != null) && (elt.getAttribute("fatherComponentMECType").length() > 0) ) { - if( elt.getAttribute("fatherComponentMECType").length() > 1 ) { - fatherArchUnitMECType = ArchUnitMEC.Types.get(0); - } - else { - fatherArchUnitMECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("fatherComponentMECType") ) ); - } - } + prio = elt.getAttribute("priority"); + if (elt != null) { + priority = Integer.decode(prio).intValue(); + } + operation = elt.getAttribute("operation"); + if( (elt.getAttribute("fatherComponentMECType") != null) && (elt.getAttribute("fatherComponentMECType").length() > 0) ) { + if( elt.getAttribute("fatherComponentMECType").length() > 1 ) { + fatherArchUnitMECType = ArchUnitMEC.Types.get(0); + } + else { + fatherArchUnitMECType = ArchUnitMEC.Types.get( Integer.valueOf( elt.getAttribute("fatherComponentMECType") ) ); + } + } } if (svalue != null) { value = svalue; - } + } if (sname != null){ taskName = sname; } @@ -299,86 +299,86 @@ public class TMLArchiArtifact extends TGCWithoutInternalComponent implements Swa } } } - + } 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 void setFullName(String _taskName, String _referenceTaskName){ - taskName= _taskName; - referenceTaskName=_referenceTaskName; - makeFullValue(); + taskName= _taskName; + referenceTaskName=_referenceTaskName; + makeFullValue(); } public String getTaskName() { return taskName; } - - public String getAttributes() { - return "Priority = " + priority; - } - - public int getOperationType() { - - if( fatherArchUnitMECType instanceof FepMEC ) { - if( operation.equals( "CWM" ) ) { - return FepOperationMEC.CwmMEC; - } - else if( operation.equals( "CWL" ) ) { - TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwlMEC ); - return FepOperationMEC.CwlMEC; - } - else if( operation.equals( "CWA" ) ) { - TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwaMEC ); - return FepOperationMEC.CwaMEC; - } - else if( operation.equals( "CWP" ) ) { - TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwpMEC ); - return FepOperationMEC.CwpMEC; - } - else if( operation.equals( "FFT" ) ) { - TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.FftMEC ); - return FepOperationMEC.FftMEC; - } - else if( operation.equals( "SUM" ) ) { - TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.SumMEC ); - return FepOperationMEC.SumMEC; - } - } - else if( fatherArchUnitMECType instanceof MapperMEC ) { - TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.MappOperationMEC ); - return OperationMEC.MappOperationMEC; - } - else if( fatherArchUnitMECType instanceof InterleaverMEC ) { - TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.IntlOperationMEC ); - return OperationMEC.IntlOperationMEC; - } - else if( fatherArchUnitMECType instanceof AdaifMEC ) { - TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.AdaifOperationMEC ); - return OperationMEC.AdaifOperationMEC; - } - else if( fatherArchUnitMECType instanceof CpuMEC ) { - TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.CpuOperationMEC ); - return OperationMEC.CpuOperationMEC; - } - return -1; - } - - public ArchUnitMEC getArchUnitMEC() { - return fatherArchUnitMECType; - } - + + public String getAttributes() { + return "Priority = " + priority; + } + + public int getOperationType() { + + if( fatherArchUnitMECType instanceof FepMEC ) { + if( operation.equals( "CWM" ) ) { + return FepOperationMEC.CwmMEC; + } + else if( operation.equals( "CWL" ) ) { + TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwlMEC ); + return FepOperationMEC.CwlMEC; + } + else if( operation.equals( "CWA" ) ) { + TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwaMEC ); + return FepOperationMEC.CwaMEC; + } + else if( operation.equals( "CWP" ) ) { + TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.CwpMEC ); + return FepOperationMEC.CwpMEC; + } + else if( operation.equals( "FFT" ) ) { + TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.FftMEC ); + return FepOperationMEC.FftMEC; + } + else if( operation.equals( "SUM" ) ) { + TraceManager.addDev( "Operation: " + operation + " returns " + FepOperationMEC.SumMEC ); + return FepOperationMEC.SumMEC; + } + } + else if( fatherArchUnitMECType instanceof MapperMEC ) { + TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.MappOperationMEC ); + return OperationMEC.MappOperationMEC; + } + else if( fatherArchUnitMECType instanceof InterleaverMEC ) { + TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.IntlOperationMEC ); + return OperationMEC.IntlOperationMEC; + } + else if( fatherArchUnitMECType instanceof AdaifMEC ) { + TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.AdaifOperationMEC ); + return OperationMEC.AdaifOperationMEC; + } + else if( fatherArchUnitMECType instanceof CpuMEC ) { + TraceManager.addDev( "Operation: " + operation + " returns " + OperationMEC.CpuOperationMEC ); + return OperationMEC.CpuOperationMEC; + } + return -1; + } + + public ArchUnitMEC getArchUnitMEC() { + return fatherArchUnitMECType; + } + } diff --git a/src/ui/tmldd/TMLArchiKey.java b/src/ui/tmldd/TMLArchiKey.java index 47152bdd0b38441e8b02b585d642be9063def7d3..6a0e9b2729e502214acc1b7dba1be13eb60f4380 100755 --- a/src/ui/tmldd/TMLArchiKey.java +++ b/src/ui/tmldd/TMLArchiKey.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 TMLArchiKey - * TML Key on Architecture diagram - * Creation: 4/7/2016 - * @version 1.0 4/7/2016 - * @author Letitia LI - * @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 TMLArchiKey + * TML Key on Architecture diagram + * Creation: 4/7/2016 + * @version 1.0 4/7/2016 + * @author Letitia LI, Ludovic APVRILLE + * @see + */ package ui.tmldd; @@ -65,53 +65,59 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe protected int fileX = 20; protected int fileY = 25; protected int cran = 5; - + protected String oldValue = ""; protected String referenceKey = "TMLKey"; - protected String typeName = "key"; - protected int priority = 5; // Between 0 and 10 - + protected String typeName = "key"; + protected int priority = 5; // Between 0 and 10 + public TMLArchiKey(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; - + minHeight = fileY + 5; + nbConnectingPoint = 0; addTGConnectingPointsComment(); - + moveable = true; editable = true; removable = true; - + userResizable = true; + value = ""; - referenceKey = "TMLKey"; - + referenceKey = "TMLKey"; + makeFullValue(); - - //setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority); - + + //setPriority(((TMLArchiDiagramPanel)tdp).getPriority(getFullValue(), priority); + myImageIcon = IconManager.imgic1118; } - - public int getPriority() { - return priority; - } - - public void setPriority(int _priority) { - priority = _priority; - } - - + + public int getPriority() { + return priority; + } + + public void setPriority(int _priority) { + priority = _priority; + } + + 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.MEMORY_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); @@ -120,31 +126,31 @@ public class TMLArchiKey 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); - - Font f = g.getFont(); - g.setFont(f.deriveFont(Font.ITALIC)); - g.drawString(typeName, x + textX , y + textY + 20); - g.setFont(f); - + + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.ITALIC)); + g.drawString(typeName, x + textX , y + textY + 20); + g.setFont(f); + } - + public void setValue(String val, Graphics g) { oldValue = value; - int w = 100+g.getFontMetrics().stringWidth(value); - int w1 = Math.max(minWidth, w + 2 * textX + fileX + space); - - //System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value); - if (w1 != width) { + int w = fileX + g.getFontMetrics().stringWidth(value) + textX; + int w1 = Math.max(minWidth, w); + + //TraceManager.addDev(" Width=" + width + " w1=" + w1 + " value=" + value); + if (w1 != width) { width = w1; resizeWithFather(); } - //System.out.println("width=" + width + " w1=" + w1 + " value=" + value); + //TraceManager.addDev(" Width=" + width + " w1=" + w1 + " value=" + value); } - + public void resizeWithFather() { if ((father != null) && (father instanceof TMLArchiMemoryNode)) { //System.out.println("cdRect comp"); @@ -153,95 +159,95 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe setMoveCd(x, y); } } - - - public boolean editOndoubleClick(JFrame frame) { - JDialogArchiKey dialog = new JDialogArchiKey(frame, "Setting channel artifact attributes", this); - dialog.setSize(700, 600); + + + public boolean editOndoubleClick(JFrame frame) { + JDialogArchiKey dialog = new JDialogArchiKey(frame, "Setting channel artifact attributes", this); + dialog.setSize(700, 600); GraphicLib.centerOnParent(dialog); dialog.show(); // blocked until dialog has been closed String tmp; - boolean error=false; - if (!dialog.isRegularClose()) { - return false; - } - - if (dialog.getReferenceCommunicationName() == null) { - return false; - } - - if (dialog.getReferenceCommunicationName().length() != 0) { - tmp = dialog.getReferenceCommunicationName(); - referenceKey = tmp; - - } - - if (dialog.getCommunicationName().length() != 0) { - tmp = dialog.getCommunicationName(); - - if (!TAttribute.isAValidId(tmp, false, false)) { - error = true; + boolean error=false; + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getReferenceCommunicationName() == null) { + return false; + } + + if (dialog.getReferenceCommunicationName().length() != 0) { + tmp = dialog.getReferenceCommunicationName(); + referenceKey = tmp; + + } + + if (dialog.getCommunicationName().length() != 0) { + tmp = dialog.getCommunicationName(); + + if (!TAttribute.isAValidId(tmp, false, false)) { + error = true; } else { - referenceKey = tmp; - } - } - - if (dialog.getTypeName().length() != 0) { - typeName = dialog.getTypeName(); - } - - - - if (error) { - JOptionPane.showMessageDialog(frame, - "Name is non-valid", - "Error", - JOptionPane.INFORMATION_MESSAGE); - } - - makeFullValue(); - - return !error; + referenceKey = tmp; + } + } + + if (dialog.getTypeName().length() != 0) { + typeName = dialog.getTypeName(); + } + + + + if (error) { + JOptionPane.showMessageDialog(frame, + "Name is non-valid", + "Error", + JOptionPane.INFORMATION_MESSAGE); + } + + makeFullValue(); + + return !error; } - + public void makeFullValue() { value = referenceKey; } - + 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.TMLARCHI_KEY; } - + protected String translateExtraParam() { StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<info value=\"" + value + "\" referenceKeyName=\""); sb.append(referenceKey); - sb.append("\" priority=\""); - sb.append(priority); - sb.append("\" typeName=\"" + typeName); + sb.append("\" priority=\""); + sb.append(priority); + sb.append("\" typeName=\"" + typeName); sb.append("\" />\n"); 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, sreferenceCommunication = null, stype = null; - String prio = null; - + String prio = null; + for(int i=0; i<nl.getLength(); i++) { n1 = nl.item(i); //System.out.println(n1); @@ -255,58 +261,58 @@ public class TMLArchiKey extends TGCWithoutInternalComponent implements Swallowe if (elt.getTagName().equals("info")) { svalue = elt.getAttribute("value"); sreferenceCommunication = elt.getAttribute("referenceKeyName"); - stype = elt.getAttribute("typeName"); - prio = elt.getAttribute("priority"); + stype = elt.getAttribute("typeName"); + prio = elt.getAttribute("priority"); } if (svalue != null) { value = svalue; - } + } if (sreferenceCommunication != null) { referenceKey = sreferenceCommunication; } - if (stype != null){ + if (stype != null){ typeName = stype; } - - if ((prio != null) && (prio.trim().length() > 0)) { - priority = Integer.decode(prio).intValue(); - } + + if ((prio != null) && (prio.trim().length() > 0)) { + priority = Integer.decode(prio).intValue(); + } } } } } - + } catch (Exception e) { - System.out.println("Key artifact"); + System.out.println("Key artifact"); throw new MalformedModelingException(); } makeFullValue(); } - + public DesignPanel getDesignPanel() { return tdp.getGUI().getDesignPanel(value); } - + public String getReferencKey() { return referenceKey; } - + public void setReferenceKey(String s){ - referenceKey=s; - } - public String getFullValue() { - String tmp = getValue(); - tmp += " (" + getTypeName() + ")"; - return tmp; - } - - public String getTypeName() { + referenceKey=s; + } + public String getFullValue() { + String tmp = getValue(); + tmp += " (" + getTypeName() + ")"; + return tmp; + } + + public String getTypeName() { return typeName; } - - public String getAttributes() { - return "Priority = " + priority; - } - + + public String getAttributes() { + return "Priority = " + priority; + } + }