From 37309001d0f322643f327d3c177abde6e33f39a7 Mon Sep 17 00:00:00 2001 From: dblouin <dominique.blouin@telecom-paristech.fr> Date: Tue, 30 May 2017 12:06:30 +0200 Subject: [PATCH] Issue #41: Ordering of tabbed panes --- src/myutil/GraphicLib.java | 18 +- src/myutil/HTMLCodeGeneratorForTables.java | 2 +- src/ui/ADDPanel.java | 24 +- src/ui/AnalysisPanel.java | 48 ++- src/ui/AttackTreePanel.java | 16 +- src/ui/AvatarAnalysisPanel.java | 38 +- src/ui/AvatarDesignPanel.java | 16 +- src/ui/AvatarMADsPanel.java | 14 +- src/ui/AvatarMethodologyPanel.java | 5 +- src/ui/AvatarRequirementPanel.java | 25 +- src/ui/DeploymentPanel.java | 16 +- src/ui/DesignPanel.java | 10 +- src/ui/DiplodocusMethodologyPanel.java | 29 +- src/ui/GTURTLEModeling.java | 2 +- src/ui/MainGUI.java | 11 +- src/ui/NCPanel.java | 24 +- src/ui/ProactiveDesignPanel.java | 44 +-- src/ui/RequirementPanel.java | 24 +- src/ui/SysmlsecMethodologyPanel.java | 57 ++- src/ui/TMLArchiPanel.java | 12 +- src/ui/TMLCommunicationPatternPanel.java | 19 +- src/ui/TMLComponentDesignPanel.java | 10 +- src/ui/TMLDesignPanel.java | 19 +- src/ui/TURTLEOSDesignPanel.java | 18 +- .../JFrameAvatarInteractiveSimulation.java | 63 ++-- .../JFrameInteractiveSimulation.java | 13 +- src/ui/window/JDialogADConnector.java | 69 ++-- src/ui/window/JDialogAvatarBlock.java | 22 +- ...JDialogAvatarExecutableCodeGeneration.java | 5 +- .../window/JDialogAvatarLibraryFunction.java | 6 +- src/ui/window/JDialogAvatarModelChecker.java | 32 +- src/ui/window/JDialogAvatarState.java | 7 +- src/ui/window/JDialogAvatarTransition.java | 356 +++++++++--------- ...ialogAvatarddExecutableCodeGeneration.java | 17 +- src/ui/window/JDialogCCodeGeneration.java | 3 +- src/ui/window/JDialogCPUNode.java | 55 ++- src/ui/window/JDialogCommPatternMapping.java | 19 +- src/ui/window/JDialogDSE.java | 81 ++-- src/ui/window/JDialogInvariantAnalysis.java | 32 +- src/ui/window/JDialogJavaGeneration.java | 12 +- src/ui/window/JDialogJavaSimulation.java | 17 +- src/ui/window/JDialogLinkNode.java | 41 +- src/ui/window/JDialogMemoryNode.java | 22 +- src/ui/window/JDialogPortArtifact.java | 191 +++++----- src/ui/window/JDialogProVerifGeneration.java | 14 +- src/ui/window/JDialogSystemCGeneration.java | 4 +- src/ui/window/JDialogTMLTaskArtifact.java | 262 ++++++------- src/ui/window/JDialogUPPAALGeneration.java | 30 +- src/ui/window/JDialogVersioningConnector.java | 18 +- src/ui/window/JFrameNC.java | 54 ++- src/ui/window/JFrameRequirementTable.java | 89 ++--- src/ui/window/JFrameStatistics.java | 11 +- 52 files changed, 1029 insertions(+), 1017 deletions(-) diff --git a/src/myutil/GraphicLib.java b/src/myutil/GraphicLib.java index dc3151d3ef..ba28f66fc9 100755 --- a/src/myutil/GraphicLib.java +++ b/src/myutil/GraphicLib.java @@ -535,7 +535,7 @@ public final class GraphicLib { // Trivial sorting algorithm as there are only a few tabs // maxIndex is a non valid index // Vector v contains elements that should be sorted the same way - public static void sortJTabbedPane(JTabbedPane jtp, Vector v, int beginIndex, int maxIndex) { + public static void sortJTabbedPane(JTabbedPane jtp, Vector<?> v, int beginIndex, int maxIndex) { //System.out.println("Sorting from " + beginIndex + " to " + maxIndex); if (beginIndex >= maxIndex) { return; @@ -626,14 +626,10 @@ public final class GraphicLib { } } } + + public static JTabbedPane createTabbedPane() { + final JTabbedPane pane = new JTabbedPane( JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT ); + + return pane; + } } - - - - - - - - - - diff --git a/src/myutil/HTMLCodeGeneratorForTables.java b/src/myutil/HTMLCodeGeneratorForTables.java index b1bdb96991..288f19afa4 100755 --- a/src/myutil/HTMLCodeGeneratorForTables.java +++ b/src/myutil/HTMLCodeGeneratorForTables.java @@ -114,7 +114,7 @@ public class HTMLCodeGeneratorForTables { } - public StringBuffer getHTMLCodeFromSorters(ArrayList<TableSorter> tss, ArrayList<String> titles, String mainTitle) { + public StringBuffer getHTMLCodeFromSorters( List<TableSorter> tss, List<String> titles, String mainTitle) { StringBuffer sb = new StringBuffer(); int max = Math.min(tss.size(), titles.size()); diff --git a/src/ui/ADDPanel.java b/src/ui/ADDPanel.java index 2007521124..0466d02d24 100755 --- a/src/ui/ADDPanel.java +++ b/src/ui/ADDPanel.java @@ -49,21 +49,29 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; + +import myutil.GraphicLib; + import ui.avatardd.*; public class ADDPanel extends TURTLEPanel { public ADDDiagramPanel tmladd; - public Vector validated, ignored; + // public Vector validated, ignored; public ADDPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDesignAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDesignAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -89,7 +97,7 @@ public class ADDPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tmladd); tmladd.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBar, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Deployment Diagram", IconManager.imgic60, toolBarPanel, "Opens deployment diagram"); diff --git a/src/ui/AnalysisPanel.java b/src/ui/AnalysisPanel.java index d8400451a4..d0de6e385a 100755 --- a/src/ui/AnalysisPanel.java +++ b/src/ui/AnalysisPanel.java @@ -52,8 +52,6 @@ import javax.swing.event.*; import java.util.*; import ui.iod.*; -import ui.sd.*; -import ui.sd2.*; import ui.ucd.*; import ui.avatarcd.*; import ui.avatarad.*; @@ -64,12 +62,18 @@ public class AnalysisPanel extends TURTLEPanel { public AnalysisPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneAnalysisAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneAnalysisAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -92,7 +96,7 @@ public class AnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(iodp); iodp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBarIOD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Interaction Overview Diagram", IconManager.imgic17, toolBarPanel, "Opens interaction overview diagram"); @@ -114,17 +118,12 @@ public class AnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(sdp); sdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBarSequence, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic18, toolBarPanel, "Open the sequence diagram of " + s); - //tabbedPane.setVisible(true); - //sdp.setVisible(true); - //jsp.setVisible(true); - //tabbedPane.setSelectedIndex(panels.size()-1); return true; - } public boolean addSequenceDiagramZV(String s) { @@ -141,17 +140,12 @@ public class AnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(sdp); sdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarSequence, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic18, toolBarPanel, "Open the sequence diagram of " + s); - //tabbedPane.setVisible(true); - //sdp.setVisible(true); - //jsp.setVisible(true); - //tabbedPane.setSelectedIndex(panels.size()-1); return true; - } public boolean addIODiagram(String s) { @@ -169,7 +163,7 @@ public class AnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(iodp); iodp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarIOD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic17, toolBarPanel, "Opens interaction overview diagram"); @@ -192,7 +186,7 @@ public class AnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(ucdp); ucdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarUC, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic19, toolBarPanel, "Open the use case diagram of " + s); @@ -301,7 +295,7 @@ public class AnalysisPanel extends TURTLEPanel { //TraceManager.addDev("Adding instances to last SD Step 2"); - ListIterator iterator = _ucdp.getComponentList().listIterator(); + Iterator<TGComponent> iterator = _ucdp.getComponentList().iterator(); TGComponent tgc; // To determine whether an actor is on the left, or on the right @@ -315,7 +309,7 @@ public class AnalysisPanel extends TURTLEPanel { } else { systemName = "System"; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if ((tgc instanceof UCDActor) || (tgc instanceof UCDActorBox)) { middleX = middleX + tgc.getX(); cptTotal ++; @@ -327,11 +321,11 @@ public class AnalysisPanel extends TURTLEPanel { //TraceManager.addDev("Adding instances to last SD Step 3"); // Classify actors - LinkedList <TGComponent> actors = new LinkedList(); - iterator = _ucdp.getComponentList().listIterator(); + java.util.List<TGComponent> actors = new LinkedList<TGComponent>(); + iterator = _ucdp.getComponentList().iterator(); int i; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if ((tgc instanceof UCDActor) || (tgc instanceof UCDActorBox)) { for(i=0; i<actors.size(); i++) { if (actors.get(i).getX() > tgc.getX()) { diff --git a/src/ui/AttackTreePanel.java b/src/ui/AttackTreePanel.java index 8243a898e8..f44e1cb701 100755 --- a/src/ui/AttackTreePanel.java +++ b/src/ui/AttackTreePanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.atd.*; import java.util.*; @@ -59,9 +61,10 @@ public class AttackTreePanel extends TURTLEPanel { public AttackTreePanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); - UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); - UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); + UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); //tabbedPane.setOpaque(true); @@ -101,7 +104,7 @@ public class AttackTreePanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(atdp); atdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBarAt, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic1074, toolBarPanel, "Opens Attack Tree Diagram"); @@ -158,9 +161,10 @@ public class AttackTreePanel extends TURTLEPanel { TGComponent tgc; for(int i=0; i<panels.size(); i++) { - ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + Iterator<TGComponent> iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator(); + while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); tgc.setAVATARMet(0); tgc.setInternalAvatarMet(0); diff --git a/src/ui/AvatarAnalysisPanel.java b/src/ui/AvatarAnalysisPanel.java index d71622d646..8d22cdc79d 100755 --- a/src/ui/AvatarAnalysisPanel.java +++ b/src/ui/AvatarAnalysisPanel.java @@ -51,9 +51,6 @@ import javax.swing.*; import javax.swing.event.*; import java.util.*; -import ui.iod.*; -import ui.sd.*; -import ui.sd2.*; import ui.ucd.*; import ui.avatarcd.*; import ui.avatarad.*; @@ -63,12 +60,17 @@ public class AvatarAnalysisPanel extends TURTLEPanel { public AvatarAnalysisPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneAnalysisAction(e); - } - }; + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneAnalysisAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -91,7 +93,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(sdp); sdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement(MainGUI.INCREMENT); toolBarPanel.add(toolBarSequence, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic18, toolBarPanel, "Open the sequence diagram of " + s); @@ -118,7 +120,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(sdp); sdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarSequence, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic18, toolBarPanel, "Open the sequence diagram of " + s); @@ -146,7 +148,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(ucdp); ucdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarUC, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic19, toolBarPanel, "Open the use case diagram of " + s); @@ -168,7 +170,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(acdp); acdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarACD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic600, toolBarPanel, "Open the context diagram of " + s); @@ -190,7 +192,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(aadp); aadp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarAAD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic5048, toolBarPanel, "Open the activity diagram of " + s); @@ -261,7 +263,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { //TraceManager.addDev("Adding instances to last SD Step 2"); - ListIterator iterator = _ucdp.getComponentList().listIterator(); + Iterator<TGComponent> iterator = _ucdp.getComponentList().iterator(); TGComponent tgc; // To determine whether an actor is on the left, or on the right @@ -275,7 +277,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { } else { systemName = "System"; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if ((tgc instanceof UCDActor) || (tgc instanceof UCDActorBox)) { middleX = middleX + tgc.getX(); cptTotal ++; @@ -287,11 +289,11 @@ public class AvatarAnalysisPanel extends TURTLEPanel { //TraceManager.addDev("Adding instances to last SD Step 3"); // Classify actors - LinkedList <TGComponent> actors = new LinkedList(); - iterator = _ucdp.getComponentList().listIterator(); + java.util.List<TGComponent> actors = new LinkedList<TGComponent>(); + iterator = _ucdp.getComponentList().iterator(); int i; while(iterator.hasNext()) { - tgc = (TGComponent)(iterator.next()); + tgc = iterator.next(); if ((tgc instanceof UCDActor) || (tgc instanceof UCDActorBox)) { for(i=0; i<actors.size(); i++) { if (actors.get(i).getX() > tgc.getX()) { diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java index daa5a61fb0..0c64a975ff 100644 --- a/src/ui/AvatarDesignPanel.java +++ b/src/ui/AvatarDesignPanel.java @@ -67,12 +67,18 @@ public class AvatarDesignPanel extends TURTLEPanel { public AvatarDesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDesignAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDesignAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } diff --git a/src/ui/AvatarMADsPanel.java b/src/ui/AvatarMADsPanel.java index f3591db9c5..dac0fdee79 100644 --- a/src/ui/AvatarMADsPanel.java +++ b/src/ui/AvatarMADsPanel.java @@ -49,21 +49,25 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; -import ui.avatarmad.*; -import myutil.*; +import myutil.GraphicLib; +import ui.avatarmad.*; public class AvatarMADsPanel extends TURTLEPanel { public AvatarMADsPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneMADAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -93,7 +97,7 @@ public class AvatarMADsPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(amadp); amadp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(amadp); diff --git a/src/ui/AvatarMethodologyPanel.java b/src/ui/AvatarMethodologyPanel.java index 2ada171991..cc7937346f 100755 --- a/src/ui/AvatarMethodologyPanel.java +++ b/src/ui/AvatarMethodologyPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.avatarmethodology.*; @@ -61,7 +63,8 @@ public class AvatarMethodologyPanel extends TURTLEPanel { public AvatarMethodologyPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); diff --git a/src/ui/AvatarRequirementPanel.java b/src/ui/AvatarRequirementPanel.java index 7bdd7d2f82..578fb910a0 100755 --- a/src/ui/AvatarRequirementPanel.java +++ b/src/ui/AvatarRequirementPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.avatarrd.*; import ui.avatarpd.*; @@ -61,17 +63,21 @@ public class AvatarRequirementPanel extends TURTLEPanel { public AvatarRequirementPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); - UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); - UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); + UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); //tabbedPane.setOpaque(true); cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneRequirementAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneRequirementAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); @@ -104,7 +110,7 @@ public class AvatarRequirementPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(ardp); ardp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(ardtb, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic84, toolBarPanel, "Opens requirement diagram"); @@ -112,7 +118,6 @@ public class AvatarRequirementPanel extends TURTLEPanel { JPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); - return true; } @@ -134,7 +139,7 @@ public class AvatarRequirementPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(apdp); apdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(apdtb, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic82, toolBarPanel, "Opens Parametric Diagram"); diff --git a/src/ui/DeploymentPanel.java b/src/ui/DeploymentPanel.java index 5da70b2533..5ce15c23f5 100755 --- a/src/ui/DeploymentPanel.java +++ b/src/ui/DeploymentPanel.java @@ -49,26 +49,32 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; + +import myutil.GraphicLib; import ui.dd.*; public class DeploymentPanel extends TURTLEPanel { public TDeploymentDiagramPanel tddp; - public Vector validated, ignored; + //public Vector validated, ignored; public DeploymentPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneDesignAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } - public void init() { // Class Diagram toolbar @@ -87,7 +93,7 @@ public class DeploymentPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(tddp); tddp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarDep, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Deployment Diagram", IconManager.imgic60, toolBarPanel, "Opens deployment diagram"); diff --git a/src/ui/DesignPanel.java b/src/ui/DesignPanel.java index 6066e45eb3..faaf1f341d 100755 --- a/src/ui/DesignPanel.java +++ b/src/ui/DesignPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.cd.*; import ui.ad.*; @@ -60,12 +62,18 @@ public class DesignPanel extends TURTLEPanel implements TURTLEDesignPanelInterfa public DesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneDesignAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } diff --git a/src/ui/DiplodocusMethodologyPanel.java b/src/ui/DiplodocusMethodologyPanel.java index 323b0d7ccc..94a3e16f13 100755 --- a/src/ui/DiplodocusMethodologyPanel.java +++ b/src/ui/DiplodocusMethodologyPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.diplodocusmethodology.*; @@ -60,20 +62,23 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { public DiplodocusMethodologyPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); - UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); - UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); + UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); //tabbedPane.setOpaque(true); cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDiplodocusMethodologyAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDiplodocusMethodologyAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); - } // Put the methodology @@ -89,7 +94,7 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { TGConnectingPoint p1, p2; p1 = tgc1.getTGConnectingPointAtIndex(0); p2 = tgc3.getTGConnectingPointAtIndex(0); - Vector listPoint = new Vector(); + Vector<Point> listPoint = new Vector<Point>(); TGConnector tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); @@ -98,7 +103,7 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { // cp -> mapping p1 = tgc4.getTGConnectingPointAtIndex(0); p2 = tgc3.getTGConnectingPointAtIndex(2); - listPoint = new Vector(); + listPoint = new Vector<Point>(); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); @@ -107,7 +112,7 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { // Archi -> mapping p1 = tgc2.getTGConnectingPointAtIndex(0); p2 = tgc3.getTGConnectingPointAtIndex(1); - listPoint = new Vector(); + listPoint = new Vector<Point>(); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); @@ -147,7 +152,7 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(dmd); dmd.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(dmdt, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic98, toolBarPanel, "Opens diplodocus methodology"); diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index 5126796157..763449767c 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -1146,7 +1146,7 @@ public class GTURTLEModeling { return cpuTaskMap; } - public void addHSM(MainGUI gui, HashMap<String, ArrayList<String>> selectedCpuTasks){ + public void addHSM(MainGUI gui, Map<String, List<String>> selectedCpuTasks){ System.out.println("Adding HSM"); String encComp="100"; String decComp="100"; diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index 9a8fa14b4b..d739b44f42 100644 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -556,7 +556,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } - private void initActions() { + private void initActions() { actions = new TGUIAction[TGUIAction.NB_ACTION]; for(int i=0; i<TGUIAction.NB_ACTION; i++) { actions[i] = new TGUIAction(i); @@ -1473,8 +1473,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe private void addTURTLEPanel() { //TraceManager.addDev("New TURTLE Panels"); - // tabbed pane - mainTabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + mainTabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); mainTabbedPane.setBackground(ColorManager.MainTabbedPane); mainTabbedPane.setForeground(Color.black); @@ -3909,7 +3910,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public void avatarSimulation() { TraceManager.addDev("Avatar simulation"); - jfais = new JFrameAvatarInteractiveSimulation(frame, this, "Interactive simulation", gtm.getAvatarSpecification()); + jfais = new JFrameAvatarInteractiveSimulation(/*frame, */this, "Interactive simulation", gtm.getAvatarSpecification()); jfais.setIconImage(IconManager.img9); // jfais.setSize(900, 600); GraphicLib.centerOnParent(jfais, 900, 600); @@ -8116,8 +8117,6 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe } - - private JMenuItem createMenuItem(String s) { JMenuItem item = new JMenuItem(s); item.setActionCommand(s); diff --git a/src/ui/NCPanel.java b/src/ui/NCPanel.java index 611f0ddb3c..ab7ce8e5fa 100755 --- a/src/ui/NCPanel.java +++ b/src/ui/NCPanel.java @@ -49,21 +49,29 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; + +import myutil.GraphicLib; + import ui.ncdd.*; public class NCPanel extends TURTLEPanel { public NCDiagramPanel ncdp; - public Vector validated, ignored; +// public Vector validated, ignored; public NCPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDesignAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDesignAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -86,7 +94,7 @@ public class NCPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(ncdp); ncdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarNC, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("Network Calculus Diagram", IconManager.imgic60, toolBarPanel, "Opens network calculus diagram"); diff --git a/src/ui/ProactiveDesignPanel.java b/src/ui/ProactiveDesignPanel.java index 20665e5275..60c3fc0c93 100755 --- a/src/ui/ProactiveDesignPanel.java +++ b/src/ui/ProactiveDesignPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.procsd.*; import ui.prosmd.*; @@ -65,12 +67,18 @@ public class ProactiveDesignPanel extends TURTLEPanel { public ProactiveDesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneAnalysisAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -109,7 +117,7 @@ public class ProactiveDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(newCSDPanel); newCSDPanel.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarCSD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(name, IconManager.imgic17, toolBarPanel, "Opens composite structure diagram"); @@ -140,7 +148,7 @@ public class ProactiveDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(newCSDPanel); newCSDPanel.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarCSD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(name, IconManager.imgic17, toolBarPanel, "Opens composite structure diagram"); @@ -149,11 +157,11 @@ public class ProactiveDesignPanel extends TURTLEPanel { public String addSMD(String s) { - for (int k=0;k<panels.size();k++) - { - TDiagramPanel tg=(TDiagramPanel)panels.get(k); - //System.out.println(tg.toString()+"\n"); - } +// for (int k=0;k<panels.size();k++) +// { +// TDiagramPanel tg=(TDiagramPanel)panels.get(k); +// //System.out.println(tg.toString()+"\n"); +// } // Ensure that s is unique // Otherwise -> add an index @@ -176,26 +184,18 @@ public class ProactiveDesignPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(psmdp); psmdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBar, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic18, toolBarPanel, "Open the state machine diagram diagram of " + s); - //tabbedPane.setVisible(true); - //sdp.setVisible(true); - //jsp.setVisible(true); - //tabbedPane.setSelectedIndex(panels.size()-1); - - //Commented by Solange - //return true; - } public String saveHeaderInXml(String extensionToName) { - if (extensionToName == null) { - return "<Modeling type=\"ProActive Design\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; - } - return "<Modeling type=\"ProActive Design\" nameTab=\"" + mgui.getTabName(this) + extensionToName + "\" >\n"; - + if (extensionToName == null) { + return "<Modeling type=\"ProActive Design\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; + } + + return "<Modeling type=\"ProActive Design\" nameTab=\"" + mgui.getTabName(this) + extensionToName + "\" >\n"; } public String saveTailInXml() { diff --git a/src/ui/RequirementPanel.java b/src/ui/RequirementPanel.java index 8f685a8ba4..0b9e2004d7 100755 --- a/src/ui/RequirementPanel.java +++ b/src/ui/RequirementPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.req.*; import ui.ebrdd.*; @@ -61,17 +63,21 @@ public class RequirementPanel extends TURTLEPanel { public RequirementPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); - UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); - UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); + UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); //tabbedPane.setOpaque(true); cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneRequirementAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneRequirementAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); @@ -103,7 +109,7 @@ public class RequirementPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(rdp); rdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarReq, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic1000, toolBarPanel, "Opens requirement diagram"); @@ -132,7 +138,7 @@ public class RequirementPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(ebrdd); ebrdd.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarEBRDD, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic1058, toolBarPanel, "Opens EBRDD"); diff --git a/src/ui/SysmlsecMethodologyPanel.java b/src/ui/SysmlsecMethodologyPanel.java index 78b01c4e2e..b4450592c0 100755 --- a/src/ui/SysmlsecMethodologyPanel.java +++ b/src/ui/SysmlsecMethodologyPanel.java @@ -49,6 +49,8 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; import ui.sysmlsecmethodology.*; @@ -60,17 +62,21 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { public SysmlsecMethodologyPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); - UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); - UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", MainGUI.BACK_COLOR); + UIManager.put("TabbedPane.selected", MainGUI.BACK_COLOR); SwingUtilities.updateComponentTreeUI(tabbedPane); //tabbedPane.setOpaque(true); cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDiplodocusMethodologyAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDiplodocusMethodologyAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); @@ -129,7 +135,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { TGConnectingPoint p1, p2; p1 = tgc1.getTGConnectingPointAtIndex(0); p2 = tgc2.getTGConnectingPointAtIndex(0); - Vector listPoint = new Vector(); + Vector<Point> listPoint = new Vector<Point>(); Point p = new Point(210, 235); listPoint.add(p); TGConnector tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.SYSMLSEC_METHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); @@ -140,7 +146,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // Reqs -> Attacks p1 = tgc2.getTGConnectingPointAtIndex(1); p2 = tgc10.getTGConnectingPointAtIndex(0); - listPoint = new Vector(); + listPoint = new Vector<Point>(); //p = new Point(375, 370); //listPoint.add(p); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.SYSMLSEC_METHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); @@ -148,10 +154,10 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { p2.setFree(false); dmd.getComponentList().add(0, tgco); - // Attacks -> Reqs + // Attacks -> Reqs p1 = tgc10.getTGConnectingPointAtIndex(1); p2 = tgc2.getTGConnectingPointAtIndex(2); - listPoint = new Vector(); + listPoint = new Vector<Point>(); //p = new Point(375, 370); //listPoint.add(p); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.SYSMLSEC_METHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); @@ -162,7 +168,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // Analysis -> Design p1 = tgc3.getTGConnectingPointAtIndex(1); p2 = tgc4.getTGConnectingPointAtIndex(0); - listPoint = new Vector(); + listPoint = new Vector<Point>(); p = new Point(xa+60, ya+125); listPoint.add(p); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.SYSMLSEC_METHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); @@ -173,7 +179,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // Design -> Prototyping p1 = tgc4.getTGConnectingPointAtIndex(1); p2 = tgc5.getTGConnectingPointAtIndex(0); - listPoint = new Vector(); + listPoint = new Vector<Point>(); p = new Point(xa+160, ya+225); listPoint.add(p); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.SYSMLSEC_METHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); @@ -184,7 +190,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // Reqs -> Prop p1 = tgc2.getTGConnectingPointAtIndex(0); p2 = tgc6.getTGConnectingPointAtIndex(0); - listPoint = new Vector(); + listPoint = new Vector<Point>(); p = new Point(xa-305, 235); listPoint.add(p); p = new Point(xa-305, ya+50); @@ -198,7 +204,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // App -> mapping p1 = tgc7.getTGConnectingPointAtIndex(0); p2 = tgc9.getTGConnectingPointAtIndex(0); - listPoint = new Vector(); + listPoint = new Vector<Point>(); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); @@ -207,7 +213,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // cp -> mapping p1 = tgc11.getTGConnectingPointAtIndex(0); p2 = tgc9.getTGConnectingPointAtIndex(2); - listPoint = new Vector(); + listPoint = new Vector<Point>(); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); @@ -216,18 +222,15 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { // Archi -> mapping p1 = tgc8.getTGConnectingPointAtIndex(0); p2 = tgc9.getTGConnectingPointAtIndex(1); - listPoint = new Vector(); + listPoint = new Vector<Point>(); tgco = TGComponentManager.addConnector(p1.getX(), p1.getY(), TGComponentManager.DIPLODOCUSMETHODOLOGY_CONNECTOR, dmd, p1, p2, listPoint); p1.setFree(false); p2.setFree(false); dmd.getComponentList().add(0, tgco); - - - dmd.bringToBack(infoParti); - dmd.bringToBack(infoSw); - dmd.bringToBack(infoReq); - - + + dmd.bringToBack(infoParti); + dmd.bringToBack(infoSw); + dmd.bringToBack(infoReq); } public void init() { @@ -261,7 +264,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { JScrollDiagramPanel jsp = new JScrollDiagramPanel(dmd); dmd.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(dmdt, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab(s, IconManager.imgic99, toolBarPanel, "Opens SysMLSec methodology"); @@ -269,10 +272,6 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { JPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); - - - - //TGComponent tgc = TGComponentManager.addComponent(100, 100, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_APPLICATION, dmd); mgui.changeMade(dmd, TDiagramPanel.NEW_COMPONENT); return true; diff --git a/src/ui/TMLArchiPanel.java b/src/ui/TMLArchiPanel.java index 9c5cf4f647..159ea9072d 100755 --- a/src/ui/TMLArchiPanel.java +++ b/src/ui/TMLArchiPanel.java @@ -49,6 +49,9 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; + import java.util.*; import ui.tmldd.*; @@ -58,16 +61,23 @@ public class TMLArchiPanel extends TURTLEPanel { public TMLArchiPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneDesignAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } + @Override public void init() { // Class Diagram toolbar diff --git a/src/ui/TMLCommunicationPatternPanel.java b/src/ui/TMLCommunicationPatternPanel.java index 5faf2ad583..2bd6d7fc8a 100755 --- a/src/ui/TMLCommunicationPatternPanel.java +++ b/src/ui/TMLCommunicationPatternPanel.java @@ -49,6 +49,9 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; + import java.util.*; import ui.tmlcp.*; @@ -60,12 +63,18 @@ public class TMLCommunicationPatternPanel extends TURTLEPanel { public TMLCommunicationPatternPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneAnalysisAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneAnalysisAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } diff --git a/src/ui/TMLComponentDesignPanel.java b/src/ui/TMLComponentDesignPanel.java index 68feb1cf1d..bf7641e0fb 100755 --- a/src/ui/TMLComponentDesignPanel.java +++ b/src/ui/TMLComponentDesignPanel.java @@ -50,6 +50,9 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; + import java.util.*; import ui.tmlcompd.*; import ui.tmlad.*; @@ -64,7 +67,8 @@ public class TMLComponentDesignPanel extends TURTLEPanel { public TMLComponentDesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); cl = new ChangeListener() { @@ -76,7 +80,9 @@ public class TMLComponentDesignPanel extends TURTLEPanel { tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); - //tabbedPane.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); + + // Issue #41: Ordering of tabbed panes + tabbedPane.setTabLayoutPolicy( JTabbedPane.SCROLL_TAB_LAYOUT ); } public TMLActivityDiagramPanel getTMLActivityDiagramPanel(String _name) { diff --git a/src/ui/TMLDesignPanel.java b/src/ui/TMLDesignPanel.java index 38705e3b00..d2a0f5d9eb 100755 --- a/src/ui/TMLDesignPanel.java +++ b/src/ui/TMLDesignPanel.java @@ -50,6 +50,9 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; + import java.util.*; import ui.tmlcd.*; import ui.tmlad.*; @@ -61,12 +64,18 @@ public class TMLDesignPanel extends TURTLEPanel { public TMLDesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { - public void stateChanged(ChangeEvent e){ - mgui.paneDesignAction(e); - } - }; + + @Override + public void stateChanged(ChangeEvent e){ + mgui.paneDesignAction(e); + } + }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } diff --git a/src/ui/TURTLEOSDesignPanel.java b/src/ui/TURTLEOSDesignPanel.java index e8125f1925..452a1106b7 100755 --- a/src/ui/TURTLEOSDesignPanel.java +++ b/src/ui/TURTLEOSDesignPanel.java @@ -49,23 +49,29 @@ package ui; import java.awt.*; import javax.swing.*; import javax.swing.event.*; -import java.util.*; + +import myutil.GraphicLib; import ui.oscd.*; import ui.osad.*; -//import ui.tmlcd.*; public class TURTLEOSDesignPanel extends TURTLEPanel implements TURTLEDesignPanelInterface { - public Vector validated, ignored; + //public Vector validated, ignored; public TURTLEOSClassDiagramPanel toscdp; public TURTLEOSDesignPanel(MainGUI _mgui) { super(_mgui); - tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + cl = new ChangeListener() { + + @Override public void stateChanged(ChangeEvent e){ mgui.paneDesignAction(e); } }; + tabbedPane.addChangeListener(cl); tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); } @@ -102,7 +108,7 @@ public class TURTLEOSDesignPanel extends TURTLEPanel implements TURTLEDesignPane JScrollDiagramPanel jsp = new JScrollDiagramPanel(tosadp); tosadp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarActivity, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); panels.add(tosadp); @@ -128,7 +134,7 @@ public class TURTLEOSDesignPanel extends TURTLEPanel implements TURTLEDesignPane JScrollDiagramPanel jsp = new JScrollDiagramPanel(toscdp); toscdp.jsp = jsp; jsp.setWheelScrollingEnabled(true); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT); toolBarPanel.add(toolBarTOS, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); tabbedPane.addTab("TURTLE-OS Class diagram", IconManager.imgic62, toolBarPanel, "Opens TURTLE-OS class diagram"); diff --git a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java index 20d396f4c3..8720e96bf4 100755 --- a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java +++ b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java @@ -45,10 +45,8 @@ package ui.avatarinteractivesimulation; -//import java.io.*; import javax.swing.*; import javax.swing.event.*; -import javax.swing.table.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; @@ -58,29 +56,27 @@ import java.util.*; import myutil.*; import ui.*; -import ui.file.*; import avatartranslator.*; import avatartranslator.directsimulation.*; import ui.avatarbd.*; - 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"; - private static String buttonStopAndCloseS = "Stop simulator and close"; - - private static int NOT_STARTED = 0; - private static int STARTED = 1; +// private static String buttonStartS = "Start simulator"; +// private static String buttonStopAndCloseS = "Stop simulator and close"; +// +// private static int NOT_STARTED = 0; +// private static int STARTED = 1; private static long SPACE_UPDATE_TIME = 100; - private Frame f; + // private Frame f; private MainGUI mgui; - private String title; + // private String title; protected JButton buttonClose, buttonStart, buttonStopAndClose; protected JTextArea jta; @@ -112,7 +108,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar //List of transactions - private JList listPendingTransactions; + private JList<AvatarSimulationPendingTransaction> listPendingTransactions; private TGComponent selectedComponentForTransaction1, selectedComponentForTransaction2; private AvatarSimulationBlock previousBlock; @@ -172,10 +168,10 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar // Asynchronous transactions private JPanel asyncPanel; - private JComboBox comboFIFOs; + private JComboBox<AvatarInteractiveSimulationFIFOData> comboFIFOs; private Vector<AvatarInteractiveSimulationFIFOData> fifos; private JButton delete, up, down; - private JList asyncmsgs; + private JList<AvatarSimulationAsynchronousTransaction> asyncmsgs; private int nbOfAsyncMsgs; // Sequence Diagram @@ -203,8 +199,8 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar private AvatarSpecification avspec; private AvatarSpecificationSimulation ass; private Thread simulationThread; - private boolean resetThread; - private boolean killThread; +// private boolean resetThread; +// private boolean killThread; private LinkedList<TGComponent> runningTGComponents; private int nbOfAllExecutedElements = 0; @@ -217,12 +213,12 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar // Async messages Vector<AvatarSimulationAsynchronousTransaction> lastAsyncmsgs; - public JFrameAvatarInteractiveSimulation(Frame _f, MainGUI _mgui, String _title, AvatarSpecification _avspec) { + public JFrameAvatarInteractiveSimulation(/*Frame _f,*/ MainGUI _mgui, String _title, AvatarSpecification _avspec) { super(_title); - f = _f; + // f = _f; mgui = _mgui; - title = _title; + // title = _title; avspec = _avspec; addWindowListener(this); @@ -390,32 +386,21 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar sdpanel.setMyScrollPanel(jsp); jsp.setWheelScrollingEnabled(true); //jsp.setPreferredSize(new Dimension(800, 400)); - jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + jsp.getVerticalScrollBar().setUnitIncrement( MainGUI.INCREMENT ); lowerPartPanel.add(jsp, BorderLayout.CENTER); - - // Commands commands = new JPanel(new BorderLayout()); - //commands.setFloatable(true); - //commands.setMinimumSize(new Dimension(300, 250)); commands.setBorder(new javax.swing.border.TitledBorder("Commands")); - - - - commandTab = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + commandTab = GraphicLib.createTabbedPane();//new JTabbedPane(); commands.add(commandTab, BorderLayout.CENTER); - //commandTab.setBackground(ColorManager.InteractiveSimulationBackground); // Control commands jp01 = new JPanel(new BorderLayout()); commandTab.addTab("Control", null, jp01, "Main control commands"); - //jp01.setMinimumSize(new Dimension(375, 400)); - //gridbag01 = new GridBagLayout(); - //c01 = new GridBagConstraints(); - //jp01.setLayout(gridbag01); mctb = new AvatarMainCommandsToolBar(this); jp01.add(mctb, BorderLayout.NORTH); @@ -442,7 +427,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar panellpt.setLayout(new BorderLayout()); panellpt.setBorder(new javax.swing.border.TitledBorder("Pending transactions")); - listPendingTransactions = new JList(); + listPendingTransactions = new JList<AvatarSimulationPendingTransaction>(); //listPendingTransactions.setPreferredSize(new Dimension(400, 300)); listPendingTransactions.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION ); listPendingTransactions.addListSelectionListener(this); @@ -524,8 +509,8 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar //c02.gridwidth = GridBagConstraints.REMAINDER; //end row - - infoTab = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + infoTab = GraphicLib.createTabbedPane();// new JTabbedPane(); infoTab.setPreferredSize(new Dimension(300, 200)); infos.add(infoTab, BorderLayout.CENTER); @@ -884,7 +869,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar ca.fill = GridBagConstraints.HORIZONTAL; ca.gridheight = 1; - comboFIFOs = new JComboBox(fifos); + comboFIFOs = new JComboBox<AvatarInteractiveSimulationFIFOData>(fifos); comboFIFOs.addActionListener(this); asyncPanel.add(comboFIFOs, ca); ca.fill = GridBagConstraints.BOTH; @@ -899,7 +884,7 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar cb.fill = GridBagConstraints.BOTH; cb.gridheight = 1; borderjlist.setBorder(new javax.swing.border.TitledBorder("Top of selected FIFO:")); - asyncmsgs = new JList(); + asyncmsgs = new JList<AvatarSimulationAsynchronousTransaction>(); JScrollPane pane = new JScrollPane(asyncmsgs); borderjlist.add(pane, cb); asyncPanel.add(borderjlist, ca); @@ -1408,8 +1393,6 @@ public class JFrameAvatarInteractiveSimulation extends JFrame implements Avatar for(AvatarInteractiveSimulationFIFOData fifo: fifos) { fifo.nb=0; } - - } if (lastAsyncmsgs != null) { diff --git a/src/ui/interactivesimulation/JFrameInteractiveSimulation.java b/src/ui/interactivesimulation/JFrameInteractiveSimulation.java index 3c3d18508b..ae8f7d8399 100755 --- a/src/ui/interactivesimulation/JFrameInteractiveSimulation.java +++ b/src/ui/interactivesimulation/JFrameInteractiveSimulation.java @@ -110,6 +110,7 @@ import java.text.*; import launcher.LauncherException; import launcher.RshClient; import myutil.Conversion; +import myutil.GraphicLib; import myutil.ScrolledJTextArea; import myutil.TableSorter; import myutil.TraceManager; @@ -422,19 +423,14 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene mainTop.add(commands, c02); - commandTab = new JTabbedPane(); - //commandTab.setBackground(ColorManager.InteractiveSimulationBackground); + // Issue #41 Ordering of tabbed panes + commandTab = GraphicLib.createTabbedPane();//new JTabbedPane(); // 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); @@ -754,7 +750,8 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene c02.gridwidth = GridBagConstraints.REMAINDER; //end row mainTop.add(infos, c02); - infoTab = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + infoTab = GraphicLib.createTabbedPane();//new JTabbedPane(); infoTab.setMinimumSize(new Dimension(300, 250)); infos.add(infoTab, BorderLayout.NORTH); diff --git a/src/ui/window/JDialogADConnector.java b/src/ui/window/JDialogADConnector.java index ede7dbd539..ad8c4d4410 100755 --- a/src/ui/window/JDialogADConnector.java +++ b/src/ui/window/JDialogADConnector.java @@ -48,16 +48,14 @@ knowledge of the CeCILL license and that you accept its terms. package ui.window; import java.awt.*; -import java.awt.event.*; import javax.swing.*; -import java.util.*; -import myutil.*; +import myutil.GraphicLib; import ui.*; -public class JDialogADConnector extends javax.swing.JDialog implements ActionListener { +public class JDialogADConnector extends JDialog {//implements ActionListener { - //private Vector<String> actions; + //private Vector<String> actions; private String guard;//, afterMin, afterMax, computeMin, computeMax; /*private Vector myAttributes, myMethods; private Vector<String> allElements, insertElements; @@ -68,17 +66,17 @@ public class JDialogADConnector extends javax.swing.JDialog implements ActionLis private boolean cancelled = false; private JPanel panel1; - private JPanel panel2; + //private JPanel panel2; // Panel1 - private JTextField guardT, afterMinT, afterMaxT, computeMinT, computeMaxT; - private JTextArea actionsT; - private JComboBox elements; - private JButton insertElement; + private JTextField guardT;//, afterMinT, afterMaxT, computeMinT, computeMaxT; + //private JTextArea actionsT; + //private JComboBox<String> elements; + //private JButton insertElement; // Main Panel - private JButton closeButton; - private JButton cancelButton; + private JButton closeButton; + private JButton cancelButton; // Panel of code and files protected JTextArea jtaCode, jtaFiles; @@ -138,15 +136,15 @@ public class JDialogADConnector extends javax.swing.JDialog implements ActionLis } private void initComponents() { - int i; + //int i; Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); GridBagLayout gridbag1 = new GridBagLayout(); - GridBagLayout gridbag2 = new GridBagLayout(); + //GridBagLayout gridbag2 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); + // GridBagConstraints c2 = new GridBagConstraints(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(gridbag0); @@ -282,9 +280,8 @@ public class JDialogADConnector extends javax.swing.JDialog implements ActionLis c0.weightx = 1.0; c0.gridwidth = GridBagConstraints.REMAINDER; //end row - - - JTabbedPane jtp = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + JTabbedPane jtp = GraphicLib.createTabbedPane();//new JTabbedPane(); jtp.add("General", panel1); //jtp.add("Prototyping", panel2); c.add(jtp, c0); @@ -296,29 +293,29 @@ public class JDialogADConnector extends javax.swing.JDialog implements ActionLis //closeButton.setPreferredSize(new Dimension(600, 50)); - closeButton.addActionListener(this); + // closeButton.addActionListener(this); c.add(closeButton, c0); c0.gridwidth = GridBagConstraints.REMAINDER; //end row cancelButton = new JButton("Cancel", IconManager.imgic27); - cancelButton.addActionListener(this); + // cancelButton.addActionListener(this); c.add(cancelButton, c0); } - - public void actionPerformed(ActionEvent evt) { - //String command = evt.getActionCommand(); - int fake = 0; - // Compare the action command to the known actions. - if (evt.getSource() == closeButton) { - //closeDialog(); - fake++; - } else if (evt.getSource() == cancelButton) { - //cancelDialog(); - fake++; - } else if (evt.getSource() == insertElement) { - //insertElements(); - fake++; - } - } +// +// public void actionPerformed(ActionEvent evt) { +// //String command = evt.getActionCommand(); +// // int fake = 0; +// // Compare the action command to the known actions. +// if (evt.getSource() == closeButton) { +// //closeDialog(); +// fake++; +// } else if (evt.getSource() == cancelButton) { +// //cancelDialog(); +// fake++; +// } else if (evt.getSource() == insertElement) { +// //insertElements(); +// fake++; +// } +// } /*public void insertElements() { int index = elements.getSelectedIndex(); diff --git a/src/ui/window/JDialogAvatarBlock.java b/src/ui/window/JDialogAvatarBlock.java index c26b6d5ffc..fdaa9acb71 100755 --- a/src/ui/window/JDialogAvatarBlock.java +++ b/src/ui/window/JDialogAvatarBlock.java @@ -80,7 +80,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis private String attrib; // "Attributes", "Gates", etc. // Panel1 - private JComboBox accessBox, typeBox; + private JComboBox<String> accessBox, typeBox; private JTextField identifierText; private JTextField initialValue; private JButton addButton; @@ -105,7 +105,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis // Signals private boolean hasSignals = true; private JPanel panel5, panel6; - private JComboBox signalInOutBox; + private JComboBox<String> signalInOutBox; private JTextField signalText; private JButton addSignalButton; private JList<AvatarSignal> listSignal; @@ -175,7 +175,9 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis } private void initComponents() { - JTabbedPane tabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + JTabbedPane tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); Container c = getContentPane(); JPanel panelAttr = new JPanel(new BorderLayout()); @@ -186,7 +188,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag2 = new GridBagLayout(); GridBagLayout gridbag3 = new GridBagLayout(); - GridBagLayout gridbag4 = new GridBagLayout(); + // GridBagLayout gridbag4 = new GridBagLayout(); GridBagLayout gridbag5 = new GridBagLayout(); GridBagLayout gridbag6 = new GridBagLayout(); GridBagLayout gridbag7 = new GridBagLayout(); @@ -243,7 +245,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis c1.gridwidth = 1; c1.fill = GridBagConstraints.HORIZONTAL; c1.anchor = GridBagConstraints.CENTER; - accessBox = new JComboBox(); + accessBox = new JComboBox<String>(); panel1.add(accessBox, c1); identifierText = new JTextField(); identifierText.setColumns(15); @@ -261,7 +263,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis panel1.add(new JLabel(" : "), c1); c1.gridwidth = GridBagConstraints.REMAINDER; //end row - typeBox = new JComboBox(); + typeBox = new JComboBox<String>(); typeBox.addActionListener(this); panel1.add(typeBox, c1); @@ -443,7 +445,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis String[] v = new String[2]; v[0] = "in"; v[1] = "out"; - signalInOutBox = new JComboBox(v); + signalInOutBox = new JComboBox<String>(v); panel5.add(signalInOutBox, c5); signalText = new JTextField(); signalText.setColumns(50); @@ -955,11 +957,11 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis TAttribute a = attributes.get (i); identifierText.setText(a.getId()); initialValue.setText(a.getInitialValue()); - select(accessBox, a.getStringAccess(a.getAccess())); + select(accessBox, TAttribute.getStringAccess(a.getAccess())); if (a.getType() == TAttribute.OTHER) { select(typeBox, a.getTypeOther()); } else { - select(typeBox, a.getStringAvatarType(a.getType())); + select(typeBox, TAttribute.getStringAvatarType(a.getType())); } removeButton.setEnabled(true); if (i > 0) { @@ -1024,7 +1026,7 @@ public class JDialogAvatarBlock extends javax.swing.JDialog implements ActionLis } } - public void select(JComboBox jcb, String text) { + public void select(JComboBox<String> jcb, String text) { String s; for(int i=0; i<jcb.getItemCount(); i++) { s = (String)(jcb.getItemAt(i)); diff --git a/src/ui/window/JDialogAvatarExecutableCodeGeneration.java b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java index 5cd8152e0f..245a2522c8 100644 --- a/src/ui/window/JDialogAvatarExecutableCodeGeneration.java +++ b/src/ui/window/JDialogAvatarExecutableCodeGeneration.java @@ -223,7 +223,8 @@ public class JDialogAvatarExecutableCodeGeneration extends javax.swing.JFrame im c.setLayout(new BorderLayout()); //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -293,7 +294,7 @@ public class JDialogAvatarExecutableCodeGeneration extends javax.swing.JFrame im jp01.add(new JLabel("1 time unit ="), c01); - units = new JComboBox(unitTab); + units = new JComboBox<String>(unitTab); units.setSelectedIndex(selectedUnit); units.addActionListener(this); jp01.add(units, c01); diff --git a/src/ui/window/JDialogAvatarLibraryFunction.java b/src/ui/window/JDialogAvatarLibraryFunction.java index 70bdbf7944..b9de4d50e2 100755 --- a/src/ui/window/JDialogAvatarLibraryFunction.java +++ b/src/ui/window/JDialogAvatarLibraryFunction.java @@ -53,6 +53,9 @@ import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JOptionPane; import javax.swing.event.ListSelectionListener; + +import myutil.GraphicLib; + import javax.swing.event.ListSelectionEvent; import java.awt.BorderLayout; @@ -554,7 +557,8 @@ public class JDialogAvatarLibraryFunction extends javax.swing.JDialog implements this.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE); // Add the tabs panel - this.tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + this.tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); tabbedPane.addTab ("Parameters", this.initParametersTab ()); // Parameters Tab tabbedPane.addTab ("Signals", this.initSignalsTab ()); // Signals Tab diff --git a/src/ui/window/JDialogAvatarModelChecker.java b/src/ui/window/JDialogAvatarModelChecker.java index e60729abcb..7712056276 100644 --- a/src/ui/window/JDialogAvatarModelChecker.java +++ b/src/ui/window/JDialogAvatarModelChecker.java @@ -49,9 +49,7 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; import java.util.Date; -import java.util.Timer; import java.util.TimerTask; import java.io.*; @@ -65,11 +63,9 @@ import java.util.concurrent.TimeUnit; import ui.graph.*; - - public class JDialogAvatarModelChecker extends javax.swing.JFrame implements ActionListener, Runnable, MasterProcessInterface { - public final static String [] INFOS = {"Not started", "Running", "Stopped by user", "Finished"}; - public final static Color [] COLORS = {Color.darkGray, Color.magenta, Color.red, Color.blue}; + private final static String [] INFOS = {"Not started", "Running", "Stopped by user", "Finished"}; + private final static Color [] COLORS = {Color.darkGray, Color.magenta, Color.red, Color.blue}; public final static int REACHABILITY_ALL = 1; @@ -142,7 +138,7 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act private Thread t; private boolean go = false; - private boolean hasError = false; + // private boolean hasError = false; private java.util.Timer timer; //protected boolean startProcess = false; @@ -163,7 +159,7 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act graphDirDot = _graphDir + File.separator + "rgavatar$.dot"; } - showLiveness = _showLiveness; + showLiveness = _showLiveness; initComponents(); myInitComponents(); @@ -190,7 +186,8 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act c.setLayout(new BorderLayout()); //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -470,14 +467,14 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act } public void run() { - String cmd; - String list, data; - int cycle = 0; + // String cmd; + // String list, data; + // int cycle = 0; - hasError = false; + // hasError = false; TraceManager.addDev("Thread started"); - File testFile; + // File testFile; try { reinitValues(); jta.append("Starting the model checker\n"); @@ -715,8 +712,9 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act jta.append(s); } + @Override public void setError() { - hasError = true; +// hasError = true; } public void updateValues() { @@ -757,8 +755,8 @@ public class JDialogAvatarModelChecker extends javax.swing.JFrame implements Act duration ); - long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration); - long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration); +// long diffInSeconds = TimeUnit.MILLISECONDS.toSeconds(duration); +// long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(duration); //long diffInMs = TimeUnit.MILLISECONDS.toMilliseconds(duration); elapsedTime.setText(t); long diff = 0; diff --git a/src/ui/window/JDialogAvatarState.java b/src/ui/window/JDialogAvatarState.java index 6bb32ea4be..434d36760d 100755 --- a/src/ui/window/JDialogAvatarState.java +++ b/src/ui/window/JDialogAvatarState.java @@ -197,10 +197,9 @@ public class JDialogAvatarState extends javax.swing.JDialog implements ActionLis c0.weightx = 1.0; c0.gridwidth = GridBagConstraints.REMAINDER; //end row - - - JTabbedPane jtp = new JTabbedPane(); - jtp.setPreferredSize(new Dimension(400, 450)); + // Issue #41 Ordering of tabbed panes + JTabbedPane jtp = GraphicLib.createTabbedPane();//new JTabbedPane(); + jtp.setPreferredSize( new Dimension( 400, 450 ) ); jtp.add("General", panel11); jtp.add("Prototyping", panel2); c.add(jtp, c0); diff --git a/src/ui/window/JDialogAvatarTransition.java b/src/ui/window/JDialogAvatarTransition.java index 3d7e6b62b6..9f4bfda9b0 100755 --- a/src/ui/window/JDialogAvatarTransition.java +++ b/src/ui/window/JDialogAvatarTransition.java @@ -73,7 +73,7 @@ public class JDialogAvatarTransition extends javax.swing.JDialog implements Acti // Panel1 private JTextField guardT, afterMinT, afterMaxT, computeMinT, computeMaxT; private JTextArea actionsT; - private JComboBox elements; + private JComboBox<String> elements; private JButton insertElement; // Main Panel @@ -106,12 +106,12 @@ public class JDialogAvatarTransition extends javax.swing.JDialog implements Acti makeElements(); initComponents(); - myInitComponents(); + // myInitComponents(); pack(); } private void makeElements() { - int i; + // int i; allElements = new Vector<String>(); insertElements = new Vector<String>(); @@ -127,184 +127,184 @@ public class JDialogAvatarTransition extends javax.swing.JDialog implements Acti } } - - private void myInitComponents() { - } - +// +// private void myInitComponents() { +// } +// private void initComponents() { - int i; - - Container c = getContentPane(); - GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); - GridBagLayout gridbag2 = new GridBagLayout(); - GridBagConstraints c0 = new GridBagConstraints(); - GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); - - setFont(new Font("Helvetica", Font.PLAIN, 14)); - //c.setLayout(gridbag0); - c.setLayout(new BorderLayout()); - - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - panel1 = new JPanel(); - panel1.setLayout(gridbag1); - - panel1.setBorder(new javax.swing.border.TitledBorder("Transition parameters")); - - //panel1.setPreferredSize(new Dimension(350, 350)); - - // guard - c1.weighty = 1.0; - c1.weightx = 1.0; - c1.gridwidth = 1; - c1.gridheight = 1; - c1.fill = GridBagConstraints.BOTH; - c1.gridheight = 1; - panel1.add(new JLabel("guard = "), c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - guardT = new JTextField(guard); - panel1.add(guardT, c1); - - // After - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - panel1.add(new JLabel("after ("), c1); - afterMinT = new JTextField(afterMin, 10); - panel1.add(afterMinT, c1); - panel1.add(new JLabel(","), c1); - afterMaxT = new JTextField(afterMax, 10); - panel1.add(afterMaxT, c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - panel1.add(new JLabel(")"), c1); - - // Compute - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - panel1.add(new JLabel("compute for ("), c1); - computeMinT = new JTextField(computeMin, 10); - panel1.add(computeMinT, c1); - panel1.add(new JLabel(","), c1); - computeMaxT = new JTextField(computeMax, 10); - panel1.add(computeMaxT, c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - panel1.add(new JLabel(")"), c1); - - - // actions - - elements = new JComboBox(allElements); - panel1.add(elements, c1); - - insertElement = new JButton("Insert"); - insertElement.setEnabled(allElements.size() > 0); - insertElement.addActionListener(this); - panel1.add(insertElement, c1); - - c1.gridheight = 10; - c1.weighty = 10.0; - c1.weightx = 10.0; - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - c1.fill = GridBagConstraints.BOTH; - actionsT = new JTextArea(); - actionsT.setEditable(true); - actionsT.setMargin(new Insets(10, 10, 10, 10)); - actionsT.setTabSize(3); - actionsT.setFont(new Font("times", Font.PLAIN, 12)); - //actionsT.setPreferredSize(new Dimension(350, 250)); - JScrollPane jsp = new JScrollPane(actionsT, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - for(i=0; i<actions.size(); i++) { - actionsT.append(actions.get(i) + "\n"); - } - panel1.add(jsp, c1); - - - panel2 = new JPanel(); - panel2.setLayout(gridbag2); - - panel2.setBorder(new javax.swing.border.TitledBorder("Code")); - // guard - c2.weighty = 1.0; - c2.weightx = 1.0; - c2.gridwidth = 1; - c2.gridheight = 1; - c2.fill = GridBagConstraints.BOTH; - c2.gridwidth = GridBagConstraints.REMAINDER; - c2.gridheight = 1; - panel2.add(new JLabel("Files to include:"), c2); - jtaFiles = new JTextArea(); - jtaFiles.setEditable(true); - jtaFiles.setMargin(new Insets(10, 10, 10, 10)); - jtaFiles.setTabSize(3); - String files = ""; - if (filesToInclude != null) { - for(i=0; i<filesToInclude.length; i++) { - files += filesToInclude[i] + "\n"; - } - } - jtaFiles.append(files); - jtaFiles.setFont(new Font("times", Font.PLAIN, 12)); - jsp = new JScrollPane(jtaFiles, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - //jsp.setPreferredSize(new Dimension(300, 300)); - panel2.add(jsp, c2); - panel2.add(new JLabel("Code to execute at the end of the transition"), c2); - jtaCode = new JTextArea(); - jtaCode.setEditable(true); - jtaCode.setMargin(new Insets(10, 10, 10, 10)); - jtaCode.setTabSize(3); - String code = ""; - if (codeToInclude != null) { - for(i=0; i<codeToInclude.length; i++) { - code += codeToInclude[i] + "\n"; - } - } - jtaCode.append(code); - jtaCode.setFont(new Font("times", Font.PLAIN, 12)); - jsp = new JScrollPane(jtaCode, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - //jsp.setPreferredSize(new Dimension(300, 300)); - panel2.add(jsp, c2); - - - // button panel; - c0.gridwidth = 1; - c0.gridheight = 10; - c0.weighty = 1.0; - c0.weightx = 1.0; - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - - - - JTabbedPane jtp = new JTabbedPane(); - jtp.add("General", panel1); - //jtp.add("Prototyping", panel2); - //c.add(jtp, c0); - c.add(jtp, BorderLayout.CENTER); - - JPanel buttons = new JPanel(); - buttons.setLayout(gridbag0); - - c0.gridwidth = 1; - c0.gridheight = 1; - c0.fill = GridBagConstraints.HORIZONTAL; - closeButton = new JButton("Save and Close", IconManager.imgic25); - //closeButton.setPreferredSize(new Dimension(600, 50)); - - - closeButton.addActionListener(this); - buttons.add(closeButton, c0); - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - cancelButton = new JButton("Cancel", IconManager.imgic27); - cancelButton.addActionListener(this); - buttons.add(cancelButton, c0); - - c.add(buttons, BorderLayout.SOUTH); + int i; + + Container c = getContentPane(); + GridBagLayout gridbag0 = new GridBagLayout(); + GridBagLayout gridbag1 = new GridBagLayout(); + GridBagLayout gridbag2 = new GridBagLayout(); + GridBagConstraints c0 = new GridBagConstraints(); + GridBagConstraints c1 = new GridBagConstraints(); + GridBagConstraints c2 = new GridBagConstraints(); + + setFont(new Font("Helvetica", Font.PLAIN, 14)); + //c.setLayout(gridbag0); + c.setLayout(new BorderLayout()); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + panel1 = new JPanel(); + panel1.setLayout(gridbag1); + + panel1.setBorder(new javax.swing.border.TitledBorder("Transition parameters")); + + //panel1.setPreferredSize(new Dimension(350, 350)); + + // guard + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.gridwidth = 1; + c1.gridheight = 1; + c1.fill = GridBagConstraints.BOTH; + c1.gridheight = 1; + panel1.add(new JLabel("guard = "), c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + guardT = new JTextField(guard); + panel1.add(guardT, c1); + + // After + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + panel1.add(new JLabel("after ("), c1); + afterMinT = new JTextField(afterMin, 10); + panel1.add(afterMinT, c1); + panel1.add(new JLabel(","), c1); + afterMaxT = new JTextField(afterMax, 10); + panel1.add(afterMaxT, c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + panel1.add(new JLabel(")"), c1); + + // Compute + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + panel1.add(new JLabel("compute for ("), c1); + computeMinT = new JTextField(computeMin, 10); + panel1.add(computeMinT, c1); + panel1.add(new JLabel(","), c1); + computeMaxT = new JTextField(computeMax, 10); + panel1.add(computeMaxT, c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + panel1.add(new JLabel(")"), c1); + + + // actions + + elements = new JComboBox<String>(allElements); + panel1.add(elements, c1); + + insertElement = new JButton("Insert"); + insertElement.setEnabled(allElements.size() > 0); + insertElement.addActionListener(this); + panel1.add(insertElement, c1); + + c1.gridheight = 10; + c1.weighty = 10.0; + c1.weightx = 10.0; + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + c1.fill = GridBagConstraints.BOTH; + actionsT = new JTextArea(); + actionsT.setEditable(true); + actionsT.setMargin(new Insets(10, 10, 10, 10)); + actionsT.setTabSize(3); + actionsT.setFont(new Font("times", Font.PLAIN, 12)); + //actionsT.setPreferredSize(new Dimension(350, 250)); + JScrollPane jsp = new JScrollPane(actionsT, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + for(i=0; i<actions.size(); i++) { + actionsT.append(actions.get(i) + "\n"); + } + panel1.add(jsp, c1); + + + panel2 = new JPanel(); + panel2.setLayout(gridbag2); + + panel2.setBorder(new javax.swing.border.TitledBorder("Code")); + // guard + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.gridwidth = 1; + c2.gridheight = 1; + c2.fill = GridBagConstraints.BOTH; + c2.gridwidth = GridBagConstraints.REMAINDER; + c2.gridheight = 1; + panel2.add(new JLabel("Files to include:"), c2); + jtaFiles = new JTextArea(); + jtaFiles.setEditable(true); + jtaFiles.setMargin(new Insets(10, 10, 10, 10)); + jtaFiles.setTabSize(3); + String files = ""; + if (filesToInclude != null) { + for(i=0; i<filesToInclude.length; i++) { + files += filesToInclude[i] + "\n"; + } + } + jtaFiles.append(files); + jtaFiles.setFont(new Font("times", Font.PLAIN, 12)); + jsp = new JScrollPane(jtaFiles, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + //jsp.setPreferredSize(new Dimension(300, 300)); + panel2.add(jsp, c2); + panel2.add(new JLabel("Code to execute at the end of the transition"), c2); + jtaCode = new JTextArea(); + jtaCode.setEditable(true); + jtaCode.setMargin(new Insets(10, 10, 10, 10)); + jtaCode.setTabSize(3); + String code = ""; + if (codeToInclude != null) { + for(i=0; i<codeToInclude.length; i++) { + code += codeToInclude[i] + "\n"; + } + } + jtaCode.append(code); + jtaCode.setFont(new Font("times", Font.PLAIN, 12)); + jsp = new JScrollPane(jtaCode, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + //jsp.setPreferredSize(new Dimension(300, 300)); + panel2.add(jsp, c2); + + + // button panel; + c0.gridwidth = 1; + c0.gridheight = 10; + c0.weighty = 1.0; + c0.weightx = 1.0; + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + + // Issue #41 Ordering of tabbed panes + JTabbedPane jtp = GraphicLib.createTabbedPane();//new JTabbedPane(); + jtp.add("General", panel1); + //jtp.add("Prototyping", panel2); + //c.add(jtp, c0); + c.add(jtp, BorderLayout.CENTER); + + JPanel buttons = new JPanel(); + buttons.setLayout(gridbag0); + + c0.gridwidth = 1; + c0.gridheight = 1; + c0.fill = GridBagConstraints.HORIZONTAL; + closeButton = new JButton("Save and Close", IconManager.imgic25); + //closeButton.setPreferredSize(new Dimension(600, 50)); + + + closeButton.addActionListener(this); + buttons.add(closeButton, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + cancelButton = new JButton("Cancel", IconManager.imgic27); + cancelButton.addActionListener(this); + buttons.add(cancelButton, c0); + + c.add(buttons, BorderLayout.SOUTH); } + @Override public void actionPerformed(ActionEvent evt) { //String command = evt.getActionCommand(); diff --git a/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java b/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java index edc1e1c48f..f2762df03c 100755 --- a/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java +++ b/src/ui/window/JDialogAvatarddExecutableCodeGeneration.java @@ -117,7 +117,7 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame protected JTabbedPane jp1; protected JScrollPane jsp; protected JCheckBox removeCFiles, removeXFiles, debugmode, tracemode, optimizemode, putUserCode; - protected JComboBox versionCodeGenerator, units; + protected JComboBox<String> versionCodeGenerator, units; protected JButton showSimulationTrace,showOverflowStatus; private static int selectedUnit = 2; @@ -132,7 +132,7 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame private boolean hasError = false; protected boolean startProcess = false; - private AvatarRelation FIFO; + // private AvatarRelation FIFO; private String hostExecute; @@ -188,9 +188,9 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -267,14 +267,14 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame jp01.add(new JLabel("1 time unit ="), c01); - units = new JComboBox(unitTab); + units = new JComboBox<String>(unitTab); units.setSelectedIndex(selectedUnit); units.addActionListener(this); jp01.add(units, c01); jp01.add(new JLabel("Code generator used:"), c01); - versionCodeGenerator = new JComboBox(codes); + versionCodeGenerator = new JComboBox<String>(codes); // versionCodeGenerator.setSelectedIndex(selectedItem); versionCodeGenerator.addActionListener(this); jp01.add(versionCodeGenerator, c01); @@ -799,11 +799,14 @@ public class JDialogAvatarddExecutableCodeGeneration extends javax.swing.JFrame /*idealement il faudrait inclure un moyen de detecter l'OS sur lequel l'application est lancé car le script utilise la commande "acroread" qui ne fonctionne que sur linux. Ainsi ajouter un paramètre avec l'OS permetterais de générer la commande appropriée sur windows ou mac*/ - + // Use System.getProperty( "os.name" ); ProcessBuilder pb = new ProcessBuilder(commande);//Letitia Runtime.runtimexec() pb.redirectError(ProcessBuilder.Redirect.INHERIT); Process p = pb.start(); + + // FIXME: Should the return code be tested? int exitStatus = p.waitFor(); + } catch (InterruptedException e) { e.printStackTrace(); } catch (Exception e) { diff --git a/src/ui/window/JDialogCCodeGeneration.java b/src/ui/window/JDialogCCodeGeneration.java index e99422a1b0..82935498e0 100755 --- a/src/ui/window/JDialogCCodeGeneration.java +++ b/src/ui/window/JDialogCCodeGeneration.java @@ -207,7 +207,8 @@ public class JDialogCCodeGeneration extends javax.swing.JDialog implements Actio setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); diff --git a/src/ui/window/JDialogCPUNode.java b/src/ui/window/JDialogCPUNode.java index fd67aa1470..0aa5dc94d7 100755 --- a/src/ui/window/JDialogCPUNode.java +++ b/src/ui/window/JDialogCPUNode.java @@ -51,10 +51,8 @@ import java.math.*; import java.awt.event.*; import javax.swing.*; import ui.*; -import ui.tmlcd.*; import java.util.*; import tmltranslator.modelcompiler.*; -import ui.*; import ui.tmldd.*; import ui.interactivesimulation.*; @@ -62,23 +60,23 @@ import myutil.*; public class JDialogCPUNode extends javax.swing.JDialog implements ActionListener { //private static String[] tracemodeTab = {"vcd trace", "VCI logger", "VCI stats"}; - private static String[] tracemodeTab = {"VCI logger"}; +// private static String[] tracemodeTab = {"VCI logger"}; private boolean regularClose; private JPanel panel2, panel4, panel5; - private Frame frame; + // private Frame frame; private TMLArchiCPUNode node; private ArchUnitMEC MECType; - protected JComboBox tracemode; - private static int selectedTracemode = 0; + protected JComboBox<String> tracemode; + // private static int selectedTracemode = 0; // Panel1 protected JTextField nodeName; // Panel2 protected JTextField sliceTime, nbOfCores, byteDataSize, pipelineSize, goIdleTime, maxConsecutiveIdleCycles, taskSwitchingTime, branchingPredictionPenalty, cacheMiss, clockRatio, execiTime, execcTime, monitored; - protected JComboBox schedulingPolicy, MECTypeCB, encryption; + protected JComboBox<String> schedulingPolicy, MECTypeCB, encryption; // Tabbed pane for panel1 and panel2 private JTabbedPane tabbedPane; @@ -90,17 +88,17 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene /** Creates new form */ public JDialogCPUNode(Frame _frame, String _title, TMLArchiCPUNode _node, ArchUnitMEC _MECType, ArrayList<SimulationTransaction> _transactions) { super(_frame, _title, true); - frame = _frame; + // frame = _frame; node = _node; MECType = _MECType; transactions = _transactions; initComponents(); - myInitComponents(); + // myInitComponents(); pack(); } - - private void myInitComponents() { - } +// +// private void myInitComponents() { +// } private void initComponents() { Container c = getContentPane(); @@ -123,7 +121,8 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene panel2.setBorder(new javax.swing.border.TitledBorder("CPU attributes")); panel2.setPreferredSize(new Dimension(400, 300)); - tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); c2.gridwidth = 1; c2.gridheight = 1; @@ -145,7 +144,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene panel2.add(new JLabel("Scheduling policy:"), c2); c2.gridwidth = GridBagConstraints.REMAINDER; //end row - schedulingPolicy = new JComboBox(); + schedulingPolicy = new JComboBox<String>(); schedulingPolicy.addItem("Round Robin"); schedulingPolicy.addItem("Round Robin - Priority Based"); schedulingPolicy.setSelectedIndex(node.getSchedulingPolicy()); @@ -255,7 +254,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene c4.anchor = GridBagConstraints.CENTER;*/ panel4.add(new JLabel("Encryption:"), c4); c4.gridwidth = GridBagConstraints.REMAINDER; - encryption = new JComboBox(); + encryption = new JComboBox<String>(); encryption.addItem("None"); encryption.addItem("Software Encryption"); encryption.addItem("Hardware Security Module"); @@ -264,7 +263,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene c4.gridwidth = 1; panel4.add(new JLabel("CPU Extension Construct:"), c4); c4.gridwidth = GridBagConstraints.REMAINDER; //end row - MECTypeCB = new JComboBox( ArchUnitMEC.stringTypes ); + MECTypeCB = new JComboBox<String>( ArchUnitMEC.stringTypes ); if( MECType == null ) { MECTypeCB.setSelectedIndex( 0 ); } @@ -319,9 +318,9 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene return; }*/ - if (evt.getSource() == tracemode) { - selectedTracemode = tracemode.getSelectedIndex(); - } +// if (evt.getSource() == tracemode) { +// selectedTracemode = tracemode.getSelectedIndex(); +// } String command = evt.getActionCommand(); @@ -431,6 +430,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene return false; } } + class MyFrame extends JPanel implements MouseMotionListener, MouseListener{ Map<Range, String> toolMap = new HashMap<Range, String>(); public MyFrame(){ @@ -439,26 +439,41 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene addMouseMotionListener(this); addMouseListener(this); } + + @Override public void mouseDragged(MouseEvent e) { //do something } + + @Override public void mouseMoved(MouseEvent e){ drawToolTip(e); } + + @Override public void mouseClicked(MouseEvent e) { drawToolTip(e); } + + @Override public void mousePressed(MouseEvent e) { drawToolTip(e); } + + @Override public void mouseExited(MouseEvent e){ /// } + + @Override public void mouseReleased(MouseEvent e){ /// } + + @Override public void mouseEntered(MouseEvent e){ } + public void drawToolTip(MouseEvent e){ setToolTipText(null); @@ -480,7 +495,7 @@ public class JDialogCPUNode extends javax.swing.JDialog implements ActionListene int i=0; java.util.List<String> tasks=new ArrayList<String>(); Map<String, java.util.List<SimulationTransaction>> tasktrans = new HashMap<String, java.util.List<SimulationTransaction>>(); - double incr=0.0; + // double incr=0.0; BigDecimal maxtime = new BigDecimal("0"); BigDecimal mintime=new BigDecimal("9999999999999999999999999999"); //Colors diff --git a/src/ui/window/JDialogCommPatternMapping.java b/src/ui/window/JDialogCommPatternMapping.java index 812dd6b991..ef4be802f0 100644 --- a/src/ui/window/JDialogCommPatternMapping.java +++ b/src/ui/window/JDialogCommPatternMapping.java @@ -253,17 +253,9 @@ public class JDialogCommPatternMapping extends JDialog /* implements ActionListe pnlManageAttributes = new JPanel(); pnlManageAttributes.setLayout( new GridBagLayout() ); pnlManageAttributes.setBorder(new TitledBorder("Managing Attributes")); - //pnlManageAttributes.setPreferredSize(new Dimension(325, 250)); - tabbedPane = new JTabbedPane(); - - // first line panel1 -// c1.weighty = 1.0; -// c1.weightx = 1.0; -// c1.gridwidth = GridBagConstraints.REMAINDER; //end row -// c1.fill = GridBagConstraints.BOTH; -// c1.gridheight = 3; - //pnlComPatternStruct.add(new JLabel(" "), c1); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); // second line panel1 final int defaultMargin = 3; @@ -272,7 +264,6 @@ public class JDialogCommPatternMapping extends JDialog /* implements ActionListe final GridBagConstraints c1 = new GridBagConstraints(); c1.gridwidth = GridBagConstraints.REMAINDER; - //c1.gridheight = 1; c1.weighty = 0.0; c1.weightx = 1.0; c1.anchor = GridBagConstraints.CENTER; @@ -611,15 +602,9 @@ public class JDialogCommPatternMapping extends JDialog /* implements ActionListe c3.insets = lblInsets; pnlAttributeValues.add( new JLabel("Address Value"), c3 ); addressValue_TF = new JTextField( "", 5 ); -// addressValue_TF.setPreferredSize( new Dimension(150, 30) ); c3.insets = tfdInsets; pnlAttributeValues.add( addressValue_TF, c3 ); - //c3.gridwidth = GridBagConstraints.REMAINDER; //end row - //c3.fill = GridBagConstraints.BOTH; - // c3.gridheight = 3; - //pnlComPatternValues.add( new JLabel(" "), c3 ); //adds some vertical space in between two JLabels - addressButton = new JButton("Assign Address Value"); addressButton.addActionListener( new ActionListener() { diff --git a/src/ui/window/JDialogDSE.java b/src/ui/window/JDialogDSE.java index 9dbddb35af..4508a378fb 100644 --- a/src/ui/window/JDialogDSE.java +++ b/src/ui/window/JDialogDSE.java @@ -52,24 +52,18 @@ import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; -import java.io.*; import ui.*; -import ui.tmldd.*; import myutil.*; -import avatartranslator.*; import tmltranslator.*; -import ui.*; import dseengine.*; import launcher.*; - public class JDialogDSE extends javax.swing.JDialog implements ActionListener, ListSelectionListener, Runnable { protected MainGUI mgui; - protected static String pathCode; protected static String pathExecute; @@ -92,13 +86,13 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L protected JCheckBox autoConf, autoWeakAuth, autoStrongAuth, autoMapKeys, custom, outputTXT, outputHTML, addHSM; protected JTextField encTime, decTime, secOverhead; - protected JComboBox addtoCPU; + protected JComboBox<String> addtoCPU; protected JTextField tmlDirectory, mappingFile, modelFile, simulationThreads, resultsDirectory, simulationCycles, minCPU, maxCPU, simulationsPerMapping; protected JTextArea outputText; protected String output = ""; protected JCheckBox secAnalysis; protected JTextField encTime2, decTime2, secOverhead2; - HashMap<JCheckBox, ArrayList<JCheckBox>> cpuTaskObjs = new HashMap<JCheckBox, ArrayList<JCheckBox>>(); + Map<JCheckBox, ArrayList<JCheckBox>> cpuTaskObjs = new HashMap<JCheckBox, ArrayList<JCheckBox>>(); protected JSlider JSMinSimulationDuration, JSAverageSimulationDuration, JSMaxSimulationDuration, JSArchitectureComplexity, JSMinCPUUsage, JSAverageCPUUsage, JSMaxCPUUsage, JSMinBusUsage, JSAverageBusUsage, JSMaxBusUsage, JSMinBusContention, JSAverageBusContention, JSMaxBusContention; DSEConfiguration config; @@ -129,10 +123,10 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JPanel listPanel; private Thread t; private boolean go = false; - private boolean hasError = false; + // private boolean hasError = false; //protected boolean startProcess = false; JList<String> contraints; - private String hostProVerif; + // private String hostProVerif; protected RshClient rshc; @@ -172,8 +166,9 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -469,7 +464,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMinSimulationDuration = new JSlider(-10,10); JSMinSimulationDuration.setMinorTickSpacing(5); JSMinSimulationDuration.setMajorTickSpacing(1); - Hashtable labelTable = new Hashtable(); + Dictionary<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -488,7 +483,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSAverageSimulationDuration = new JSlider(-10,10); JSAverageSimulationDuration.setMinorTickSpacing(5); JSAverageSimulationDuration.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -506,7 +501,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMaxSimulationDuration = new JSlider(-10,10); JSMaxSimulationDuration.setMinorTickSpacing(5); JSMaxSimulationDuration.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -524,7 +519,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSArchitectureComplexity = new JSlider(-10,10); JSArchitectureComplexity.setMinorTickSpacing(5); JSArchitectureComplexity.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -542,7 +537,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMinCPUUsage = new JSlider(-10,10); JSMinCPUUsage.setMinorTickSpacing(5); JSMinCPUUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -560,7 +555,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSAverageCPUUsage = new JSlider(-10,10); JSAverageCPUUsage.setMinorTickSpacing(5); JSAverageCPUUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -578,7 +573,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMaxCPUUsage = new JSlider(-10,10); JSMaxCPUUsage.setMinorTickSpacing(5); JSMaxCPUUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -595,7 +590,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMinBusUsage = new JSlider(-10,10); JSMinBusUsage.setMinorTickSpacing(5); JSMinBusUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -613,7 +608,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSAverageBusUsage = new JSlider(-10,10); JSAverageBusUsage.setMinorTickSpacing(5); JSAverageBusUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -631,7 +626,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMaxBusUsage = new JSlider(-10,10); JSMaxBusUsage.setMinorTickSpacing(5); JSMaxBusUsage.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -648,7 +643,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSMinBusContention = new JSlider(-10,10); JSMinBusContention.setMinorTickSpacing(5); JSMinBusContention.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -665,7 +660,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L JSAverageBusContention = new JSlider(-10,10); JSAverageBusContention.setMinorTickSpacing(5); JSAverageBusContention.setMajorTickSpacing(1); - labelTable = new Hashtable(); + labelTable = new Hashtable<Integer, JLabel>(); labelTable.put(new Integer(-10), new JLabel("-1.0")); labelTable.put(new Integer(-5), new JLabel("-0.5")); labelTable.put(new Integer(0), new JLabel("0.0")); @@ -883,20 +878,20 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L go = true; t.start(); } - - private void testGo() throws InterruptedException { - if (go == false) { - throw new InterruptedException("Stopped by user"); - } - } +// +// private void testGo() throws InterruptedException { +// if (go == false) { +// throw new InterruptedException("Stopped by user"); +// } +// } public void run() { - String cmd; - String list, data; - int cycle = 0; + // String cmd; + // String list, data; + // int cycle = 0; output=""; - hasError = false; + // hasError = false; //try { mapFile = mappingFile.getText(); modFile = modelFile.getText(); @@ -908,7 +903,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L NbMaxCPU = maxCPU.getText(); Nbsim = simulationsPerMapping.getText(); TraceManager.addDev("Thread started"); - File testFile; + // File testFile; if (jp1.getSelectedIndex() == 0){ encCC=encTime.getText(); decCC=decTime.getText(); @@ -926,7 +921,8 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L // ArrayList<String> comps = new ArrayList<String>(); // comps.add(addToComp.getText()); - HashMap<String, ArrayList<String>> selectedCpuTasks = new HashMap<String, ArrayList<String>>(); + Map<String, java.util.List<String>> selectedCpuTasks = new HashMap<String, java.util.List<String>>(); + for (String task: selectedTasks){ String cpu = taskCpuMap.get(task); if (selectedCpuTasks.containsKey(cpu)){ @@ -969,7 +965,7 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L config.decComp = decCC; config.mainGUI = mgui; - TMLMapping map = mgui.gtm.getTMLMapping(); + // TMLMapping map = mgui.gtm.getTMLMapping(); if (config.setModelPath(tmlDir) != 0) { TraceManager.addDev("TML Directory file at " + tmlDir + " error"); @@ -1157,10 +1153,9 @@ public class JDialogDSE extends javax.swing.JDialog implements ActionListener, L public boolean hasToContinue() { return (go == true); } - - - public void setError() { - hasError = true; - } - +// +// public void setError() { +// hasError = true; +// } +// } diff --git a/src/ui/window/JDialogInvariantAnalysis.java b/src/ui/window/JDialogInvariantAnalysis.java index e47595492f..23bffefe93 100644 --- a/src/ui/window/JDialogInvariantAnalysis.java +++ b/src/ui/window/JDialogInvariantAnalysis.java @@ -50,17 +50,13 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; import java.util.*; import myutil.*; -import avatartranslator.totpn.*; import avatartranslator.*; import tpndescription.*; import ui.*; import ui.avatarsmd.*; -import launcher.*; -//import frompipe.*; public class JDialogInvariantAnalysis extends javax.swing.JDialog implements ActionListener, Runnable { @@ -92,7 +88,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act private Thread t; private boolean go = false; - private boolean hasError = false; +// private boolean hasError = false; protected boolean startProcess = false; private IntMatrix im; @@ -123,9 +119,9 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act setFont(new Font("Helvetica", Font.PLAIN, 14)); Font f = new Font("Courrier", Font.BOLD, 12); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel panelCompute = new JPanel(new BorderLayout()); JPanel panelCheck = new JPanel(new BorderLayout()); @@ -491,7 +487,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act percS = String.format("%.2f", perc/100); //TraceManager.addDev("PercS=" + percS); info.setText(percS+" %, matrix:" + im.sizeRow + "x" + im.sizeColumn); - Thread.currentThread().sleep(100); + Thread.sleep(100); if (im.isFinished()) { cont = false; } @@ -534,12 +530,12 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act AvatarBlock ab = null; AvatarBlock ab1, ab2; Object o; - int state; + // int state; int valToken = 0; boolean sameBlock; AvatarBlock prevBlock, prevBlock1; - int ignored = 0; + // int ignored = 0; TGComponent tgc1, tgc2; int valLine; @@ -586,7 +582,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act // Putting components - state = 0; + // state = 0; for(int j=0; j<elts.length; j++) { tmp = elts[j].trim(); @@ -736,7 +732,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act } else { //TraceManager.addDev("Invariant ignored " + inv); jtainvariants.append("Ignored invariant: " + inv + "\n"); - ignored ++; + // ignored ++; } } @@ -745,7 +741,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act public void run() { TPN tpn; - hasError = false; + // hasError = false; TraceManager.addDev("Thread started"); @@ -771,7 +767,7 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act jta.append("Computing incidence matrix\n"); im = tpn.getIncidenceMatrix(); - int nbOfColumn = im.sizeColumn; + // int nbOfColumn = im.sizeColumn; if ((im.sizeRow < 100) && (im.sizeColumn<100)) { jtamatrix.append("Incidence matrix: " + im.sizeRow + "x" + im.sizeColumn +"\n" + im.toString() + "\n\n"); } else { @@ -879,8 +875,8 @@ public class JDialogInvariantAnalysis extends javax.swing.JDialog implements Act public boolean hasToContinue() { return (go == true); } - - public void setError() { - hasError = true; - } +// +// public void setError() { +// hasError = true; +// } } diff --git a/src/ui/window/JDialogJavaGeneration.java b/src/ui/window/JDialogJavaGeneration.java index 3058debb3b..bf4836f832 100755 --- a/src/ui/window/JDialogJavaGeneration.java +++ b/src/ui/window/JDialogJavaGeneration.java @@ -154,9 +154,9 @@ public class JDialogJavaGeneration extends javax.swing.JDialog implements Action Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -470,10 +470,10 @@ public class JDialogJavaGeneration extends javax.swing.JDialog implements Action pt = new ProcessThread(cmd, this); pt.start(); - Thread.currentThread().sleep(250); + Thread.sleep(250); while(pt.isStarted() == true) { - Thread.currentThread().sleep(250); + Thread.sleep(250); } jta.append("Compilation done\n"); @@ -489,10 +489,10 @@ public class JDialogJavaGeneration extends javax.swing.JDialog implements Action pt = new ProcessThread(cmd, this); pt.start(); - Thread.currentThread().sleep(250); + Thread.sleep(250); while(pt.isStarted() == true) { - Thread.currentThread().sleep(250); + Thread.sleep(250); } jta.append("Execution done\n"); diff --git a/src/ui/window/JDialogJavaSimulation.java b/src/ui/window/JDialogJavaSimulation.java index d1088719d1..1357ba44e6 100755 --- a/src/ui/window/JDialogJavaSimulation.java +++ b/src/ui/window/JDialogJavaSimulation.java @@ -147,9 +147,8 @@ public class JDialogJavaSimulation extends javax.swing.JDialog implements Action Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -157,12 +156,6 @@ public class JDialogJavaSimulation extends javax.swing.JDialog implements Action jp01.setLayout(gridbag01); jp01.setBorder(new javax.swing.border.TitledBorder("Code generation")); - //JPanel jp02 = new JPanel(); - //GridBagLayout gridbag02 = new GridBagLayout(); - //GridBagConstraints c02 = new GridBagConstraints(); - //jp02.setLayout(gridbag02); - //jp02.setBorder(new javax.swing.border.TitledBorder("Compilation")); - JPanel jp03 = new JPanel(); GridBagLayout gridbag03 = new GridBagLayout(); GridBagConstraints c03 = new GridBagConstraints(); @@ -418,10 +411,10 @@ public class JDialogJavaSimulation extends javax.swing.JDialog implements Action pt = new ProcessThread(cmd, this); pt.start(); - Thread.currentThread().sleep(250); + Thread.sleep(250); while(pt.isStarted() == true) { - Thread.currentThread().sleep(250); + Thread.sleep(250); } jta.append("Simluation environment compiled\n"); @@ -437,10 +430,10 @@ public class JDialogJavaSimulation extends javax.swing.JDialog implements Action pt = new ProcessThread(cmd, this); pt.start(); - Thread.currentThread().sleep(250); + Thread.sleep(250); while(pt.isStarted() == true) { - Thread.currentThread().sleep(250); + Thread.sleep(250); } jta.append("Simulation done\n"); diff --git a/src/ui/window/JDialogLinkNode.java b/src/ui/window/JDialogLinkNode.java index 6d2908609d..7452c06127 100755 --- a/src/ui/window/JDialogLinkNode.java +++ b/src/ui/window/JDialogLinkNode.java @@ -50,6 +50,9 @@ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; + +import myutil.GraphicLib; + import java.util.*; import ui.*; @@ -58,7 +61,8 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen private String delay, lossRate; private int implementation, oport, dport; - private Vector lothers, rothers, associations; + private Vector<ArtifactTClassGate> lothers, rothers; + private Vector<LRArtifactTClassGate> associations; private boolean cancel = false; private JPanel panel1, panel2, panel3, panel4, panel5; @@ -68,13 +72,13 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen // Panels2 String[] impStrings = { "None", "UDP", "TCP", "RMI" }; - JComboBox jimp; + JComboBox<String> jimp; JTextField joport, jdport; // Panels 3, 4 and 5 - JComboBox gatesBox1, gatesBox2; + JComboBox<ArtifactTClassGate> gatesBox1, gatesBox2; JButton addButton, upButton, downButton, removeButton; - JList listGates; + JList<LRArtifactTClassGate> listGates; // Main Panel @@ -84,7 +88,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen //private String id1, id2; /** Creates new form */ - public JDialogLinkNode(Frame f, String _delay, String _lossRate, int _implementation, int _oport, int _dport, Vector _lothers, Vector _rothers, Vector _associations) { + public JDialogLinkNode(Frame f, String _delay, String _lossRate, int _implementation, int _oport, int _dport, Vector<ArtifactTClassGate> _lothers, Vector<ArtifactTClassGate> _rothers, Vector<LRArtifactTClassGate> _associations) { super(f, "Setting link's properties", true); @@ -95,9 +99,9 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen dport = _dport; // Danger -> vectors should be duplicated - lothers = new Vector(_lothers); - rothers = new Vector(_rothers); - associations = new Vector(_associations); + lothers = new Vector<ArtifactTClassGate>(_lothers); + rothers = new Vector<ArtifactTClassGate>(_rothers); + associations = new Vector<LRArtifactTClassGate>(_associations); initComponents(); myInitComponents(); @@ -111,8 +115,9 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen } private void initComponents() { - JTabbedPane tabbedPane = new JTabbedPane(); - //tabbedPane.setPreferredSize(new Dimension(550, 400)); + + // Issue #41 Ordering of tabbed panes + JTabbedPane tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); @@ -120,13 +125,11 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen GridBagLayout gridbag2 = new GridBagLayout(); GridBagLayout gridbag3 = new GridBagLayout(); GridBagLayout gridbag4 = new GridBagLayout(); - //GridBagLayout gridbag5 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints(); GridBagConstraints c2 = new GridBagConstraints(); GridBagConstraints c3 = new GridBagConstraints(); GridBagConstraints c4 = new GridBagConstraints(); - //GridBagConstraints c5 = new GridBagConstraints(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(gridbag0); @@ -197,7 +200,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen c2.fill = GridBagConstraints.HORIZONTAL; panel2.add(new JLabel("Implementation = "), c2); c2.gridwidth = GridBagConstraints.REMAINDER; //end row - jimp = new JComboBox(impStrings); + jimp = new JComboBox<String>(impStrings); jimp.setSelectedIndex(implementation); jimp.addActionListener(this); panel2.add(jimp, c1); @@ -256,13 +259,13 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen c3.fill = GridBagConstraints.HORIZONTAL; c3.anchor = GridBagConstraints.CENTER; - gatesBox1 = new JComboBox(); + gatesBox1 = new JComboBox<ArtifactTClassGate>(); panel3.add(gatesBox1, c3); c3.gridwidth = 1; panel3.add(new JLabel(" = "), c3); c3.gridwidth = GridBagConstraints.REMAINDER; //end row - gatesBox2 = new JComboBox(); + gatesBox2 = new JComboBox<ArtifactTClassGate>(); panel3.add(gatesBox2, c3); // third line panel3 @@ -279,7 +282,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen panel3.add(addButton, c3); // 1st line panel4 - listGates = new JList(associations); + listGates = new JList<LRArtifactTClassGate>(associations); listGates.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listGates.addListSelectionListener(this); JScrollPane scrollPane = new JScrollPane(listGates); @@ -426,7 +429,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen public void downSynchro() { int i = listGates.getSelectedIndex(); if ((i!= -1) && (i != associations.size() - 1)) { - Object o = associations.elementAt(i); + LRArtifactTClassGate o = associations.elementAt(i); associations.removeElementAt(i); associations.insertElementAt(o, i+1); listGates.setListData(associations); @@ -437,7 +440,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen public void upSynchro() { int i = listGates.getSelectedIndex(); if (i > 0) { - Object o = associations.elementAt(i); + LRArtifactTClassGate o = associations.elementAt(i); associations.removeElementAt(i); associations.insertElementAt(o, i-1); listGates.setListData(associations); @@ -492,7 +495,7 @@ public class JDialogLinkNode extends javax.swing.JDialog implements ActionListen return dport; } - public Vector getAssociations() { + public Vector<LRArtifactTClassGate> getAssociations() { return associations; } diff --git a/src/ui/window/JDialogMemoryNode.java b/src/ui/window/JDialogMemoryNode.java index e8b2f12c29..356079a6b7 100755 --- a/src/ui/window/JDialogMemoryNode.java +++ b/src/ui/window/JDialogMemoryNode.java @@ -49,6 +49,9 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; + +import myutil.GraphicLib; + //import javax.swing.event.*; import java.util.*; @@ -64,10 +67,10 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList private boolean regularClose; private JPanel panel2, panel3; - private Frame frame; + // private Frame frame; private TMLArchiMemoryNode node; - protected JComboBox tracemode; + protected JComboBox<String> tracemode; private static int selectedTracemode = 0; // Panel1 @@ -78,7 +81,7 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList //Panel3: code generation protected int bufferType = 0; //it is the index in the ArrayList of String - protected JComboBox bufferTypesCB; + protected JComboBox<String> bufferTypesCB; private JTabbedPane tabbedPane; @@ -89,7 +92,7 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList /** Creates new form */ public JDialogMemoryNode( Frame _frame, String _title, TMLArchiMemoryNode _node, int _bufferType ) { super(_frame, _title, true); - frame = _frame; + // frame = _frame; node = _node; bufferType = _bufferType; @@ -104,7 +107,7 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList private void initComponents() { Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); + // GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag2 = new GridBagLayout(); GridBagLayout gridbag3 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); @@ -117,7 +120,8 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); panel2 = new JPanel(); panel2.setLayout(gridbag2); @@ -154,9 +158,7 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList c2.gridwidth = 1; panel2.add(new JLabel("Monitored:"), c2); - //c2.gridwidth = GridBagConstraints.REMAINDER; //end row - //monitored = new JTextField(""+node.getMonitored(), 15);//DG 19.04. - tracemode = new JComboBox(tracemodeTab); + tracemode = new JComboBox<String>(tracemodeTab); tracemode.setSelectedIndex(selectedTracemode); tracemode.addActionListener(this); panel2.add(tracemode, c2); @@ -177,7 +179,7 @@ public class JDialogMemoryNode extends javax.swing.JDialog implements ActionList c3.weightx = 1.0; panel3.add(new JLabel("<html>Memory Extension<br>Construct:</html>"), c3); c3.gridwidth = GridBagConstraints.REMAINDER; //end row - bufferTypesCB = new JComboBox( new Vector<String>( Arrays.asList( Buffer.memoryTypesList ) ) ); + bufferTypesCB = new JComboBox<String>( new Vector<String>( Arrays.asList( Buffer.memoryTypesList ) ) ); bufferTypesCB.setSelectedIndex( bufferType ); panel3.add( bufferTypesCB, c3 ); diff --git a/src/ui/window/JDialogPortArtifact.java b/src/ui/window/JDialogPortArtifact.java index 792787025f..0998fcf944 100755 --- a/src/ui/window/JDialogPortArtifact.java +++ b/src/ui/window/JDialogPortArtifact.java @@ -58,8 +58,6 @@ import ui.*; import ui.tmldd.*; import tmltranslator.modelcompiler.*; -import myutil.*; - public class JDialogPortArtifact extends javax.swing.JDialog implements ActionListener { @@ -71,20 +69,20 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private TMLArchiPortArtifact artifact; private String mappedMemory = "VOID"; - protected JComboBox mappedPortCB, memoryCB; + protected JComboBox<String> mappedPortCB, memoryCB; protected JTextField baseAddressTF, numSamplesTF, bitsPerSymbolTF; protected String baseAddress, mappedPort, sampleLength, numSamples, bitsPerSymbol; protected String bank, dataType, symmetricalValue; - protected JComboBox dataTypeCB, bankCB, symmetricalValueCB; + protected JComboBox<String> dataTypeCB, bankCB, symmetricalValueCB; //Intl Data In protected JTextField widthIntl_TF, bitInOffsetIntl_TF, inputOffsetIntl_TF; protected String widthIntl, bitInOffsetIntl, inputOffsetIntl, packedBinaryInIntl; - protected JComboBox packedBinaryInIntl_CB; + protected JComboBox<String> packedBinaryInIntl_CB; //Intl Data Out protected JTextField bitOutOffsetIntl_TF, outputOffsetIntl_TF; - protected JComboBox packedBinaryOutIntl_CB; + protected JComboBox<String> packedBinaryOutIntl_CB; protected String packedBinaryOutIntl, bitOutOffsetIntl, outputOffsetIntl; //Intl Perm @@ -94,7 +92,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi //Mapper Data In protected JTextField baseAddressDataInMapp_TF, numSamplesDataInMapp_TF, bitsPerSymbolDataInMapp_TF; protected String baseAddressDataInMapp, numSamplesDataInMapp, bitsPerSymbolDataInMapp, symmetricalValueDataInMapp; - protected JComboBox symmetricalValueDataInMapp_CB; + protected JComboBox<String> symmetricalValueDataInMapp_CB; //Mapper Data Out protected JTextField baseAddressDataOutMapp_TF; protected String baseAddressDataOutMapp; @@ -107,11 +105,11 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private JButton cancelButton; //Code generation - private JPanel panel3, panel4, panel5; - private JTabbedPane tabbedPane; + private JPanel panel3;//, panel4, panel5; + //private JTabbedPane tabbedPane; private String HALUnitName = ""; private Vector<String> portsList; - private String appName = ""; + //private String appName = ""; /** Creates new form */ public JDialogPortArtifact(Frame _frame, String _title, TMLArchiPortArtifact _artifact, String _mappedMemory, Vector<String> _portsList, String _mappedPort ) { @@ -121,7 +119,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi mappedMemory = _mappedMemory; portsList = _portsList; mappedPort = _mappedPort; - appName = mappedPort.split("::")[0]; + //appName = mappedPort.split("::")[0]; initComponents(); pack(); } @@ -130,7 +128,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi Container c = getContentPane(); GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); + //GridBagLayout gridbag1 = new GridBagLayout(); GridBagLayout gridbag2 = new GridBagLayout(); GridBagConstraints c0 = new GridBagConstraints(); GridBagConstraints c1 = new GridBagConstraints(); @@ -151,9 +149,10 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi panel3.setBorder(new javax.swing.border.TitledBorder("Code generation: memory configuration")); panel3.setPreferredSize(new Dimension(650, 350)); - tabbedPane = new JTabbedPane(); - panel4 = new JPanel(); - panel5 = new JPanel(); + // Issue #41 Ordering of tabbed panes + // tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + //panel4 = new JPanel(); + // panel5 = new JPanel(); c1.gridwidth = 1; c1.gridheight = 1; @@ -170,14 +169,14 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi mappedPortIndex = portsList.indexOf( mappedPort ); } - mappedPortCB = new JComboBox( portsList ); + mappedPortCB = new JComboBox<String>( portsList ); mappedPortCB.setSelectedIndex( mappedPortIndex ); panel2.add( new JLabel( "Port:" ), c2 ); mappedPortCB.addActionListener(this); panel2.add( mappedPortCB, c1 ); //Make the list of memories that are available for being mapped - List componentList = artifact.getTDiagramPanel().getComponentList(); + List<TGComponent> componentList = artifact.getTDiagramPanel().getComponentList(); Vector<String> memoryList = new Vector<String>(); for( int k = 0; k < componentList.size(); k++ ) { if( componentList.get(k) instanceof TMLArchiMemoryNode ) { @@ -188,7 +187,7 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi memoryList.add( "No available memory" ); } - memoryCB = new JComboBox( memoryList ); + memoryCB = new JComboBox<String>( memoryList ); if( !mappedMemory.equals( "VOID" ) && !mappedMemory.equals( "" ) ) { memoryCB.setSelectedIndex( memoryList.indexOf( mappedMemory ) ); } @@ -222,8 +221,8 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi private String getBufferTypeFromSelectedMemory( String mappedMemory ) { - List componentList = artifact.getTDiagramPanel().getComponentList(); - Vector<String> list = new Vector<String>(); + List<TGComponent> componentList = artifact.getTDiagramPanel().getComponentList(); + //Vector<String> list = new Vector<String>(); for( int k = 0; k < componentList.size(); k++ ) { if( componentList.get(k) instanceof TMLArchiMemoryNode ) { @@ -249,66 +248,66 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi cancelDialog(); } } - - private void updateBufferPanel() { - - GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); - - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - c1.fill = GridBagConstraints.HORIZONTAL; - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - - //flushBuffersStrings(); - HALUnitName = getBufferTypeFromSelectedMemory( (String)memoryCB.getItemAt( memoryCB.getSelectedIndex() ) ); - ArrayList<JPanel> panelsList; - - switch( HALUnitName ) { - case "FEP_BUFFER": - tabbedPane.removeAll(); - panelsList = FepBuffer.makePanel( c1, c2 ); - panel3 = panelsList.get(0); - tabbedPane.addTab( "Data", panel3 ); - break; - case "MAPPER_BUFFER": - tabbedPane.removeAll(); - panelsList = MapperBuffer.makePanel( c1, c2 ); - tabbedPane.addTab( "Data In", panelsList.get(0) ); - tabbedPane.addTab( "Data Out", panelsList.get(1) ); - tabbedPane.addTab( "Look Up Table", panelsList.get(2) ); - tabbedPane.setSelectedIndex(0); - break; - case "ADAIF_BUFFER": - tabbedPane.removeAll(); - panelsList = AdaifBuffer.makePanel( c1, c2 ); - panel3 = panelsList.get(0); - tabbedPane.addTab( "Data", panel3 ); - break; - case "INTERLEAVER_BUFFER": - tabbedPane.removeAll(); - panelsList = InterleaverBuffer.makePanel( c1, c2 ); - tabbedPane.addTab( "Data In", panelsList.get(0) ); - tabbedPane.addTab( "Data Out", panelsList.get(1) ); - tabbedPane.addTab( "Permutation Table", panelsList.get(2) ); - tabbedPane.setSelectedIndex(0); - break; - case "MAIN_MEMORY_BUFFER": - tabbedPane.removeAll(); - panelsList = MMBuffer.makePanel( c1, c2 ); - panel3 = panelsList.get(0); - tabbedPane.addTab( "Data", panel3 ); - break; - default: //the main memory buffer - tabbedPane.removeAll(); - panelsList = FepBuffer.makePanel( c1, c2 ); - panel3 = panelsList.get(0); - tabbedPane.addTab( "Data", panel3 ); - break; - } - } +// +// private void updateBufferPanel() { +// +// GridBagConstraints c1 = new GridBagConstraints(); +// GridBagConstraints c2 = new GridBagConstraints(); +// +// c1.gridwidth = 1; +// c1.gridheight = 1; +// c1.weighty = 1.0; +// c1.weightx = 1.0; +// c1.fill = GridBagConstraints.HORIZONTAL; +// c1.gridwidth = GridBagConstraints.REMAINDER; //end row +// +// //flushBuffersStrings(); +// HALUnitName = getBufferTypeFromSelectedMemory( (String)memoryCB.getItemAt( memoryCB.getSelectedIndex() ) ); +// ArrayList<JPanel> panelsList; +// +// switch( HALUnitName ) { +// case "FEP_BUFFER": +// tabbedPane.removeAll(); +// panelsList = FepBuffer.makePanel( c1, c2 ); +// panel3 = panelsList.get(0); +// tabbedPane.addTab( "Data", panel3 ); +// break; +// case "MAPPER_BUFFER": +// tabbedPane.removeAll(); +// panelsList = MapperBuffer.makePanel( c1, c2 ); +// tabbedPane.addTab( "Data In", panelsList.get(0) ); +// tabbedPane.addTab( "Data Out", panelsList.get(1) ); +// tabbedPane.addTab( "Look Up Table", panelsList.get(2) ); +// tabbedPane.setSelectedIndex(0); +// break; +// case "ADAIF_BUFFER": +// tabbedPane.removeAll(); +// panelsList = AdaifBuffer.makePanel( c1, c2 ); +// panel3 = panelsList.get(0); +// tabbedPane.addTab( "Data", panel3 ); +// break; +// case "INTERLEAVER_BUFFER": +// tabbedPane.removeAll(); +// panelsList = InterleaverBuffer.makePanel( c1, c2 ); +// tabbedPane.addTab( "Data In", panelsList.get(0) ); +// tabbedPane.addTab( "Data Out", panelsList.get(1) ); +// tabbedPane.addTab( "Permutation Table", panelsList.get(2) ); +// tabbedPane.setSelectedIndex(0); +// break; +// case "MAIN_MEMORY_BUFFER": +// tabbedPane.removeAll(); +// panelsList = MMBuffer.makePanel( c1, c2 ); +// panel3 = panelsList.get(0); +// tabbedPane.addTab( "Data", panel3 ); +// break; +// default: //the main memory buffer +// tabbedPane.removeAll(); +// panelsList = FepBuffer.makePanel( c1, c2 ); +// panel3 = panelsList.get(0); +// tabbedPane.addTab( "Data", panel3 ); +// break; +// } +// } public void closeDialog() { @@ -449,21 +448,21 @@ public class JDialogPortArtifact extends javax.swing.JDialog implements ActionLi } return params; } - - private void cleanPanels() { - panel3.removeAll(); - panel4.removeAll(); - panel5.removeAll(); - tabbedPane.removeAll(); - } - - private void revalidateAndRepaintPanels() { - panel3.revalidate(); - panel3.repaint(); - panel4.revalidate(); - panel4.repaint(); - panel5.revalidate(); - panel5.repaint(); - } +// +// private void cleanPanels() { +// panel3.removeAll(); +// panel4.removeAll(); +// panel5.removeAll(); +// tabbedPane.removeAll(); +// } + +// private void revalidateAndRepaintPanels() { +// panel3.revalidate(); +// panel3.repaint(); +// panel4.revalidate(); +// panel4.repaint(); +// panel5.revalidate(); +// panel5.repaint(); +// } } //End of class diff --git a/src/ui/window/JDialogProVerifGeneration.java b/src/ui/window/JDialogProVerifGeneration.java index d507aa886b..48ccc201ec 100644 --- a/src/ui/window/JDialogProVerifGeneration.java +++ b/src/ui/window/JDialogProVerifGeneration.java @@ -50,12 +50,9 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; -import java.util.*; import java.io.*; import myutil.*; -import avatartranslator.toproverif.*; import avatartranslator.*; import proverifspec.*; import ui.*; @@ -99,7 +96,7 @@ public class JDialogProVerifGeneration extends javax.swing.JDialog implements Ac protected JCheckBox outputOfProVerif, typedLanguage; protected JRadioButton stateReachabilityAll, stateReachabilitySelected, stateReachabilityNone; protected ButtonGroup stateReachabilityGroup; - protected JComboBox versionSimulator; + protected JComboBox<String> versionSimulator; private Thread t; private boolean go = false; @@ -147,7 +144,8 @@ public class JDialogProVerifGeneration extends javax.swing.JDialog implements Ac c.setLayout(new BorderLayout()); //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -344,8 +342,8 @@ public class JDialogProVerifGeneration extends javax.swing.JDialog implements Ac public void run() { String cmd; - String list, data; - int cycle = 0; + String /*list,*/ data; + // int cycle = 0; hasError = false; @@ -380,7 +378,7 @@ public class JDialogProVerifGeneration extends javax.swing.JDialog implements Ac if (mgui.gtm.generateProVerifFromAVATAR(pathCode, stateReachabilityAll.isSelected () ? REACHABILITY_ALL : stateReachabilitySelected.isSelected () ? REACHABILITY_SELECTED : REACHABILITY_NONE, typedLanguage.isSelected(), loopLimit.getText())) { jta.append("ProVerif code generation done\n"); } else { - setError(); + setError(); jta.append("Could not generate proverif code\n"); } diff --git a/src/ui/window/JDialogSystemCGeneration.java b/src/ui/window/JDialogSystemCGeneration.java index ab5c1485ca..05c700e2e2 100755 --- a/src/ui/window/JDialogSystemCGeneration.java +++ b/src/ui/window/JDialogSystemCGeneration.java @@ -261,9 +261,9 @@ public class JDialogSystemCGeneration extends javax.swing.JDialog implements Act Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - tabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); diff --git a/src/ui/window/JDialogTMLTaskArtifact.java b/src/ui/window/JDialogTMLTaskArtifact.java index 0c496f29dc..6f7b257650 100755 --- a/src/ui/window/JDialogTMLTaskArtifact.java +++ b/src/ui/window/JDialogTMLTaskArtifact.java @@ -58,19 +58,19 @@ import tmltranslator.modelcompiler.*; import myutil.*; -public class JDialogTMLTaskArtifact extends javax.swing.JDialog implements ActionListener { +public class JDialogTMLTaskArtifact extends javax.swing.JDialog implements ActionListener { private boolean regularClose; private boolean emptyList = false; - private JPanel panel2, panel3; - private Frame frame; - private TMLArchiArtifact artifact; + private JPanel panel2, panel3; + // private Frame frame; + private TMLArchiArtifact artifact; private String operation = "VOID"; private ArchUnitMEC MECType; //protected JTextField taskName; - protected JComboBox referenceTaskName, priority, operationsListCB; + protected JComboBox<String> referenceTaskName, priority, operationsListCB; private JTabbedPane tabbedPane; @@ -81,152 +81,154 @@ public class JDialogTMLTaskArtifact extends javax.swing.JDialog implements Actio /** Creates new form */ public JDialogTMLTaskArtifact(Frame _frame, String _title, TMLArchiArtifact _artifact, String _operation, ArchUnitMEC _MECType) { super(_frame, _title, true); - frame = _frame; + //frame = _frame; artifact = _artifact; - operation = _operation; - MECType = _MECType; + operation = _operation; + MECType = _MECType; initComponents(); - myInitComponents(); + // myInitComponents(); pack(); } - - private void myInitComponents() { - } - +// +// private void myInitComponents() { +// } +// private void initComponents() { - Container c = getContentPane(); - GridBagLayout gridbag0 = new GridBagLayout(); - GridBagLayout gridbag1 = new GridBagLayout(); - GridBagLayout gridbag2 = new GridBagLayout(); - GridBagLayout gridbag3 = new GridBagLayout(); - GridBagConstraints c0 = new GridBagConstraints(); - GridBagConstraints c1 = new GridBagConstraints(); - GridBagConstraints c2 = new GridBagConstraints(); - GridBagConstraints c3 = new GridBagConstraints(); - - setFont(new Font("Helvetica", Font.PLAIN, 14)); - c.setLayout(gridbag0); - - setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - - panel2 = new JPanel(); - panel2.setLayout(gridbag2); - panel2.setBorder(new javax.swing.border.TitledBorder("Artifact attributes")); - panel2.setPreferredSize(new Dimension(350, 250)); + Container c = getContentPane(); + GridBagLayout gridbag0 = new GridBagLayout(); + // GridBagLayout gridbag1 = new GridBagLayout(); + GridBagLayout gridbag2 = new GridBagLayout(); + GridBagLayout gridbag3 = new GridBagLayout(); + GridBagConstraints c0 = new GridBagConstraints(); + GridBagConstraints c1 = new GridBagConstraints(); + //GridBagConstraints c2 = new GridBagConstraints(); + GridBagConstraints c3 = new GridBagConstraints(); - tabbedPane = new JTabbedPane(); - - c1.gridwidth = 1; - c1.gridheight = 1; - c1.weighty = 1.0; - c1.weightx = 1.0; - c1.fill = GridBagConstraints.HORIZONTAL; - panel2.add(new JLabel("Task:"), c1); - c1.gridwidth = GridBagConstraints.REMAINDER; //end row - Vector<String> list = artifact.getTDiagramPanel().getMGUI().getAllNonMappedTMLTaskNames((TMLArchiDiagramPanel)(artifact.getTDiagramPanel()), artifact.getReferenceTaskName(), artifact.getTaskName()); - int index = 0; - if (list.size() == 0) { - list.add("No more task to map"); - emptyList = true; - } else { - index = indexOf(list, artifact.getValue()); - } - referenceTaskName = new JComboBox(list); - referenceTaskName.setSelectedIndex(index); - //referenceTaskName.setEditable(true); - //referenceTaskName.setFont(new Font("times", Font.PLAIN, 12)); - panel2.add(referenceTaskName, c1); - - list = new Vector<String>(); - for(int i=0; i<11; i++) { - list.add(""+i); - } - c1.gridwidth = 1;//GridBagConstraints.REMAINDER; //end row - panel2.add(new JLabel("Priority:"), c1); + setFont(new Font("Helvetica", Font.PLAIN, 14)); + c.setLayout(gridbag0); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + + panel2 = new JPanel(); + panel2.setLayout(gridbag2); + panel2.setBorder(new javax.swing.border.TitledBorder("Artifact attributes")); + panel2.setPreferredSize(new Dimension(350, 250)); + + // Issue #41 Ordering of tabbed panes + tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); + + c1.gridwidth = 1; + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + c1.fill = GridBagConstraints.HORIZONTAL; + panel2.add(new JLabel("Task:"), c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + Vector<String> list = artifact.getTDiagramPanel().getMGUI().getAllNonMappedTMLTaskNames((TMLArchiDiagramPanel)(artifact.getTDiagramPanel()), artifact.getReferenceTaskName(), artifact.getTaskName()); + int index = 0; + if (list.size() == 0) { + list.add("No more task to map"); + emptyList = true; + } else { + index = indexOf(list, artifact.getValue()); + } + referenceTaskName = new JComboBox<String>(list); + referenceTaskName.setSelectedIndex(index); + //referenceTaskName.setEditable(true); + //referenceTaskName.setFont(new Font("times", Font.PLAIN, 12)); + panel2.add(referenceTaskName, c1); + + list = new Vector<String>(); + for(int i=0; i<11; i++) { + list.add(""+i); + } + c1.gridwidth = 1;//GridBagConstraints.REMAINDER; //end row + panel2.add(new JLabel("Priority:"), c1); //c1.gridwidth = GridBagConstraints.REMAINDER; //end row - priority = new JComboBox(list); - priority.setSelectedIndex(artifact.getPriority()); - panel2.add(priority, c1); - - panel3 = new JPanel(); - panel3.setLayout(gridbag3); - panel3.setBorder(new javax.swing.border.TitledBorder("Code generation")); - panel3.setPreferredSize(new Dimension(350, 250)); - c3.gridwidth = 1; + priority = new JComboBox<String>(list); + priority.setSelectedIndex(artifact.getPriority()); + panel2.add(priority, c1); + + panel3 = new JPanel(); + panel3.setLayout(gridbag3); + panel3.setBorder(new javax.swing.border.TitledBorder("Code generation")); + panel3.setPreferredSize(new Dimension(350, 250)); + c3.gridwidth = 1; c3.gridheight = 1; - c3.weighty = 1.0; - c3.weightx = 1.0; + c3.weighty = 1.0; + c3.weightx = 1.0; c3.fill = GridBagConstraints.HORIZONTAL; - //c3.gridwidth = GridBagConstraints.REMAINDER; //end row - panel3.add(new JLabel("<html>Task Extension<br>Construct:</html>"), c3); + //c3.gridwidth = GridBagConstraints.REMAINDER; //end row + panel3.add(new JLabel("<html>Task Extension<br>Construct:</html>"), c3); c3.gridwidth = GridBagConstraints.REMAINDER; //end row - Vector<String> operationsListS = new Vector<String>(); - int indexOp = 0; - TraceManager.addDev( "Inside JDialogTMLTaskArtifact: " + MECType ); - if( MECType instanceof FepMEC ) { - operationsListS = FepMEC.operationsList; - indexOp = operationsListS.indexOf( operation ); - } - else if( MECType instanceof MapperMEC ) { - operationsListS.add( MapperMEC.Operation ); - indexOp = operationsListS.indexOf( operation ); - } - else if( MECType instanceof InterleaverMEC ) { - operationsListS.add( InterleaverMEC.Operation ); - indexOp = operationsListS.indexOf( operation ); - } - else if( MECType instanceof AdaifMEC ) { - operationsListS.add( AdaifMEC.Operation ); - indexOp = operationsListS.indexOf( operation ); - } - else if( MECType instanceof CpuMEC ) { - String tmp = (String)(referenceTaskName.getSelectedItem()); - operationsListS.add( tmp.split("::")[1] ); - indexOp = operationsListS.indexOf( operation ); - } - else { - operationsListS.add("No MEC selected"); - } - operationsListCB = new JComboBox( operationsListS ); - if( operation.equals( "VOID" ) || operation.equals( "" ) ) { - operationsListCB.setSelectedIndex( 0 ); - } - else { - if( indexOp == -1 ) { indexOp = 0; } - operationsListCB.setSelectedIndex( indexOp ); - } - panel3.add( operationsListCB, c3 ); + Vector<String> operationsListS = new Vector<String>(); + int indexOp = 0; + TraceManager.addDev( "Inside JDialogTMLTaskArtifact: " + MECType ); + if( MECType instanceof FepMEC ) { + operationsListS = FepMEC.operationsList; + indexOp = operationsListS.indexOf( operation ); + } + else if( MECType instanceof MapperMEC ) { + operationsListS.add( MapperMEC.Operation ); + indexOp = operationsListS.indexOf( operation ); + } + else if( MECType instanceof InterleaverMEC ) { + operationsListS.add( InterleaverMEC.Operation ); + indexOp = operationsListS.indexOf( operation ); + } + else if( MECType instanceof AdaifMEC ) { + operationsListS.add( AdaifMEC.Operation ); + indexOp = operationsListS.indexOf( operation ); + } + else if( MECType instanceof CpuMEC ) { + String tmp = (String)(referenceTaskName.getSelectedItem()); + operationsListS.add( tmp.split("::")[1] ); + indexOp = operationsListS.indexOf( operation ); + } + else { + operationsListS.add("No MEC selected"); + } + operationsListCB = new JComboBox<String>( operationsListS ); + if( operation.equals( "VOID" ) || operation.equals( "" ) ) { + operationsListCB.setSelectedIndex( 0 ); + } + else { + if( indexOp == -1 ) { indexOp = 0; } + operationsListCB.setSelectedIndex( indexOp ); + } + panel3.add( operationsListCB, c3 ); - // main panel; - c0.gridheight = 10; - c0.weighty = 1.0; + // main panel; + c0.gridheight = 10; + c0.weighty = 1.0; c0.weightx = 1.0; - c0.gridwidth = GridBagConstraints.REMAINDER; //end row - c0.fill = GridBagConstraints.BOTH; - tabbedPane.addTab( "Simulation", panel2 ); - tabbedPane.addTab( "Code generation", panel3 ); - tabbedPane.setSelectedIndex(0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + c0.fill = GridBagConstraints.BOTH; + tabbedPane.addTab( "Simulation", panel2 ); + tabbedPane.addTab( "Code generation", panel3 ); + tabbedPane.setSelectedIndex(0); /*c.add(panel2, c0); c.add(panel3, c0);*/ - c.add( tabbedPane, c0 ); - - c0.gridwidth = 1; - c0.gridheight = 1; + c.add( tabbedPane, c0 ); + + c0.gridwidth = 1; + c0.gridheight = 1; c0.fill = GridBagConstraints.HORIZONTAL; - closeButton = new JButton("Save and Close", IconManager.imgic25); - //closeButton.setPreferredSize(new Dimension(600, 50)); + closeButton = new JButton("Save and Close", IconManager.imgic25); + //closeButton.setPreferredSize(new Dimension(600, 50)); closeButton.addActionListener(this); - c.add(closeButton, c0); - c0.gridwidth = GridBagConstraints.REMAINDER; //end row + c.add(closeButton, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row cancelButton = new JButton("Cancel", IconManager.imgic27); - cancelButton.addActionListener(this); - c.add(cancelButton, c0); - } + cancelButton.addActionListener(this); + c.add(cancelButton, c0); + } + @Override public void actionPerformed(ActionEvent evt) { /* if (evt.getSource() == typeBox) { boolean b = ((Boolean)(initValues.elementAt(typeBox.getSelectedIndex()))).booleanValue(); diff --git a/src/ui/window/JDialogUPPAALGeneration.java b/src/ui/window/JDialogUPPAALGeneration.java index a0ddc65fb8..978d332802 100755 --- a/src/ui/window/JDialogUPPAALGeneration.java +++ b/src/ui/window/JDialogUPPAALGeneration.java @@ -51,7 +51,6 @@ import java.awt.event.*; import javax.swing.*; import myutil.*; -import translator.tojava.*; import ui.*; @@ -59,7 +58,7 @@ public class JDialogUPPAALGeneration extends javax.swing.JDialog implements Acti protected MainGUI mgui; - private String textJava1 = "Generate UPPAAL code in"; + // private String textJava1 = "Generate UPPAAL code in"; public final static int TURTLE_MODE = 0; public final static int DIPLODOCUS_MODE = 1; @@ -97,7 +96,7 @@ public class JDialogUPPAALGeneration extends javax.swing.JDialog implements Acti private Thread t; private boolean go = false; private ProcessThread pt; - private boolean hasError = false; + // private boolean hasError = false; /** Creates new form */ @@ -138,9 +137,9 @@ public class JDialogUPPAALGeneration extends javax.swing.JDialog implements Acti Container c = getContentPane(); setFont(new Font("Helvetica", Font.PLAIN, 14)); c.setLayout(new BorderLayout()); - //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - jp1 = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + jp1 = GraphicLib.createTabbedPane();//new JTabbedPane(); JPanel jp01 = new JPanel(); GridBagLayout gridbag01 = new GridBagLayout(); @@ -275,16 +274,16 @@ public class JDialogUPPAALGeneration extends javax.swing.JDialog implements Acti go = true; t.start(); } - - private void testGo() throws InterruptedException { - if (go == false) { - throw new InterruptedException("Stopped by user"); - } - } +// +// private void testGo() throws InterruptedException { +// if (go == false) { +// throw new InterruptedException("Stopped by user"); +// } +// } public void run() { - String cmd; - String list; + // String cmd; + // String list; boolean debug, choices, variables; int nb = 0; @@ -394,14 +393,15 @@ public class JDialogUPPAALGeneration extends javax.swing.JDialog implements Acti } public boolean hasToContinue() { - return (go == true); + return go; } public void appendOut(String s) { jta.append(s); } + @Override public void setError() { - hasError = true; +// hasError = true; } } diff --git a/src/ui/window/JDialogVersioningConnector.java b/src/ui/window/JDialogVersioningConnector.java index d7c68309f7..b6a3584196 100755 --- a/src/ui/window/JDialogVersioningConnector.java +++ b/src/ui/window/JDialogVersioningConnector.java @@ -49,15 +49,13 @@ package ui.window; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; -import java.util.*; import ui.*; -public class JDialogVersioningConnector extends javax.swing.JDialog implements ActionListener { +public class JDialogVersioningConnector extends JDialog implements ActionListener { - private JPanel panel1, panel2, panel3, panel4, panel5; + private JPanel panel1;//, panel2, panel3, panel4, panel5; // Panel1 int oldVersion, newVersion; @@ -81,16 +79,16 @@ public class JDialogVersioningConnector extends javax.swing.JDialog implements A initComponents(); - myInitComponents(); +// myInitComponents(); pack(); } - - - private void myInitComponents() { - } +// +// +// private void myInitComponents() { +// } private void initComponents() { - JTabbedPane tabbedPane = new JTabbedPane(); + // JTabbedPane tabbedPane = new JTabbedPane(); //tabbedPane.setPreferredSize(new Dimension(550, 400)); Container c = getContentPane(); diff --git a/src/ui/window/JFrameNC.java b/src/ui/window/JFrameNC.java index 9a20484aae..c32e6955ed 100755 --- a/src/ui/window/JFrameNC.java +++ b/src/ui/window/JFrameNC.java @@ -45,18 +45,12 @@ knowledge of the CeCILL license and that you accept its terms. package ui.window; -//import java.io.*; import javax.swing.*; -//import javax.swing.event.*; -import javax.swing.table.*; import java.awt.*; import java.awt.event.*; -import java.io.*; - import myutil.*; import ui.*; -import ui.file.*; import nc.*; @@ -602,8 +596,9 @@ public class JFrameNC extends JFrame implements ActionListener /*, StoppableGUIE */ - - mainTabbedPane = new JTabbedPane(); + + // Issue #41 Ordering of tabbed panes + mainTabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); mainTabbedPane.addTab("General info.", IconManager.imgic13, jspGeneralInfo, "Information on diagram"); mainTabbedPane.addTab("Equipments", IconManager.imgic13, jspEquipmentInfo, "Information on equipments"); mainTabbedPane.addTab("Switches", IconManager.imgic13, jspSwitchInfo, "Information on switches"); @@ -635,7 +630,7 @@ public class JFrameNC extends JFrame implements ActionListener /*, StoppableGUIE - private void compute(int idFunc) { +// private void compute(int idFunc) { /*computingPath = true; GraphAlgorithms.go = true; String info; @@ -730,27 +725,22 @@ public class JFrameNC extends JFrame implements ActionListener /*, StoppableGUIE t.setExternalCall((ExternalCall)this); t.setStoppableGUIElement((StoppableGUIElement)this); t.go();*/ - } - - - - - private int maxLengthColumn(Component c, AbstractTableModel tm, int index) { - int w = 0, wtmp; - FontMetrics fm = c.getFontMetrics(c.getFont()); - if (fm == null) { - return 0; - } - - String s; - - for(int i=0; i<tm.getRowCount(); i++) { - s = tm.getValueAt(i, index).toString(); - wtmp = fm.stringWidth(s); - w = Math.max(w, wtmp); - } - return w; - } - - +// } +// +// private int maxLengthColumn(Component c, AbstractTableModel tm, int index) { +// int w = 0, wtmp; +// FontMetrics fm = c.getFontMetrics(c.getFont()); +// if (fm == null) { +// return 0; +// } +// +// String s; +// +// for(int i=0; i<tm.getRowCount(); i++) { +// s = tm.getValueAt(i, index).toString(); +// wtmp = fm.stringWidth(s); +// w = Math.max(w, wtmp); +// } +// return w; +// } } // Class \ No newline at end of file diff --git a/src/ui/window/JFrameRequirementTable.java b/src/ui/window/JFrameRequirementTable.java index 98b88960af..b2cb264cd6 100755 --- a/src/ui/window/JFrameRequirementTable.java +++ b/src/ui/window/JFrameRequirementTable.java @@ -45,38 +45,31 @@ knowledge of the CeCILL license and that you accept its terms. package ui.window; -//import java.io.*; import javax.swing.*; -//import javax.swing.event.*; import javax.swing.table.*; import java.awt.*; import java.awt.event.*; -import java.io.*; import java.util.*; import myutil.*; import ui.*; -import ui.file.*; import ui.req.*; import ui.avatarrd.*; -import nc.*; - - public class JFrameRequirementTable extends JFrame implements ActionListener /*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ { - private Vector tabs; + private Vector<TURTLEPanel> tabs; - private ArrayList<AbstractTableModel> atms; - private ArrayList<TableSorter> tss; - private ArrayList<String> titles; + private java.util.List<AbstractTableModel> atms; + private java.util.List<TableSorter> tss; + private java.util.List<String> titles; //private StatisticsTableModel tm; //private JStatisticsPanel jstat; - private LinkedList<JScrollPane> panes; + //private java.util.List<JScrollPane> panes; private JButton buttonGenerate; //private JTextField eq, sw, tr, li, pa; @@ -97,7 +90,7 @@ public class JFrameRequirementTable extends JFrame implements ActionListener /*, //JButton goPath, goPathL, savePath, savePathL; - public JFrameRequirementTable(String title, Vector _tabs, JTabbedPane _main, Point [] _pts) { + public JFrameRequirementTable(String title, Vector<TURTLEPanel> _tabs, JTabbedPane _main, Point [] _pts) { super(title); tabs = _tabs; pts = _pts; @@ -127,40 +120,14 @@ public class JFrameRequirementTable extends JFrame implements ActionListener /*, framePanel.add(jp, BorderLayout.SOUTH); - // upper information - //Point p = FormatManager.nbStateTransitionRGAldebaran(data); - //Container c = getContentPane(); - //GridBagLayout gridbag0 = new GridBagLayout(); - //GridBagConstraints c0 = new GridBagConstraints(); - - //jp = new JPanel(); - //jp.setLayout(gridbag0); - - /*c0.gridwidth = 1; - c0.gridheight = 1; - c0.weighty = 1.0; - c0.weightx = 1.0; - jp.add(new JLabel("Equipments:"), c0); - c0.gridwidth = GridBagConstraints.REMAINDER; - eq = new JTextField(5); - eq.setEditable(false); - eq.setText(""+nc.equipments.size()); - jp.add(eq, c0); - c0.gridwidth = 1; - jp.add(new JLabel("Switches:"), c0); - c0.gridwidth = GridBagConstraints.REMAINDER; - sw = new JTextField(5); - sw.setEditable(false); - sw.setText(""+nc.switches.size()); - jp.add(sw, c0);*/ - - mainTabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + mainTabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); // Information TURTLEPanel tp; int i, j; - TDiagramPanel tdp; +// TDiagramPanel tdp; RequirementDiagramPanel rdp; AvatarRDPanel ardp; LinkedList<TGComponent> all, list; @@ -169,7 +136,7 @@ public class JFrameRequirementTable extends JFrame implements ActionListener /*, String maintitle; for(i=0; i<tabs.size(); i++) { - tp = (TURTLEPanel)(tabs.elementAt(i)); + tp = tabs.elementAt(i); maintitle = main.getTitleAt(i); if (tp instanceof RequirementPanel) { for(j=0; j<tp.panels.size(); j++) { @@ -272,23 +239,21 @@ public class JFrameRequirementTable extends JFrame implements ActionListener /*, - - private int maxLengthColumn(Component c, AbstractTableModel tm, int index) { - int w = 0, wtmp; - FontMetrics fm = c.getFontMetrics(c.getFont()); - if (fm == null) { - return 0; - } - - String s; - - for(int i=0; i<tm.getRowCount(); i++) { - s = tm.getValueAt(i, index).toString(); - wtmp = fm.stringWidth(s); - w = Math.max(w, wtmp); - } - return w; - } - - +// +// private int maxLengthColumn(Component c, AbstractTableModel tm, int index) { +// int w = 0, wtmp; +// FontMetrics fm = c.getFontMetrics(c.getFont()); +// if (fm == null) { +// return 0; +// } +// +// String s; +// +// for(int i=0; i<tm.getRowCount(); i++) { +// s = tm.getValueAt(i, index).toString(); +// wtmp = fm.stringWidth(s); +// w = Math.max(w, wtmp); +// } +// return w; +// } } // Class \ No newline at end of file diff --git a/src/ui/window/JFrameStatistics.java b/src/ui/window/JFrameStatistics.java index 8656cad782..7f64959ffa 100755 --- a/src/ui/window/JFrameStatistics.java +++ b/src/ui/window/JFrameStatistics.java @@ -45,9 +45,7 @@ package ui.window; -//import java.io.*; import javax.swing.*; -//import javax.swing.event.*; import javax.swing.table.*; import java.awt.*; import java.awt.event.*; @@ -531,18 +529,13 @@ public class JFrameStatistics extends JFrame implements ActionListener, Stoppab return; } - //System.out.println("Making last elements"); - mainTabbedPane = new JTabbedPane(); + // Issue #41 Ordering of tabbed panes + mainTabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane(); mainTabbedPane.addTab("General info.", IconManager.imgic13, jp, "# states, #transitions"); mainTabbedPane.addTab("Statistics", IconManager.imgic13, jsp, "Statistics on states & transitions"); - //if (graph.getNbTransition() < MAX_TRANSITIONS) { mainTabbedPane.addTab("Deadlocks", IconManager.imgic13, jspDeadlock, "Potential deadlocks"); mainTabbedPane.addTab("Shortest Paths", IconManager.imgic13, jp2, "Shortest paths"); mainTabbedPane.addTab("Longest Paths", IconManager.imgic13, jp4, "Longest paths"); - //} - //} - - if (shouldIStop()) { return; -- GitLab