diff --git a/src/ui/tmlad/TGConnectingPointTMLAD.java b/src/ui/tmlad/TGConnectingPointTMLAD.java new file mode 100755 index 0000000000000000000000000000000000000000..afe80aceb7dc6c7ea934d41af153ba5d16e32451 --- /dev/null +++ b/src/ui/tmlad/TGConnectingPointTMLAD.java @@ -0,0 +1,72 @@ +/**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 TGConnectingPointTMLAD + * Definition of connecting points on which connectors of TML activity diagram can be connected + * Creation: 28/10/2005 + * @version 1.0 28/10/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +//import java.awt.*; +import ui.*; + +public class TGConnectingPointTMLAD extends TGConnectingPointWidthHeight{ + + public TGConnectingPointTMLAD(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { + super(_container, _x, _y, _in, _out, _w, _h); + } + + public boolean isCompatibleWith(int type) { + if (type == TGComponentManager.CONNECTOR_TMLAD) { + return true; + } + return false; + } + +} + + + + + + + diff --git a/src/ui/tmlad/TGConnectorTMLAD.java b/src/ui/tmlad/TGConnectorTMLAD.java new file mode 100755 index 0000000000000000000000000000000000000000..c91b04104ca5dcb32275fa323dd58aeeacee40bc --- /dev/null +++ b/src/ui/tmlad/TGConnectorTMLAD.java @@ -0,0 +1,82 @@ +/**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 TGConnectorInteraction + * Basic connector with a full arrow at the end. Used in activity diagram. + * Creation: 30/09/2004 + * @version 1.0 30/09/2004 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import java.util.*; + +import myutil.*; +import ui.*; + +public class TGConnectorTMLAD extends TGConnector { + protected int arrowLength = 10; + + public TGConnectorTMLAD(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { + super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); + myImageIcon = IconManager.imgic202; + } + + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) { + g.drawLine(x1, y1, x2, y2); + } else { + GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true); + } + } + + public int getType() { + return TGComponentManager.CONNECTOR_TMLAD; + } +} + + + + + + + diff --git a/src/ui/tmlad/TMLADActionState.java b/src/ui/tmlad/TMLADActionState.java new file mode 100755 index 0000000000000000000000000000000000000000..7a0504425419c28057e9f5943ceeb46220684717 --- /dev/null +++ b/src/ui/tmlad/TMLADActionState.java @@ -0,0 +1,149 @@ +/**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 TMLADActionState + * Action state of an activity diagram + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import myutil.*; +import ui.*; + +public class TMLADActionState extends TGCOneLineText implements PreJavaCode, PostJavaCode, CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + + public TMLADActionState(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + moveable = true; + editable = true; + removable = true; + + value = "action"; + name = "action state"; + + myImageIcon = IconManager.imgic204; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + g.drawString(value, x + (width - w) / 2 , y + textY); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x +width/2, y- lineLength, x+width/2, y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public String getAction() { + return value; + } + + public String getAction(int cpt) { + if (cpt <0) { + return value; + } + + String ret; + + try { + ret = value; + while(cpt >0) { + ret = ret.substring(ret.indexOf(';') + 1, ret.length()); + cpt --; + } + + int index = ret.indexOf(';'); + + if (index > 0) { + ret = ret.substring(0, index+1); + } + } catch (Exception e) { + return value; + } + return ret; + } + + public int getType() { + return TGComponentManager.TMLAD_ACTION_STATE; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADChoice.java b/src/ui/tmlad/TMLADChoice.java new file mode 100755 index 0000000000000000000000000000000000000000..d274cc236b46175875f79fe841c8e2d9508d67c8 --- /dev/null +++ b/src/ui/tmlad/TMLADChoice.java @@ -0,0 +1,165 @@ +/** + 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 TMLADChoice + * Choice with guards. to be used in activity diagrams + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import myutil.*; +import ui.*; + +public class TMLADChoice extends TGCWithInternalComponent implements EmbeddedComment { + private int lineLength = 10; + private int lineOutLength = 25; + private int textX1, textY1, textX2, textY2, textX3, textY3; + + + public TMLADChoice(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 = 30; + height = 30; + textX1 = -lineOutLength; + textY1 = height/2 - 5; + textX2 = width + 5; + textY2 = height/2 - 5; + textX3 = width /2 + 5; + textY3 = height + 15; + + nbConnectingPoint = 4; + connectingPoint = new TGConnectingPoint[nbConnectingPoint]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, -lineOutLength, 0, false, true, 0.0, 0.5); + connectingPoint[2] = new TGConnectingPointTMLAD(this, lineOutLength, 0, false, true, 1.0, 0.5); + connectingPoint[3] = new TGConnectingPointTMLAD(this, 0, lineOutLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 3; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCOneLineText tgc = new TGCOneLineText(x+textX1, y+textY1, textX1-50, textX1+5, textY1, textY1 + 25, true, this, _tdp); + tgc.setValue("[ ]"); + tgc.setName("guard 1"); + tgcomponent[0] = tgc; + + tgc = new TGCOneLineText(x+textX2, y+textY2, textX2, textX2+20, textY2, textY2+25, true, this, _tdp); + tgc.setValue("[ ]"); + tgc.setName("guard 2"); + tgcomponent[1] = tgc; + + tgc = new TGCOneLineText(x+textX3, y+textY3, textX3, textX3+20, textY3, textY3+25, true, this, _tdp); + tgc.setValue("[ ]"); + tgc.setName("guard 3"); + tgcomponent[2] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "choice"; + + myImageIcon = IconManager.imgic208; + } + + public void internalDrawing(Graphics g) { + g.drawLine(x+(width/2), y, x+width, y + height/2); + g.drawLine(x, y + height / 2, x+width/2, y + height); + g.drawLine(x + width/2, y, x, y + height/2); + g.drawLine(x + width, y + height/2, x + width/2, y + height); + + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x, y + height/2, x-lineOutLength, y + height/2); + g.drawLine(x + width, y + height/2, x+ width + lineOutLength, y + height/2); + g.drawLine(x+(width/2), y + height, x+(width/2), y + height + lineOutLength); + } + + public TGComponent isOnOnlyMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y + height, x+(width/2), y + height + lineOutLength, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x + width, y + height/2, x+ width + lineOutLength, y + height/2, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x, y + height/2, x-lineOutLength, y + height/2, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y, x+(width/2), y - lineLength, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public String getGuard(int i) { + if ((i>=0) && (i<nbInternalTGComponent)) { + return tgcomponent[i].getValue(); + } + return ""; + } + + public void setGuard(String guard, int i) { + if ((i>=0) && (i<nbInternalTGComponent)) { + tgcomponent[i].setValue(guard); + } + } + + public int getType() { + return TGComponentManager.TMLAD_CHOICE; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADExecC.java b/src/ui/tmlad/TMLADExecC.java new file mode 100755 index 0000000000000000000000000000000000000000..7319674f9a29a096387d597e0a50654d1df39ae4 --- /dev/null +++ b/src/ui/tmlad/TMLADExecC.java @@ -0,0 +1,129 @@ +/**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 TMLADExecC + * Fixed custom duration operator. To be used in TML activity diagrams + * Creation: 21/05/2008 + * @version 1.0 21/05/2008 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import ui.*; +import myutil.*; + +public class TMLADExecC extends TGCWithInternalComponent implements EmbeddedComment { + private int lineLength = 5; + private int textX, textY; + private int ilength = 10; + private int lineLength1 = 2; + + public TMLADExecC(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 = 10; + height = 30; + textX = width + 5; + textY = height/2 + 5; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 1; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCOneLineText tgc = new TGCOneLineText(x+textX, y+textY, -75, 30, textY - 10, textY + 10, true, this, _tdp); + tgc.setValue("execc value"); + tgc.setName("value of the delay"); + tgcomponent[0] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "execC"; + + myImageIcon = IconManager.imgic214; + } + + public void internalDrawing(Graphics g) { + g.drawRect(x, y, width, height); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2 + ilength, x + (width/2) + lineLength1, y+(height-ilength)/2 + ilength); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2)- lineLength1, y+(height+ilength)/2); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x +width/2, y- lineLength, x+width/2, y + lineLength + height, x1, y1)) < distanceSelected) { + return this; + } + + return null; + } + + public String getDelayValue() { + return tgcomponent[0].getValue(); + } + + public void setDelayValue(String value) { + tgcomponent[0].setValue(value); + } + + public int getType() { + return TGComponentManager.TMLAD_EXECC; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} + diff --git a/src/ui/tmlad/TMLADExecCInterval.java b/src/ui/tmlad/TMLADExecCInterval.java new file mode 100755 index 0000000000000000000000000000000000000000..374262141abf2caba837e4848a8e880bc5c3a3a9 --- /dev/null +++ b/src/ui/tmlad/TMLADExecCInterval.java @@ -0,0 +1,136 @@ +/**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 TMLADExecCInterval + * Non deterministic duration and custom operator. To be used in TML activity diagrams + * Creation: 21/05/2008 + * @version 1.0 21/05/2008 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import ui.*; +import myutil.*; + +public class TMLADExecCInterval extends TGCWithInternalComponent implements EmbeddedComment { + private int lineLength = 5; + private int textX, textY; + private int ilength = 10; + private int lineLength1 = 2; + + public TMLADExecCInterval(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 = 10; + height = 30; + textX = width + 5; + textY = height/2 + 5; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 1; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCTimeInterval tgc = new TGCTimeInterval(x+textX, y+textY, -75, 30, textY - 10, textY + 10, true, this, _tdp); + tgc.setValue(""); + tgc.setName("value of the time interval"); + tgcomponent[0] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "execIInterval"; + + myImageIcon = IconManager.imgic214; + } + + public void internalDrawing(Graphics g) { + g.drawRect(x, y, width, height); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2 + ilength, x + (width/2) + lineLength1, y+(height-ilength)/2 + ilength); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) - lineLength1, y+(height+ilength)/2); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x +width/2, y- lineLength, x+width/2, y + lineLength + height, x1, y1)) < distanceSelected) { + return this; + } + + return null; + } + + public String getMinDelayValue() { + return ((TGCTimeInterval)(tgcomponent[0])).getMinDelay(); + } + + public String getMaxDelayValue() { + return ((TGCTimeInterval)(tgcomponent[0])).getMaxDelay(); + } + + public void setMinValue(String val) { + ((TGCTimeInterval)(tgcomponent[0])).setMinDelay(val); + } + + public void setMaxValue(String val) { + ((TGCTimeInterval)(tgcomponent[0])).setMaxDelay(val); + } + + public int getType() { + return TGComponentManager.TMLAD_EXECC_INTERVAL; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADExecI.java b/src/ui/tmlad/TMLADExecI.java new file mode 100755 index 0000000000000000000000000000000000000000..de5167cc3ca0040ff9435ac92fb0cb902e7621c8 --- /dev/null +++ b/src/ui/tmlad/TMLADExecI.java @@ -0,0 +1,129 @@ +/**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 TMLADExecI + * Fixed duration operator. To be used in TML activity diagrams + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import ui.*; +import myutil.*; + +public class TMLADExecI extends TGCWithInternalComponent implements EmbeddedComment { + private int lineLength = 5; + private int textX, textY; + private int ilength = 10; + private int lineLength1 = 2; + + public TMLADExecI(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 = 10; + height = 30; + textX = width + 5; + textY = height/2 + 5; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 1; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCOneLineText tgc = new TGCOneLineText(x+textX, y+textY, -75, 30, textY - 10, textY + 10, true, this, _tdp); + tgc.setValue("execi value"); + tgc.setName("value of the delay"); + tgcomponent[0] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "execI"; + + myImageIcon = IconManager.imgic214; + } + + public void internalDrawing(Graphics g) { + g.drawRect(x, y, width, height); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2 + ilength, x + (width/2) + lineLength1, y+(height-ilength)/2 + ilength); + g.drawLine(x + (width/2), y+(height-ilength)/2, x + (width/2), y+(height+ilength)/2); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x +width/2, y- lineLength, x+width/2, y + lineLength + height, x1, y1)) < distanceSelected) { + return this; + } + + return null; + } + + public String getDelayValue() { + return tgcomponent[0].getValue(); + } + + public void setDelayValue(String value) { + tgcomponent[0].setValue(value); + } + + public int getType() { + return TGComponentManager.TMLAD_EXECI; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} + diff --git a/src/ui/tmlad/TMLADExecIInterval.java b/src/ui/tmlad/TMLADExecIInterval.java new file mode 100755 index 0000000000000000000000000000000000000000..4e261f933f6b2c8d627bfa0d36f06ceb7b726c19 --- /dev/null +++ b/src/ui/tmlad/TMLADExecIInterval.java @@ -0,0 +1,136 @@ +/**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 TMLADExecIInterval + * Non deterministic duration operator. To be used in TML activity diagrams + * Creation: 02/12/2005 + * @version 1.0 02/12/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import ui.*; +import myutil.*; + +public class TMLADExecIInterval extends TGCWithInternalComponent implements EmbeddedComment { + private int lineLength = 5; + private int textX, textY; + private int ilength = 10; + private int lineLength1 = 2; + + public TMLADExecIInterval(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 = 10; + height = 30; + textX = width + 5; + textY = height/2 + 5; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, + lineLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 1; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCTimeInterval tgc = new TGCTimeInterval(x+textX, y+textY, -75, 30, textY - 10, textY + 10, true, this, _tdp); + tgc.setValue(""); + tgc.setName("value of the time interval"); + tgcomponent[0] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "execIInterval"; + + myImageIcon = IconManager.imgic214; + } + + public void internalDrawing(Graphics g) { + g.drawRect(x, y, width, height); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2, x + (width/2) + lineLength1, y+(height-ilength)/2); + g.drawLine(x + (width/2) - lineLength1, y+(height-ilength)/2 + ilength, x + (width/2) + lineLength1, y+(height-ilength)/2 + ilength); + g.drawLine(x + (width/2), y+(height-ilength)/2, x + (width/2), y+(height+ilength)/2); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x +width/2, y- lineLength, x+width/2, y + lineLength + height, x1, y1)) < distanceSelected) { + return this; + } + + return null; + } + + public String getMinDelayValue() { + return ((TGCTimeInterval)(tgcomponent[0])).getMinDelay(); + } + + public String getMaxDelayValue() { + return ((TGCTimeInterval)(tgcomponent[0])).getMaxDelay(); + } + + public void setMinValue(String val) { + ((TGCTimeInterval)(tgcomponent[0])).setMinDelay(val); + } + + public void setMaxValue(String val) { + ((TGCTimeInterval)(tgcomponent[0])).setMaxDelay(val); + } + + public int getType() { + return TGComponentManager.TMLAD_EXECI_INTERVAL; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADForLoop.java b/src/ui/tmlad/TMLADForLoop.java new file mode 100755 index 0000000000000000000000000000000000000000..93eb42551e180cc97a40a50407d3ffd05c1b8beb --- /dev/null +++ b/src/ui/tmlad/TMLADForLoop.java @@ -0,0 +1,237 @@ +/**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 TMLADForLoop + *For loop of a TML activity diagram + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADForLoop extends TGCWithoutInternalComponent implements EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + + protected String init = "i=0"; + protected String condition = "i<5"; + protected String increment = "i = i+1"; + + public TMLADForLoop(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 3; + connectingPoint = new TGConnectingPoint[3]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 1.0, 0.45); // loop + connectingPoint[2] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); // after lopp + + moveable = true; + editable = true; + removable = true; + + makeValue(); + + name = "for loop"; + + myImageIcon = IconManager.imgic912; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x+width, y+height/2, x+width +lineLength, y+height/2); + + g.drawString(value, x + (width - w) / 2 , y + textY); + } + + public boolean editOndoubleClick(JFrame frame) { + String [] labels = new String[3]; + String [] values = new String[3]; + labels[0] = "Initialisation of variables"; + values[0] = init; + labels[1] = "Condition to stay in loop"; + values[1] = condition; + labels[2] = "Increment at each loop"; + values[2] = increment; + + + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting loop's properties", 3, labels, values); + jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms); + jdms.show(); // blocked until dialog has been closed + + if (jdms.hasBeenSet()) { + init = jdms.getString(0); + condition = jdms.getString(1); + increment = jdms.getString(2); + + makeValue(); + return true; + } + + return false; + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+width, y+height/2, x+width +lineLength, y+height/2, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + value = "for(" + init + ";" + condition + ";" + increment + ")"; + } + + public String getAction() { + return value; + } + + public String getInit() { + return init; + } + + public String getCondition() { + return condition; + } + + public String getIncrement() { + return increment; + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data init=\""); + sb.append(getInit()); + sb.append("\" condition=\""); + sb.append(GTURTLEModeling.transformString(getCondition())); + sb.append("\" increment=\""); + sb.append(getIncrement()); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + init = elt.getAttribute("init"); + condition = elt.getAttribute("condition"); + increment = elt.getAttribute("increment"); + } + + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_FOR_LOOP; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADForStaticLoop.java b/src/ui/tmlad/TMLADForStaticLoop.java new file mode 100755 index 0000000000000000000000000000000000000000..223c23f233a4ffe632dffb8813398cd5b5da9d6b --- /dev/null +++ b/src/ui/tmlad/TMLADForStaticLoop.java @@ -0,0 +1,162 @@ +/**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 TMLADForLoop + *For loop of a TML activity diagram + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADForStaticLoop extends TGCWithoutInternalComponent implements EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + protected String valueLoop = ""; + + public TMLADForStaticLoop(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 3; + connectingPoint = new TGConnectingPoint[3]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 1.0, 0.45); // loop + connectingPoint[2] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); // after lopp + + moveable = true; + editable = true; + removable = true; + + value = "10"; + name = "for loop"; + + myImageIcon = IconManager.imgic912; + } + + public void makeValueLoop() { + valueLoop = "Loop " + value + " times"; + } + + public void internalDrawing(Graphics g) { + + if (valueLoop.length() == 0) { + makeValueLoop(); + } + int w = g.getFontMetrics().stringWidth(valueLoop); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x+width, y+height/2, x+width +lineLength, y+height/2); + + g.drawString(valueLoop, x + (width - w) / 2 , y + textY); + } + + public boolean editOndoubleClick(JFrame frame) { + String text = "Static for loop : "; + String s = (String)JOptionPane.showInputDialog(frame, text, + "Setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101, + null, + getValue()); + + if (s != null) { + s = s.trim(); + } + + //System.out.println("emptytext=" + emptyText); + + if ((s != null) && (s.length() > 0) && (s.matches("\\d*"))) { + setValue(s); + makeValueLoop(); + //System.out.println("Value ok"); + return true; + } + + return false; + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+width, y+height/2, x+width +lineLength, y+height/2, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + + public int getType() { + return TGComponentManager.TMLAD_FOR_STATIC_LOOP; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADNotifiedEvent.java b/src/ui/tmlad/TMLADNotifiedEvent.java new file mode 100755 index 0000000000000000000000000000000000000000..806210bf288cf58111c941469c2aabf944ad5cb6 --- /dev/null +++ b/src/ui/tmlad/TMLADNotifiedEvent.java @@ -0,0 +1,239 @@ +/**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 TMLADNotifiedEvent + * Action of waiting for an event + * Creation: 27/10/2006 + * @version 1.0 27/10/2006 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADNotifiedEvent extends TGCWithoutInternalComponent implements EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int linebreak = 10; + protected int textX1 = 2; + + protected String eventName = "evt"; + protected String result = "x"; + + public TMLADNotifiedEvent(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + moveable = true; + editable = true; + removable = true; + + name = "notified event"; + makeValue(); + + myImageIcon = IconManager.imgic904; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 3 * textX); + if ((w1 != width) && (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + Color c = g.getColor(); + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + g.setColor(ColorManager.TML_PORT_EVENT); + g.drawLine(x1, y1, x1+width1, y1); + g.drawLine(x1+width1, y1, x1+width1, y1+height1); + g.drawLine(x1, y1+height1, x1+width1, y1+height1); + g.drawLine(x1, y1, x1+linebreak, y1+height1/2); + g.drawLine(x1, y1+height1, x1+linebreak, y1+height1/2); + g.setColor(c); + + g.drawLine(x, y, x+width, y); + g.drawLine(x+width, y, x+width, y+height); + g.drawLine(x, y+height, x+width, y+height); + g.drawLine(x, y, x+linebreak, y+height/2); + g.drawLine(x, y+height, x+linebreak, y+height/2); + + g.drawString("evt", x+(width-w) / 2, y); + g.drawString(value, x + linebreak + textX1, y + textY); + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + value = result + "=?" + eventName + "()"; + } + + public String getEventName() { + return eventName; + } + + public String getVariable() { + return result; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + String [] labels = new String[2]; + String [] values = new String[2]; + labels[0] = "Event name"; + values[0] = eventName; + labels[1] = "variable"; + values[1] = result; + + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", 2, labels, values); + jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms); + jdms.show(); // blocked until dialog has been closed + + if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { + eventName = jdms.getString(0); + result = jdms.getString(1); + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data eventName=\""); + sb.append(getEventName()); + sb.append("\" variable=\""); + sb.append(getVariable()); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + eventName = elt.getAttribute("eventName"); + result = elt.getAttribute("variable"); + //System.out.println("eventName=" +eventName + " variable=" + result); + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_NOTIFIED_EVENT; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADRandom.java b/src/ui/tmlad/TMLADRandom.java new file mode 100755 index 0000000000000000000000000000000000000000..13b96b9ae709ea74a1274515b3e6ec12a8407183 --- /dev/null +++ b/src/ui/tmlad/TMLADRandom.java @@ -0,0 +1,278 @@ +/**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 TMLADRandom + * Random operator of a TML activity diagram + * Creation: 10/06/2008 + * @version 1.0 10/06/2008 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADRandom extends TGCWithoutInternalComponent implements EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + protected String valueRandom = ""; + protected String variable; + protected String minValue; + protected String maxValue; + protected int functionId; + + public TMLADRandom(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); // after lopp + + moveable = true; + editable = true; + removable = true; + + variable = "x"; + minValue = "0"; + maxValue = "10"; + functionId = 0; + + myImageIcon = IconManager.imgic912; + } + + public void makeValue() { + valueRandom = variable + " = RANDOM" + functionId + "(" + minValue + ", " + maxValue + ")"; + } + + public void internalDrawing(Graphics g) { + + if (valueRandom.length() == 0) { + makeValue(); + } + + int w = g.getFontMetrics().stringWidth(valueRandom); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + //g.drawLine(x+width, y+height/2, x+width +lineLength, y+height/2); + + g.drawString(valueRandom, x + (width - w) / 2 , y + textY); + } + + public boolean editOndoubleClick(JFrame frame) { + boolean error = false; + String errors = ""; + int tmp; + String tmpName; + + JDialogTMLADRandom dialog = new JDialogTMLADRandom(frame, "Setting RANDOM attributes", this); + dialog.setSize(500, 450); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getVariable().length() != 0) { + tmpName = dialog.getVariable(); + tmpName = tmpName.trim(); + if (!TAttribute.isAValidId(tmpName, false, false)) { + error = true; + errors += "Variable "; + } else { + variable = tmpName; + } + } + + if (dialog.getMinValue().length() != 0) { + minValue = dialog.getMinValue(); + } else { + error = true; + errors += "Min value "; + } + + if (dialog.getMaxValue().length() != 0) { + maxValue = dialog.getMaxValue(); + } else { + error = true; + errors += "Max value "; + } + + functionId = dialog.getFunctionId(); + + if (error) { + JOptionPane.showMessageDialog(frame, + "Invalid value for the following attributes: " + errors, + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + makeValue(); + + return true; + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+width, y+height/2, x+width +lineLength, y+height/2, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public String getVariable() { + return variable; + } + + public String getMinValue() { + return minValue; + } + + public String getMaxValue() { + return maxValue; + } + + public int getFunctionId() { + return functionId; + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data variable=\""); + sb.append(getVariable()); + sb.append("\" minValue=\""); + sb.append(getMinValue()); + sb.append("\" maxValue=\""); + sb.append(getMaxValue()); + sb.append("\" functionId=\""); + sb.append(getFunctionId()); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + variable = elt.getAttribute("variable"); + minValue = elt.getAttribute("minValue"); + maxValue = elt.getAttribute("maxValue"); + s = elt.getAttribute("functionId"); + if (s != null) { + try { + functionId = new Integer(s).intValue(); + } catch (Exception e){ + } + } + //System.out.println("eventName=" +eventName + " variable=" + result); + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_RANDOM; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADReadChannel.java b/src/ui/tmlad/TMLADReadChannel.java new file mode 100755 index 0000000000000000000000000000000000000000..f11d74a3249aa32ca979511d2a8dba1bbcc08e43 --- /dev/null +++ b/src/ui/tmlad/TMLADReadChannel.java @@ -0,0 +1,233 @@ +/**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 TMLADReadChannel + * Action of writting data in channel + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADReadChannel extends TGCWithoutInternalComponent implements CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textX0 = 2; + protected int textY0 = 0; + protected int textY1 = 15; + protected int linebreak = 10; + + + protected String channelName = "ch"; + protected String nbOfSamples= "1"; + + public TMLADReadChannel(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + moveable = true; + editable = true; + removable = true; + + makeValue(); + name = "read channel"; + + myImageIcon = IconManager.imgic906; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + Color c = g.getColor(); + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + g.setColor(ColorManager.TML_PORT_CHANNEL); + g.drawLine(x1, y1, x1+width1, y1); + g.drawLine(x1+width1, y1, x1+width1, y1+height1); + g.drawLine(x1, y1+height1, x1+width1, y1+height1); + g.drawLine(x1, y1, x1+linebreak, y1+height1/2); + g.drawLine(x1, y1+height1, x1+linebreak, y1+height1/2); + g.setColor(c); + + g.drawLine(x, y, x+width, y); + g.drawLine(x+width, y, x+width, y+height); + g.drawLine(x, y+height, x+width, y+height); + g.drawLine(x, y, x+linebreak, y+height/2); + g.drawLine(x, y+height, x+linebreak, y+height/2); + + g.drawString("chl", x+(width-w) / 2, y+textY0); + g.drawString(value, x + linebreak + textX0, y + textY1); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + value = channelName + "(" + nbOfSamples + ") "; + } + + public String getChannelName() { + return channelName; + } + + public String getSamplesValue() { + return nbOfSamples; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + + JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); + jdts.setSize(350, 300); + GraphicLib.centerOnParent(jdts); + jdts.show(); // blocked until dialog has been closed + + if (jdts.hasBeenSet() && (jdts.hasValidString())) { + channelName = jdts.getString1(); + nbOfSamples = jdts.getString2(); + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data channelName=\""); + sb.append(getChannelName()); + sb.append("\" nbOfSamples=\""); + sb.append(getSamplesValue()); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + channelName = elt.getAttribute("channelName"); + nbOfSamples = elt.getAttribute("nbOfSamples"); + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_READ_CHANNEL; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + + +} diff --git a/src/ui/tmlad/TMLADSelectEvt.java b/src/ui/tmlad/TMLADSelectEvt.java new file mode 100755 index 0000000000000000000000000000000000000000..5c577925c1f9139158d5238352f751fe340cf3cb --- /dev/null +++ b/src/ui/tmlad/TMLADSelectEvt.java @@ -0,0 +1,144 @@ +/** + 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 TMLADSelectEvt + * Select between events. To be used in TML activity diagrams + * Creation: 06/04/2007 + * @version 1.0 06/04/2007 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import myutil.*; +import ui.*; + +public class TMLADSelectEvt extends TGCWithoutInternalComponent implements EmbeddedComment{ + private int lineLength = 10; + private int lineOutLength = 25; + //private int textX1, textY1, textX2, textY2, textX3, textY3; + + + public TMLADSelectEvt(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 = 30; + height = 30; + /*textX1 = -lineOutLength; + textY1 = height/2 - 5; + textX2 = width + 5; + textY2 = height/2 - 5; + textX3 = width /2 + 5; + textY3 = height + 15;*/ + + nbConnectingPoint = 10; + connectingPoint = new TGConnectingPoint[nbConnectingPoint]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, -lineOutLength, 0, false, true, 0.0, 0.5); + connectingPoint[2] = new TGConnectingPointTMLAD(this, lineOutLength, 0, false, true, 1.0, 0.5); + connectingPoint[3] = new TGConnectingPointTMLAD(this, 0, lineOutLength, false, true, 0.5, 1.0); + connectingPoint[4] = new TGConnectingPointTMLAD(this, -lineOutLength, 0, false, true, 0.0, 0.5); + connectingPoint[5] = new TGConnectingPointTMLAD(this, lineOutLength, 0, false, true, 1.0, 0.5); + connectingPoint[6] = new TGConnectingPointTMLAD(this, 0, lineOutLength, false, true, 0.5, 1.0); + connectingPoint[7] = new TGConnectingPointTMLAD(this, -lineOutLength, 0, false, true, 0.0, 0.5); + connectingPoint[8] = new TGConnectingPointTMLAD(this, lineOutLength, 0, false, true, 1.0, 0.5); + connectingPoint[9] = new TGConnectingPointTMLAD(this, 0, lineOutLength, false, true, 0.5, 1.0); + + moveable = true; + editable = false; + removable = true; + + name = "select"; + + myImageIcon = IconManager.imgic208; + } + + public void internalDrawing(Graphics g) { + g.drawLine(x+(width/2), y, x+width, y + height/2); + g.drawLine(x, y + height / 2, x+width/2, y + height); + g.drawLine(x + width/2, y, x, y + height/2); + g.drawLine(x + width, y + height/2, x + width/2, y + height); + + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x, y + height/2, x-lineOutLength, y + height/2); + g.drawLine(x + width, y + height/2, x+ width + lineOutLength, y + height/2); + g.drawLine(x+(width/2), y + height, x+(width/2), y + height + lineOutLength); + + //g.drawString("select", x, y + height/2 - 5); + g.drawString("evt", x+7, y + height/2 + 3); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y + height, x+(width/2), y + height + lineOutLength, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x + width, y + height/2, x+ width + lineOutLength, y + height/2, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x, y + height/2, x-lineOutLength, y + height/2, _x, _y)) < distanceSelected) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y, x+(width/2), y - lineLength, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public int getType() { + return TGComponentManager.TMLAD_SELECT_EVT; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADSendEvent.java b/src/ui/tmlad/TMLADSendEvent.java new file mode 100755 index 0000000000000000000000000000000000000000..7db3874a5cbe64291a5e4d2190cc3a73f1bf1051 --- /dev/null +++ b/src/ui/tmlad/TMLADSendEvent.java @@ -0,0 +1,298 @@ +/**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 TMLADSendEvent + * Action of sending an event + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADSendEvent extends TGCWithoutInternalComponent implements CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + protected int linebreak = 10; + + protected String eventName = "evt"; + int nParam = 3; + protected String [] params = new String[nParam]; + + public TMLADSendEvent(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + for(int i=0; i<nParam; i++) { + params[i] = ""; + } + //params[0] = "1"; + + moveable = true; + editable = true; + removable = true; + + name = "send event"; + makeValue(); + + myImageIcon = IconManager.imgic904; + } + + public void internalDrawing(Graphics g) { + + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + Color c = g.getColor(); + //System.out.println("Color=" + c); + + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + /*if (g.getColor().equals(ColorManager.NORMAL_0)) { + g.setColor(ColorManager.TML_PORT_EVENT); + }*/ + + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + g.setColor(ColorManager.TML_PORT_EVENT); + g.drawLine(x1, y1, x1+width1-linebreak, y1); + g.drawLine(x1, y1+height1, x1+width1-linebreak, y1+height1); + g.drawLine(x1, y1, x1, y1+height1); + g.drawLine(x1+width1-linebreak, y1, x1+width1, y1+height1/2); + g.drawLine(x1+width1-linebreak, y1+height1, x1+width1, y1+height1/2); + g.setColor(c); + + g.drawLine(x, y, x+width-linebreak, y); + g.drawLine(x, y+height, x+width-linebreak, y+height); + g.drawLine(x, y, x, y+height); + g.drawLine(x+width-linebreak, y, x+width, y+height/2); + g.drawLine(x+width-linebreak, y+height, x+width, y+height/2); + + + + g.drawString("evt", x+(width-w) / 2, y); + g.drawString(value, x + (width - w) / 2 , y + textY); + + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + boolean first = true; + value = eventName + "("; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + if (!first) { + value += ", " + params[i]; + } else { + first = false; + value += params[i]; + } + + } + } + value += ")"; + + } + + public String getEventName() { + return eventName; + } + + public String getParamValue(int i) { + return params[i]; + } + + public int nbOfParams() { + return nParam; + } + + public int realNbOfParams() { + int cpt = 0; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + cpt ++; + } + } + return cpt; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + String [] labels = new String[nParam + 1]; + String [] values = new String[nParam + 1]; + labels[0] = "Event name"; + values[0] = eventName; + for(int i=0; i<nParam; i++) { + labels[i+1] = "Param #" + (i+1); + values[i+1] = params[i]; + } + + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", nParam+1, labels, values); + jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms); + jdms.show(); // blocked until dialog has been closed + + if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { + eventName = jdms.getString(0); + for(int i=0; i<nParam; i++) { + params[i] = jdms.getString(i+1); + } + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data eventName=\""); + sb.append(getEventName()); + sb.append("\" nbOfParams=\""); + sb.append(nbOfParams()); + sb.append("\" />\n"); + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + sb.append("<Param index=\""); + sb.append(i); + sb.append("\" value=\""); + sb.append(params[i]); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + eventName = elt.getAttribute("eventName"); + nParam = Integer.decode(elt.getAttribute("nbOfParams")).intValue(); + } + if (elt.getTagName().equals("Param")) { + s = elt.getAttribute("value"); + k = Integer.decode(elt.getAttribute("index")).intValue(); + params[k] = s; + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_SEND_EVENT; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } +} diff --git a/src/ui/tmlad/TMLADSendRequest.java b/src/ui/tmlad/TMLADSendRequest.java new file mode 100755 index 0000000000000000000000000000000000000000..8ff79fbf0b8a24c3a79987724d263b7616eb6ff0 --- /dev/null +++ b/src/ui/tmlad/TMLADSendRequest.java @@ -0,0 +1,290 @@ +/**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 TMLADSendRequest + * Action of sending a request + * Creation: 18/11/2005 + * @version 1.0 18/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADSendRequest extends TGCWithoutInternalComponent implements CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + protected int linebreak = 10; + + protected String requestName = "req"; + int nParam = 3; + protected String [] params = new String[nParam]; + + public TMLADSendRequest(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + for(int i=0; i<nParam; i++) { + params[i] = ""; + } + //params[0] = "1"; + + moveable = true; + editable = true; + removable = true; + + name = "send request"; + makeValue(); + + myImageIcon = IconManager.imgic902; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + Color c = g.getColor(); + g.setColor(ColorManager.TML_PORT_REQUEST); + g.drawLine(x1, y1, x1+width1-linebreak, y1); + g.drawLine(x1, y1+height1, x1+width1-linebreak, y1+height1); + g.drawLine(x1, y1, x1, y1+height1); + g.drawLine(x1+width1-linebreak, y1, x1+width1, y1+height1/2); + g.drawLine(x1+width1-linebreak, y1+height1, x1+width1, y1+height1/2); + g.setColor(c); + + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + g.drawLine(x, y, x+width-linebreak, y); + g.drawLine(x, y+height, x+width-linebreak, y+height); + g.drawLine(x, y, x, y+height); + g.drawLine(x+width-linebreak, y, x+width, y+height/2); + g.drawLine(x+width-linebreak, y+height, x+width, y+height/2); + + g.drawString("req", x+(width-w) / 2, y); + g.drawString(value, x + (width - w) / 2 , y + textY); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + boolean first = true; + value = requestName + "("; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + if (!first) { + value += ", " + params[i]; + } else { + first = false; + value += params[i]; + } + + } + } + value += ")"; + + } + + public String getRequestName() { + return requestName; + } + + public String getParamValue(int i) { + return params[i]; + } + + public int nbOfParams() { + return nParam; + } + + public int realNbOfParams() { + int cpt = 0; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + cpt ++; + } + } + return cpt; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + String [] labels = new String[nParam + 1]; + String [] values = new String[nParam + 1]; + labels[0] = "Request name"; + values[0] = requestName; + for(int i=0; i<nParam; i++) { + labels[i+1] = "Param #" + (i+1); + values[i+1] = params[i]; + } + + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting request's properties", nParam+1, labels, values); + jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms); + jdms.show(); // blocked until dialog has been closed + + if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { + requestName = jdms.getString(0); + for(int i=0; i<nParam; i++) { + params[i] = jdms.getString(i+1); + } + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data requestName=\""); + sb.append(getRequestName()); + sb.append("\" nbOfParams=\""); + sb.append(nbOfParams()); + sb.append("\" />\n"); + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + sb.append("<Param index=\""); + sb.append(i); + sb.append("\" value=\""); + sb.append(params[i]); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + requestName = elt.getAttribute("requestName"); + nParam = Integer.decode(elt.getAttribute("nbOfParams")).intValue(); + } + if (elt.getTagName().equals("Param")) { + s = elt.getAttribute("value"); + k = Integer.decode(elt.getAttribute("index")).intValue(); + params[k] = s; + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_SEND_REQUEST; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADSequence.java b/src/ui/tmlad/TMLADSequence.java new file mode 100755 index 0000000000000000000000000000000000000000..b63c38fe318e0935747cdb8f1752c140ac7220f2 --- /dev/null +++ b/src/ui/tmlad/TMLADSequence.java @@ -0,0 +1,117 @@ +/** + 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 TMLADSequence + * Sequence. To be used in activity diagrams of TMLDesigns + * Creation: 13/03/2006 + * @version 1.0 13/03/2006 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; + +import myutil.*; +import ui.*; + +public class TMLADSequence extends TGCWithInternalComponent implements EmbeddedComment{ + private int lineLength = 0; + private int textX, textY; + + public TMLADSequence(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 = 150; + height = 5; + + textX = width - 6; + textY = height + 2; + + nbConnectingPoint = 6; + connectingPoint = new TGConnectingPoint[6]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.167, 1.0); + connectingPoint[2] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.333, 1.0); + connectingPoint[3] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + connectingPoint[4] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.667, 1.0); + connectingPoint[5] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.833, 1.0); + + nbInternalTGComponent = 1; + tgcomponent = new TGComponent[nbInternalTGComponent]; + + TGCOneLineText tgc = new TGCOneLineText(x+textX + 10, y+textY, textX +10 , textX + 10 , textY, textY, true, this, _tdp); + tgc.setValue(">>"); + tgc.setName("Sequence"); + tgc.setEditable(false); + + tgcomponent[0] = tgc; + + moveable = true; + editable = false; + removable = true; + + name = "sequence"; + + myImageIcon = IconManager.imgic206; + } + + public void internalDrawing(Graphics g) { + g.drawRect(x, y, width, height); + g.fillRect(x, y, width, height); + } + + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + return null; + } + + public int getType() { + return TGComponentManager.TMLAD_SEQUENCE; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADStartState.java b/src/ui/tmlad/TMLADStartState.java new file mode 100755 index 0000000000000000000000000000000000000000..1f0c8c6a274d7673561ea1553e14ea47db3be884 --- /dev/null +++ b/src/ui/tmlad/TMLADStartState.java @@ -0,0 +1,104 @@ +/**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 TMLADStartState + * Used to start a new activity of a TML Task + * Creation: 28/10/2005 + * @version 1.0 28/10/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; + +import myutil.*; +import ui.*; + +public class TMLADStartState extends TGCWithoutInternalComponent implements EmbeddedComment{ + private int lineLength = 5; + + public TMLADStartState(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 = 15; + height = 15; + + nbConnectingPoint = 1; + connectingPoint = new TGConnectingPoint[1]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + nbInternalTGComponent = 0; + + moveable = true; + editable = false; + removable = true; + + name = "start state"; + + myImageIcon = IconManager.imgic222; + } + + public void internalDrawing(Graphics g) { + g.fillOval(x, y, width, height); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y+height, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public int getType() { + return TGComponentManager.TMLAD_START_STATE; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADStopState.java b/src/ui/tmlad/TMLADStopState.java new file mode 100755 index 0000000000000000000000000000000000000000..9fa0dcc9934a4055d09987b7c9073e158f873f13 --- /dev/null +++ b/src/ui/tmlad/TMLADStopState.java @@ -0,0 +1,105 @@ +/**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 TMLADStopState + * Used to terminate an activity of a TML Task. + * Creation: 28/10/2005 + * @version 1.0 28/10/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; + +import myutil.*; +import ui.*; + +public class TMLADStopState extends TGCWithoutInternalComponent implements EmbeddedComment { + private int internalCircleSize = 16; + private int lineLength = 5; + + public TMLADStopState(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 = 20; + height = 20; + + nbConnectingPoint = 1; + connectingPoint = new TGConnectingPoint[1]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, - lineLength, true, false, 0.5, 0.0); + + nbInternalTGComponent = 0; + + moveable = true; + editable = false; + removable = true; + + name = "stop state"; + + myImageIcon = IconManager.imgic210; + } + + public void internalDrawing(Graphics g) { + ColorManager.setColor(g, state, 0); + g.fillOval(x + (width - internalCircleSize)/2, y + (height - internalCircleSize)/2, internalCircleSize, internalCircleSize); + g.drawOval(x, y, width, height); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + } + + + 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.TMLAD_STOP_STATE; + } + +} + + + + + + + diff --git a/src/ui/tmlad/TMLADWaitEvent.java b/src/ui/tmlad/TMLADWaitEvent.java new file mode 100755 index 0000000000000000000000000000000000000000..469c99c16400c28c15a416173a73f732d39979b5 --- /dev/null +++ b/src/ui/tmlad/TMLADWaitEvent.java @@ -0,0 +1,290 @@ +/**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 TMLADWaitEvent + * Action of waiting for an event + * Creation: 21/11/2005 + * @version 1.0 21/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADWaitEvent extends TGCWithoutInternalComponent implements CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int linebreak = 10; + protected int textX1 = 2; + + protected String eventName = "evt"; + int nParam = 3; + protected String [] params = new String[nParam]; + + public TMLADWaitEvent(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + for(int i=0; i<nParam; i++) { + params[i] = ""; + } + //params[0] = "1"; + + moveable = true; + editable = true; + removable = true; + + name = "wait event"; + makeValue(); + + myImageIcon = IconManager.imgic904; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + Color c = g.getColor(); + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + g.setColor(ColorManager.TML_PORT_EVENT); + g.drawLine(x1, y1, x1+width1, y1); + g.drawLine(x1+width1, y1, x1+width1, y1+height1); + g.drawLine(x1, y1+height1, x1+width1, y1+height1); + g.drawLine(x1, y1, x1+linebreak, y1+height1/2); + g.drawLine(x1, y1+height1, x1+linebreak, y1+height1/2); + g.setColor(c); + + g.drawLine(x, y, x+width, y); + g.drawLine(x+width, y, x+width, y+height); + g.drawLine(x, y+height, x+width, y+height); + g.drawLine(x, y, x+linebreak, y+height/2); + g.drawLine(x, y+height, x+linebreak, y+height/2); + + g.drawString("evt", x+(width-w) / 2, y); + g.drawString(value, x + linebreak + textX1, y + textY); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + boolean first = true; + value = eventName + "("; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + if (!first) { + value += ", " + params[i]; + } else { + first = false; + value += params[i]; + } + + } + } + value += ") "; + + } + + public String getEventName() { + return eventName; + } + + public String getParamValue(int i) { + return params[i]; + } + + public int nbOfParams() { + return nParam; + } + + public int realNbOfParams() { + int cpt = 0; + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + cpt ++; + } + } + return cpt; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + String [] labels = new String[nParam + 1]; + String [] values = new String[nParam + 1]; + labels[0] = "Event name"; + values[0] = eventName; + for(int i=0; i<nParam; i++) { + labels[i+1] = "Param #" + (i+1); + values[i+1] = params[i]; + } + + JDialogMultiString jdms = new JDialogMultiString(frame, "Setting event's properties", nParam+1, labels, values); + jdms.setSize(350, 300); + GraphicLib.centerOnParent(jdms); + jdms.show(); // blocked until dialog has been closed + + if (jdms.hasBeenSet() && (jdms.hasValidString(0))) { + eventName = jdms.getString(0); + for(int i=0; i<nParam; i++) { + params[i] = jdms.getString(i+1); + } + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data eventName=\""); + sb.append(getEventName()); + sb.append("\" nbOfParams=\""); + sb.append(nbOfParams()); + sb.append("\" />\n"); + for(int i=0; i<nParam; i++) { + if (params[i].length() > 0) { + sb.append("<Param index=\""); + sb.append(i); + sb.append("\" value=\""); + sb.append(params[i]); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int k; + String s; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + eventName = elt.getAttribute("eventName"); + nParam = Integer.decode(elt.getAttribute("nbOfParams")).intValue(); + } + if (elt.getTagName().equals("Param")) { + s = elt.getAttribute("value"); + k = Integer.decode(elt.getAttribute("index")).intValue(); + params[k] = s; + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_WAIT_EVENT; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLADWriteChannel.java b/src/ui/tmlad/TMLADWriteChannel.java new file mode 100755 index 0000000000000000000000000000000000000000..4ab77a528919938cf0428110575a8aeb9c526bd8 --- /dev/null +++ b/src/ui/tmlad/TMLADWriteChannel.java @@ -0,0 +1,230 @@ +/**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 TMLADWriteChannel + * Action of writting data in channel + * Creation: 17/11/2005 + * @version 1.0 17/11/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class TMLADWriteChannel extends TGCWithoutInternalComponent implements CheckableAccessibility, EmbeddedComment { + protected int lineLength = 5; + protected int textX = 5; + protected int textY = 15; + protected int arc = 5; + protected int linebreak = 10; + + protected String channelName = "ch"; + protected String nbOfSamples= "1"; + + public TMLADWriteChannel(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 = 30; + height = 20; + minWidth = 30; + + nbConnectingPoint = 2; + connectingPoint = new TGConnectingPoint[2]; + connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0); + connectingPoint[1] = new TGConnectingPointTMLAD(this, 0, lineLength, false, true, 0.5, 1.0); + + moveable = true; + editable = true; + removable = true; + + makeValue(); + name = "write channel"; + + myImageIcon = IconManager.imgic900; + } + + public void internalDrawing(Graphics g) { + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX); + if ((w1 != width) & (!tdp.isScaled())) { + setCd(x + width/2 - w1/2, y); + width = w1; + //updateConnectingPoints(); + } + //g.drawRoundRect(x, y, width, height, arc, arc); + g.drawLine(x+(width/2), y, x+(width/2), y - lineLength); + g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height); + + int x1 = x + 1; + int y1 = y + 1; + int height1 = height; + int width1 = width; + Color c = g.getColor(); + g.setColor(ColorManager.TML_PORT_CHANNEL); + g.drawLine(x1, y1, x1+width1-linebreak, y1); + g.drawLine(x1, y1+height1, x1+width1-linebreak, y1+height1); + g.drawLine(x1, y1, x1, y1+height1); + g.drawLine(x1+width1-linebreak, y1, x1+width1, y1+height1/2); + g.drawLine(x1+width1-linebreak, y1+height1, x1+width1, y1+height1/2); + g.setColor(c); + + g.drawLine(x, y, x+width-linebreak, y); + g.drawLine(x, y+height, x+width-linebreak, y+height); + g.drawLine(x, y, x, y+height); + g.drawLine(x+width-linebreak, y, x+width, y+height/2); + g.drawLine(x+width-linebreak, y+height, x+width, y+height/2); + + g.drawString("chl", x+(width-w) / 2, y); + g.drawString(value, x + (width - w) / 2 , y + textY); + + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + + if ((int)(Line2D.ptSegDistSq(x+(width/2), y-lineLength, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) { + return this; + } + + return null; + } + + public void makeValue() { + value = channelName + "(" + nbOfSamples + ")"; + } + + public String getChannelName() { + return channelName; + } + + public String getSamplesValue() { + return nbOfSamples; + } + + public String getAction() { + return value; + } + + public boolean editOndoubleClick(JFrame frame) { + + JDialogTwoString jdts = new JDialogTwoString(frame, "Setting channel's properties", "Channel name", channelName, "Nb of samples", nbOfSamples); + jdts.setSize(350, 300); + GraphicLib.centerOnParent(jdts); + jdts.show(); // blocked until dialog has been closed + + if (jdts.hasBeenSet() && (jdts.hasValidString())) { + channelName = jdts.getString1(); + nbOfSamples = jdts.getString2(); + + makeValue(); + return true; + } + + return false; + + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<Data channelName=\""); + sb.append(getChannelName()); + sb.append("\" nbOfSamples=\""); + sb.append(getSamplesValue()); + 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 *** " + getId()); + try { + + NodeList nli; + Node n1, n2; + Element elt; + + //System.out.println("Loading Synchronization gates"); + //System.out.println(nl.toString()); + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Data")) { + channelName = elt.getAttribute("channelName"); + nbOfSamples = elt.getAttribute("nbOfSamples"); + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + + public int getType() { + return TGComponentManager.TMLAD_WRITE_CHANNEL; + } + + public int getDefaultConnector() { + return TGComponentManager.CONNECTOR_TMLAD; + } + +} diff --git a/src/ui/tmlad/TMLActivityDiagramPanel.java b/src/ui/tmlad/TMLActivityDiagramPanel.java new file mode 100755 index 0000000000000000000000000000000000000000..dd7bc25e032e9220c1d07d7f3194c96b5be98709 --- /dev/null +++ b/src/ui/tmlad/TMLActivityDiagramPanel.java @@ -0,0 +1,169 @@ +/**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 TMLActivityDiagramPanel + * Panel used for drawing activity diagrams of TML Tasks + * Creation: 28/10/2005 + * @version 1.0 28/10/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +//import java.awt.*; +import java.util.*; + +//import org.w3c.dom.*; +//import org.xml.sax.*; +//import javax.xml.parsers.*; + +import ui.*; + +public class TMLActivityDiagramPanel extends TDiagramPanel { + + public TMLActivityDiagramPanel(MainGUI mgui, TToolBar _ttb) { + super(mgui, _ttb); + addComponent(400, 50, TGComponentManager.TMLAD_START_STATE, false); + TDiagramMouseManager tdmm = new TDiagramMouseManager(this); + addMouseListener(tdmm); + addMouseMotionListener(tdmm); + } + + public boolean actionOnDoubleClick(TGComponent tgc) { + return false; + } + + public boolean actionOnAdd(TGComponent tgc) { + return false; + } + public boolean actionOnValueChanged(TGComponent tgc) { + return false; + } + + public boolean actionOnRemove(TGComponent tgc) { + return false; + } + + public String getXMLHead() { + return "<TMLActivityDiagramPanel name=\"" + name + "\"" + sizeParam() + " >"; + } + + public String getXMLTail() { + return "</TMLActivityDiagramPanel>"; + } + + public String getXMLSelectedHead() { + return "<TMLActivityDiagramPanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + "\" heightSel=\"" + heightSel + "\" >"; + } + + public String getXMLSelectedTail() { + return "</TMLActivityDiagramPanelCopy>"; + } + + public String getXMLCloneHead() { + return "<TMLActivityDiagramPanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + 0 + "\" >"; + } + + public String getXMLCloneTail() { + return "</TMLActivityDiagramPanelCopy>"; + } + + public void makeGraphicalOptimizations() { + // Segments of connector that mask components + + // Components over others + + // Position correctly guards of choice + } + + public void enhance() { + //System.out.println("enhance"); + Vector v = new Vector(); + Object o; + Iterator iterator = componentList.listIterator(); + + while(iterator.hasNext()) { + o = iterator.next(); + if (o instanceof TMLADStartState){ + enhance(v, (TMLADStartState)o); + } + } + + mgui.changeMade(this, MOVE_CONNECTOR); + repaint(); + } + + public void enhance(Vector v, TGComponent tgc) { + TGComponent tgc1; + TGConnector tgcon; + int i; + + //System.out.println("Enhancing: " + tgc); + + if (tgc == null) { + return; + } + + if (v.contains(tgc)) { + return; + } + + v.add(tgc); + + //System.out.println("Nb of nexts: " + tgc.getNbNext()); + if (!(tgc instanceof TMLADStartState)) { + for(i=0; i<tgc.getNbNext(); i++) { + tgc1 = getNextTGComponent(tgc, i); + tgcon = getNextTGConnector(tgc, i); + if (tgcon.getAutomaticDrawing()) { + if ((tgc1 != null) && (tgcon != null)) { + tgcon.alignOrMakeSquareTGComponents(); + } + } + } + } + + // Explore next elements + for(i=0; i<tgc.getNbNext(); i++) { + tgc1 = getNextTGComponent(tgc, i); + enhance(v, tgc1); + } + } + +} diff --git a/src/ui/tmlad/TMLActivityDiagramToolBar.java b/src/ui/tmlad/TMLActivityDiagramToolBar.java new file mode 100755 index 0000000000000000000000000000000000000000..f0dafb321e67682abd79231ecc68fd0a9d16e7b3 --- /dev/null +++ b/src/ui/tmlad/TMLActivityDiagramToolBar.java @@ -0,0 +1,191 @@ +/**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 TMLActivityDiagramToolBar + * Toolbar associated with TML activity diagrams + * Creation: 28/10/2005 + * @version 1.0 28/10/2005 + * @author Ludovic APVRILLE + * @see + */ + +package ui.tmlad; + +import javax.swing.*; +//import java.awt.*; +//import java.awt.event.*; + +import ui.*; + +public class TMLActivityDiagramToolBar extends TToolBar { + + + public TMLActivityDiagramToolBar(MainGUI _mgui) { + super(_mgui); + } + + protected void setActive(boolean b) { + mgui.actions[TGUIAction.TMLAD_EDIT].setEnabled(b); + mgui.actions[TGUIAction.UML_NOTE].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_START].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_STOP].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_ACTION_STATE].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_JUNCTION].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_CHOICE].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_SELECT_EVT].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_RANDOM].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_EXECI].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_EXECI_INTERVAL].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_EXECC].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_EXECC_INTERVAL].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_WRITE_CHANNEL].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_READ_CHANNEL].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_SEND_REQUEST].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_SEND_EVENT].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_WAIT_EVENT].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_NOTIFIED_EVENT].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_FOR_LOOP].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_FOR_STATIC_LOOP].setEnabled(b); + mgui.actions[TGUIAction.TMLAD_SEQUENCE].setEnabled(b); + mgui.actions[TGUIAction.ACT_ENHANCE].setEnabled(b); + mgui.actions[TGUIAction.ACT_TOGGLE_INTERNAL_COMMENT].setEnabled(b); + } + + protected void setButtons() { + JButton button; + + button = this.add(mgui.actions[TGUIAction.TMLAD_EDIT]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.UML_NOTE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_CONNECTOR]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_START]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_STOP]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_WRITE_CHANNEL]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_SEND_EVENT]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_SEND_REQUEST]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_READ_CHANNEL]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_WAIT_EVENT]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_NOTIFIED_EVENT]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_ACTION_STATE]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_CHOICE]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_SELECT_EVT]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_FOR_LOOP]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_FOR_STATIC_LOOP]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TMLAD_SEQUENCE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_RANDOM]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_EXECI]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.TMLAD_EXECI_INTERVAL]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.TMLAD_EXECC]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.TMLAD_EXECC_INTERVAL]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.ACT_ENHANCE]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_INTERNAL_COMMENT]); + button.addMouseListener(mgui.mouseHandler); + + } +} // Class + + + + +