Skip to content
Snippets Groups Projects
Commit e7e1bd74 authored by Ludovic Apvrille's avatar Ludovic Apvrille
Browse files

Adding the index of the lastly displayed transaction

parent 4bba1aae
No related branches found
No related tags found
No related merge requests found
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
......@@ -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;
......
......@@ -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());
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment