From 1ee67a396fccedbd09f1bc7b60b47646a8ea1843 Mon Sep 17 00:00:00 2001 From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr> Date: Thu, 28 Aug 2014 14:53:54 +0000 Subject: [PATCH] Update on tree management --- executablecode/Makefile.src | 2 +- modeling/MicroWaveOven_SimpleAsynchronous.xml | 87 ++++++++ src/ui/ADDPanel.java | 1 + src/ui/AttackTreePanel.java | 2 +- src/ui/AvatarAnalysisPanel.java | 2 +- src/ui/AvatarDesignPanel.java | 1 + src/ui/AvatarMADsPanel.java | 3 +- src/ui/AvatarMethodologyPanel.java | 190 ++++++++++++++++++ src/ui/AvatarRequirementPanel.java | 2 + src/ui/DiplodocusMethodologyPanel.java | 8 +- src/ui/GTURTLEModeling.java | 103 +++++++++- src/ui/MainGUI.java | 78 ++++++- src/ui/tree/DiagramTreeRenderer.java | 7 + 13 files changed, 477 insertions(+), 9 deletions(-) create mode 100755 src/ui/AvatarMethodologyPanel.java diff --git a/executablecode/Makefile.src b/executablecode/Makefile.src index 6d2b02513f..164fead3d3 100755 --- a/executablecode/Makefile.src +++ b/executablecode/Makefile.src @@ -1 +1 @@ -SRCS = generated_src/main.c generated_src/B1.c generated_src/B0.c \ No newline at end of file +SRCS = generated_src/main.c generated_src/MicroWaveOven.c generated_src/Bell.c generated_src/ControlPanel.c generated_src/Controller.c generated_src/Magnetron.c generated_src/Door.c \ No newline at end of file diff --git a/modeling/MicroWaveOven_SimpleAsynchronous.xml b/modeling/MicroWaveOven_SimpleAsynchronous.xml index 8a72a14aa4..bf8506519e 100644 --- a/modeling/MicroWaveOven_SimpleAsynchronous.xml +++ b/modeling/MicroWaveOven_SimpleAsynchronous.xml @@ -3232,4 +3232,91 @@ +<Modeling type="Avatar Methodology" nameTab="AVATARMYMethodology" > +<AvatarMethodologyDiagramPanel name="Ava methodology" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" > + +</AvatarMethodologyDiagramPanel> + +</Modeling> + + + + +<Modeling type="Diplodocus Methodology" nameTab="DIPLODOCUS_Methodology" > +<DiplodocusMethodologyDiagramPanel name="Dip methodology" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" > +<COMPONENT type="6003" id="1514" > +<cdparam x="50" y="150" /> +<sizeparam width="200" height="120" minWidth="10" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> +<infoparam name="TGComponent" value="Requirements" /> +<TGConnectingPoint num="0" id="1510" /> +<TGConnectingPoint num="1" id="1511" /> +<TGConnectingPoint num="2" id="1512" /> +<TGConnectingPoint num="3" id="1513" /> +</COMPONENT> + +<COMPONENT type="6002" id="1520" > +<cdparam x="600" y="300" /> +<sizeparam width="200" height="120" minWidth="10" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> +<infoparam name="TGComponent" value="Mapping" /> +<TGConnectingPoint num="0" id="1515" /> +<TGConnectingPoint num="1" id="1516" /> +<TGConnectingPoint num="2" id="1517" /> +<TGConnectingPoint num="3" id="1518" /> +<TGConnectingPoint num="4" id="1519" /> +</COMPONENT> + +<COMPONENT type="6001" id="1525" > +<cdparam x="750" y="100" /> +<sizeparam width="200" height="120" minWidth="10" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> +<infoparam name="TGComponent" value="Architecture" /> +<TGConnectingPoint num="0" id="1521" /> +<TGConnectingPoint num="1" id="1522" /> +<TGConnectingPoint num="2" id="1523" /> +<TGConnectingPoint num="3" id="1524" /> +</COMPONENT> + +<COMPONENT type="6000" id="1530" > +<cdparam x="450" y="100" /> +<sizeparam width="200" height="120" minWidth="10" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<hidden value="false" /> +<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" /> +<infoparam name="TGComponent" value="Application" /> +<TGConnectingPoint num="0" id="1526" /> +<TGConnectingPoint num="1" id="1527" /> +<TGConnectingPoint num="2" id="1528" /> +<TGConnectingPoint num="3" id="1529" /> +</COMPONENT> + +<CONNECTOR type="6004" id="1532" > +<cdparam x="850" y="220" /> +<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<infoparam name="connector" value="<<deriveReqt>>" /> +<TGConnectingPoint num="0" id="1531" /> +<P1 x="850" y="220" id="1521" /> +<P2 x="720" y="300" id="1516" /> +<AutomaticDrawing data="true" /> +</CONNECTOR> +<CONNECTOR type="6004" id="1534" > +<cdparam x="550" y="220" /> +<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" /> +<infoparam name="connector" value="<<deriveReqt>>" /> +<TGConnectingPoint num="0" id="1533" /> +<P1 x="550" y="220" id="1526" /> +<P2 x="680" y="300" id="1515" /> +<AutomaticDrawing data="true" /> +</CONNECTOR> + +</DiplodocusMethodologyDiagramPanel> + +</Modeling> + + + + </TURTLEGMODELING> \ No newline at end of file diff --git a/src/ui/ADDPanel.java b/src/ui/ADDPanel.java index 12c69fdd04..1af34a60c9 100755 --- a/src/ui/ADDPanel.java +++ b/src/ui/ADDPanel.java @@ -95,6 +95,7 @@ public class ADDPanel extends TURTLEPanel { tabbedPane.addTab("Avatar Deployment Diagram", IconManager.imgic60, toolBarPanel, "Opens Avatar deployment diagram"); tabbedPane.setSelectedIndex(0); + mgui.changeMade(tmladd, TDiagramPanel.NEW_COMPONENT); return true; } diff --git a/src/ui/AttackTreePanel.java b/src/ui/AttackTreePanel.java index a0c43aeb3c..348f1ceeed 100755 --- a/src/ui/AttackTreePanel.java +++ b/src/ui/AttackTreePanel.java @@ -76,7 +76,7 @@ public class AttackTreePanel extends TURTLEPanel { } public void init() { - + mgui.changeMade(null, TDiagramPanel.NEW_COMPONENT); // Requirement Diagram toolbar //addRequirementDiagram("Requirement Diagram"); diff --git a/src/ui/AvatarAnalysisPanel.java b/src/ui/AvatarAnalysisPanel.java index 2457825917..0d5e0e4264 100755 --- a/src/ui/AvatarAnalysisPanel.java +++ b/src/ui/AvatarAnalysisPanel.java @@ -73,7 +73,7 @@ public class AvatarAnalysisPanel extends TURTLEPanel { } public void init() { - + mgui.changeMade(null, TDiagramPanel.NEW_COMPONENT); /*// Class Diagram toolbar InteractionOverviewDiagramToolBar toolBarIOD = new InteractionOverviewDiagramToolBar(mgui); toolbars.add(toolBarIOD); diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java index 2960eb41b1..3aa596db6d 100644 --- a/src/ui/AvatarDesignPanel.java +++ b/src/ui/AvatarDesignPanel.java @@ -176,6 +176,7 @@ public class AvatarDesignPanel extends TURTLEPanel { tabbedPane.addTab("AVATAR Design", IconManager.imgic80, toolBarPanel, "Opens the AVATAR Design"); tabbedPane.setSelectedIndex(0); //tabbedPane.setMnemonicAt(tabbedPane.getTabCount()-1, '^'); + mgui.changeMade(abdp, TDiagramPanel.NEW_COMPONENT); //jsp.setVisible(true); diff --git a/src/ui/AvatarMADsPanel.java b/src/ui/AvatarMADsPanel.java index 97d338ace6..4119aaa8c0 100644 --- a/src/ui/AvatarMADsPanel.java +++ b/src/ui/AvatarMADsPanel.java @@ -99,11 +99,12 @@ public class AvatarMADsPanel extends TURTLEPanel { panels.add(amadp); tabbedPane.addTab(s, IconManager.imgic63, toolBarPanel, "Opens Modeling Assumption Panel of " + s); //tabbedPane.setMnemonicAt(tabbedPane.getTabCount()-1, '^'); + mgui.changeMade(amadp, TDiagramPanel.NEW_COMPONENT); return; } public void init() { - + mgui.changeMade(null, TDiagramPanel.NEW_COMPONENT); // Class Diagram toolbar /*AvatarMADToolBar toolBarAvatarMAD = new AvatarMADToolBar(mgui); toolbars.add(toolBarAvatarMAD); diff --git a/src/ui/AvatarMethodologyPanel.java b/src/ui/AvatarMethodologyPanel.java new file mode 100755 index 0000000000..bf48201556 --- /dev/null +++ b/src/ui/AvatarMethodologyPanel.java @@ -0,0 +1,190 @@ +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille + +ludovic.apvrille AT enst.fr + +This software is a computer program whose purpose is to allow the +edition of TURTLE analysis, design and deployment diagrams, to +allow the generation of RT-LOTOS or Java code from this diagram, +and at last to allow the analysis of formal validation traces +obtained from external tools, e.g. RTL from LAAS-CNRS and CADP +from INRIA Rhone-Alpes. + +This software is governed by the CeCILL license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL license and that you accept its terms. + +/** + * Class AvatarMethodologyPanel + * Managenemt of the avatar methodology panels + * Creation: 27/08/2014 + * @version 1.1 27/08/2014 + * @author Ludovic APVRILLE + * @see MainGUI + */ + +package ui; + +import java.awt.*; +import javax.swing.*; +import javax.swing.event.*; +import ui.avatarmethodology.*; + + +import java.util.*; + +public class AvatarMethodologyPanel extends TURTLEPanel { + public AvatarMethodologyDiagramPanel dmd; + + public AvatarMethodologyPanel(MainGUI _mgui) { + super(_mgui); + + tabbedPane = new JTabbedPane(); + UIManager.put("TabbedPane.tabAreaBackground", _mgui.BACK_COLOR); + UIManager.put("TabbedPane.selected", _mgui.BACK_COLOR); + SwingUtilities.updateComponentTreeUI(tabbedPane); + //tabbedPane.setOpaque(true); + + cl = new ChangeListener() { + public void stateChanged(ChangeEvent e){ + mgui.paneDiplodocusMethodologyAction(e); + } + }; + tabbedPane.addChangeListener(cl); + tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui)); + + } + + // Put the methodology + public void initElements() { + //TGComponent tgc1 = dmd.addComponent(450, 100, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_APPLICATION, false); + //TGComponent tgc2 = dmd.addComponent(750, 100, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_ARCHITECTURE, false); + //TGComponent tgc3 = dmd.addComponent(600, 300, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_MAPPING, false); + + //Connectors + + // App -> mapping + /*TGConnectingPoint p1, p2; + p1 = tgc1.getTGConnectingPointAtIndex(0); + p2 = tgc3.getTGConnectingPointAtIndex(0); + Vector listPoint = new Vector(); + TGConnector 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); + + // Archi -> mapping + p1 = tgc2.getTGConnectingPointAtIndex(0); + p2 = tgc3.getTGConnectingPointAtIndex(1); + listPoint = new Vector(); + 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.addComponent(50, 150, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_REQUIREMENT, false);*/ + } + + public void init() { + init("Avatar methodology"); + } + + public void init(String name) { + addAvatarMethodologyDiagram(name); + + // Requirement Diagram toolbar + //addRequirementDiagram("Requirement Diagram"); + + //jsp.setVisible(true); + } + + public boolean addAvatarMethodologyDiagram(String s) { + AvatarMethodologyDiagramToolbar dmdt = new AvatarMethodologyDiagramToolbar(mgui); + toolbars.add(dmdt); + + toolBarPanel = new JPanel(); + //toolBarPanel.setBackground(Color.red); + toolBarPanel.setLayout(new BorderLayout()); + //toolBarPanel.setBackground(ColorManager.MainTabbedPaneSelect); + + //Class diagram + dmd = new AvatarMethodologyDiagramPanel(mgui, dmdt); + dmd.setName(s); + dmd.tp = this; + tdp = dmd; + panels.add(dmd); + JScrollDiagramPanel jsp = new JScrollDiagramPanel(dmd); + dmd.jsp = jsp; + jsp.setWheelScrollingEnabled(true); + jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); + toolBarPanel.add(dmdt, BorderLayout.NORTH); + toolBarPanel.add(jsp, BorderLayout.CENTER); + tabbedPane.addTab(s, IconManager.imgic98, toolBarPanel, "Opens avatar methodology"); + tabbedPane.setSelectedIndex(0); + 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; + } + + + + + public String saveHeaderInXml() { + return "<Modeling type=\"Avatar Methodology\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; + } + + public String saveTailInXml() { + return "</Modeling>\n\n\n"; + } + + public String toString() { + return mgui.getTitleAt(this) + " (Avatar Methodology)"; + } + + public boolean removeEnabled(int index) { + if (panels.size() > 1) { + return true; + } + return false; + } + + public boolean renameEnabled(int index) { + if (panels.size() == 0) { + return false; + } + + + return true; + } + + public boolean isAvatarMethodologyEnabled() { + return true; + } + + +} \ No newline at end of file diff --git a/src/ui/AvatarRequirementPanel.java b/src/ui/AvatarRequirementPanel.java index d510c308c9..e6c4bab689 100755 --- a/src/ui/AvatarRequirementPanel.java +++ b/src/ui/AvatarRequirementPanel.java @@ -79,6 +79,7 @@ public class AvatarRequirementPanel extends TURTLEPanel { public void init() { + mgui.changeMade(null, TDiagramPanel.NEW_COMPONENT); // Requirement Diagram toolbar //addRequirementDiagram("Requirement Diagram"); @@ -110,6 +111,7 @@ public class AvatarRequirementPanel extends TURTLEPanel { tabbedPane.setSelectedIndex(0); JPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); + return true; } diff --git a/src/ui/DiplodocusMethodologyPanel.java b/src/ui/DiplodocusMethodologyPanel.java index c3c584c6d3..7d20b4c632 100755 --- a/src/ui/DiplodocusMethodologyPanel.java +++ b/src/ui/DiplodocusMethodologyPanel.java @@ -107,7 +107,11 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { } public void init() { - addDiplodocusMethodologyDiagram("Diplodocus methodology"); + init("Diplodocus methodology"); + } + + public void init(String name) { + addDiplodocusMethodologyDiagram(name); // Requirement Diagram toolbar //addRequirementDiagram("Requirement Diagram"); @@ -140,7 +144,7 @@ public class DiplodocusMethodologyPanel extends TURTLEPanel { tabbedPane.setSelectedIndex(0); JPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); - + mgui.changeMade(dmd, TDiagramPanel.NEW_COMPONENT); //TGComponent tgc = TGComponentManager.addComponent(100, 100, TGComponentManager.DIPLODODUSMETHODOLOGY_REF_APPLICATION, dmd); diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index 721c1fa9db..a035fb46a9 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -95,6 +95,7 @@ import avatartranslator.totpn.*; import tpndescription.*; import ui.diplodocusmethodology.*; +import ui.avatarmethodology.*; import ui.tmlad.*; import ui.tmlcd.*; import ui.tmlcompd.*; @@ -2840,6 +2841,59 @@ public class GTURTLEModeling { //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " post loading done"); } } + + + }else if (tdp instanceof AvatarMethodologyDiagramPanel) { + nl = doc.getElementsByTagName("DiplodocusMethodologyDiagramPanelCopy"); + docCopy = doc; + + if (nl == null) { + return; + } + + //TraceManager.addDev("Toto 1"); + + + AvatarMethodologyDiagramPanel amdp = (AvatarMethodologyDiagramPanel)tdp; + + + for(i=0; i<nl.getLength(); i++) { + adn = nl.item(i); + if (adn.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) adn; + + if (amdp == null) { + throw new MalformedModelingException(); + } + + //int xSel = Integer.decode(elt.getAttribute("xSel")).intValue(); + //int ySel = Integer.decode(elt.getAttribute("ySel")).intValue(); + //int widthSel = Integer.decode(elt.getAttribute("widthSel")).intValue(); + //int heightSel = Integer.decode(elt.getAttribute("heightSel")).intValue(); + + decX = _decX; + decY = _decY; + + amdp.loadExtraParameters(elt); + + //TraceManager.addDev("Toto 2"); + + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " components"); + makeXMLComponents(elt.getElementsByTagName("COMPONENT"), amdp); + //TraceManager.addDev("Toto 3"); + makePostProcessing(amdp); + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " connectors"); + makeXMLConnectors(elt.getElementsByTagName("CONNECTOR"), amdp); + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " subcomponents"); + makeXMLComponents(elt.getElementsByTagName("SUBCOMPONENT"), amdp); + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " real points"); + connectConnectorsToRealPoints(amdp); + amdp.structureChanged(); + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " post loading " + beginIndex); + makePostLoading(amdp, beginIndex); + //TraceManager.addDev("TML task diagram : " + tmltdp.getName() + " post loading done"); + } + } } else if (tdp instanceof TMLComponentTaskDiagramPanel) { nl = doc.getElementsByTagName("TMLComponentTaskDiagramPanelCopy"); docCopy = doc; @@ -3795,6 +3849,8 @@ public class GTURTLEModeling { loadAttackTree(node); } else if (type.compareTo("Diplodocus Methodology") == 0) { loadDiplodocusMethodology(node); + } else if (type.compareTo("Avatar Methodology") == 0) { + loadAvatarMethodology(node); } else if (type.compareTo("TML Design") == 0) { loadTMLDesign(node); } else if (type.compareTo("TML Component Design") == 0) { @@ -4222,6 +4278,34 @@ public class GTURTLEModeling { } } } + + public void loadAvatarMethodology(Node node) throws MalformedModelingException, SAXException { + Element elt = (Element) node; + String nameTab; + NodeList diagramNl; + int indexDesign; + + + nameTab = elt.getAttribute("nameTab"); + + indexDesign = mgui.createAvatarMethodology(nameTab); + + diagramNl = node.getChildNodes(); + + for(int j=0; j<diagramNl.getLength(); j++) { + //TraceManager.addDev("Design nodes: " + j); + node = diagramNl.item(j); + if (node.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element)node; + if (elt.getTagName().compareTo("AvatarMethodologyDiagramPanel") == 0) { + // Class diagram + //TraceManager.addDev("Loading TML CD"); + loadAvatarMethodologyDiagram(elt, indexDesign); + //TraceManager.addDev("End loading TML CD"); + } + } + } + } public void loadTMLDesign(Node node) throws MalformedModelingException, SAXException { Element elt = (Element) node; @@ -4663,10 +4747,27 @@ public class GTURTLEModeling { String name; TDiagramPanel tdp; - // class diagram name + // Diagram name name = elt.getAttribute("name"); mgui.setDiplodocusMethodologyDiagramName(indexDesign, name); tdp = mgui.getMainTDiagramPanel(indexDesign); + tdp.setName(name); + + TraceManager.addDev("tdp=" + tdp.getName()); + + loadDiagram(elt, tdp); + } + + public void loadAvatarMethodologyDiagram(Element elt, int indexDesign) throws MalformedModelingException, SAXException { + + String name; + TDiagramPanel tdp; + + // class diagram name + name = elt.getAttribute("name"); + mgui.setAvatarMethodologyDiagramName(indexDesign, name); + tdp = mgui.getMainTDiagramPanel(indexDesign); + tdp.setName(name); //TraceManager.addDev("tdp=" + tdp.getName()); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index d187efee77..2849a97b51 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -486,6 +486,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe public void changeMade(TDiagramPanel tdp, int type) { hasChanged = true; + if (tdp != null) { switch (type) { case -1: // Structural change @@ -515,6 +516,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe break; default: + } } setMode(MODEL_CHANGED); Point p; @@ -1127,7 +1129,26 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe mainTabbedPane.setTitleAt(index, name); mainTabbedPane.setIconAt(index, IconManager.imgic98); //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams"); - dp.init(); + dp.init(name); + if (addDefaultElements) { + dp.initElements(); + } + //ystem.out.println("Design added"); + return index; + } + + private int addAvatarMethodologyPanel(String name, int index, boolean addDefaultElements) { + if (index == -1) { + index = tabs.size(); + } + AvatarMethodologyPanel dp = new AvatarMethodologyPanel(this); + tabs.add(index, dp); + mainTabbedPane.add(dp.tabbedPane, index); + mainTabbedPane.setToolTipTextAt(index, "Open AVATAR methodology"); + mainTabbedPane.setTitleAt(index, name); + mainTabbedPane.setIconAt(index, IconManager.imgic98); + //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams"); + dp.init(name); if (addDefaultElements) { dp.initElements(); } @@ -1476,6 +1497,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe mainTabbedPane.setSelectedIndex(index); return index; } + + public int createAvatarMethodology(String name) { + int index = addAvatarMethodologyPanel(name, -1, false); + mainTabbedPane.setSelectedIndex(index); + return index; + } public int createTMLDesign(String name) { int index = addTMLDesignPanel(name, -1); @@ -1808,6 +1835,15 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe //paneAction(null); //frame.repaint(); } + + public void newAvatarMethodology() { + //TraceManager.addDev("NEW DESIGN"); + addAvatarMethodologyPanel("AVATAR_Methodology", -1, true); + ((TURTLEPanel)tabs.elementAt(tabs.size()-1)).tabbedPane.setSelectedIndex(0); + mainTabbedPane.setSelectedIndex(tabs.size()-1); + //paneAction(null); + //frame.repaint(); + } public void newTMLComponentDesign() { //TraceManager.addDev("NEW DESIGN"); @@ -5208,6 +5244,11 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign)); tp.tabbedPane.setTitleAt(0, name); } + + public void setAvatarMethodologyDiagramName(int indexDesign, String name) { + TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign)); + tp.tabbedPane.setTitleAt(0, name); + } public void setTMLTaskDiagramName(int indexDesign, String name) { TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign)); @@ -6212,6 +6253,34 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe //TraceManager.addDev("Exception pane design action"); } } + + public void paneAvatarMethodologyAction(ChangeEvent e) { + //TraceManager.addDev("Pane design action size=" + tabs.size()); + try { + + TDiagramPanel tdp1 = (TDiagramPanel)(getCurrentTURTLEPanel().panels.elementAt(getCurrentJTabbedPane().getSelectedIndex())); + //TraceManager.addDev("Pane design action 1"); + if (activetdp != null) { + + activetdp.activateActions(false); + unactivateDrawing(); + activetdp.stopAddingConnector(); + } + //TraceManager.addDev("Pane design action 1 on "+ tdp1.getName()); + tdp1.activateActions(true); + activetdp = tdp1; + + setEditMode(); + setPanelMode(); + //TraceManager.addDev("Pane design action 3"); + + // activate the drawing of the right pane + basicActivateDrawing(); + + } catch (Exception ex) { + //TraceManager.addDev("Exception pane design action"); + } + } public void paneAnalysisAction(ChangeEvent e) { //TraceManager.addDev("Pane analysis action size=" + tabs.size()); @@ -8169,7 +8238,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe private JPopupMenu menu; private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement, newTMLDesign, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, - newNCDesign, sort, clone, newAttackTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, newAVATARDD; + newNCDesign, sort, clone, newAttackTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, newAvatarMethodo, newAVATARDD; private JMenuItem newAVATARAnalysis; public PopupListener(MainGUI _mgui) { @@ -8209,6 +8278,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe newAttackTree = createMenuItem("New AVATAR Attack Tree"); newRequirement = createMenuItem("New TURTLE Requirement Diagram"); newTMLMethodo = createMenuItem("New DIPLODOCUS Methodology"); + newTMLDesign = createMenuItem("New DIPLODOCUS Design"); newTMLComponentDesign = createMenuItem("New Component-based DIPLODOCUS Design"); newTMLArchi = createMenuItem("New DIPLODOCUS Architecture"); @@ -8221,6 +8291,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe newAVATARAnalysis = createMenuItem("New AVATAR Analysis"); newAVATARBD = createMenuItem("New AVATAR Design"); newAVATARDD = createMenuItem("New AVATAR Deployment Diagram"); + newAvatarMethodo = createMenuItem("New AVATAR Methodology"); menu = new JPopupMenu("TURTLE analysis, design and deployment / DIPLODOCUS design / Proactive design"); menu.add(moveLeft); @@ -8277,6 +8348,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe if (avatarOn) { menu.addSeparator(); + menu.add(newAvatarMethodo); menu.add(newAttackTree); menu.add(newMAD); menu.add(newAVATARRequirement); @@ -8357,6 +8429,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Pe mgui.newRequirement(); } else if (e.getSource() == newTMLMethodo) { mgui.newDiplodocusMethodology(); + } else if (e.getSource() == newAvatarMethodo) { + mgui.newAvatarMethodology(); } else if (ac.equals("New DIPLODOCUS Design")) { mgui.newTMLDesign(); } else if (ac.equals("New Component-based DIPLODOCUS Design")) { diff --git a/src/ui/tree/DiagramTreeRenderer.java b/src/ui/tree/DiagramTreeRenderer.java index ea5740a01b..4c8bedf334 100755 --- a/src/ui/tree/DiagramTreeRenderer.java +++ b/src/ui/tree/DiagramTreeRenderer.java @@ -82,6 +82,7 @@ import ui.avatarad.*; import ui.avatarcd.*; import ui.diplodocusmethodology.*; +import ui.avatarmethodology.*; public class DiagramTreeRenderer extends DefaultTreeCellRenderer { @@ -115,6 +116,12 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer { } else if (value instanceof DiplodocusMethodologyDiagramPanel) { setIcon(IconManager.imgic98); setToolTipText("DIPLODOCUS Methodology"); + } else if (value instanceof AvatarMethodologyPanel) { + setIcon(IconManager.imgic98); + setToolTipText("Avatar Methodology"); + } else if (value instanceof AvatarMethodologyDiagramPanel) { + setIcon(IconManager.imgic98); + setToolTipText("Avatar Methodology"); } else if (value instanceof TMLCommunicationPatternPanel) { setIcon(IconManager.imgic18); setToolTipText("DIPLODOCUS Communication Patterns"); -- GitLab