diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java index 6a7b84246145a3160289d75c3d11df08267ae837..3c10adda04d3999a5deaf1cfe5bdcd1e80e346ef 100644 --- a/src/main/java/ui/ActionPerformer.java +++ b/src/main/java/ui/ActionPerformer.java @@ -1121,10 +1121,24 @@ public class ActionPerformer { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_ANALYSIS); } else if (command.equals(mgui.actions[TGUIAction.M_REF_DESIGN].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_DESIGN); - } else if (command.equals(mgui.actions[TGUIAction.AM_REF_PROPERTIES].getActionCommand())) { + } else if (command.equals(mgui.actions[TGUIAction.M_REF_PROPERTIES].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_PROPERTIES); } else if (command.equals(mgui.actions[TGUIAction.M_REF_PROTOTYPING].getActionCommand())) { mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_PROTOTYPE); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_FAULT].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_FAULT); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_ATTACK].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_ATTACK); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_FV].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_FUNCTIONAL_VIEW); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_CP].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_CP_VIEW); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_ARCHI].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_ARCHITECTURE_VIEW); + } else if (command.equals(mgui.actions[TGUIAction.M_REF_MAPPING].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.SYSMLSEC_METHODOLOGY_REF_MAPPING_VIEW); + } else if (command.equals(mgui.actions[TGUIAction.M_PANEL_INFO].getActionCommand())) { + mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.INFO_PANEL); // Requirement diagrams } else if (command.equals(mgui.actions[TGUIAction.TREQ_REQUIREMENT].getActionCommand())) { diff --git a/src/main/java/ui/GTURTLEModeling.java b/src/main/java/ui/GTURTLEModeling.java index 945f23c76a4da3c2a4c26ca7208f99ee098063c6..49678dd73fc757bf6d0a9456cd01071ff3469e40 100644 --- a/src/main/java/ui/GTURTLEModeling.java +++ b/src/main/java/ui/GTURTLEModeling.java @@ -7558,6 +7558,27 @@ public class GTURTLEModeling { //TraceManager.addDev(tgc.getValue()); tgc.makePostLoading(decId); } + + // Order components + //TraceManager.addDev("Ordering components?"); + list = tdp.getComponentList(); + if (list.size() > 0) { + tgc = list.get(0); + if (tgc.getIndexU() > -1) { + // We need to order components + //TraceManager.addDev("Ordering components"); + ArrayList<IndexedTGComponent> comps = new ArrayList<IndexedTGComponent>(list.size()); + for(TGComponent tgcL: list) { + comps.add(new IndexedTGComponent(tgcL.getIndexU(), tgcL)); + } + Collections.sort(comps); + tdp.removeAll(); + for(IndexedTGComponent iTgc: comps) { + tdp.addComponent(iTgc.tgc); + } + } + } + /*SwingUtilities.invokeAndWait(new Runnable() { public void run() { mgui.repaintAll(); @@ -7648,6 +7669,7 @@ public class GTURTLEModeling { // try { + int index = -1; NodeList nl = n.getChildNodes(); elt = (Element) n; @@ -7656,6 +7678,12 @@ public class GTURTLEModeling { int myType = Integer.decode(elt.getAttribute("type")); int myId = Integer.decode(elt.getAttribute("id")) + decId; + if (elt.hasAttribute("index")) { + String tmp = elt.getAttribute("index"); + if (tmp != null) { + index = Integer.decode(tmp); + } + } UUID uid = null; String tmpUid = elt.getAttribute("uid"); @@ -7688,6 +7716,7 @@ public class GTURTLEModeling { boolean masterMutex = false; boolean enable = true; + for (i = 0; i < nl.getLength(); i++) { n = nl.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { @@ -7823,6 +7852,8 @@ public class GTURTLEModeling { throw new MalformedModelingException(); } + tgc.setIndexU(index); + if (myName != null) { tgc.setName(myName); } @@ -8203,6 +8234,7 @@ public class GTURTLEModeling { //TraceManager.addDev(n.toString()); try { + int index = -1; NodeList nl = n.getChildNodes(); elt = (Element) n; @@ -8210,6 +8242,13 @@ public class GTURTLEModeling { int myType = Integer.decode(elt.getAttribute("type")); int myId = Integer.decode(elt.getAttribute("id")) + decId; + if (elt.hasAttribute("index")) { + String tmp = elt.getAttribute("index"); + if (tmp != null) { + index = Integer.decode(tmp); + } + } + UUID uid = null; String tmpUid = elt.getAttribute("uid"); @@ -8302,6 +8341,8 @@ public class GTURTLEModeling { tgco.setAutomaticDrawing(automaticDrawing); + tgco.setIndexU(index); + if (myName != null) { tgco.setName(myName); } diff --git a/src/main/java/ui/IndexedTGComponent.java b/src/main/java/ui/IndexedTGComponent.java new file mode 100644 index 0000000000000000000000000000000000000000..817ad79598c53fba8b482469184ab14d642c11cf --- /dev/null +++ b/src/main/java/ui/IndexedTGComponent.java @@ -0,0 +1,63 @@ +/* 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. + */ + +package ui; + +/** + * Class IndexedTGComponent + * index and TGComponent + * Creation: 22/06/2021 + * @version 1.0 22/06/2021 + * @author Ludovic APVRILLE + */ + +public class IndexedTGComponent implements Comparable<IndexedTGComponent> { + + public int index; + public TGComponent tgc; + + public IndexedTGComponent(int _index, TGComponent _tgc) { + index = _index; + tgc = _tgc; + } + + public int compareTo(IndexedTGComponent itgc) { + return index - itgc.index; + } + +} diff --git a/src/main/java/ui/MainGUI.java b/src/main/java/ui/MainGUI.java index 9f8c5660beece1aa23b21b76128521fd87b4689f..9b643b1e865395be170150ad46b452ae3c901462 100644 --- a/src/main/java/ui/MainGUI.java +++ b/src/main/java/ui/MainGUI.java @@ -2071,6 +2071,15 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per // frame.repaint(); } + public void newMethodology() { + // TraceManager.addDev("NEW DESIGN"); + addSysmlsecMethodologyPanel("Methodology", -1, true); + tabs.elementAt(tabs.size() - 1).tabbedPane.setSelectedIndex(0); + mainTabbedPane.setSelectedIndex(tabs.size() - 1); + // paneAction(null); + // frame.repaint(); + } + public void newVerificationPropertyPanel() { // TraceManager.addDev("NEW DESIGN"); addVerificationPropertyPanel("Verification Tracking", -1, true); @@ -9437,7 +9446,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement/* , newTMLDesign */, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, newNCDesign, sort, clone, newAttackTree, newFaultTree, newAVATARBD, newAVATARRequirement, newMAD, newTMLCP, newTMLMethodo, newAvatarMethodo, newAVATARDD, newSysmlsecMethodo, newSysCAMS, - newELN, newVerificationProperty, clearVerificationInformation; + newELN, newVerificationProperty, clearVerificationInformation, newMethodo; private JMenuItem newAVATARAnalysis; public PopupListener(MainGUI _mgui) { @@ -9505,6 +9514,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per newAVATARAnalysis = createMenuItem("New Analysis"); newAVATARBD = createMenuItem("New Design"); newAVATARDD = createMenuItem("New Deployment Diagram"); + newMethodo = createMenuItem("New Methodology"); newAvatarMethodo = createMenuItem("New AVATAR Methodology"); newSysmlsecMethodo = createMenuItem("New SysML-Sec Methodology"); newVerificationProperty = createMenuItem("New Verification Tracking"); @@ -9559,14 +9569,16 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per } + menu.add(newMethodo); + // Methodologies if (!avatarOnly) { if (systemcOn) { menu.add(newTMLMethodo); } - } + if (avatarOn) { menu.add(newAvatarMethodo); menu.add(newSysmlsecMethodo); @@ -9703,6 +9715,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener, Per } else if (e.getSource() == newSysmlsecMethodo) { ModeManager.setMode(CREATE_NEW_PANEL, actions, mainBar, mgui); mgui.newSysmlsecMethodology(); + } else if (e.getSource() == newMethodo) { + ModeManager.setMode(CREATE_NEW_PANEL, actions, mainBar, mgui); + mgui.newMethodology(); } else if (ac.equals("New DIPLODOCUS Design")) { ModeManager.setMode(CREATE_NEW_PANEL, actions, mainBar, mgui); mgui.newTMLDesign(); diff --git a/src/main/java/ui/SysmlsecMethodologyPanel.java b/src/main/java/ui/SysmlsecMethodologyPanel.java index 0ebdd12b856f949d5c0db47471bdefd0f8749473..ea018e126462c6e31fb2625b957dcb25239b3894 100644 --- a/src/main/java/ui/SysmlsecMethodologyPanel.java +++ b/src/main/java/ui/SysmlsecMethodologyPanel.java @@ -113,14 +113,14 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { infoParti.resize(750, 250); infoParti.setValue("SW/HW Partitioning"); infoParti.setStringPos(TGCPanelInfo.UPPER_MIDDLE); - infoParti.setFillColor(ColorManager.SYSMLSEC_PARTITIONING); + infoParti.setCurrentColor(ColorManager.SYSMLSEC_PARTITIONING); infoParti.setTextColor(Color.white); TGCPanelInfo infoSw = (TGCPanelInfo) (dmd.addComponent(xa - 270, ya - 25, TGComponentManager.INFO_PANEL, false)); infoSw.resize(750, 325); infoSw.setValue("SW Design"); infoSw.setStringPos(TGCPanelInfo.UPPER_MIDDLE); - infoSw.setFillColor(ColorManager.SYSMLSEC_SWDESIGN); + infoSw.setCurrentColor(ColorManager.SYSMLSEC_SWDESIGN); infoSw.setTextColor(Color.white); @@ -129,7 +129,7 @@ public class SysmlsecMethodologyPanel extends TURTLEPanel { infoReq.setValue("Req / faults / attacks"); infoReq.setStringPos(TGCPanelInfo.UPPER_MIDDLE); infoReq.setTextColor(Color.white); - infoReq.setFillColor(ColorManager.SYSMLSEC_REQ); + infoReq.setCurrentColor(ColorManager.SYSMLSEC_REQ); //Connectors diff --git a/src/main/java/ui/TDiagramPanel.java b/src/main/java/ui/TDiagramPanel.java index b685f7d39dae0a6ad55a268f1d089ad553dbd700..9ec654880f8b704d24938f0a10bafa16f41afab3 100644 --- a/src/main/java/ui/TDiagramPanel.java +++ b/src/main/java/ui/TDiagramPanel.java @@ -398,6 +398,8 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { this.componentList = new LinkedList<>(); } + + public void setInternalCommentVisible(int mode) { internalCommentVisible = mode; } @@ -684,8 +686,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { // LinkedList<TGComponent> ruteoList = this.componentList; // - for (TGComponent tgc : this.getAllComponentList()){ + int cpt = 0; + for (TGComponent tgc : this.getAllComponentList()) { //for (TGComponent tgc : this.componentList) { + tgc.setIndexU(cpt); if ((selected == false) || (tgc.isSelected())) { if((tgc.getFather() == null) || (cloneEvenIfNonNullFather)) { //TraceManager.addDev("Cloning:" + tgc); @@ -698,6 +702,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { sb.append("\n"); } } + cpt ++; } if (cloneEvenIfNonNullFather) { TraceManager.addDev("sb=\n" + sb); @@ -973,6 +978,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { } + public TGConnectingPoint getSelectedTGConnectingPoint() { return selectedConnectingPoint; } @@ -1040,6 +1046,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { return ret; } + public void addComponent(TGComponent tgc) { + componentList.add(tgc); + } + private void adaptPanelToNewComponent(TGComponent tgc) { while (maxX < (tgc.getX() + tgc.getWidth())) { diff --git a/src/main/java/ui/TGCPanelInfo.java b/src/main/java/ui/TGCPanelInfo.java index 40f60b54d27456c0c05457f46062cadc16f44554..66035a367d2cb8c53fd7d3743b3362f64aba7c2d 100644 --- a/src/main/java/ui/TGCPanelInfo.java +++ b/src/main/java/ui/TGCPanelInfo.java @@ -47,16 +47,20 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import myutil.GraphicLib; +import ui.atd.ATDAttack; +import ui.atd.ATDConstraint; +import ui.atd.ATDCountermeasure; +import ui.sysmlsecmethodology.SysmlsecMethodologyDiagramReference; import ui.util.IconManager; /** * Class TGCPanelInfo - * Component for displaying an informatio + * Component for displaying an information * Creation: 8/03/2016 * @version 1.0 8/03/2016 * @author Ludovic APVRILLE */ -public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { +public class TGCPanelInfo extends TGCScalableWithInternalComponent implements SwallowTGComponent, ColorCustomizable { public final static int UPPER_LEFT = 1; public final static int UPPER_MIDDLE = 2; @@ -76,7 +80,6 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { protected Graphics myg; - protected Color myColor; private Font myFont;//, myFontB; // private int maxFontSize = 30; @@ -85,7 +88,6 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { private int stringPos = 2; //Upperleft: 1; Upper: 2; UpperRight: 3, etc. - private Color fillColor; private Color textColor; protected Graphics graphics; @@ -127,7 +129,7 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { name = "Info"; value = "Info"; - fillColor = Color.LIGHT_GRAY; + //fillColor = Color.LIGHT_GRAY; textColor = Color.RED; myImageIcon = IconManager.imgic320; } @@ -154,7 +156,7 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { Color c = g.getColor(); - g.setColor(fillColor); + g.setColor(getCurrentColor()); g.fillRect(x, y, width, height); g.setColor(c); g.drawRect(x, y, width, height); @@ -202,14 +204,38 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { g.setColor(c); } - @Override - public TGComponent isOnMe(int x1, int y1) { + public TGComponent isOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { return this; } return null; } + public boolean acceptSwallowedTGComponent(TGComponent tgc) { + return tgc instanceof SysmlsecMethodologyDiagramReference; + + } + + public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) { + if (tgc instanceof SysmlsecMethodologyDiagramReference) { + tgc.setFather(this); + tgc.setDrawingZone(true); + tgc.resizeWithFather(); + addInternalComponent(tgc, 0); + return true; + } + + + return false; + } + + public void removeSwallowedTGComponent(TGComponent tgc) { + removeInternalComponent(tgc); + } + + + // @Override // public void rescale(double scaleFactor){ /*dlineHeight = (lineHeight + dlineHeight) / oldScaleFactor * scaleFactor; @@ -230,10 +256,6 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { } - public void setFillColor(Color _c) { - fillColor = _c; - } - public void setTextColor(Color _c) { textColor = _c; } @@ -248,7 +270,6 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { //value = ""; StringBuffer sb = new StringBuffer("<extraparam>\n"); sb.append("<TextColor value=\"" + textColor.getRGB() + "\" />\n"); - sb.append("<FillColor value=\"" + textColor.getRGB() + "\" />\n"); sb.append("</extraparam>\n"); return new String(sb); @@ -285,4 +306,11 @@ public class TGCPanelInfo extends TGCScalableWithoutInternalComponent { throw new MalformedModelingException(); } } + + + // Color management + public Color getMainColor() { + return Color.LIGHT_GRAY; + } + }//Class diff --git a/src/main/java/ui/TGComponent.java b/src/main/java/ui/TGComponent.java index 08c1ea785f4c831e1b0a5e4b8461770bad453b19..c229987e80b72a890391e20c482c8c770e747fad 100644 --- a/src/main/java/ui/TGComponent.java +++ b/src/main/java/ui/TGComponent.java @@ -82,6 +82,7 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem protected final static String XML_HEAD = "<COMPONENT type=\""; protected final static String XML_ID = "\" id=\""; + protected final static String XML_INDEX = "\" index=\""; protected final static String XML_UUID = "\" uid=\""; protected final static String XML_TAIL = "</COMPONENT>\n"; @@ -218,6 +219,9 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem // Colors protected Color currentMainColor; + // For front / back + public int indexU = -1; + // Zoom // Issue #31: Moved to scalable component @@ -2593,6 +2597,18 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem return id; } + public int getIndexU() { + return indexU; + } + + public int compareTo(TGComponent tgc){ + return indexU - tgc.getIndexU(); + } + + public void setIndexU(int _indexU) { + indexU = _indexU; + } + public UUID getUUID() { if (uniqueID == null) { makeUUID(); @@ -3203,6 +3219,9 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem sb.append(getType()); sb.append(XML_ID); sb.append(getId()); + sb.append(XML_INDEX); + sb.append((getIndexU())); + if (getUUID() != null) { sb.append(XML_UUID); sb.append(getUUID().toString()); @@ -3496,6 +3515,7 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem if (currentMainColor != null) { return currentMainColor; } + if (this instanceof ColorCustomizable) { return ((ColorCustomizable)(this)).getMainColor(); } @@ -3504,10 +3524,12 @@ public abstract class TGComponent extends AbstractCDElement implements /*CDElem } public void setCurrentColor(int _rgb) { + //TraceManager.addDev("Setting current color to: " + _rgb); currentMainColor = new Color(_rgb); } public void setCurrentColor(Color _c) { + //TraceManager.addDev("Setting current color to: " + _c); currentMainColor = _c; } diff --git a/src/main/java/ui/TGConnector.java b/src/main/java/ui/TGConnector.java index 03d5319fd585f21b24c436b83fbdf5266317b13d..7d47dcc72e3c817e8775bcbdfcc6e4a91beb3cef 100644 --- a/src/main/java/ui/TGConnector.java +++ b/src/main/java/ui/TGConnector.java @@ -751,6 +751,8 @@ public abstract class TGConnector extends TGCScalableWithInternalComponent { sb.append(getType()); sb.append(XML_ID); sb.append(getId()); + sb.append(XML_INDEX); + sb.append(getIndexU()); if (getUUID() != null) { sb.append(XML_UUID); sb.append(getUUID().toString()); diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java index 1041ab9d1acf37d0b79bcac7b5282d71d21d23e9..a307687c2e642df4611ffbb9c1108b5e4feae67a 100644 --- a/src/main/java/ui/TGUIAction.java +++ b/src/main/java/ui/TGUIAction.java @@ -700,11 +700,18 @@ public class TGUIAction extends AbstractAction { public static final int M_REF_REQUIREMENTS = 542; public static final int M_REF_ANALYSIS = 543; public static final int M_REF_DESIGN = 544; - public static final int AM_REF_PROPERTIES = 545; + public static final int M_REF_PROPERTIES = 545; public static final int M_REF_PROTOTYPING = 546; + public static final int M_REF_FAULT = 547; + public static final int M_REF_ATTACK = 548; + public static final int M_REF_FV = 549; + public static final int M_REF_CP = 550; + public static final int M_REF_ARCHI = 551; + public static final int M_REF_MAPPING = 552; + public static final int M_PANEL_INFO = 553; - public static final int NB_ACTION = 547; // Last + 1 + public static final int NB_ACTION = 554; // Last + 1 private static final TAction [] actions = new TAction[NB_ACTION]; @@ -1491,11 +1498,32 @@ public class TGUIAction extends AbstractAction { "Reference to analysis", "Add a reference to a analysis diagrams", 0); actions[M_REF_DESIGN] = new TAction("add-ref-des", "Add reference to design diagrams", IconManager.imgic410, IconManager.imgic410, "Reference to designs", "Add a reference to design diagrams", 0); - actions[AM_REF_PROPERTIES] = new TAction("add-ref-prop", "Add reference to property diagrams", IconManager.imgic412, IconManager.imgic412, + actions[M_REF_PROPERTIES] = new TAction("add-ref-prop", "Add reference to property diagrams", IconManager.imgic412, IconManager.imgic412, "Reference to properties", "Add a reference to a property diagrams", 0); actions[M_REF_PROTOTYPING] = new TAction("add-ref-proto", "Add reference to a prototyping diagram", IconManager.imgic414, IconManager.imgic414, "Reference to prototyping", "Add a reference to a prototyping diagram", 0); + actions[M_REF_FAULT] = new TAction("add-ref-fault", "Add reference to a fault diagram", IconManager.imgic416, + IconManager.imgic416, + "Reference to fault", "Add a reference to a fault diagram", 0); + actions[M_REF_ATTACK] = new TAction("add-ref-attack", "Add reference to an attack diagram", IconManager.imgic418, + IconManager.imgic418, + "Reference to attack", "Add a reference to an attack diagram", 0); + actions[M_REF_FV] = new TAction("add-ref-fv", "Add reference to a functional view", IconManager.imgic420, + IconManager.imgic420, + "Reference to function view", "Add a reference to a functional view", 0); + actions[M_REF_CP] = new TAction("add-ref-cp", "Add reference to a communication pattern", IconManager.imgic422, + IconManager.imgic422, + "Reference to communication pattern", "Add a reference to a communication pattern", 0); + actions[M_REF_ARCHI] = new TAction("add-ref-archi", "Add reference to an architecture", IconManager.imgic424, + IconManager.imgic424, + "Reference to an architecture", "Add a reference to an architecture", 0); + actions[M_REF_MAPPING] = new TAction("add-ref-mapping", "Add reference to a mapping", IconManager.imgic426, + IconManager.imgic426, + "Reference to a mapping", "Add a reference to a mapping", 0); + actions[M_PANEL_INFO] = new TAction("add-diag-name", "Add a diagram name", IconManager.imgic426, + IconManager.imgic426, + "diagram name", "Add a diagram name", 0); } diff --git a/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java b/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java index 68c3e1192cbc4746ff44c73c91b89e02779e08ca..417710e29930cfccb553cdfac7c407d157b0aa0c 100755 --- a/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java +++ b/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramReference.java @@ -45,6 +45,7 @@ package ui.sysmlsecmethodology; import myutil.GraphicLib; import myutil.TraceManager; import ui.*; +import ui.atd.ATDBlock; import ui.avatarmethodology.AvatarMethodologyConnectingPoint; import ui.util.IconManager; import ui.window.JDialogManageListOfString; @@ -63,7 +64,8 @@ import java.util.Vector; * @version 1.0 26/01/2016 * @author Ludovic APVRILLE */ -public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWithInternalComponent implements SwallowTGComponent { +public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWithInternalComponent implements SwallowTGComponent, ColorCustomizable, + SwallowedTGComponent { public String oldValue; protected int textX = 5; protected int textY = 22; @@ -193,7 +195,7 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit // int h = g.getFontMetrics().getHeight(); - g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + g.setColor(getCurrentColor()); g.fillRect(x, y, width, height); ColorManager.setColor(g, getState(), 0); g.drawRect(x, y, width, height); @@ -307,6 +309,16 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit g.setFont(f);*/ } + @Override + public void resizeWithFather() { + + if ((father != null) && (father instanceof TGCPanelInfo)) { + setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); + //setCd(Math.min(x, father.getWidth() - getWidth()), Math.min(y, father.getHeight() - getHeight())); + setMoveCd(x, y); + } + } + public boolean editOnDoubleClick(JFrame frame, int _x, int _y) { addDiagramReference(frame); return true; @@ -572,6 +584,10 @@ public abstract class SysmlsecMethodologyDiagramReference extends TGCScalableWit tdp.getMGUI().setStatusBarText(info); } + // Color management + public Color getMainColor() { + return ColorManager.AVATAR_REQUIREMENT_TOP; + } /*public String getDiagramReferences() { diff --git a/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramToolbar.java b/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramToolbar.java index 244ca681da76b496feb1ccccdb02f682f6b6d963..c78c6c9dd346968726469000de80ba28ece36427 100755 --- a/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramToolbar.java +++ b/src/main/java/ui/sysmlsecmethodology/SysmlsecMethodologyDiagramToolbar.java @@ -76,11 +76,23 @@ public class SysmlsecMethodologyDiagramToolbar extends TToolBar { mgui.actions[TGUIAction.CONNECTOR_COMMENT].setEnabled(b); mgui.actions[TGUIAction.M_LINK].setEnabled(b); + + mgui.actions[TGUIAction.M_PANEL_INFO].setEnabled(b); + mgui.actions[TGUIAction.M_REF_ASSUMPTIONS].setEnabled(b); + mgui.actions[TGUIAction.M_REF_REQUIREMENTS].setEnabled(b); + mgui.actions[TGUIAction.M_REF_FAULT].setEnabled(b); + mgui.actions[TGUIAction.M_REF_ATTACK].setEnabled(b); + + mgui.actions[TGUIAction.M_REF_FV].setEnabled(b); + mgui.actions[TGUIAction.M_REF_CP].setEnabled(b); + mgui.actions[TGUIAction.M_REF_ARCHI].setEnabled(b); + mgui.actions[TGUIAction.M_REF_MAPPING].setEnabled(b); + mgui.actions[TGUIAction.M_REF_ANALYSIS].setEnabled(b); mgui.actions[TGUIAction.M_REF_DESIGN].setEnabled(b); - mgui.actions[TGUIAction.AM_REF_PROPERTIES].setEnabled(b); + mgui.actions[TGUIAction.M_REF_PROPERTIES].setEnabled(b); mgui.actions[TGUIAction.M_REF_PROTOTYPING].setEnabled(b); mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(!b); @@ -94,6 +106,7 @@ public class SysmlsecMethodologyDiagramToolbar extends TToolBar { button = this.add(mgui.actions[TGUIAction.M_EDIT]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); this.addSeparator(); button = this.add(mgui.actions[TGUIAction.UML_NOTE]); @@ -102,38 +115,64 @@ public class SysmlsecMethodologyDiagramToolbar extends TToolBar { button = this.add(mgui.actions[TGUIAction.CONNECTOR_COMMENT]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); this.addSeparator(); button = this.add(mgui.actions[TGUIAction.M_LINK]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.M_PANEL_INFO]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); this.addSeparator(); button = this.add(mgui.actions[TGUIAction.M_REF_ASSUMPTIONS]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); this.addSeparator(); button = this.add(mgui.actions[TGUIAction.M_REF_REQUIREMENTS]); button.addMouseListener(mgui.mouseHandler); - this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.M_REF_FAULT]); + button.addMouseListener(mgui.mouseHandler); - button = this.add(mgui.actions[TGUIAction.M_REF_ANALYSIS]); + button = this.add(mgui.actions[TGUIAction.M_REF_ATTACK]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); this.addSeparator(); - button = this.add(mgui.actions[TGUIAction.M_REF_DESIGN]); + button = this.add(mgui.actions[TGUIAction.M_REF_FV]); button.addMouseListener(mgui.mouseHandler); - this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.M_REF_CP]); + button.addMouseListener(mgui.mouseHandler); - button = this.add(mgui.actions[TGUIAction.AM_REF_PROPERTIES]); + button = this.add(mgui.actions[TGUIAction.M_REF_ARCHI]); button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.M_REF_MAPPING]); + button.addMouseListener(mgui.mouseHandler); + + + this.addSeparator(); this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.M_REF_ANALYSIS]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.M_REF_DESIGN]); + button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.M_REF_PROPERTIES]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.M_REF_PROTOTYPING]); button.addMouseListener(mgui.mouseHandler); diff --git a/src/main/java/ui/util/IconManager.java b/src/main/java/ui/util/IconManager.java index d21599ef495074b04909230e5a2c773a672efea8..66572c52189911145f1fe4c611d41dbce8adbdab 100755 --- a/src/main/java/ui/util/IconManager.java +++ b/src/main/java/ui/util/IconManager.java @@ -99,7 +99,9 @@ public class IconManager { public static ImageIcon imgic340, imgic341, imgic342, imgic344; //IOD - public static ImageIcon imgic400, imgic402, imgic404, imgic406, imgic408, imgic410, imgic412, imgic414; + public static ImageIcon imgic400, imgic402, imgic404, imgic406, imgic408; + public static ImageIcon imgic410, imgic412, imgic414, imgic416, imgic418; + public static ImageIcon imgic420, imgic422, imgic424, imgic426; public static ImageIcon imgic500, imgic502, imgic504, imgic506, imgic508, imgic510; public static ImageIcon imgic512, imgic514, imgic516, imgic518, imgic520, imgic522, imgic524; @@ -438,6 +440,12 @@ public class IconManager { private static String icon410 = "referencetodesign.gif"; private static String icon412 = "referencetoprop.gif"; private static String icon414 = "referencetoproto.gif"; + private static String icon416 = "referencetofault.gif"; + private static String icon418 = "referencetoattack.gif"; + private static String icon420 = "referencetofv.gif"; + private static String icon422 = "referencetocp.gif"; + private static String icon424 = "referencetoarch.gif"; + private static String icon426 = "referencetomapping.gif"; @@ -981,6 +989,12 @@ public class IconManager { imgic410 = getIcon(icon410); imgic412 = getIcon(icon412); imgic414 = getIcon(icon414); + imgic416 = getIcon(icon416); + imgic418 = getIcon(icon418); + imgic420 = getIcon(icon420); + imgic422 = getIcon(icon422); + imgic424 = getIcon(icon424); + imgic426 = getIcon(icon426);