diff --git a/src/remotesimulation/CommandParser.java b/src/remotesimulation/CommandParser.java index f167f7a979a1b87119a75606d6e9c18415c7e46c..52defb290927f46c66a93f0aaf84a94da8cdd76f 100755 --- a/src/remotesimulation/CommandParser.java +++ b/src/remotesimulation/CommandParser.java @@ -252,6 +252,30 @@ public class CommandParser { sc = new SimulationCommand("run-x-time-units", "rxtu", "1 6", params, paramNames, "Runs the simulation for x units of time"); commandList.add(sc); + // run-to-time + params = new int[1]; + paramNames = new String[1]; + params[0] = 1; + paramNames[0] = "x: time value"; + sc = new SimulationCommand("run-to-time", "rtt", "1 5", params, paramNames, "Runs the simulation until time x is reached"); + commandList.add(sc); + + // run-x-transactions + params = new int[1]; + paramNames = new String[1]; + params[0] = 1; + paramNames[0] = "nb of transactions"; + sc = new SimulationCommand("run-x-transactions", "rxtr", "1 2", params, paramNames, "Runs the simulation for x transactions"); + commandList.add(sc); + + // run-x-commands + params = new int[1]; + paramNames = new String[1]; + params[0] = 1; + paramNames[0] = "nb of commands"; + sc = new SimulationCommand("run-x-commands", "rxcomm", "1 4", params, paramNames, "Runs the simulation for x commands"); + commandList.add(sc); + // save-trace-in-file params = new int[2]; paramNames = new String[2]; diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java index 2911a2a683cc2ce47f780ce8062a4e33cf409e3e..a82621c6dbc1b366779caaf30b232b094827b179 100755 --- a/src/ui/IconManager.java +++ b/src/ui/IconManager.java @@ -113,7 +113,8 @@ public class IconManager { // TML component task diagram public static ImageIcon imgic1200, imgic1202, imgic1204, imgic1206, imgic1208; - + public static ImageIcon imgic1300, imgic1302, imgic1304, imgic1306, imgic1308; + public static ImageIcon imgic1310, imgic1312, imgic1314, imgic1316, imgic1318; // SMD diagram public static ImageIcon imgic2000, imgic2002, imgic2004,imgic2006,imgic2008,imgic2010, imgic2012; @@ -399,7 +400,18 @@ public class IconManager { private static String icon1204 = "images/tmlcompport.gif"; private static String icon1206 = "images/tmlprimport.gif"; private static String icon1208 = "images/tmlcompdiag.gif"; - + + private static String icon1300 = "images/stepforwardxtimeunits24.gif"; + private static String icon1302 = "images/stepforwardtobreakpoint24.gif"; + private static String icon1304 = "images/stepforwardtotime24.gif"; + private static String icon1306 = "images/stepforwardxtransactions24.gif"; + private static String icon1308 = "images/stepforwardxcommands24.gif"; + private static String icon1310 = "images/savevcd24.gif"; + private static String icon1312 = "images/savehtml24.gif"; + private static String icon1314 = "images/savetxt24.gif"; + //private static String icon1316 = "images/savestate24.gif"; + //private static String icon1318 = "images/restorestate24.gif"; + // SMD diagrams private static String icon2000 = "images/prosmdsendmsg.gif"; private static String icon2002 = "images/prosmdgetmsg.gif"; @@ -674,6 +686,17 @@ public class IconManager { imgic1204 = getIcon(icon1204); imgic1206 = getIcon(icon1206); imgic1208 = getIcon(icon1208); + + imgic1300 = getIcon(icon1300); + imgic1302 = getIcon(icon1302); + imgic1304 = getIcon(icon1304); + imgic1306 = getIcon(icon1306); + imgic1308 = getIcon(icon1308); + imgic1310 = getIcon(icon1310); + imgic1312 = getIcon(icon1312); + imgic1314 = getIcon(icon1314); + //imgic1316 = getIcon(icon1316); + //imgic1318 = getIcon(icon1318); imgic2000 = getIcon(icon2000); imgic2002 = getIcon(icon2002); diff --git a/src/ui/interactivesimulation/InteractiveSimulationActions.java b/src/ui/interactivesimulation/InteractiveSimulationActions.java index 7289efd23b879bb1888a4eb9345c69f185b16869..611b77d342fcf0606414bf40185a4b11910cfec7 100755 --- a/src/ui/interactivesimulation/InteractiveSimulationActions.java +++ b/src/ui/interactivesimulation/InteractiveSimulationActions.java @@ -60,12 +60,23 @@ public class InteractiveSimulationActions extends AbstractAction { public static final int ACT_RUN_SIMU = 0; public static final int ACT_STOP_SIMU = 1; public static final int ACT_RESET_SIMU = 2; + public static final int ACT_RUN_X_TIME_UNITS = 6; + public static final int ACT_RUN_TO_TIME = 7; + public static final int ACT_RUN_X_TRANSACTIONS = 8; + public static final int ACT_RUN_X_COMMANDS = 9; + + public static final int ACT_SAVE_VCD = 10; + public static final int ACT_SAVE_HTML = 11; + public static final int ACT_SAVE_TXT = 12; + + public static final int ACT_SAVE_STATE = 13; + public static final int ACT_RESTORE_STATE = 14; public static final int ACT_START_ALL = 3; public static final int ACT_STOP_ALL = 4; public static final int ACT_STOP_AND_CLOSE_ALL = 5; - public static final int NB_ACTION = 6; + public static final int NB_ACTION = 15; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -105,10 +116,21 @@ public class InteractiveSimulationActions extends AbstractAction { } public void init() { - actions[ACT_RUN_SIMU] = new TAction("run-simu", "Run simulation", IconManager.imgic53, IconManager.imgic53, "Run simulation", "Run simulation. works only if the simulator is \"ready\"", 'R'); + actions[ACT_RUN_SIMU] = new TAction("run-simu", "Run simulation", IconManager.imgic1302, IconManager.imgic1302, "Run simulation", "Run simulation until next breakpoint. works only if the simulator is \"ready\"", 'R'); actions[ACT_STOP_SIMU] = new TAction("stop-simu", "Stop simulation", IconManager.imgic55, IconManager.imgic55, "Stop simulation", "Stop simulation. Works only if the simulator is \"busy\"", 'S'); actions[ACT_RESET_SIMU] = new TAction("reset-simu", "Reset simulation", IconManager.imgic45, IconManager.imgic45, "Reset simulation", "Reset simulation", 'T'); - + actions[ACT_RUN_X_TIME_UNITS] = new TAction("run-x-time-units", "Run x time units", IconManager.imgic1300, IconManager.imgic1300, "Run x time units", "Run simulation for x units of time. Works only if the simulator is \"ready\"", 'R'); + actions[ACT_RUN_TO_TIME] = new TAction("run-to-time", "Run to time x", IconManager.imgic1304, IconManager.imgic1304, "Run to time x", "Run simulation until time x is reached. Works only if the simulator is \"ready\"", 'R'); + actions[ACT_RUN_X_TRANSACTIONS] = new TAction("run-x-transactions", "Run x transactions", IconManager.imgic1306, IconManager.imgic1306, "Run x transactions", "Run simulation for x transactions. Works only if the simulator is \"ready\"", 'R'); + actions[ACT_RUN_X_COMMANDS] = new TAction("run-x-commands", "Run x commands", IconManager.imgic1308, IconManager.imgic1308, "Run x commands", "Run simulation for x commands. Works only if the simulator is \"ready\"", 'R'); + + actions[ACT_SAVE_VCD] = new TAction("save-vcd", "Save trace in VCD format", IconManager.imgic1310, IconManager.imgic1310, "Save trace in VCD format", "Save trace in VCD format", 'R'); + actions[ACT_SAVE_HTML] = new TAction("save-html", "Save trace in HTML format", IconManager.imgic1312, IconManager.imgic1312, "Save trace in HTML format", "Save trace in HTML format", 'R'); + actions[ACT_SAVE_TXT] = new TAction("save-txt", "Save trace in TXT format", IconManager.imgic1314, IconManager.imgic1314, "Save trace in TXT format", "Save trace in TXT format", 'R'); + + actions[ACT_SAVE_STATE] = new TAction("save-state", "Save simulation state in File", IconManager.imgic341, IconManager.imgic341, "Save simulation state in File", "Save simulation state in File", 'R'); + actions[ACT_RESTORE_STATE] = new TAction("restore-state", "Restore simulation state from File", IconManager.imgic339, IconManager.imgic339, "Restore simulation state from File", "Restore simulation state from File", 'R'); + actions[ACT_START_ALL] = new TAction("start-all", "Connect to simulator", IconManager.imgic53, IconManager.imgic53, "Connect", "Start the server - if it is not yet running - and connect to it", 'C'); actions[ACT_STOP_ALL] = new TAction("stop-all", "Quit simulation window", IconManager.imgic27, IconManager.imgic27, "Quit simulation window", "Quit the simulation window without terminating the simulation", 'Q'); actions[ACT_STOP_AND_CLOSE_ALL] = new TAction("stop-and-close-all", "Terminate simulation and quit", IconManager.imgic27, IconManager.imgic27, "Terminate simulation and quit", "Terminate the simulation and quit the simulation window", 'T'); diff --git a/src/ui/interactivesimulation/JFrameInteractiveSimulation.java b/src/ui/interactivesimulation/JFrameInteractiveSimulation.java index 0daf8e46090f5f56fa635f479cd351cae4168192..6c1b53aa40aa79515ff013e0533881352d3d9aea 100755 --- a/src/ui/interactivesimulation/JFrameInteractiveSimulation.java +++ b/src/ui/interactivesimulation/JFrameInteractiveSimulation.java @@ -108,10 +108,15 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene // Control command protected JButton resetCommand, runCommand, StopCommand; protected MainCommandsToolBar mctb; + protected SaveCommandsToolBar sctb; + protected StateCommandsToolBar stctb; - - JPanel main, mainTop, commands, infos, outputs; // from MGUI - JTabbedPane commandTab, infoTab; + JPanel main, mainTop, commands, save, state, infos, outputs; // from MGUI + JCheckBox debug; + JTabbedPane commandTab, infoTab, saveTab, stateTab; + protected JTextField paramMainCommand; + protected JTextField saveFileName; + protected JTextField stateFileName; // Status elements JLabel status, time; @@ -156,7 +161,7 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene } public void makeComponents() { - JPanel jp01; + JPanel jp01, jp02; //jp01.setPreferredSize(new Dimension(375, 400)); GridBagLayout gridbag01; GridBagConstraints c01 ; @@ -256,32 +261,27 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene commandTab.addTab("Control", null, jp01, "Main control commands"); - /*c01.gridheight = 1; - c01.weighty = 1.0; - c01.weightx = 1.0; - //c01.gridwidth = 1; - c01.fill = GridBagConstraints.BOTH; - //c01.gridheight = 1; + mctb = new MainCommandsToolBar(this); + jp01.add(mctb, BorderLayout.NORTH); + + jp02 = new JPanel(); + //jp01.setPreferredSize(new Dimension(375, 400)); + gridbag01 = new GridBagLayout(); + c01 = new GridBagConstraints(); + jp02.setLayout(gridbag01); c01.gridheight = 1; - jp01.add(new JLabel(" "), c01); - c01.gridheight = 1; - resetCommand = new JButton(IconManager.imgic45); - //resetCommand.setPreferredSize(new Dimension(35, 35)); - resetCommand.addMouseListener(this); - jp01.add(resetCommand, c01); - StopCommand = new JButton(IconManager.imgic55); - StopCommand.addMouseListener(this); - jp01.add(StopCommand, c01); + c01.weighty = 1.0; + c01.weightx = 1.0; c01.gridwidth = GridBagConstraints.REMAINDER; //end row - runCommand = new JButton(IconManager.imgic53); - runCommand.addMouseListener(this); - jp01.add(runCommand, c01); + c01.fill = GridBagConstraints.BOTH; c01.gridheight = 1; - jp01.add(new JLabel(" "), c01);*/ - mctb = new MainCommandsToolBar(this); - jp01.add(mctb, BorderLayout.NORTH); + jp02.add(new JLabel("Command parameter:"), c01); + paramMainCommand = new JTextField(30); + jp02.add(paramMainCommand, c01); + + jp01.add(jp02, BorderLayout.CENTER); // Text commands @@ -325,6 +325,58 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene commands.add(commandTab); + // Save commands + jp01 = new JPanel(new BorderLayout()); + + commandTab.addTab("Save trace", null, jp01, "Save commands"); + + sctb = new SaveCommandsToolBar(this); + jp01.add(sctb, BorderLayout.NORTH); + + jp02 = new JPanel(); + gridbag01 = new GridBagLayout(); + c01 = new GridBagConstraints(); + jp02.setLayout(gridbag01); + + c01.gridheight = 1; + c01.weighty = 1.0; + c01.weightx = 1.0; + c01.gridwidth = GridBagConstraints.REMAINDER; //end row + c01.fill = GridBagConstraints.BOTH; + c01.gridheight = 1; + + jp02.add(new JLabel("File name:"), c01); + saveFileName = new JTextField(30); + jp02.add(saveFileName, c01); + + jp01.add(jp02, BorderLayout.CENTER); + + // State commands + jp01 = new JPanel(new BorderLayout()); + + commandTab.addTab("Save / restore state", null, jp01, "Save commands"); + + stctb = new StateCommandsToolBar(this); + jp01.add(stctb, BorderLayout.NORTH); + + jp02 = new JPanel(); + gridbag01 = new GridBagLayout(); + c01 = new GridBagConstraints(); + jp02.setLayout(gridbag01); + + c01.gridheight = 1; + c01.weighty = 1.0; + c01.weightx = 1.0; + c01.gridwidth = GridBagConstraints.REMAINDER; //end row + c01.fill = GridBagConstraints.BOTH; + c01.gridheight = 1; + + jp02.add(new JLabel("File name:"), c01); + stateFileName = new JTextField(30); + jp02.add(stateFileName, c01); + + jp01.add(jp02, BorderLayout.CENTER); + //Info infos = new JPanel(); @@ -370,7 +422,9 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene time = new JLabel("Unknown"); time.setForeground(ColorManager.InteractiveSimulationText); jp01.add(time, c01); - + jp01.add(new JLabel(" "), c01); + debug = new JCheckBox("Print messages received from server"); + jp01.add(debug, c01); pack(); @@ -525,7 +579,9 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene while(true) { testGo(); s = rc.readOneLine(); - //jta.append("\nFrom server: " + s + "\n"); + if (debug.isSelected()) { + jta.append("\nFrom server: " + s + "\n"); + } analyzeServerAnswer(s); } } catch (RemoteConnectionException rce) { @@ -856,16 +912,25 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene } public void setBusyStatus(boolean b) { - actions[InteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(!b); - actions[InteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(!b); + setAll(!b); actions[InteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(b); busyStatus = b; } public void setAll(boolean b) { actions[InteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(b); + actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS].setEnabled(b); + actions[InteractiveSimulationActions.ACT_RUN_TO_TIME].setEnabled(b); + actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS].setEnabled(b); + actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(b); actions[InteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(b); actions[InteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(b); + actions[InteractiveSimulationActions.ACT_SAVE_VCD].setEnabled(b); + actions[InteractiveSimulationActions.ACT_SAVE_HTML].setEnabled(b); + actions[InteractiveSimulationActions.ACT_SAVE_STATE].setEnabled(b); + actions[InteractiveSimulationActions.ACT_RESTORE_STATE].setEnabled(b); + actions[InteractiveSimulationActions.ACT_SAVE_TXT].setEnabled(b); + } public static String decodeString(String s) { @@ -922,6 +987,44 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene } } + public void sendCommandWithPositiveInt(String command) { + String param = paramMainCommand.getText().trim(); + if (isAPositiveInt(param)) { + sendCommand(command + " " + param); + } else { + error("Wrong parameter: must be a positive int"); + } + } + + public void sendSaveTraceCommand(String format) { + String param = saveFileName.getText().trim(); + if (param.length() >0) { + sendCommand("save-trace-in-file" + " " + format + " " + param); + } else { + error("Wrong parameter: must be a file name"); + } + } + + public void sendSaveStateCommand() { + String param = stateFileName.getText().trim(); + if (param.length() >0) { + sendCommand("save-simulation-state-in-file " + param); + } else { + error("Wrong parameter: must be a file name"); + } + } + + public void sendRestoreStateCommand() { + String param = stateFileName.getText().trim(); + if (param.length() >0) { + sendCommand("restore-simulation-state-from-file " + param); + } else { + error("Wrong parameter: must be a file name"); + } + } + + + public void actionPerformed(ActionEvent evt) { String command = evt.getActionCommand(); //System.out.println("Command:" + command); @@ -939,6 +1042,24 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene //System.out.println("Start simulation!"); } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_SIMU].getActionCommand())) { sendCommand("run-to-next-breakpoint"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS].getActionCommand())) { + sendCommandWithPositiveInt("run-x-time-units"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_TO_TIME].getActionCommand())) { + sendCommandWithPositiveInt("run-to-time"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS].getActionCommand())) { + sendCommandWithPositiveInt("run-x-transactions"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS].getActionCommand())) { + sendCommandWithPositiveInt("run-x-commands"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_VCD].getActionCommand())) { + sendSaveTraceCommand("0"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_HTML].getActionCommand())) { + sendSaveTraceCommand("1"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_TXT].getActionCommand())) { + sendSaveTraceCommand("2"); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_STATE].getActionCommand())) { + sendSaveStateCommand(); + } else if (command.equals(actions[InteractiveSimulationActions.ACT_RESTORE_STATE].getActionCommand())) { + sendRestoreStateCommand(); } else if (command.equals(actions[InteractiveSimulationActions.ACT_RESET_SIMU].getActionCommand())) { sendCommand("reset"); } else if (command.equals(actions[InteractiveSimulationActions.ACT_STOP_SIMU].getActionCommand())) { @@ -946,5 +1067,22 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene } } + public void error(String error) { + jta.append("error: " + error + "\n"); + } + + public boolean isAPositiveInt(String s) { + int val; + try { + val = Integer.decode(s).intValue(); + } catch (Exception e) { + return false; + } + if (val > -1) { + return true; + } + return false; + } + } // Class \ No newline at end of file diff --git a/src/ui/interactivesimulation/MainCommandsToolBar.java b/src/ui/interactivesimulation/MainCommandsToolBar.java index d82b6138d18f664a2fda72540b229e9037281a55..9929e71f8cee1ea617fb3725445e2d7bcdf71b96 100755 --- a/src/ui/interactivesimulation/MainCommandsToolBar.java +++ b/src/ui/interactivesimulation/MainCommandsToolBar.java @@ -61,6 +61,10 @@ public class MainCommandsToolBar extends InteractiveSimulationBar { protected void setActive(boolean b) { jfis.actions[InteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_RUN_TO_TIME].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(b); jfis.actions[InteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(b); jfis.actions[InteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(b); } @@ -78,6 +82,22 @@ public class MainCommandsToolBar extends InteractiveSimulationBar { button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_SIMU]); button.addMouseListener(jfis.mouseHandler); + + this.addSeparator(); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_TO_TIME]); + button.addMouseListener(jfis.mouseHandler); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS]); + button.addMouseListener(jfis.mouseHandler); + + this.addSeparator(); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS]); + button.addMouseListener(jfis.mouseHandler); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS]); + button.addMouseListener(jfis.mouseHandler); diff --git a/src/ui/interactivesimulation/SaveCommandsToolBar.java b/src/ui/interactivesimulation/SaveCommandsToolBar.java new file mode 100755 index 0000000000000000000000000000000000000000..4a49687d3a4057218568a0b2f518a2794d7323c5 --- /dev/null +++ b/src/ui/interactivesimulation/SaveCommandsToolBar.java @@ -0,0 +1,91 @@ +/**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 SaveCommandsToolBar + * Toolbar associated with interactive simulation (save commands) + * Creation: 28/05/2009 + * @version 1.0 28/05/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.interactivesimulation; + +import javax.swing.*; +//import java.awt.*; +//import java.awt.event.*; + +import ui.*; + +public class SaveCommandsToolBar extends InteractiveSimulationBar { + + + public SaveCommandsToolBar(JFrameInteractiveSimulation _jfis) { + super(_jfis); + } + + protected void setActive(boolean b) { + jfis.actions[InteractiveSimulationActions.ACT_SAVE_VCD].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_SAVE_HTML].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_SAVE_TXT].setEnabled(b); + } + + protected void setButtons() { + JButton button; + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_SAVE_VCD]); + button.addMouseListener(jfis.mouseHandler); + + this.addSeparator(); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_SAVE_HTML]); + button.addMouseListener(jfis.mouseHandler); + + this.addSeparator(); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_SAVE_TXT]); + button.addMouseListener(jfis.mouseHandler); + + + } +} // Class + + + + + diff --git a/src/ui/interactivesimulation/StateCommandsToolBar.java b/src/ui/interactivesimulation/StateCommandsToolBar.java new file mode 100755 index 0000000000000000000000000000000000000000..2f298f2f5846e9c3e2a9caf7375d0971983df607 --- /dev/null +++ b/src/ui/interactivesimulation/StateCommandsToolBar.java @@ -0,0 +1,84 @@ +/**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 StateCommandsToolBar + * Toolbar associated with interactive simulation (save / restore state commands) + * Creation: 28/05/2009 + * @version 1.0 28/05/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.interactivesimulation; + +import javax.swing.*; +//import java.awt.*; +//import java.awt.event.*; + +import ui.*; + +public class StateCommandsToolBar extends InteractiveSimulationBar { + + + public StateCommandsToolBar(JFrameInteractiveSimulation _jfis) { + super(_jfis); + } + + protected void setActive(boolean b) { + jfis.actions[InteractiveSimulationActions.ACT_SAVE_STATE].setEnabled(b); + jfis.actions[InteractiveSimulationActions.ACT_RESTORE_STATE].setEnabled(b); + } + + protected void setButtons() { + JButton button; + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_SAVE_STATE]); + button.addMouseListener(jfis.mouseHandler); + + this.addSeparator(); + + button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RESTORE_STATE]); + button.addMouseListener(jfis.mouseHandler); + + } +} // Class + + + + +