diff --git a/executablecode/Makefile.src b/executablecode/Makefile.src index 28b9acb23f0af46aef4caec4f72c265800a703d3..1a5aafcafa7abcf094ea1b3c9d8808777263ed3e 100755 --- a/executablecode/Makefile.src +++ b/executablecode/Makefile.src @@ -1 +1 @@ -SRCS = generated_src/main.c generated_src/ObserverProp1.c generated_src/RemotelyControlledMicrowave.c generated_src/RemoteControl.c generated_src/MicroWaveOven.c generated_src/Bell.c generated_src/ControlPanel.c generated_src/Controller.c generated_src/Magnetron.c generated_src/Door.c generated_src/WirelessInterface.c \ No newline at end of file +SRCS = generated_src/main.c generated_src/ObserverProp1.c generated_src/RemotelyControlledMicrowave.c generated_src/MicroWaveOven.c generated_src/WirelessInterface.c generated_src/Door.c generated_src/Magnetron.c generated_src/Controller.c generated_src/ControlPanel.c generated_src/Bell.c generated_src/RemoteControl.c \ No newline at end of file diff --git a/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java b/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java index 2243de2a919b8557d3004f389932460ed130c59a..11bfb8b6a5e8606900ba63bbf3a93027f0ec3327 100644 --- a/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java +++ b/src/ui/avatarinteractivesimulation/AvatarSpecificationSimulationSDPanel.java @@ -99,6 +99,7 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous // Transactions private int drawnTransactions = 1000; + private int lastDrawnTransactions = 0; // -1 means the last current one // My scroll panel private JScrollPane jsp; @@ -136,6 +137,10 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous drawnTransactions = _d; } + public void setLastDrawnTransactions(int _d) { + lastDrawnTransactions = _d; + } + public void setTrace(boolean b) { trace = b; } @@ -256,7 +261,15 @@ public class AvatarSpecificationSimulationSDPanel extends JPanel implements Mous g.drawString("@" + clockValue, 10, currentY+g.getFontMetrics().getHeight()/2); } - for(int i=Math.max(allTransactions.size()-drawnTransactions, 0); i<allTransactions.size(); i++) { + + int realLast; + if (lastDrawnTransactions == 0) { + realLast = allTransactions.size(); + } else { + realLast = Math.min(lastDrawnTransactions, allTransactions.size()); + } + + for(int i=Math.max(realLast-drawnTransactions, 0); i<realLast; i++) { ast = allTransactions.get(i); ast.stamp = stamp; diff --git a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java index 6c7a4201c125455588cef9108a77d0f8f8f5fb7f..3785e4350d31caa08b4eab84448547901a858a91 100755 --- a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java +++ b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java @@ -66,6 +66,7 @@ import avatartranslator.directsimulation.*; public class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarSimulationInteraction, ActionListener, Runnable, MouseListener, ItemListener, ListSelectionListener, WindowListener/*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ { private static int TRACED_TRANSACTIONS = 1000; + private static int LAST_TRANSACTIONS = 0; private static String buttonStartS = "Start simulator"; @@ -101,7 +102,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS //outputs, cpuPanel; // from MGUI JCheckBox latex, debug, animate, diploids, update, openDiagram, animateWithInfo, executeEmptyTransition, executeStateEntering, traceInSD; JTabbedPane commandTab, infoTab; - protected JTextField displayedTransactionsText; + protected JTextField displayedTransactionsText, lastTransactionsText; protected JTextField paramMainCommand; protected JTextField saveFileName; protected JTextField stateFileName; @@ -573,8 +574,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS jp01.add(traceInSD, c01); traceInSD.addItemListener(this); traceInSD.setSelected(true); - jp01.add(new JLabel("Traced transactions:"), c01); - c01.gridwidth = GridBagConstraints.REMAINDER; //end row + jp01.add(new JLabel("# of transactions:"), c01); displayedTransactionsText = new JTextField(""+TRACED_TRANSACTIONS, 10); jp01.add(displayedTransactionsText, c01); //displayedTransactionsText.addActionListener(this); @@ -607,6 +607,40 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarS statuss.setText("Unknown / bad number: " + displayedTransactionsText.getText()); } }); + jp01.add(new JLabel("Index of last transaction:"), c01); + c01.gridwidth = GridBagConstraints.REMAINDER; //end row + lastTransactionsText = new JTextField(""+LAST_TRANSACTIONS, 10); + jp01.add(lastTransactionsText, c01); + //displayedTransactionsText.addActionListener(this); + lastTransactionsText.getDocument().addDocumentListener(new DocumentListener() { + public void changedUpdate(DocumentEvent e) { + warn(); + } + public void removeUpdate(DocumentEvent e) { + warn(); + } + public void insertUpdate(DocumentEvent e) { + warn(); + } + + public void warn() { + try { + int nb = Integer.parseInt(lastTransactionsText.getText()); + if (nb > -1){ + statuss.setText("Index of last transation modified to: " + nb); + if (sdpanel != null) { + sdpanel.setLastDrawnTransactions(nb); + if (sdpanel.isVisible()) { + sdpanel.repaint(); + } + } + return; + } + } catch (Exception e) { + } + statuss.setText("Unknown / bad number: " + lastTransactionsText.getText()); + } + });