diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index a8b5082a85e89b9034dba355d5fd92b662d0da39..93e23c30ba9c1942a2a52fb3291bccc9a71df34b 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -7905,8 +7905,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per actionOnButton(TGComponentManager.EDIT, -1); } else if (command.equals(actions[TGUIAction.TMLSD_MESSAGE_ASYNC].getActionCommand())) { actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_MESSAGE_ASYNC_TMLSD); - } else if (command.equals(actions[TGUIAction.TMLSD_INSTANCE].getActionCommand())) { - actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_INSTANCE); + } else if (command.equals(actions[TGUIAction.TMLSD_STORAGE_INSTANCE].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_STORAGE_INSTANCE); + } else if (command.equals(actions[TGUIAction.TMLSD_CONTROLLER_INSTANCE].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_CONTROLLER_INSTANCE); + } else if (command.equals(actions[TGUIAction.TMLSD_TRANSFER_INSTANCE].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_TRANSFER_INSTANCE); } else if (command.equals(actions[TGUIAction.TMLSD_ACTION_STATE].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLSD_ACTION_STATE); diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index fcd4b963ce369326454b568ede891cec306b0981..a17ad822c780eeb8a9cd027fa0e87bb6e8d472eb 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -41,7 +41,7 @@ * Definition and creation of all possible TURTLE graphical component * Creation: 21/12/2003 * @version 1.1 28/10/2005 - * @author Ludovic APVRILLE + * @author Ludovic APVRILLE, Andrea ENRICI * @see */ @@ -280,9 +280,11 @@ public class TGComponentManager { public static final int TMLCP_STOP_STATE = 1507; public static final int TMLCP_JUNCTION = 1508; - public static final int TMLSD_INSTANCE = 1520; - public static final int CONNECTOR_MESSAGE_ASYNC_TMLSD = 1521; - public static final int TMLSD_ACTION_STATE = 1522; + public static final int TMLSD_STORAGE_INSTANCE = 1520; + public static final int TMLSD_TRANSFER_INSTANCE = 1521; + public static final int TMLSD_CONTROLLER_INSTANCE = 1522; + public static final int CONNECTOR_MESSAGE_ASYNC_TMLSD = 1523; + public static final int TMLSD_ACTION_STATE = 1524; // SMD diagram public static final int PROSMD_START_STATE = 2000; @@ -930,8 +932,14 @@ public class TGComponentManager { case TMLSD_ACTION_STATE: tgc = new TMLSDActionState(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; - case TMLSD_INSTANCE: - tgc = new TMLSDInstance(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + case TMLSD_STORAGE_INSTANCE: + tgc = new TMLSDStorageInstance(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case TMLSD_CONTROLLER_INSTANCE: + tgc = new TMLSDControllerInstance(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case TMLSD_TRANSFER_INSTANCE: + tgc = new TMLSDTransferInstance(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; // Requirements @@ -1474,8 +1482,12 @@ public class TGComponentManager { return CONNECTOR_TMLCP; } else if (tgc instanceof TMLSDActionState) { return TMLSD_ACTION_STATE; - } else if (tgc instanceof TMLSDInstance) { - return TMLSD_INSTANCE; + } else if (tgc instanceof TMLSDStorageInstance) { + return TMLSD_STORAGE_INSTANCE; + } else if (tgc instanceof TMLSDTransferInstance) { + return TMLSD_TRANSFER_INSTANCE; + } else if (tgc instanceof TMLSDControllerInstance) { + return TMLSD_CONTROLLER_INSTANCE; } else if (tgc instanceof TGConnectorMessageAsyncTMLSD) { return CONNECTOR_MESSAGE_ASYNC_TMLSD; diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index b6cd6b92ad44b07260ffa44213f1085f4f72347c..4a21d62c64188ba0a9ae9adeb40474c1e3126d52 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -228,7 +228,9 @@ public class TGUIAction extends AbstractAction { public static final int TMLCP_CHOICE = 386; public static final int TMLCP_JUNCTION = 387; - public static final int TMLSD_INSTANCE = 388; + public static final int TMLSD_STORAGE_INSTANCE = 388; + public static final int TMLSD_CONTROLLER_INSTANCE = 396; + public static final int TMLSD_TRANSFER_INSTANCE = 397; public static final int TMLSD_ACTION_STATE = 389; public static final int TMLSD_MESSAGE_ASYNC = 390; public static final int TMLSD_EDIT = 391; @@ -526,7 +528,7 @@ public class TGUIAction extends AbstractAction { //Action for the help button created by Solange public static final int PRUEBA_1 = 205; - public static final int NB_ACTION = 396; + public static final int NB_ACTION = 398; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -880,7 +882,9 @@ public class TGUIAction extends AbstractAction { actions[TMLSD_EDIT] = new TAction("edit-tmlsd-diagram", "Edit CP-SD diagram", IconManager.imgic100, IconManager.imgic101, "Edit The sequence diagram of communication patterns", "Make it possible to edit the currently opened communication pattern sequence diagram", 0); actions[TMLSD_MESSAGE_ASYNC] = new TAction("add-tmlsd-messageasync", "Add async msg", IconManager.imgic202, IconManager.imgic202, "Asynchronous msg", "Add an asynchronous message between two components of the currently opened communication pattern sequence diagram", 0); - actions[TMLSD_INSTANCE] = new TAction("add-instance-tmlsd", "Instance", IconManager.imgic500, IconManager.imgic500, "Instance", "Add an instance to the currently opened communication pattern sequence diagram", 0); + actions[TMLSD_STORAGE_INSTANCE] = new TAction("add-storage-instance-tmlsd", "Storage instance", IconManager.imgic500, IconManager.imgic500, "Storage instance", "Add a storage instance to the currently opened communication pattern sequence diagram", 0); + actions[TMLSD_TRANSFER_INSTANCE] = new TAction("add-transfer-instance-tmlsd", "Transfer instance", IconManager.imgic500, IconManager.imgic500, "Transfer instance", "Add a transfer instance to the currently opened communication pattern sequence diagram", 0); + actions[TMLSD_CONTROLLER_INSTANCE] = new TAction("add-controller-instance-tmlsd", "Controller instance", IconManager.imgic500, IconManager.imgic500, "Controller instance", "Add a controller instance to the currently opened communication pattern sequence diagram", 0); actions[TMLSD_ACTION_STATE] = new TAction("add-action-tmlsd", "Action state", IconManager.imgic512, IconManager.imgic512, "Action state", "Add an action state to the currently opened communication pattern sequence diagram", 0); diff --git a/src/ui/tmlsd/TMLSDControllerInstance.java b/src/ui/tmlsd/TMLSDControllerInstance.java new file mode 100755 index 0000000000000000000000000000000000000000..3c1af75ab04fbbdc7344eddd83ca297aca1e9d27 --- /dev/null +++ b/src/ui/tmlsd/TMLSDControllerInstance.java @@ -0,0 +1,148 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici + +ludovic.apvrille AT telecom-paristech.fr +andrea.enrici AT telecom-paristech.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 TMLSDControllerInstance + * Instance of a Controller for a TML Sequence Diagram + * Creation: 17/02/2004 + * @version 1.1 10/06/2014 + * @author Ludovic APVRILLE, Andrea ENRICI + * @see + */ + +package ui.tmlsd; + +import java.awt.*; +import javax.swing.*; +import org.w3c.dom.*; +import java.awt.event.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +import tmltranslator.tmlcp.*; + +public class TMLSDControllerInstance extends TMLSDInstance implements SwallowTGComponent { + + public TMLSDControllerInstance(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 = 500; + //textX = 0; + //textY = 2; + minWidth = 10; + maxWidth = 10; + minHeight = 250; + maxHeight = 1500; + + + makeTGConnectingPoints(); + //addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + value = "Controller instance name"; + name = "Controller instance"; + isActor = false; + + myImageIcon = IconManager.imgic500; + } + + @Override public boolean editOndoubleClick( JFrame frame ) { + + String oldValue = name; + + JDialogSDInstance jdsdi = new JDialogSDInstance( frame, name, isActor, "Controller attributes" ); + jdsdi.setSize(300, 250); + GraphicLib.centerOnParent(jdsdi); + jdsdi.show(); // blocked until dialog has been closed + + + String text = getName() + ": "; + if(hasFather() ) { + text = getTopLevelName() + " / " + text; + } + + if( jdsdi.hasBeenUpdated() ) { + isActor = jdsdi.isAnActor(); + String s = jdsdi.getInstanceName(); + if( s != null ) { + s = s.trim(); + } + + if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { + if (!TAttribute.isAValidId(s, false, false)) { + JOptionPane.showMessageDialog( frame, + "Could not change the name of the instance: the new name is not a valid name", + "Error", JOptionPane.INFORMATION_MESSAGE ); + return false; + } + setName(s); + TraceManager.addDev( Integer.toString( connectingPoint.length ) ); + for( int i = 0; i < connectingPoint.length; i++ ) { + //for each connecting point connected to something + if( connectingPoint[i].getReferenceToConnector() != null ) { + TGConnectorMessageAsyncTMLSD connector = (TGConnectorMessageAsyncTMLSD) connectingPoint[i].getReferenceToConnector(); + if( connectingPoint[i].isSource() ) { + connector.changeStartName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + else { + connector.changeEndName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + } + } + return true; + } + } + return false; + } + + @Override public int getType() { + return TGComponentManager.TMLSD_CONTROLLER_INSTANCE; + } +} //End of class diff --git a/src/ui/tmlsd/TMLSDInstance.java b/src/ui/tmlsd/TMLSDInstance.java index c87e1d925d7b09a6252a8909c469227c9f7127c9..352144269d9f353d8b95b6ec6802d8e9d37461d3 100755 --- a/src/ui/tmlsd/TMLSDInstance.java +++ b/src/ui/tmlsd/TMLSDInstance.java @@ -56,17 +56,19 @@ import myutil.*; import ui.*; import ui.window.*; +import tmltranslator.tmlcp.*; +//Abstract class, getType() is abstract +public abstract class TMLSDInstance extends TGCWithInternalComponent implements SwallowTGComponent { -public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTGComponent { - //private int lineLength = 5; - //private int textX, textY; - private int spacePt = 10; - private int wText = 10, hText = 15; - private int increaseSlice = 250; - private boolean isActor; - private static int heightActor = 30; - private static int widthActor = 16; + //protected int lineLength = 5; + //protected int textX, textY; + protected int spacePt = 10; + protected int wText = 10, hText = 15; + protected int increaseSlice = 250; + protected boolean isActor; + protected static int heightActor = 30; + protected static int widthActor = 16; public TMLSDInstance(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { @@ -97,9 +99,7 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG isActor = false; myImageIcon = IconManager.imgic500; - - - } + } public void internalDrawing(Graphics g) { if (!tdp.isScaled()) { @@ -157,22 +157,20 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG } public String getInstanceName() { - return getValue(); + return getName(); } - public int getType() { - return TGComponentManager.TMLSD_INSTANCE; - } + public abstract int getType(); - private void makeTGConnectingPoints() { + protected void makeTGConnectingPoints() { - nbConnectingPoint = ((height - (2 * spacePt)) / spacePt) + 1; - connectingPoint = new TGConnectingPoint[nbConnectingPoint]; + nbConnectingPoint = ( (height - (2 * spacePt) ) / spacePt ) + 1; + connectingPoint = new TGConnectingPoint[ nbConnectingPoint ]; int yh = spacePt; - for(int i=0; i<nbConnectingPoint; i ++, yh+=spacePt) { - connectingPoint[i] = new TGConnectingPointTMLSD(this, (width/2), yh, true, true); + for(int i = 0; i < nbConnectingPoint; i++, yh += spacePt ) { + connectingPoint[i] = new TGConnectingPointTMLSD(this, ( width/2), yh, true, true ); } } @@ -201,13 +199,27 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { if (!TAttribute.isAValidId(s, false, false)) { - JOptionPane.showMessageDialog(frame, + JOptionPane.showMessageDialog( frame, "Could not change the name of the instance: the new name is not a valid name", - "Error", - JOptionPane.INFORMATION_MESSAGE); + "Error", JOptionPane.INFORMATION_MESSAGE ); return false; } setName(s); + TraceManager.addDev( Integer.toString( connectingPoint.length ) ); + for( int i = 0; i < connectingPoint.length; i++ ) { + //for each connecting point connected to something + if( connectingPoint[i].getReferenceToConnector() != null ) { + TGConnectorMessageAsyncTMLSD connector = (TGConnectorMessageAsyncTMLSD) connectingPoint[i].getReferenceToConnector(); + if( connectingPoint[i].isSource() ) { + connector.changeStartName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + else { + connector.changeEndName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + } + } return true; } } @@ -215,13 +227,9 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG } public boolean acceptSwallowedTGComponent(TGComponent tgc) { - - if ((tgc instanceof TMLSDActionState)) { return true; } - - return false; } @@ -399,7 +407,7 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG } } - private void setCDRectangleOfSwallowed(TGComponent tgc) { + protected void setCDRectangleOfSwallowed(TGComponent tgc) { if ((tgc instanceof TMLSDActionState)) { @@ -454,4 +462,15 @@ public class TMLSDInstance extends TGCWithInternalComponent implements SwallowTG isActor = b; } + public int getNumberInternalComponents() { + return nbInternalTGComponent; + } + + public TGComponent[] getInternalComponents() { + return tgcomponent; + } + + public TGConnectingPoint[] getConnectingPoint() { + return connectingPoint; + } } diff --git a/src/ui/tmlsd/TMLSDPanel.java b/src/ui/tmlsd/TMLSDPanel.java index 6b7bb1c70901121d84b8f0e655846e8f93f9c5b3..685d44347fb9c846988b8778b7207bf802398a17 100755 --- a/src/ui/tmlsd/TMLSDPanel.java +++ b/src/ui/tmlsd/TMLSDPanel.java @@ -141,15 +141,45 @@ public class TMLSDPanel extends TDiagramPanel { }*/ } - public TMLSDInstance getTMLSDInstance(String name) { + public TMLSDTransferInstance getTMLSDTransferInstance(String name) { TGComponent tgc; Iterator iterator = componentList.listIterator(); while(iterator.hasNext()) { tgc = (TGComponent)(iterator.next()); - if (tgc instanceof TMLSDInstance) { + if (tgc instanceof TMLSDTransferInstance) { + if (tgc.getValue().compareTo(name) ==0) { + return (TMLSDTransferInstance)tgc; + } + } + } + return null; + } + + public TMLSDControllerInstance getTMLSDControllerInstance(String name) { + TGComponent tgc; + Iterator iterator = componentList.listIterator(); + + while(iterator.hasNext()) { + tgc = (TGComponent)(iterator.next()); + if (tgc instanceof TMLSDControllerInstance) { + if (tgc.getValue().compareTo(name) ==0) { + return (TMLSDControllerInstance)tgc; + } + } + } + return null; + } + + public TMLSDStorageInstance getTMLSDStorageInstance(String name) { + TGComponent tgc; + Iterator iterator = componentList.listIterator(); + + while(iterator.hasNext()) { + tgc = (TGComponent)(iterator.next()); + if (tgc instanceof TMLSDStorageInstance) { if (tgc.getValue().compareTo(name) ==0) { - return (TMLSDInstance)tgc; + return (TMLSDStorageInstance)tgc; } } } @@ -174,6 +204,7 @@ public class TMLSDPanel extends TDiagramPanel { return null; } + //TMLSDStorage,Controller,Transfer inherit from TMLSDInstance so they are also of type TMLSDInstance public TGConnector messageActionCloserTo(TGComponent tgc, TMLSDInstance sd) { int distance = 25; TGConnector found = null; @@ -203,6 +234,7 @@ public class TMLSDPanel extends TDiagramPanel { return found; } + //TMLSDStorage,Controller,Transfer inherit from TMLSDInstance so they are also of type TMLSDInstance public TGConnectingPoint TGConnectingPointActionCloserTo(TGComponent tc1, TGConnector tgco, TMLSDInstance sdi) { TGConnectingPoint p1, p2; p1 = tgco.getTGConnectingPointP1(); @@ -234,6 +266,7 @@ public class TMLSDPanel extends TDiagramPanel { } } + //TMLSDStorage,Controller,Transfer inherit from TMLSDInstance so they are also of type TMLSDInstance public TGComponent getActionCloserTo(int y, TMLSDInstance sdi) { int distance = 25; TGComponent tgc, found = null; @@ -254,6 +287,7 @@ public class TMLSDPanel extends TDiagramPanel { return found; } + //TMLSDStorage,Controller,Transfer inherit from TMLSDInstance so they are also of type TMLSDInstance public void increaseInstanceSize(int size) { Iterator iterator = componentList.listIterator(); TGComponent tgc; @@ -276,6 +310,7 @@ public class TMLSDPanel extends TDiagramPanel { } + //TMLSDStorage,Controller,Transfer inherit from TMLSDInstance so they are also of type TMLSDInstance public void alignInstances() { TMLSDInstance ontheLeft = null, sdi; int x = getMaxX(),xtmp; diff --git a/src/ui/tmlsd/TMLSDStorageInstance.java b/src/ui/tmlsd/TMLSDStorageInstance.java new file mode 100755 index 0000000000000000000000000000000000000000..d428ada3174de84f708af13bd4d695f0495e83a8 --- /dev/null +++ b/src/ui/tmlsd/TMLSDStorageInstance.java @@ -0,0 +1,147 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici + +ludovic.apvrille AT telecom-paristech.fr +andrea.enrici AT telecom-paristech.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 TMLSDStorageInstance + * Instance of storage CP component for a TML Sequence Diagram + * Creation: 17/02/2004 + * @version 1.1 10/06/2014 + * @author Ludovic APVRILLE, Andrea ENRICI + * @see + */ + +package ui.tmlsd; + +import java.awt.*; +import javax.swing.*; +import org.w3c.dom.*; +import java.awt.event.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +import tmltranslator.tmlcp.*; + +public class TMLSDStorageInstance extends TMLSDInstance implements SwallowTGComponent { + + public TMLSDStorageInstance( 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 = 500; + //textX = 0; + //textY = 2; + minWidth = 10; + maxWidth = 10; + minHeight = 250; + maxHeight = 1500; + + + makeTGConnectingPoints(); + //addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + value = "Storage instance name"; + name = "Storage instance"; + isActor = false; + + myImageIcon = IconManager.imgic500; + } + + @Override public boolean editOndoubleClick(JFrame frame) { + + String oldValue = name; + + JDialogSDInstance jdsdi = new JDialogSDInstance( frame, name, isActor, "Storage attributes" ); + jdsdi.setSize( 300, 250 ); + GraphicLib.centerOnParent( jdsdi ); + jdsdi.show(); // blocked until dialog has been closed + + String text = getName() + ": "; + if(hasFather() ) { + text = getTopLevelName() + " / " + text; + } + + if( jdsdi.hasBeenUpdated() ) { + isActor = jdsdi.isAnActor(); + String s = jdsdi.getInstanceName(); + if( s != null ) { + s = s.trim(); + } + + if( (s != null) && (s.length() > 0) && ( !s.equals(oldValue) ) ) { + if( !TAttribute.isAValidId(s, false, false) ) { + JOptionPane.showMessageDialog( frame, + "Could not change the name of the instance: the new name is not a valid name", + "Error", JOptionPane.INFORMATION_MESSAGE ); + return false; + } + setName(s); + TraceManager.addDev( Integer.toString( connectingPoint.length ) ); + for( int i = 0; i < connectingPoint.length; i++ ) { + //for each connecting point connected to something + if( connectingPoint[i].getReferenceToConnector() != null ) { + TGConnectorMessageAsyncTMLSD connector = (TGConnectorMessageAsyncTMLSD) connectingPoint[i].getReferenceToConnector(); + if( connectingPoint[i].isSource() ) { + connector.changeStartName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + else { + connector.changeEndName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + } + } + return true; + } + } + return false; + } + + @Override public int getType() { + return TGComponentManager.TMLSD_STORAGE_INSTANCE; + } +} //End of class diff --git a/src/ui/tmlsd/TMLSDToolBar.java b/src/ui/tmlsd/TMLSDToolBar.java index 3866c73bf8724e85828146ea0e968812c7e62da0..3112f28b3e0a12606ffe4dad66c2816ad42f1ae5 100755 --- a/src/ui/tmlsd/TMLSDToolBar.java +++ b/src/ui/tmlsd/TMLSDToolBar.java @@ -1,6 +1,7 @@ -/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici -ludovic.apvrille AT enst.fr +ludovic.apvrille AT telecom-paristech.fr +andrea.enrici AT telecom-paristech.fr This software is a computer program whose purpose is to allow the edition of TURTLE analysis, design and deployment diagrams, to @@ -41,7 +42,7 @@ knowledge of the CeCILL license and that you accept its terms. * sequence diagram * Creation: 17/02/2004 * @version 1.0 17/02/2004 - * @author Ludovic APVRILLE + * @author Ludovic APVRILLE, Andrea ENRICI * @see TMLSDPanel */ @@ -52,6 +53,7 @@ import javax.swing.*; //import java.awt.event.*; import ui.*; +import myutil.*; public class TMLSDToolBar extends TToolBar { @@ -65,7 +67,9 @@ public class TMLSDToolBar extends TToolBar { mgui.actions[TGUIAction.UML_NOTE].setEnabled(b); mgui.actions[TGUIAction.CONNECTOR_COMMENT].setEnabled(b); mgui.actions[TGUIAction.TMLSD_MESSAGE_ASYNC].setEnabled(b); - mgui.actions[TGUIAction.TMLSD_INSTANCE].setEnabled(b); + mgui.actions[TGUIAction.TMLSD_STORAGE_INSTANCE].setEnabled(b); + mgui.actions[TGUIAction.TMLSD_CONTROLLER_INSTANCE].setEnabled(b); + mgui.actions[TGUIAction.TMLSD_TRANSFER_INSTANCE].setEnabled(b); mgui.actions[TGUIAction.TMLSD_ACTION_STATE].setEnabled(b); mgui.actions[TGUIAction.SD_ALIGN_INSTANCES].setEnabled(b); @@ -96,7 +100,12 @@ public class TMLSDToolBar extends TToolBar { this.addSeparator(); - button = this.add(mgui.actions[TGUIAction.TMLSD_INSTANCE]); + TraceManager.addDev( "Value is: " + TGUIAction.TMLSD_STORAGE_INSTANCE ); + button = this.add(mgui.actions[TGUIAction.TMLSD_STORAGE_INSTANCE]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.TMLSD_CONTROLLER_INSTANCE]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.TMLSD_TRANSFER_INSTANCE]); button.addMouseListener(mgui.mouseHandler); this.addSeparator(); diff --git a/src/ui/tmlsd/TMLSDTransferInstance.java b/src/ui/tmlsd/TMLSDTransferInstance.java new file mode 100755 index 0000000000000000000000000000000000000000..083190899c67147e9d094bbfc5c928643774af73 --- /dev/null +++ b/src/ui/tmlsd/TMLSDTransferInstance.java @@ -0,0 +1,148 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille, Andrea Enrici + +ludovic.apvrille AT telecom-paristech.fr +andrea.enrici AT telecom-paristech.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 TMLSDTransferInstance + * Instance of a Transfer component for a TML Sequence Diagram + * Creation: 17/02/2004 + * @version 1.1 10/06/2014 + * @author Ludovic APVRILLE, Andrea ENRICI + * @see + */ + +package ui.tmlsd; + +import java.awt.*; +import javax.swing.*; +import org.w3c.dom.*; +import java.awt.event.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +import tmltranslator.tmlcp.*; + +public class TMLSDTransferInstance extends TMLSDInstance implements SwallowTGComponent { + + public TMLSDTransferInstance( 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 = 500; + //textX = 0; + //textY = 2; + minWidth = 10; + maxWidth = 10; + minHeight = 250; + maxHeight = 1500; + + + makeTGConnectingPoints(); + //addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + userResizable = true; + + value = "Transfer instance name"; + name = "Transfer instance"; + isActor = false; + + myImageIcon = IconManager.imgic500; + } + + @Override public boolean editOndoubleClick( JFrame frame ) { + + String oldValue = name; + + JDialogSDInstance jdsdi = new JDialogSDInstance(frame, name, isActor, "Transfer attributes"); + jdsdi.setSize(300, 250); + GraphicLib.centerOnParent(jdsdi); + jdsdi.show(); // blocked until dialog has been closed + + + String text = getName() + ": "; + if(hasFather() ) { + text = getTopLevelName() + " / " + text; + } + + if( jdsdi.hasBeenUpdated() ) { + isActor = jdsdi.isAnActor(); + String s = jdsdi.getInstanceName(); + if( s != null ) { + s = s.trim(); + } + + if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { + if (!TAttribute.isAValidId(s, false, false)) { + JOptionPane.showMessageDialog( frame, + "Could not change the name of the instance: the new name is not a valid name", + "Error", JOptionPane.INFORMATION_MESSAGE ); + return false; + } + setName(s); + TraceManager.addDev( Integer.toString( connectingPoint.length ) ); + for( int i = 0; i < connectingPoint.length; i++ ) { + //for each connecting point connected to something + if( connectingPoint[i].getReferenceToConnector() != null ) { + TGConnectorMessageAsyncTMLSD connector = (TGConnectorMessageAsyncTMLSD) connectingPoint[i].getReferenceToConnector(); + if( connectingPoint[i].isSource() ) { + connector.changeStartName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + else { + connector.changeEndName(s); + TraceManager.addDev( connector.getConnectorName() ); + } + } + } + return true; + } + } + return false; + } + + @Override public int getType() { + return TGComponentManager.TMLSD_TRANSFER_INSTANCE; + } +} //End of class