Newer
Older
/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille

Ludovic Apvrille
committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 JFrameInteractiveSimulation
* Creation: 21/04/2009
* version 1.0 21/04/2009
* @author Ludovic APVRILLE
* @see
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Vector;
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import launcher.LauncherException;
import launcher.RshClient;
import myutil.Conversion;
import myutil.ScrolledJTextArea;
import myutil.TableSorter;
import myutil.TraceManager;
import remotesimulation.CommandParser;
import remotesimulation.RemoteConnection;
import remotesimulation.RemoteConnectionException;
import tmltranslator.HwA;
import tmltranslator.HwBus;
import tmltranslator.HwCPU;
import tmltranslator.HwMemory;
import tmltranslator.HwNode;
import tmltranslator.TMLElement;
import tmltranslator.TMLMapping;
import tmltranslator.TMLTask;
import ui.ColorManager;
import ui.ConfigurationTTool;
import ui.IconManager;
import ui.MainGUI;
import ui.TGComponent;

Ludovic Apvrille
committed
public class JFrameInteractiveSimulation extends JFrame implements ActionListener, Runnable, MouseListener, ItemListener, ChangeListener/*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ {
protected static final int NB_OF_TRANSACTIONS = 10;

Ludovic Apvrille
committed
protected static final String SIMULATION_HEADER = "siminfo";
protected static final String SIMULATION_GLOBAL = "global";
protected static final String SIMULATION_TASK = "task";
protected static final String SIMULATION_CPU = "cpu";
protected static final String SIMULATION_BUS = "bus";
protected static final String SIMULATION_TRANS = "transinfo";
protected static final String SIMULATION_TRANS_NB = "transnb";

Ludovic Apvrille
committed
protected static final String SIMULATION_COMMAND = "cmd";
//private static String buttonStartS = "Start simulator";
//private static String buttonCloseS = "Close";
//private static String buttonStopAndCloseS = "Stop simulator and close";

Ludovic Apvrille
committed
private static int NOT_STARTED = 0;
private static int STARTING = 1;
private static int STARTED_NOT_CONNECTED = 2;
private static int STARTED_AND_CONNECTED = 3;
//private Frame f;

Ludovic Apvrille
committed
private MainGUI mgui;
// private String title;

Ludovic Apvrille
committed
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
private String hostSystemC;
private String pathExecute;
protected JButton buttonClose, buttonStart, buttonStopAndClose;
protected JTextArea jta;
protected JScrollPane jsp;
protected Thread t;
protected int threadMode = 0;
protected boolean go;
protected RshClient rshc;
protected RemoteConnection rc;
protected CommandParser cp;
protected String ssxml;
// Text commands
protected JTextField textCommand;
protected JButton sendTextCommand, printHelpTextCommands, listTextCommands;
//private static String sendTextCommandS = "Send Command";
// Control command
protected JButton resetCommand, runCommand, StopCommand;
protected MainCommandsToolBar mctb;
protected SaveCommandsToolBar sctb;
protected StateCommandsToolBar stctb;
protected BenchmarkCommandsToolBar bctb;
protected FormalVerificationToolBar fvtb;
// Commands
JPanel main, mainTop, commands, save, state, infos, outputs, cpuPanel, variablePanel;
protected JPanelTransactions transactionPanel;

Ludovic Apvrille
committed
JCheckBox latex, debug, animate, diploids, update, openDiagram, animateWithInfo;
JTabbedPane commandTab, infoTab;
protected JTextField paramMainCommand;
protected JTextField saveDirName;
protected JTextField saveFileName;
protected JTextField stateFileName;
protected JTextField benchmarkFileName;
protected JComboBox<String> cpus, busses, mems, tasks, chans;

Ludovic Apvrille
committed
private String[] cpuIDs, busIDs, memIDs, taskIDs, chanIDs;
// Status elements
JLabel status, time, info;
// Task elements
TaskVariableTableModel tvtm;
JButton updateTaskVariableInformationButton;
private JScrollPane jspTaskVariableInfo;
// Last transactions elements
//private TransactionTableModel ttm;
//JButton updateTransactionInformationButton;
//private JScrollPane jspTransactionInfo;

Ludovic Apvrille
committed
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
private Vector<SimulationTransaction> trans;
// Breakpoints
JPanelBreakPoints jpbp;
// Set variables
JPanelSetVariables jpsv;
// Formal verification
JSlider minimalCommandCoverage, minimalBranchCoverage;
JLabel labelMinimalCommandCoverage, labelMinimalBranchCoverage;
// Tasks
JPanel taskPanel;
TaskTableModel tasktm;
JButton updateTaskInformationButton;
private JScrollPane jspTaskInfo;
// CPU
CPUTableModel cputm;
JButton updateCPUInformationButton, printCPUInfo;
private JScrollPane jspCPUInfo;
private JPanel panelCPU;
// Memories
JPanel memPanel;
MemTableModel memtm;
JButton updateMemoryInformationButton, printBusInfo;
private JScrollPane jspMemInfo;
// Bus
JPanel busPanel;
BusTableModel bustm;
JButton updateBusInformationButton;
private JScrollPane jspBusInfo;
private JPanel panelBus;
//Latency
JPanel latencyPanel;
JComboBox transaction1;
JComboBox transaction2;
JButton addLatencyCheckButton;
LatencyTableModel latm;
public Vector checkedTransactions = new Vector();
private JScrollPane jspLatency;

Ludovic Apvrille
committed
private int mode = 0;
//private boolean busyStatus = false;
private int busyMode = 0; // 0: unknown; 1: ready; 2:busy; 3:term
private boolean threadStarted = false;
private boolean gotTimeAnswerFromServer = false;
// For managing actions
public InteractiveSimulationActions [] actions;
public MouseHandler mouseHandler;
public KeyListener keyHandler;
private TMLMapping tmap;
private int hashCode;
private boolean hashOK = true;
private Hashtable <Integer, String> valueTable;
private Hashtable <Integer, Integer> rowTable;
private Hashtable <Integer, Integer> runningTable;
private Hashtable <String, String> diagramTable;
private ArrayList<Point> points;
private HashMap<String, String> checkTable=new HashMap<String, String>();
private HashMap<String, ArrayList<String>> transTimes = new HashMap<String, ArrayList<String>>();
private Vector latencies=new Vector();

Ludovic Apvrille
committed
public JFrameInteractiveSimulation(Frame _f, MainGUI _mgui, String _title, String _hostSystemC, String _pathExecute, TMLMapping _tmap, ArrayList<Point> _points) {
super(_title);
// f = _f;

Ludovic Apvrille
committed
mgui = _mgui;
//title = _title;

Ludovic Apvrille
committed
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
hostSystemC = _hostSystemC;
pathExecute = _pathExecute;
mode = NOT_STARTED;
tmap = _tmap;
if (tmap != null) {
tmap.makeMinimumMapping();
hashCode = tmap.getHashCode();
tmap.getTMLModeling().computeCorrespondance();
} else {
hashOK = false;
}
points = _points;
//System.out.println("Tmap=" + tmap);
valueTable = new Hashtable<Integer, String>();
rowTable = new Hashtable<Integer, Integer>();
runningTable = new Hashtable<Integer, Integer>();
diagramTable = new Hashtable<String, String>();
mgui.resetRunningID();
mgui.resetLoadID();
setBackground(new Color(50, 40, 40));
initActions();
makeComponents();
setComponents();

Ludovic Apvrille
committed
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
}
private JLabel createStatusBar() {
status = new JLabel("Ready...");
status.setForeground(ColorManager.InteractiveSimulationText);
status.setBorder(BorderFactory.createEtchedBorder());
return status;
}
public void makeComponents() {
JPanel jp01, jp02;
//jp01.setPreferredSize(new Dimension(375, 400));
GridBagLayout gridbag01;
GridBagConstraints c01 ;
cp = new CommandParser();
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Container framePanel = getContentPane();
framePanel.setLayout(new BorderLayout());
//framePanel.setBackground(ColorManager.InteractiveSimulationBackground);
//framePanel.setForeground(new Color(255, 166, 38));
//System.out.println("Button start created");
buttonStart = new JButton(actions[InteractiveSimulationActions.ACT_START_ALL]);
buttonClose = new JButton(actions[InteractiveSimulationActions.ACT_STOP_ALL]);
buttonStopAndClose = new JButton(actions[InteractiveSimulationActions.ACT_STOP_AND_CLOSE_ALL]);
//buttonStopAndClose = new JButton(buttonStopAndCloseS, IconManager.imgic27);
// statusBar
status = createStatusBar();
framePanel.add(status, BorderLayout.SOUTH);
// Mouse handler
mouseHandler = new MouseHandler(status);
JPanel mainpanel = new JPanel(new BorderLayout());
//mainpanel.setBackground(ColorManager.InteractiveSimulationBackground);
framePanel.add(mainpanel, BorderLayout.NORTH);
JPanel jp = new JPanel();
//jp.setBackground(ColorManager.InteractiveSimulationBackground);
//jp.setPreferredSize(new Dimension(800, 75));
jp.add(buttonStart);
jp.add(buttonStopAndClose);
jp.add(buttonClose);
mainpanel.add(jp, BorderLayout.NORTH);
GridBagLayout gridbag02 = new GridBagLayout();
GridBagConstraints c02 = new GridBagConstraints();
mainTop = new JPanel(gridbag02);
//mainTop.setPreferredSize(new Dimension(800, 375));
c02.gridheight = 1;
c02.weighty = 1.0;
c02.weightx = 1.0;
c02.gridwidth = 1;
c02.fill = GridBagConstraints.BOTH;
c02.gridheight = 1;
// Ouput textArea
jta = new ScrolledJTextArea();
jta.setBackground(ColorManager.InteractiveSimulationJTABackground);
jta.setForeground(ColorManager.InteractiveSimulationJTAForeground);
jta.setMinimumSize(new Dimension(800, 400));
jta.setRows(15);
//jta.setMaximumSize(new Dimension(800, 500));
jta.setEditable(false);
jta.setMargin(new Insets(10, 10, 10, 10));
jta.setTabSize(3);
jta.append("Click on \"Connect to simulator\" to start the remote simulator and connect to it\n");

Ludovic Apvrille
committed
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
Font f = new Font("Courrier", Font.BOLD, 12);
jta.setFont(f);
jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
jsp.setViewportBorder(BorderFactory.createLineBorder(ColorManager.InteractiveSimulationBackground));
//jsp.setColumnHeaderView(100);
//jsp.setRowHeaderView(30);
jsp.setMaximumSize(new Dimension(800, 500));
JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, mainTop, jsp);
//split.setBackground(ColorManager.InteractiveSimulationBackground);
mainpanel.add(split, BorderLayout.CENTER);
// Commands
commands = new JPanel();
//commands.setFloatable(true);
//commands.setMinimumSize(new Dimension(300, 250));
commands.setBorder(new javax.swing.border.TitledBorder("Commands"));
mainTop.add(commands, c02);
commandTab = new JTabbedPane();
//commandTab.setBackground(ColorManager.InteractiveSimulationBackground);
// Control commands
jp01 = new JPanel(new BorderLayout());
//jp01.setMinimumSize(new Dimension(375, 400));
//gridbag01 = new GridBagLayout();
//c01 = new GridBagConstraints();
//jp01.setLayout(gridbag01);
commandTab.addTab("Control", null, jp01, "Main control commands");
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;
c01.weighty = 1.0;
c01.weightx = 1.0;
c01.gridwidth = 1;
c01.fill = GridBagConstraints.BOTH;
c01.gridheight = 1;
jp02.add(new JLabel("Command parameter: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
paramMainCommand = new JTextField("1", 30);
jp02.add(paramMainCommand, c01);
c01.gridwidth = 1;
jp02.add(new JLabel("CPUs and HwA: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
if (cpuIDs == null) {
cpus = new JComboBox<String>();

Ludovic Apvrille
committed
} else {
cpus = new JComboBox<String>(cpuIDs);

Ludovic Apvrille
committed
}
jp02.add(cpus, c01);
c01.gridwidth = 1;
jp02.add(new JLabel("Busses: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
if (busIDs == null) {
busses = new JComboBox<String>();

Ludovic Apvrille
committed
} else {
busses = new JComboBox<String>(busIDs);

Ludovic Apvrille
committed
}
jp02.add(busses, c01);
c01.gridwidth = 1;
jp02.add(new JLabel("Memories: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
if (memIDs == null) {
mems = new JComboBox<String>();

Ludovic Apvrille
committed
} else {
mems = new JComboBox<String>(memIDs);

Ludovic Apvrille
committed
}
jp02.add(mems, c01);
c01.gridwidth = 1;
jp02.add(new JLabel("Tasks: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
if (taskIDs == null) {
tasks = new JComboBox<String>();

Ludovic Apvrille
committed
} else {
tasks = new JComboBox<String>(taskIDs);

Ludovic Apvrille
committed
}
jp02.add(tasks, c01);
c01.gridwidth = 1;
jp02.add(new JLabel("Channels: "), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
if (chanIDs == null) {
chans = new JComboBox<String>();

Ludovic Apvrille
committed
} else {
chans = new JComboBox<String>(chanIDs);

Ludovic Apvrille
committed
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
}
jp02.add(chans, c01);
jp01.add(jp02, BorderLayout.CENTER);
// Text commands
jp01 = new JPanel();
//jp01.setPreferredSize(new Dimension(375, 400));
gridbag01 = new GridBagLayout();
c01 = new GridBagConstraints();
jp01.setLayout(gridbag01);
commandTab.addTab("Text commands", null, jp01, "Sending text commands to simulator");
c01.gridheight = 1;
c01.weighty = 1.0;
c01.weightx = 1.0;
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
c01.fill = GridBagConstraints.BOTH;
c01.gridheight = 1;
c01.gridheight = 2;
jp01.add(new JLabel("Enter a text command:"), c01);
textCommand = new JTextField(30);
jp01.add(textCommand, c01);
c01.gridheight = 1;
jp01.add(new JLabel(" "), c01);
c01.gridheight = 2;
sendTextCommand = new JButton("Send Command", IconManager.imgic71);
sendTextCommand.addMouseListener(this);
jp01.add(sendTextCommand, c01);
c01.gridheight = 1;
jp01.add(new JLabel(" "), c01);
c01.gridheight = 2;
printHelpTextCommands = new JButton("Help on a text command", IconManager.imgic33);
printHelpTextCommands.addMouseListener(this);
jp01.add(printHelpTextCommands, c01);
c01.gridheight = 1;
jp01.add(new JLabel(" "), c01);
c01.gridheight = 2;
listTextCommands = new JButton("List all text commands", IconManager.imgic29);
listTextCommands.addMouseListener(this);
jp01.add(listTextCommands, c01);
commands.add(commandTab);
// Set variables
jpsv = new JPanelSetVariables(this, valueTable);
commandTab.addTab("Set variables", null, jpsv, "Set variables");
// 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("Directory:"), c01);
saveDirName = new JTextField(30);
if (ConfigurationTTool.SystemCCodeDirectory != null) {
saveDirName.setText(ConfigurationTTool.SystemCCodeDirectory);
}
jp02.add(saveDirName, c01);
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);
// Benchmark commands
jp01 = new JPanel(new BorderLayout());
commandTab.addTab("Benchmarks", null, jp01, "Benchmarks");
bctb = new BenchmarkCommandsToolBar(this);
jp01.add(bctb, 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);
benchmarkFileName = new JTextField(30);
jp02.add(benchmarkFileName, c01);
jp01.add(jp02, BorderLayout.CENTER);
// Formal verification
jp01 = new JPanel(new BorderLayout());
commandTab.addTab("Formal verification", null, jp01, "Formal verification");
fvtb = new FormalVerificationToolBar(this);
jp01.add(fvtb, 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.fill = GridBagConstraints.BOTH;
c01.gridheight = 1;
// First empty line
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);
// Line minimum command: labels
c01.gridwidth = 1;
jp02.add(new JLabel("minimum COMMAND coverage"), c01);
labelMinimalCommandCoverage = new JLabel("100%");
c01.fill = GridBagConstraints.CENTER;
jp02.add(labelMinimalCommandCoverage, c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
c01.fill = GridBagConstraints.BOTH;
jp02.add(new JLabel(" "), c01);
// Line minimum command: slider
c01.gridwidth = 1;
jp02.add(new JLabel(" "), c01);
minimalCommandCoverage = new JSlider(JSlider.HORIZONTAL, 0, 100, 100);
minimalCommandCoverage.setValue(100);
minimalCommandCoverage.setMajorTickSpacing(10);
minimalCommandCoverage.setMinorTickSpacing(1);
minimalCommandCoverage.setPaintTicks(true);
minimalCommandCoverage.setPaintLabels(true);
minimalCommandCoverage.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
minimalCommandCoverage.addChangeListener(this);
Font font = new Font("Serif", Font.ITALIC, 10);
minimalCommandCoverage.setFont(font);
jp02.add(minimalCommandCoverage, c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);
// One empty line
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);
// Line minimum command: labels
c01.gridwidth = 1;
jp02.add(new JLabel("minimum BRANCH coverage"), c01);
labelMinimalBranchCoverage = new JLabel("100%");
c01.fill = GridBagConstraints.CENTER;
jp02.add(labelMinimalBranchCoverage, c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
c01.fill = GridBagConstraints.BOTH;
jp02.add(new JLabel(" "), c01);
// Line minimum branch: slider
c01.gridwidth = 1;
jp02.add(new JLabel(" "), c01);
minimalBranchCoverage = new JSlider(JSlider.HORIZONTAL, 0, 100, 100);
minimalBranchCoverage.setValue(100);
minimalBranchCoverage.setMajorTickSpacing(10);
minimalBranchCoverage.setMinorTickSpacing(1);
minimalBranchCoverage.setPaintTicks(true);
minimalBranchCoverage.setPaintLabels(true);
minimalBranchCoverage.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
minimalBranchCoverage.addChangeListener(this);
minimalBranchCoverage.setFont(font);
jp02.add(minimalBranchCoverage, c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);
// Last empty line
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);
/*c01.gridwidth = 1;
jp02.add(new JLabel("minimum BRANCH coverage"), c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
labelMinimalBranchCoverage = new JLabel("100%");
c01.fill = GridBagConstraints.EAST;
jp02.add(labelMinimalBranchCoverage, c01);
c01.fill = GridBagConstraints.BOTH;
minimalBranchCoverage = new JSlider(JSlider.HORIZONTAL, 0, 100, 100);
minimalBranchCoverage.setValue(100);
minimalBranchCoverage.setMajorTickSpacing(10);
minimalBranchCoverage.setMinorTickSpacing(1);
minimalBranchCoverage.setPaintTicks(true);
minimalBranchCoverage.setPaintLabels(true);
minimalBranchCoverage.setBorder(BorderFactory.createEmptyBorder(0,0,10,0));
minimalBranchCoverage.addChangeListener(this);
minimalBranchCoverage.setFont(font);
c01.gridwidth = 1; //end row
jp02.add(new JLabel(" "), c01);
jp02.add(minimalBranchCoverage, c01);
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
jp02.add(new JLabel(" "), c01);*/
jp01.add(jp02, BorderLayout.CENTER);
//Info
infos = new JPanel(new BorderLayout());
infos.setMinimumSize(new Dimension(300, 250));
//infos.setPreferredSize(new Dimension(400, 450));
infos.setBorder(new javax.swing.border.TitledBorder("Simulation information"));
c02.gridwidth = GridBagConstraints.REMAINDER; //end row
mainTop.add(infos, c02);
infoTab = new JTabbedPane();
infoTab.setMinimumSize(new Dimension(300, 250));
infos.add(infoTab, BorderLayout.NORTH);
// Simulation time
jp02 = new JPanel();
infos.add(jp02, BorderLayout.SOUTH);
jp02.add(new JLabel("Status:"));
status = new JLabel("Unknown");
status.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
jp02.add(status);
jp02.add(new JLabel(" "));
jp02.add(new JLabel("Time:"));
time = new JLabel("Unknown");
time.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
jp02.add(time);
jp02.add(new JLabel(" "));
jp02.add(new JLabel("Sim. interrupt reason:"));
info = new JLabel("Unknown");
info.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
jp02.add(info);
// Options
jp01 = new JPanel();
//jp01.setMinimumSize(new Dimension(375, 400));
//jp01.setPreferredSize(new Dimension(375, 400));
gridbag01 = new GridBagLayout();
c01 = new GridBagConstraints();
jp01.setLayout(gridbag01);
// INFORMATION
infoTab.addTab("Options", null, jp01, "Options on simulation");
c01.gridheight = 1;
c01.weighty = 1.0;
c01.weightx = 1.0;
c01.gridwidth = GridBagConstraints.REMAINDER; //end row
c01.fill = GridBagConstraints.BOTH;
c01.gridheight = 1;
jp01.add(new JLabel(" "), c01);
latex = new JCheckBox("Generate info in Latex format");
jp01.add(latex, c01);
debug = new JCheckBox("Print messages received from server");
jp01.add(debug, c01);
animate = new JCheckBox("Animate UML diagrams");
jp01.add(animate, c01);
diploids = new JCheckBox("Show DIPLO IDs on UML diagrams");
jp01.add(diploids, c01);
diploids.addItemListener(this);
diploids.setSelected(false);
animateWithInfo = new JCheckBox("Show transaction progression on UML diagrams");
jp01.add(animateWithInfo, c01);
animateWithInfo.addItemListener(this);
animateWithInfo.setSelected(true);
openDiagram = new JCheckBox("Automatically open active task diagram");
jp01.add(openDiagram, c01);
openDiagram.setSelected(true);
update = new JCheckBox("Automatically update information (task, CPU, etc.)");
jp01.add(update, c01);
update.addItemListener(this);
update.setSelected(true);
animate.addItemListener(this);
animate.setSelected(true);
TableSorter sorterPI;
JTable jtablePI;
// Breakpoints
jpbp = new JPanelBreakPoints(this, points);
infoTab.addTab("Breakpoints", null, jpbp, "List of active breakpoints");
// Tasks
taskPanel = new JPanel();
taskPanel.setLayout(new BorderLayout());
infoTab.addTab("Tasks", IconManager.imgic1202, taskPanel, "Current state of tasks");
if (tmap == null) {
tasktm = new TaskTableModel(null, valueTable, rowTable);
} else {
tasktm = new TaskTableModel(tmap.getTMLModeling(), valueTable, rowTable);
}
sorterPI = new TableSorter(tasktm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(80);
((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(300);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspTaskInfo = new JScrollPane(jtablePI);
jspTaskInfo.setWheelScrollingEnabled(true);
jspTaskInfo.getVerticalScrollBar().setUnitIncrement(10);
jspTaskInfo.setPreferredSize(new Dimension(500, 300));
taskPanel.add(jspTaskInfo, BorderLayout.NORTH);
updateTaskInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_TASKS]);
taskPanel.add(updateTaskInformationButton, BorderLayout.SOUTH);
// Variables
variablePanel = new JPanel();
variablePanel.setLayout(new BorderLayout());
infoTab.addTab("Tasks variables", null, variablePanel, "Current value of variables");
if (tmap == null) {
tvtm = new TaskVariableTableModel(null, valueTable, rowTable);
} else {
tvtm = new TaskVariableTableModel(tmap.getTMLModeling(), valueTable, rowTable);
}
sorterPI = new TableSorter(tvtm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(60);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(60);
((jtablePI.getColumnModel()).getColumn(4)).setPreferredWidth(100);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspTaskVariableInfo = new JScrollPane(jtablePI);
jspTaskVariableInfo.setWheelScrollingEnabled(true);
jspTaskVariableInfo.getVerticalScrollBar().setUnitIncrement(10);
jspTaskVariableInfo.setPreferredSize(new Dimension(500, 300));
variablePanel.add(jspTaskVariableInfo, BorderLayout.NORTH);
updateTaskVariableInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_VARIABLES]);
variablePanel.add(updateTaskVariableInformationButton, BorderLayout.SOUTH);
// Transactions
transactionPanel = new JPanelTransactions(this, NB_OF_TRANSACTIONS);
//transactionPanel.setLayout(new BorderLayout());

Ludovic Apvrille
committed
infoTab.addTab("Transactions", null, transactionPanel, "Recent transactions");

Ludovic Apvrille
committed
sorterPI = new TableSorter(ttm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(150);
((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(4)).setPreferredWidth(100);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspTransactionInfo = new JScrollPane(jtablePI);
jspTransactionInfo.setWheelScrollingEnabled(true);
jspTransactionInfo.getVerticalScrollBar().setUnitIncrement(10);
jspTransactionInfo.setPreferredSize(new Dimension(500, 300));
transactionPanel.add(jspTransactionInfo, BorderLayout.NORTH);
updateTransactionInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_TRANSACTIONS]);
transactionPanel.add(updateTransactionInformationButton, BorderLayout.SOUTH);*/

Ludovic Apvrille
committed
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
// CPUs
cpuPanel = new JPanel();
cpuPanel.setLayout(new BorderLayout());
infoTab.addTab("CPUs/HwA", IconManager.imgic1100, cpuPanel, "Current state of CPUs and hardware accelerators");
cputm = new CPUTableModel(tmap, valueTable, rowTable);
sorterPI = new TableSorter(cputm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(700);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspCPUInfo = new JScrollPane(jtablePI);
jspCPUInfo.setWheelScrollingEnabled(true);
jspCPUInfo.getVerticalScrollBar().setUnitIncrement(10);
jspCPUInfo.setPreferredSize(new Dimension(500, 300));
cpuPanel.add(jspCPUInfo, BorderLayout.NORTH);
panelCPU = new JPanel(new FlowLayout());
updateCPUInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_CPUS]);
panelCPU.add(updateCPUInformationButton);
printCPUInfo = new JButton(actions[InteractiveSimulationActions.ACT_PRINT_CPUS]);
panelCPU.add(printCPUInfo);
cpuPanel.add(panelCPU, BorderLayout.SOUTH);
// Memories
memPanel = new JPanel();
memPanel.setLayout(new BorderLayout());
infoTab.addTab("Memories", IconManager.imgic1108, memPanel, "Current state of Memories");
MemTableModel memtm = new MemTableModel(tmap, valueTable, rowTable);
sorterPI = new TableSorter(memtm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(300);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspMemInfo = new JScrollPane(jtablePI);
jspMemInfo.setWheelScrollingEnabled(true);
jspMemInfo.getVerticalScrollBar().setUnitIncrement(10);
jspMemInfo.setPreferredSize(new Dimension(500, 300));
memPanel.add(jspMemInfo, BorderLayout.NORTH);
updateMemoryInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_MEMS]);
memPanel.add(updateMemoryInformationButton, BorderLayout.SOUTH);
// Busses
busPanel = new JPanel();
busPanel.setLayout(new BorderLayout());
infoTab.addTab("Bus", IconManager.imgic1102, busPanel, "Current state of busses");
bustm = new BusTableModel(tmap, valueTable, rowTable);
sorterPI = new TableSorter(bustm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(300);
jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
jspBusInfo = new JScrollPane(jtablePI);
jspBusInfo.setWheelScrollingEnabled(true);
jspBusInfo.getVerticalScrollBar().setUnitIncrement(10);
jspBusInfo.setPreferredSize(new Dimension(500, 300));
busPanel.add(jspBusInfo, BorderLayout.NORTH);
panelBus = new JPanel(new FlowLayout());
updateBusInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_BUS]);
panelBus.add(updateBusInformationButton);
printBusInfo = new JButton(actions[InteractiveSimulationActions.ACT_PRINT_BUS]);
panelBus.add(printBusInfo);
busPanel.add(panelBus, BorderLayout.SOUTH);
//Latency
latencyPanel = new JPanel();
GridBagLayout gridbag0 = new GridBagLayout();
GridBagConstraints c0 = new GridBagConstraints();
latencyPanel.setLayout(gridbag0);
infoTab.addTab("Latency", null, latencyPanel, "Latency Measurements");
c0.gridheight=1;
latencyPanel.add(new JLabel("Checkpoint 1:"),c0);
c0.gridwidth = GridBagConstraints.REMAINDER;
transaction1 = new JComboBox(checkedTransactions);
latencyPanel.add(transaction1, c0);
c0.gridwidth=1;
latencyPanel.add(new JLabel("Checkpoint 2:"),c0);
c0.gridwidth= GridBagConstraints.REMAINDER;
transaction2 = new JComboBox(checkedTransactions);
latencyPanel.add(transaction2, c0);
addLatencyCheckButton = new JButton(actions[InteractiveSimulationActions.ACT_ADD_LATENCY]);
latencyPanel.add(addLatencyCheckButton,c0);
latm = new LatencyTableModel(this);
sorterPI = new TableSorter(latm);
jtablePI = new JTable(sorterPI);
sorterPI.setTableHeader(jtablePI.getTableHeader());
((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(400);
((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(400);
((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(50);
((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(50);