diff --git a/src/ui/AttackTreePanel.java b/src/ui/AttackTreePanel.java index 6d8020fec139bdec9207fb0c64fa3c710d7a6f98..7288cac4727e301e79349371aae68273fdd47239 100755 --- a/src/ui/AttackTreePanel.java +++ b/src/ui/AttackTreePanel.java @@ -104,7 +104,7 @@ public class AttackTreePanel extends TURTLEPanel { jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT); toolBarPanel.add(toolBarAt, BorderLayout.NORTH); toolBarPanel.add(jsp, BorderLayout.CENTER); - tabbedPane.addTab(s, IconManager.imgic1000, toolBarPanel, "Opens Attack Tree Diagram"); + tabbedPane.addTab(s, IconManager.imgic1074, toolBarPanel, "Opens Attack Tree Diagram"); tabbedPane.setSelectedIndex(0); JPanel toolBarPanel = new JPanel(); toolBarPanel.setLayout(new BorderLayout()); diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java index 03f1527f11a47dba3b800e612e4bd9be3e61ce1f..31372ff230f559540d25e00bcfe369850bfa6ddb 100755 --- a/src/ui/ColorManager.java +++ b/src/ui/ColorManager.java @@ -110,6 +110,7 @@ public class ColorManager { public static final Color TML_COMPOSITE_COMPONENT = new Color(239, 212, 176, 125); + public static final Color TML_PORT_CHANNEL = new Color(104, 229, 255); public static final Color TML_PORT_EVENT = new Color(216, 187, 249); public static final Color TML_PORT_REQUEST = new Color(196, 166, 122); @@ -119,6 +120,11 @@ public class ColorManager { public static final Color SD_REFERENCE = new Color(104, 229, 255); public static final Color IOD_REFERENCE = new Color(216, 187, 249); + + public static final Color ATD_BLOCK = new Color(196, 232, 195); + public static final Color ATD_ATTACK = new Color(214, 187, 158); + public static final Color ATD_CONSTRAINT = new Color(191, 153, 161); + public static final Color DIAGRAM_BACKGROUND = Color.white; public static final Color MainTabbedPane = new Color(231, 214, 176); diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java index 8aa7926d2cbf6a61b61acc6e020170e6a7d1b0a6..b5bcfd3debb5cc390f8326111e235018e4668e15 100755 --- a/src/ui/GTURTLEModeling.java +++ b/src/ui/GTURTLEModeling.java @@ -63,6 +63,7 @@ import launcher.*; import myutil.*; import nc.*; import ui.ad.*; +import ui.atd.*; import ui.cd.*; import ui.dd.*; import ui.iod.*; @@ -2210,6 +2211,40 @@ public class GTURTLEModeling { makePostLoading(ebrddp, beginIndex); } } + } else if (tdp instanceof AttackTreeDiagramPanel) { + nl = doc.getElementsByTagName("AttackTreeDiagramPanelCopy"); + + if (nl == null) { + return; + } + + AttackTreeDiagramPanel atdp = (AttackTreeDiagramPanel)tdp; + + for(i=0; i<nl.getLength(); i++) { + adn = nl.item(i); + if (adn.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) adn; + + if (atdp == 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; + + makeXMLComponents(elt.getElementsByTagName("COMPONENT"), atdp); + makeXMLConnectors(elt.getElementsByTagName("CONNECTOR"), atdp); + makeXMLComponents(elt.getElementsByTagName("SUBCOMPONENT"), atdp); + connectConnectorsToRealPoints(atdp); + atdp.structureChanged(); + makePostLoading(atdp, beginIndex); + } + } } else if (tdp instanceof TMLTaskDiagramPanel) { nl = doc.getElementsByTagName("TMLTaskDiagramPanelCopy"); docCopy = doc; @@ -2779,6 +2814,8 @@ public class GTURTLEModeling { loadNC(node); } else if (type.compareTo("Requirement") == 0) { loadRequirement(node); + } else if (type.compareTo("AttackTree") == 0) { + loadAttackTree(node); } else if (type.compareTo("TML Design") == 0) { loadTMLDesign(node); } else if (type.compareTo("TML Component Design") == 0) { @@ -2942,6 +2979,30 @@ public class GTURTLEModeling { } } } + + public void loadAttackTree(Node node) throws MalformedModelingException, SAXException { + Element elt = (Element) node; + String nameTab; + NodeList diagramNl; + int indexTree; + + nameTab = elt.getAttribute("nameTab"); + + indexTree = mgui.createAttackTree(nameTab); + + diagramNl = node.getChildNodes(); + + for(int j=0; j<diagramNl.getLength(); j++) { + //System.out.println("Deployment nodes: " + j); + node = diagramNl.item(j); + if (node.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element)node; + if (elt.getTagName().compareTo("AttackTreeDiagramPanel") == 0) { + loadAttackTreeDiagram(elt, indexTree); + } + } + } + } public void loadTMLDesign(Node node) throws MalformedModelingException, SAXException { Element elt = (Element) node; @@ -3396,6 +3457,22 @@ public class GTURTLEModeling { loadDiagram(elt, tdp); } + + public void loadAttackTreeDiagram(Element elt, int indexDiag) throws MalformedModelingException, SAXException { + String name; + + name = elt.getAttribute("name"); + mgui.createAttackTreeDiagram(indexDiag, name); + + TDiagramPanel tdp = mgui.getAttackTreeDiagramPanel(indexDiag, name); + + if (tdp == null) { + throw new MalformedModelingException(); + } + tdp.removeAll(); + + loadDiagram(elt, tdp); + } public void loadSequenceDiagram(Element elt, int indexAnalysis) throws MalformedModelingException, SAXException { String name; diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java index 4808f529902ca7c39955255c897fd9caf39758ee..807f4b6b714e6a0880d08fb60bbc88c8e9ed3db3 100755 --- a/src/ui/IconManager.java +++ b/src/ui/IconManager.java @@ -109,6 +109,9 @@ public class IconManager { public static ImageIcon imgic1000, imgic1002, imgic1004,imgic1006,imgic1008, imgic1010, imgic1012, imgic1014; public static ImageIcon imgic1050, imgic1052, imgic1054,imgic1056, imgic1058, imgic1060; + // Attack Tree Diagrams + public static ImageIcon imgic1070, imgic1072, imgic1074; + // TMLDD public static ImageIcon imgic1100, imgic1102, imgic1104, imgic1106, imgic1108; @@ -406,6 +409,10 @@ public class IconManager { private static String icon1058 = "images/ebrdd.gif"; private static String icon1060 = "images/ebrddvar.gif"; + // Attack Tree Diagrams + private static String icon1070 = "images/atdblock.gif"; + private static String icon1072 = "images/atdattack.gif"; + private static String icon1074 = "images/atdiag.gif"; // DIPLODOCUS architecture private static String icon1100 = "images/tmlcpunode.gif"; @@ -711,6 +718,10 @@ public class IconManager { imgic1058 = getIcon(icon1058); imgic1060 = getIcon(icon1060); + imgic1070 = getIcon(icon1070); + imgic1072 = getIcon(icon1072); + imgic1074 = getIcon(icon1074); + imgic1100 = getIcon(icon1100); imgic1102 = getIcon(icon1102); imgic1104 = getIcon(icon1104); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index ca065b173e74c10d2c95de4b599b312b996332a0..fac7fbf613064ffbc0ad247863ceb81395d554c4 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -62,6 +62,7 @@ import translator.*; import myutil.*; import ui.ad.*; +import ui.atd.*; import ui.cd.*; import ui.file.*; import ui.interactivesimulation.*; @@ -772,9 +773,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { AttackTreePanel atp = new AttackTreePanel(this); tabs.add(index, atp); // should look for the first mainTabbedPane.add(atp.tabbedPane, index); - mainTabbedPane.setToolTipTextAt(index, "Open requirement diagrams"); + mainTabbedPane.setToolTipTextAt(index, "Open attack tree diagrams"); mainTabbedPane.setTitleAt(index, name); - mainTabbedPane.setIconAt(index, IconManager.imgic1000); + mainTabbedPane.setIconAt(index, IconManager.imgic1074); atp.init(); return index; } @@ -1068,6 +1069,12 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { mainTabbedPane.setSelectedIndex(index); return index; } + + public int createAttackTree(String name) { + int index = addAttackTreePanel(name, -1); + mainTabbedPane.setSelectedIndex(index); + return index; + } public void setIODName(int analysisIndex, String name) { AnalysisPanel ap = (AnalysisPanel)(tabs.elementAt(analysisIndex)); @@ -4151,6 +4158,22 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(index)); return getSequenceDiagramPanel(tp, s); } + + public AttackTreeDiagramPanel getAttackTreeDiagramPanel(int index, String s) { + //System.out.println("Searching for " + s); + TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(index)); + return getAttackTreeDiagramPanel(tp, s); + } + + public AttackTreeDiagramPanel getAttackTreeDiagramPanel(TURTLEPanel tp, String s) { + for(int i=0; i<tp.tabbedPane.getTabCount(); i++) { + if (tp.tabbedPane.getTitleAt(i).equals(s)) { + if (tp.panelAt(i) instanceof AttackTreeDiagramPanel) + return (AttackTreeDiagramPanel)(tp.panelAt(i)); + } + } + return null; + } public InteractionOverviewDiagramPanel getIODiagramPanel(int index, String s) { //System.out.println("Searching for " + s); @@ -4325,6 +4348,10 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { return true; } + public boolean createAttackTreeDiagram(int index, String s) { + return createAttackTreeDiagram((TURTLEPanel)(tabs.elementAt(index)), s); + } + public boolean createAttackTreeDiagram(TURTLEPanel tp, String s) { if (!(tp instanceof AttackTreePanel)) { return false; @@ -5231,7 +5258,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { public void toggleAttr() { TDiagramPanel tdp = getCurrentTDiagramPanel(); if (tdp != null){ - System.out.println("Toggle attributes"); + //System.out.println("Toggle attributes"); tdp.setAttributes((tdp.getAttributeState() +1 )% 3); tdp.checkAllMySize(); tdp.repaint(); @@ -5793,6 +5820,17 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_ARTIFACT); } else if (command.equals(actions[TGUIAction.TMLARCHI_COMMUNICATION_ARTIFACT].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLARCHI_COMMUNICATION_ARTIFACT); + + // Attack Tree Diagrams + } else if (command.equals(actions[TGUIAction.ATD_BLOCK].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ATD_BLOCK); + } else if (command.equals(actions[TGUIAction.ATD_ATTACK].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ATD_ATTACK); + } else if (command.equals(actions[TGUIAction.ATD_COMPOSITION_CONNECTOR].getActionCommand())) { + actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.ATD_COMPOSITION_CONNECTOR); + } else if (command.equals(actions[TGUIAction.ATD_ATTACK_CONNECTOR].getActionCommand())) { + actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.ATD_ATTACK_CONNECTOR); + // TURTLE-OS } else if (command.equals(actions[TGUIAction.TOS_TCLASS].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TOSCD_TCLASS); diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java index c2fb95705919bd77ef2e94ee439cda6f611be042..11837fd4948f40e5dfb0eb630ba0a7128df97c71 100755 --- a/src/ui/TDiagramPanel.java +++ b/src/ui/TDiagramPanel.java @@ -63,6 +63,9 @@ import ui.tmlcd.*; import ui.tmlcompd.*; import ui.req.*; import ui.ncdd.*; + +import ui.atd.*; + // Added by Solange import ui.procsd.*; @@ -1991,6 +1994,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { public void detach(TGComponent tgc) { if ((tgc instanceof SwallowedTGComponent) && (tgc.getFather() != null)) { ((SwallowTGComponent)tgc.getFather()).removeSwallowedTGComponent(tgc); + tgc.setFather(null); componentList.add(tgc); tgc.wasUnswallowed(); bringToFront(tgc); @@ -2408,6 +2412,34 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { } return name; } + + public String findBlockName(String name) { + boolean ok; + int i; + int index = 0; + ATDBlock t; + Object o; + Iterator iterator; + + while(index >= 0) { + ok = true; + iterator = componentList.listIterator(); + while(iterator.hasNext()) { + o = (TGComponent)(iterator.next()); + if (o instanceof ATDBlock) { + t = (ATDBlock)o; + if (t.getName().equals(name + index)) { + ok = false; + } + } + } + if (ok) { + return name + index; + } + index ++; + } + return name; + } public String findTObjectName(String name) { boolean ok; @@ -2580,6 +2612,24 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree { return true; } + public boolean isBlockNameUnique(String s) { + Object o; + ATDBlock t; + Iterator iterator = componentList.listIterator(); + + + while(iterator.hasNext()) { + o = (TGComponent)(iterator.next()); + if (o instanceof ATDBlock) { + t = (ATDBlock)o; + if (t.getName().equals(s)) { + return false; + } + } + } + return true; + } + public boolean isNCNameUnique(String s) { Object o; TGComponent tgc; diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index 24e179275c5728edec92f9c4e17dcd0303716708..80d281d4e9949331433bec9a45422712ca0aad4f 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -59,6 +59,8 @@ import ui.ucd.*; import ui.req.*; import ui.ebrdd.*; +import ui.atd.*; + import ui.tmlad.*; import ui.tmlcd.*; import ui.tmldd.*; @@ -131,6 +133,9 @@ public class TGComponentManager { public static final int CONNECTOR_EBRDD = 130; public static final int CONNECTOR_EBRDD_ERC = 131; + + public static final int ATD_COMPOSITION_CONNECTOR = 132; + public static final int ATD_ATTACK_CONNECTOR = 133; public static final int TCD_TCLASS = 201; public static final int TCD_PARALLEL_OPERATOR = 202; @@ -230,6 +235,7 @@ public class TGComponentManager { public static final int ATD_BLOCK = 1400; public static final int ATD_ATTACK = 1401; + // SMD diagram public static final int PROSMD_START_STATE = 2000; @@ -272,6 +278,9 @@ public class TGComponentManager { public static final int NCDD_SWITCHNODE = 4001; public static final int NCDD_TRAFFIC_ARTIFACT = 4002; public static final int NCDD_ROUTE_ARTIFACT = 4003; + + + public static final int EDIT = -1; @@ -461,6 +470,12 @@ public class TGComponentManager { break; case EBRDD_ERB: tgc = new EBRDDERB(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case ATD_BLOCK: + tgc = new ATDBlock(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case ATD_ATTACK: + tgc = new ATDAttack(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; case TMLAD_START_STATE: tgc = new TMLADStartState(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); @@ -829,6 +844,14 @@ public class TGComponentManager { return EBRDD_ESO; } else if (tgc instanceof EBRDDERB) { return EBRDD_ERB; + } else if (tgc instanceof ATDBlock) { + return ATD_BLOCK; + } else if (tgc instanceof ATDAttack) { + return ATD_ATTACK; + } else if (tgc instanceof ATDCompositionConnector) { + return ATD_COMPOSITION_CONNECTOR; + } else if (tgc instanceof ATDAttackConnector) { + return ATD_ATTACK_CONNECTOR; } else if (tgc instanceof TMLADStartState) { return TMLAD_START_STATE; } else if (tgc instanceof TMLADStopState) { @@ -1073,6 +1096,12 @@ public class TGComponentManager { break; case CONNECTOR_EBRDD_ERC: tgc = new TGConnectorEBRDDERC(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); + break; + case ATD_COMPOSITION_CONNECTOR: + tgc = new ATDCompositionConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); + break; + case ATD_ATTACK_CONNECTOR: + tgc = new ATDAttackConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); break; case CONNECTOR_TMLAD: tgc = new TGConnectorTMLAD(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index c9188ce6951ef41ad4387421e8904e2c55fc4ea6..c943e625933d9abc7c177b5f384e1f9541af88dd 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -289,7 +289,8 @@ public class TGUIAction extends AbstractAction { public static final int ATD_BLOCK = 284; public static final int ATD_ATTACK = 285; - public static final int ATD_CONNECTOR = 286; + public static final int ATD_ATTACK_CONNECTOR = 286; + public static final int ATD_COMPOSITION_CONNECTOR = 292; public static final int ATD_OR_CONSTRAINT = 287; public static final int ATD_AND_CONSTRAINT = 288; public static final int ATD_SEQUENCE_CONSTRAINT = 289; @@ -403,7 +404,7 @@ public class TGUIAction extends AbstractAction { //Action for the help button created by Solange public static final int PRUEBA_1 = 205; - public static final int NB_ACTION = 292; + public static final int NB_ACTION = 293; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -757,9 +758,10 @@ public class TGUIAction extends AbstractAction { // Attack Tree Diagrams - actions[ATD_BLOCK] = new TAction("atd-block", "Add a block", IconManager.imgic1012, IconManager.imgic1012, "Block", "Add a SysML Block to the currently opened attack tree diagram", 0); - actions[ATD_ATTACK] = new TAction("atd-attack", "Add an attack", IconManager.imgic1012, IconManager.imgic1012, " Attack", "Add an attack (i.e. a SysML value type) to the currently opened attack tree diagram", 0); - actions[ATD_CONNECTOR] = new TAction("atd-connector", "Add a connector", IconManager.imgic1012, IconManager.imgic1012, "Connector", "Add a connector between attacks / constraints to the currently opened attack tree diagram", 0); + actions[ATD_BLOCK] = new TAction("atd-block", "Add a block", IconManager.imgic1070, IconManager.imgic1070, "Block", "Add a SysML Block to the currently opened attack tree diagram", 0); + actions[ATD_ATTACK] = new TAction("atd-attack", "Add an attack", IconManager.imgic1072, IconManager.imgic1072, " Attack", "Add an attack (i.e. a SysML value type) to the currently opened attack tree diagram", 0); + actions[ATD_ATTACK_CONNECTOR] = new TAction("atd-attack-connector", "Add a connector between attacks /constraints", IconManager.imgic1012, IconManager.imgic1012, "Connector", "Add a connector between attacks / constraints of the currently opened attack tree diagram", 0); + actions[ATD_COMPOSITION_CONNECTOR] = new TAction("atd-composition-connector", "Add a composition connector between blocks", IconManager.imgic1012, IconManager.imgic1012, "Composition connector", "Add a composition between blocks of the currently opened attack tree diagram", 0); actions[ATD_OR_CONSTRAINT] = new TAction("atd-or", "Add an <<or>>", IconManager.imgic1012, IconManager.imgic1012, "Or", "Add an <<or>> constraint to the currently opened attack tree diagram", 0); actions[ATD_AND_CONSTRAINT] = new TAction("atd-and", "Add an <<and>>", IconManager.imgic1012, IconManager.imgic1012, "And", "Add an <<and>> constraint to the currently opened attack tree diagram", 0); actions[ATD_SEQUENCE_CONSTRAINT] = new TAction("atd-sequence", "Add a <<sequence>>", IconManager.imgic1012, IconManager.imgic1012, "Sequence", "Add a <<sequence>> constraint to the currently opened attack tree diagram", 0); diff --git a/src/ui/atd/ATDAttack.java b/src/ui/atd/ATDAttack.java new file mode 100755 index 0000000000000000000000000000000000000000..9bafe4da675e1e76057ea03f3169b8042f89ef0e --- /dev/null +++ b/src/ui/atd/ATDAttack.java @@ -0,0 +1,270 @@ +/**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 ATDAttack + * Attack -> SysML value type + * Creation: 09/12/2009 + * @version 1.0 09/12/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.atd; + +import java.awt.*; +import java.util.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +public class ATDAttack extends TGCWithoutInternalComponent implements SwallowedTGComponent, WithAttributes { + private int textY1 = 15; + private int textY2 = 30; + + protected String oldValue = ""; + protected String description = ""; + private String stereotype = "attack"; + + public ATDAttack(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); + + width = 125; + height = 40; + minWidth = 100; + + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.5, 0.0); + connectingPoint[2] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[3] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); + connectingPoint[4] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); + connectingPoint[5] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[6] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.5, 1.0); + connectingPoint[7] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); + + connectingPoint[8] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.25, 0.0); + connectingPoint[9] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.75, 0.0); + connectingPoint[10] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.0, 0.25); + connectingPoint[11] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 0.25); + connectingPoint[12] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.0, 0.75); + connectingPoint[13] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 0.75); + connectingPoint[14] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.25, 1.0); + connectingPoint[15] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.75, 1.0); + //addTGConnectingPointsComment(); + + moveable = true; + editable = true; + removable = true; + + value = "name"; + description = "blah blah blah"; + + myImageIcon = IconManager.imgic702; + } + + public void internalDrawing(Graphics g) { + + Color c = g.getColor(); + g.draw3DRect(x, y, width, height, true); + + g.setColor(ColorManager.ATD_ATTACK); + g.fill3DRect(x+1, y+1, width-1, height-1, true); + g.setColor(c); + + // Strings + String ster = "<<" + stereotype + ">>"; + int w = g.getFontMetrics().stringWidth(ster); + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.BOLD)); + g.drawString(ster, x + (width - w)/2, y + textY1); + g.setFont(f); + w = g.getFontMetrics().stringWidth(value); + g.drawString(value, x + (width - w)/2, y + textY2); + + } + + /* public void setValue(String val, Graphics g) { + oldValue = value; + int w = g.getFontMetrics().stringWidth(value); + int w1 = Math.max(minWidth, w + 2 * textX + fileX + space); + + //System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value); + if (w1 != width) { + width = w1; + resizeWithFather(); + } + //System.out.println("width=" + width + " w1=" + w1 + " value=" + value); + }*/ + + public void resizeWithFather() { + if ((father != null) && (father instanceof ATDBlock)) { + //System.out.println("cdRect comp"); + 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) { + String tmp; + boolean error = false; + + /*JDialogTMLTaskArtifact dialog = new JDialogTMLTaskArtifact(frame, "Setting artifact attributes", this); + dialog.setSize(400, 350); + GraphicLib.centerOnParent(dialog); + dialog.show(); // blocked until dialog has been closed + + if (!dialog.isRegularClose()) { + return false; + } + + if (dialog.getReferenceTaskName() == null) { + return false; + } + + } + + if (dialog.getTaskName().length() != 0) { + tmp = dialog.getTaskName(); + + if (!TAttribute.isAValidId(tmp, false, false)) { + error = true; + } else { + taskName = tmp; + } + } + + priority = dialog.getPriority(); + + if (error) { + JOptionPane.showMessageDialog(frame, + "Name is non-valid", + "Error", + JOptionPane.INFORMATION_MESSAGE); + } + + makeFullValue(); + + return !error;*/ + return true; + } + + public TGComponent isOnMe(int _x, int _y) { + if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + return this; + } + return null; + } + + public int getType() { + return TGComponentManager.ATD_ATTACK; + } + + protected String translateExtraParam() { + StringBuffer sb = new StringBuffer("<extraparam>\n"); + sb.append("<info description=\"" + description); + sb.append("\" />\n"); + sb.append("</extraparam>\n"); + return new String(sb); + } + + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ + //System.out.println("*** load extra synchro ***"); + try { + + NodeList nli; + Node n1, n2; + Element elt; + int t1id; + String sdescription = null; + String prio; + + for(int i=0; i<nl.getLength(); i++) { + n1 = nl.item(i); + //System.out.println(n1); + if (n1.getNodeType() == Node.ELEMENT_NODE) { + nli = n1.getChildNodes(); + for(int j=0; i<nli.getLength(); i++) { + n2 = nli.item(i); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("info")) { + sdescription = elt.getAttribute("description"); + } + if (sdescription != null) { + description = sdescription; + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + } + + + public String getDescription() { + return description; + } + + public void setDescription(String _description) { + description = _description; + } + + public String getAttackName() { + return value; + } + + public String getAttributes() { + return "Description = " + description; + } + + + + +} diff --git a/src/ui/atd/ATDAttackConnectingPoint.java b/src/ui/atd/ATDAttackConnectingPoint.java new file mode 100755 index 0000000000000000000000000000000000000000..36b703953c6a7a64c309499de6c8999089ecdd8c --- /dev/null +++ b/src/ui/atd/ATDAttackConnectingPoint.java @@ -0,0 +1,65 @@ +/**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 ATDAttackConnectingPoint + * Definition of connecting points on which composition connectors can be connected + * Creation: 09/12/2009 + * @version 1.0 09/12/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.atd; + + +import ui.*; + +public class ATDAttackConnectingPoint extends TGConnectingPointWidthHeight { + + public ATDAttackConnectingPoint(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { + super(_container, _x, _y, _in, _out, _w, _h); + } + + public boolean isCompatibleWith(int type) { + if (type == TGComponentManager.ATD_ATTACK_CONNECTOR) { + return true; + } + return false; + } + +} diff --git a/src/ui/atd/ATDAttackConnector.java b/src/ui/atd/ATDAttackConnector.java new file mode 100755 index 0000000000000000000000000000000000000000..7cfade7f210b2d86325a6da9924dbbaaf90ee87d --- /dev/null +++ b/src/ui/atd/ATDAttackConnector.java @@ -0,0 +1,90 @@ +/**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 ATDAttackConnector + * Connector used in Attack Tree Diagrams + * Creation: 09/12/2009 + * @version 1.0 09/12/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.atd; + + + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; +import java.util.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.cd.*; +import ui.window.*; + +public class ATDAttackConnector extends TGConnector { + //protected int arrowLength = 10; + //protected int widthValue, heightValue, maxWidthValue, h; + + + public ATDAttackConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { + super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); + myImageIcon = IconManager.imgic202; + value = "{info}"; + editable = true; + } + + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) { + g.drawLine(x1, y1, x2, y2); + } else { + GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true); + } + } + + + public int getType() { + return TGComponentManager.ATD_ATTACK_CONNECTOR; + } + + + +} diff --git a/src/ui/atd/ATDBlock.java b/src/ui/atd/ATDBlock.java index f6786329b74534d2096be4119673b882191be7b6..073888110e9a6f64bcebd38c2200a7bebaf34466 100755 --- a/src/ui/atd/ATDBlock.java +++ b/src/ui/atd/ATDBlock.java @@ -37,9 +37,9 @@ knowledge of the CeCILL license and that you accept its terms. /** * Class ATDBlock - * SysML Block. To be used in attack tree diagrams - * Creation: 08/12/2009 - * @version 1.0 08/12/2009 + * Node. To be used in Attack Tree Diagrams + * Creation: 09/12/2009 + * @version 1.1 09/12/2009 * @author Ludovic APVRILLE * @see */ @@ -57,205 +57,147 @@ import ui.*; import ui.window.*; -public class ATDBlock extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, HiddenInternalComponents { - private int maxFontSize = 20; - private int minFontSize = 4; - private int currentFontSize = -1; - private boolean displayText = true; - private int spacePt = 3; - private Color myColor; - private int iconSize = 17; - - private int textX = 15; // border for ports - private double dtextX = 0.0; +public class ATDBlock extends TGCWithInternalComponent implements SwallowTGComponent { + private int textY1 = 15; + private int textY2 = 30; + private String stereotype = "block"; - public TMLCCompositeComponent(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { + public ATDBlock(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) { super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp); - initScaling(250, 200); - - oldScaleFactor = tdp.getZoom(); - dtextX = textX * oldScaleFactor; - textX = (int)dtextX; - dtextX = dtextX - textX; - - minWidth = 1; - minHeight = 1; + width = 250; + height = 200; + minWidth = 150; + minHeight = 100; - nbConnectingPoint = 0; - //connectingPoint = new TGConnectingPoint[0]; - //connectingPoint[0] = new TMLArchiConnectingPoint(this, 0, 0, false, true, 0.0, 0.0); + nbConnectingPoint = 16; + connectingPoint = new TGConnectingPoint[16]; + + connectingPoint[0] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.0, 0.0); + connectingPoint[1] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.5, 0.0); + connectingPoint[2] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 1.0, 0.0); + connectingPoint[3] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.0, 0.5); + connectingPoint[4] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 1.0, 0.5); + connectingPoint[5] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.0, 1.0); + connectingPoint[6] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.5, 1.0); + connectingPoint[7] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 1.0, 1.0); + + connectingPoint[8] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.25, 0.0); + connectingPoint[9] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.75, 0.0); + connectingPoint[10] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.0, 0.25); + connectingPoint[11] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 1.0, 0.25); + connectingPoint[12] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.0, 0.75); + connectingPoint[13] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 1.0, 0.75); + connectingPoint[14] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.25, 1.0); + connectingPoint[15] = new ATDCompositionConnectingPoint(this, 0, 0, true, true, 0.75, 1.0); addTGConnectingPointsComment(); nbInternalTGComponent = 0; - - maxWidth = 2000; - maxHeight = 2000; moveable = true; editable = true; removable = true; userResizable = true; - value = "MyName"; - name = "Composite component"; - - myImageIcon = IconManager.imgic1200; + name = tdp.findBlockName("Block"); + value = "name"; + + myImageIcon = IconManager.imgic700; } public void internalDrawing(Graphics g) { - int w; - int c; - Font f = g.getFont(); - Font fold = f; - //FontMetrics fm = g.getFontMetrics(); - - if (myColor == null) { - myColor = new Color(251, 252, 200- (getMyDepth() * 10), 200); - } - - if ((rescaled) && (!tdp.isScaled())) { - - if (currentFontSize == -1) { - currentFontSize = f.getSize(); - } - rescaled = false; - // Must set the font size .. - // Find the biggest font not greater than max_font size - // By Increment of 1 - // Or decrement of 1 - // If font is less than 4, no text is displayed - - int maxCurrentFontSize = Math.max(0, Math.min(height-(2*textX), maxFontSize)); - - //f = f.deriveFont((float)maxCurrentFontSize); - //g.setFont(f); - while(maxCurrentFontSize > (minFontSize-1)) { - f = f.deriveFont((float)maxCurrentFontSize); - g.setFont(f); - w = g.getFontMetrics().stringWidth(value); - //w = fm.stringWidth(value); - c = width - iconSize - (2 * textX); - //System.out.println("Font size=" + maxCurrentFontSize + " w=" + w + " c=" + c + "value=" + value); - if (w < c) { - break; - } - maxCurrentFontSize --; - - } - currentFontSize = maxCurrentFontSize; - - if(currentFontSize <minFontSize) { - displayText = false; - } else { - displayText = true; - //f = f.deriveFont((float)currentFontSize); - //g.setFont(f); - } - - } - - // Zoom is assumed to be computed - Color col = g.getColor(); - g.drawRect(x, y, width, height); - if ((width > 2) && (height > 2)) { - g.setColor(myColor); - g.fillRect(x+1, y+1, width-1, height-1); - g.setColor(col); - } + Color c = g.getColor(); + g.draw3DRect(x, y, width, height, true); - // Font size - if (displayText) { - f = f.deriveFont((float)currentFontSize); - g.setFont(f); - w = g.getFontMetrics().stringWidth(value); - //System.out.println("Display text: Font size=" + currentFontSize + " w=" + w + " value=" + value); - if (!(w < (width - 2 * (iconSize + textX)))) { - g.drawString(value, x + textX + 1, y + currentFontSize + textX); - } else { - g.drawString(value, x + (width - w)/2, y + currentFontSize + textX); - } - } - - g.setFont(fold); + g.setColor(ColorManager.ATD_BLOCK); + g.fill3DRect(x+1, y+1, width-1, height-1, true); + g.setColor(c); + + // Strings + String ster = "<<" + stereotype + ">>"; + int w = g.getFontMetrics().stringWidth(ster); + Font f = g.getFont(); + g.setFont(f.deriveFont(Font.BOLD)); + g.drawString(ster, x + (width - w)/2, y + textY1); + g.setFont(f); + w = g.getFontMetrics().stringWidth(name); + g.drawString(name, x + (width - w)/2, y + textY2); // Icon - if ((width>30) && (height > (iconSize + 2*textX))) { - g.drawImage(IconManager.imgic1200.getImage(), x + width - iconSize - textX, y + textX, null); - } + //g.drawImage(IconManager.imgic1100.getImage(), x + 4, y + 4, null); + //g.drawImage(IconManager.img9, x + width - 20, y + 4, null); } - - public void rescale(double scaleFactor){ - dtextX = (textX + dtextX) / oldScaleFactor * scaleFactor; - textX = (int)(dtextX); - dtextX = dtextX - textX; - - super.rescale(scaleFactor); - } - public TGComponent isOnOnlyMe(int _x, int _y) { - if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) { + public TGComponent isOnOnlyMe(int x1, int y1) { + + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { return this; } return null; } - - public boolean editOndoubleClick(JFrame frame) { - String s = (String)JOptionPane.showInputDialog(frame, "Name:", "Setting block name", - JOptionPane.PLAIN_MESSAGE, IconManager.imgic100, + public String getStereotype() { + return stereotype; + + } + + public String getNodeName() { + return name; + } + + public boolean editOndoubleClick(JFrame frame) { + String oldValue = value; + + //String text = getName() + ": "; + String s = (String)JOptionPane.showInputDialog(frame, "Block name", + "setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101, null, getValue()); - if ((s != null) && (s.length() > 0)) { - if (!TAttribute.isAValidId(s, false, false)) { - JOptionPane.showMessageDialog(frame, - "Could not change the name of the block: the new name is not a valid name", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return false; - } - setValueWithChange(s); - return true; + + if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) { + //boolean b; + if (!TAttribute.isAValidId(s, false, false)) { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Block: the new name is not a valid name", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + if (!tdp.isBlockNameUnique(s)) { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Block: the new name is already in use", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + setValue(s); + recalculateSize(); + + + + if (tdp.actionOnDoubleClick(this)) { + return true; + } else { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Block: this name is already in use", + "Error", + JOptionPane.INFORMATION_MESSAGE); + setValue(oldValue); + } } return false; } - + public int getType() { return TGComponentManager.ATD_BLOCK; } - - public void wasSwallowed() { - myColor = null; - } - - public void wasUnswallowed() { - myColor = null; - setFather(null); - TDiagramPanel tdp = getTDiagramPanel(); - setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY()); - - } public void addSwallowedTGComponent(TGComponent tgc, int x, int y) { - boolean swallowed = false; - - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof SwallowTGComponent) { - if (tgcomponent[i].isOnMe(x, y) != null) { - swallowed = true; - ((SwallowTGComponent)tgcomponent[i]).addSwallowedTGComponent(tgc, x, y); - break; - } - } - } - - if (swallowed) { - return; - } - //System.out.println("Add swallow component"); // Choose its position @@ -265,8 +207,12 @@ public class ATDBlock extends TGCScalableWithInternalComponent implements Swallo tgc.setDrawingZone(true); //Set its coordinates - if (tgc instanceof ATDBlock) { - ((ATDBlock)tgc).resizeWithFather(); + if (tgc instanceof ATDAttack) { + //tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt); + //System.out.println("cdRect comp swallow"); + ((ATDAttack)tgc).resizeWithFather(); + //tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight()); + //tgc.setCd(x, y); } // else unknown*/ @@ -276,328 +222,31 @@ public class ATDBlock extends TGCScalableWithInternalComponent implements Swallo } public void removeSwallowedTGComponent(TGComponent tgc) { - //System.out.println("removeSwallowedTGComponent"); - if (tgc instanceof TMLCCompositePort) { - portRemoved(); - } - //removeInternalComponent(tgc); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] == tgc) { - nbInternalTGComponent = nbInternalTGComponent - 1; - if (nbInternalTGComponent == 0) { - tgcomponent = null; - } else { - TGComponent [] tgcomponentbis = new TGComponent[nbInternalTGComponent]; - for(int j=0; j<nbInternalTGComponent; j++) { - if (j<i) { - tgcomponentbis[j] = tgcomponent[j]; - } - if (j>=i) { - tgcomponentbis[j] = tgcomponent[j+1]; - } - } - tgcomponent = tgcomponentbis; - } - break; - } - } + removeInternalComponent(tgc); } - - public void hasBeenResized() { - rescaled = true; + public Vector getAttackList() { + Vector v = new Vector(); for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof ATDBlock) { - ((ATDBlock)tgcomponent[i]).resizeWithFather(); - } - /*if (tgcomponent[i] instanceof TMLCPrimitiveComponent) { - ((TMLCPrimitiveComponent)tgcomponent[i]).resizeWithFather(); - } - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - ((TMLCRemoteCompositeComponent)tgcomponent[i]).resizeWithFather(); - } - if (tgcomponent[i] instanceof TMLCCompositePort) { - ((TMLCCompositePort)tgcomponent[i]).resizeWithFather(); - }*/ - } - - if (getFather() != null) { - resizeWithFather(); - } - } - - public void resizeWithFather() { - if ((father != null) && ((father instanceof ATDBlock))) { - // Too large to fit in the father? -> resize it! - resizeToFatherSize(); - - setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight()); - setMoveCd(x, y); - } - } - - /*public ArrayList<TMLCPrimitiveComponent> getAllPrimitiveComponents() { - ArrayList<TMLCPrimitiveComponent> ll = new ArrayList<TMLCPrimitiveComponent>(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - ll.addAll(((TMLCCompositeComponent)tgcomponent[i]).getAllPrimitiveComponents()); - } - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - ll.addAll(((TMLCRemoteCompositeComponent)tgcomponent[i]).getAllPrimitiveComponents()); - } - - if (tgcomponent[i] instanceof TMLCPrimitiveComponent) { - ll.add(((TMLCPrimitiveComponent)(tgcomponent[i]))); - } - } - - return ll; - } - - public void getAllCompositeComponents(ArrayList<String> list, String _name) { - String s; - TMLCCompositeComponent tmlcc; - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - tmlcc = (TMLCCompositeComponent)tgcomponent[i]; - s = _name + "::" + tmlcc.getValue(); - list.add(s); - tmlcc.getAllCompositeComponents(list, _name); - } - } - } - - public ArrayList<TMLCCompositePort> getAllInternalCompositePorts() { - ArrayList<TMLCCompositePort> list = new ArrayList<TMLCCompositePort>(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - list.addAll(((TMLCCompositeComponent)tgcomponent[i]).getAllInternalCompositePorts()); - } - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - list.addAll(((TMLCRemoteCompositeComponent)tgcomponent[i]).getAllInternalCompositePorts()); - } - if (tgcomponent[i] instanceof TMLCCompositePort) { - list.add((TMLCCompositePort)(tgcomponent[i])); - } - } - - return list; - } - - public ArrayList<TMLCCompositePort> getAllReferencedCompositePorts() { - ArrayList<TMLCCompositePort> list = new ArrayList<TMLCCompositePort>(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - list.addAll(((TMLCCompositeComponent)tgcomponent[i]).getAllReferencedCompositePorts()); - } - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - list.addAll(((TMLCRemoteCompositeComponent)tgcomponent[i]).getAllInternalCompositePorts()); - } - } - - return list; - } - - public ArrayList<TMLCCompositePort> getFirstLevelCompositePorts() { - ArrayList<TMLCCompositePort> list = new ArrayList<TMLCCompositePort>(); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositePort) { - list.add((TMLCCompositePort)(tgcomponent[i])); - } - } - - return list; - } - - public ArrayList<TMLCPrimitivePort> getAllInternalPrimitivePorts() { - ArrayList<TMLCPrimitivePort> list = new ArrayList<TMLCPrimitivePort>(); - for(int i=0; i<nbInternalTGComponent; i++) { - - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - list.addAll(((TMLCCompositeComponent)tgcomponent[i]).getAllInternalPrimitivePorts()); - } - - if (tgcomponent[i] instanceof TMLCPrimitiveComponent) { - list.addAll(((TMLCPrimitiveComponent)tgcomponent[i]).getAllInternalPrimitivePorts()); - } - } - - return list; - } - - public TMLCPrimitiveComponent getPrimitiveComponentByName(String _name) { - TMLCPrimitiveComponent tgc; - ListIterator li = getAllPrimitiveComponents().listIterator(); - - while(li.hasNext()) { - tgc = (TMLCPrimitiveComponent)(li.next()); - if (tgc.getValue().equals(_name)) { - return tgc; - } - } - - return null; - } - - public TMLCCompositeComponent getCompositeComponentByName(String _name) { - TGComponent tgc; - TMLCCompositeComponent tmp; - - for(int i=0; i<nbInternalTGComponent; i++) { - tgc = tgcomponent[i]; - if (tgc instanceof TMLCCompositeComponent) { - tmp = (TMLCCompositeComponent)tgc; - if (tmp.getValue().equals(_name)) { - return tmp; - } - - if ((tmp = tmp.getCompositeComponentByName(name)) != null) { - return tmp; - } + if (tgcomponent[i] instanceof ATDAttack) { + v.add(tgcomponent[i]); } } - - return null; - } - - public void setInternalsHidden(boolean hide) { - hiddeni = hide; - for(int i=0; i<nbInternalTGComponent; i++) { - if (!(tgcomponent[i] instanceof TMLCCompositePort)) { - tgcomponent[i].setHidden(hide); - } - } - - if (tdp instanceof TMLComponentTaskDiagramPanel) { - ((TMLComponentTaskDiagramPanel)tdp).hideConnectors(); - } - } - - public boolean areInternalsHidden() { - return hiddeni; - } - - public void drawInternalComponentsWhenHidden(Graphics g) { - //System.out.println("Draw when hidden"); - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositePort) { - //ColorManager.setColor(g, tgcomponent[i].getState(), 0); - tgcomponent[i].draw(g); - } - } - }*/ - - /*protected String translateExtraParam() { - StringBuffer sb = new StringBuffer("<extraparam>\n"); - sb.append("<info hiddeni=\"" + hiddeni + "\" "); - sb.append("/>\n"); - sb.append("</extraparam>\n"); - return new String(sb); + return v; } - public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ - //System.out.println("*** load extra synchro ***"); - try { - - NodeList nli; - Node n1, n2; - Element elt; - int t1id; - - for(int i=0; i<nl.getLength(); i++) { - n1 = nl.item(i); - //System.out.println(n1); - if (n1.getNodeType() == Node.ELEMENT_NODE) { - nli = n1.getChildNodes(); - for(int j=0; i<nli.getLength(); i++) { - n2 = nli.item(i); - //System.out.println(n2); - if (n2.getNodeType() == Node.ELEMENT_NODE) { - elt = (Element) n2; - if (elt.getTagName().equals("info")) { - if (elt.getAttribute("hiddeni").equals("true")) { - setInternalsHidden(true); - } - } - - } - } - } - } - - } catch (Exception e) { - throw new MalformedModelingException(); - } - }*/ - - /*public void drawTGConnectingPoint(Graphics g, int type) { - //System.out.println("I am " + getName()); - for (int i=0; i<nbConnectingPoint; i++) { - if (connectingPoint[i].isCompatibleWith(type)) { - connectingPoint[i].draw(g); - } - } - + public void hasBeenResized() { for(int i=0; i<nbInternalTGComponent; i++) { - if (hiddeni) { - if (tgcomponent[i] instanceof TMLCCompositePort) { - tgcomponent[i].drawTGConnectingPoint(g, type); - } - } else { - tgcomponent[i].drawTGConnectingPoint(g, type); - } - + if (tgcomponent[i] instanceof ATDAttack) { + ((ATDAttack)tgcomponent[i]).resizeWithFather(); + } } - }*/ - - /*public String getExtendedValue() { - return getValuePanel() + "::" + getValue(); - }*/ - - public void myActionWhenRemoved() { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - //ColorManager.setColor(g, tgcomponent[i].getState(), 0); - tgcomponent[i].myActionWhenRemoved(); - } - } - tdp = null; - } - - /*public void updateReferenceToTMLCCompositeComponent(TMLCCompositeComponent tmlcc) { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - //ColorManager.setColor(g, tgcomponent[i].getState(), 0); - ((TMLCRemoteCompositeComponent)tgcomponent[i]).updateReference(tmlcc); - } - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - ((TMLCCompositeComponent)tgcomponent[i]).updateReferenceToTMLCCompositeComponent(tmlcc); - } - } - } - - public void delayedLoad() { - for(int i=0; i<nbInternalTGComponent; i++) { - if (tgcomponent[i] instanceof TMLCRemoteCompositeComponent) { - //ColorManager.setColor(g, tgcomponent[i].getState(), 0); - try { - ((TMLCRemoteCompositeComponent)tgcomponent[i]).delayedLoad(); - } catch (Exception e) { - } - } - if (tgcomponent[i] instanceof TMLCCompositeComponent) { - ((TMLCCompositeComponent)tgcomponent[i]).delayedLoad(); - } - } - } - - public int getCompositePortNb() { - return compositePortNb; - } - - public void portRemoved() { - compositePortNb --; - }*/ + + } + + public int getDefaultConnector() { + return TGComponentManager.ATD_COMPOSITION_CONNECTOR; + } } diff --git a/src/ui/atd/ATDCompositionConnectingPoint.java b/src/ui/atd/ATDCompositionConnectingPoint.java new file mode 100755 index 0000000000000000000000000000000000000000..08127de7249e2afb59bae798c02ee873272e5614 --- /dev/null +++ b/src/ui/atd/ATDCompositionConnectingPoint.java @@ -0,0 +1,65 @@ +/**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 ATDCompositionConnectingPoint + * Definition of connecting points on which composition connectors can be connected + * Creation: 09/12/2009 + * @version 1.0 09/12/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.atd; + + +import ui.*; + +public class ATDCompositionConnectingPoint extends TGConnectingPointWidthHeight { + + public ATDCompositionConnectingPoint(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { + super(_container, _x, _y, _in, _out, _w, _h); + } + + public boolean isCompatibleWith(int type) { + if (type == TGComponentManager.ATD_COMPOSITION_CONNECTOR) { + return true; + } + return false; + } + +} diff --git a/src/ui/atd/ATDCompositionConnector.java b/src/ui/atd/ATDCompositionConnector.java new file mode 100755 index 0000000000000000000000000000000000000000..ea71a92c771c067a78402961ef374a867e087268 --- /dev/null +++ b/src/ui/atd/ATDCompositionConnector.java @@ -0,0 +1,144 @@ +/**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 ATDCompositionConnector + * Connector used in Attack Tree Diagrams + * Creation: 09/12/2009 + * @version 1.0 09/12/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.atd; + + + +import java.awt.*; +import java.awt.geom.*; +import javax.swing.*; +import java.util.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.cd.*; +import ui.window.*; + +public class ATDCompositionConnector extends TGConnector { + protected int d = 10; + protected int D = 13; + //protected int widthValue, heightValue, maxWidthValue, h; + + + public ATDCompositionConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) { + super(_x, _y, _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint); + myImageIcon = IconManager.imgic202; + value = "{info}"; + editable = true; + } + + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + /*if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) { + g.drawLine(x1, y1, x2, y2); + } else { + GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true); + }*/ + Polygon p = new Polygon(); + Double alpha; + + + if (x1 == x2) { + if (y1 > y2) { + p.addPoint(x2, y2+(2*D)); + p.addPoint(x2+d, y2+D); + p.addPoint(x2, y2); + p.addPoint(x2-d, y2+D); + } else { + p.addPoint(x2, y2-(2*D)); + p.addPoint(x2+d, y2-D); + p.addPoint(x2, y2); + p.addPoint(x2-d, y2-D); + } + } else { + double xd[] = new double[4]; + double yd[] = new double[4]; + double a = ((double)y1-y2)/(x1-x2); + + alpha = Math.atan(a); + x2 = (int)(x2 + (Math.cos(alpha)*D)); + y2 = (int)(y2 + (Math.sin(alpha)*D)); + + /*if (x1 > x2) { + x2 = (int)(x2 + (Math.cos(alpha)*D)); + } else { + x2 = (int)(x2 - (Math.cos(alpha)*D)); + } + + if (y1 > y2) { + y2 = (int)(y2 + (Math.sin(alpha)*D)); + } else { + y2 = (int)(y2 - (Math.sin(alpha)*D)); + }*/ + + + int distance; + for(int i=0; i<4; i++){ + if ((i%2) == 0) { + distance = D; + } else { + distance = d; + } + xd[i] = x2 + (Math.cos(alpha)*distance); + yd[i] = y2 + (Math.sin(alpha)*distance); + p.addPoint((int)xd[i], (int)yd[i]); + alpha = alpha + (Math.PI/2); + } + } + g.fillPolygon(p); + g.drawLine(x1, y1, x2, y2); + } + + + public int getType() { + return TGComponentManager.ATD_COMPOSITION_CONNECTOR; + } + + + +} diff --git a/src/ui/atd/AttackTreeDiagramPanel.java b/src/ui/atd/AttackTreeDiagramPanel.java index cb4f897fe5402eb25e4282000cc0071225cf6aa0..4b11b96b263f926de27f9c952ec55570021d7962 100644 --- a/src/ui/atd/AttackTreeDiagramPanel.java +++ b/src/ui/atd/AttackTreeDiagramPanel.java @@ -55,7 +55,7 @@ import java.util.*; import ui.*; -public class AttackTreeDiagramPanel extends TDiagramPanel { +public class AttackTreeDiagramPanel extends TDiagramPanel implements TDPWithAttributes{ public AttackTreeDiagramPanel(MainGUI mgui, TToolBar _ttb) { super(mgui, _ttb); @@ -81,27 +81,27 @@ public class AttackTreeDiagramPanel extends TDiagramPanel { } public String getXMLHead() { - return "<AttckTreePanel name=\"" + name + "\"" + sizeParam() + " >"; + return "<AttackTreeDiagramPanel name=\"" + name + "\"" + sizeParam() + " >"; } public String getXMLTail() { - return "</AttackTreePanel>"; + return "</AttackTreeDiagramPanel>"; } public String getXMLSelectedHead() { - return "<AttackTreePanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + "\" heightSel=\"" + heightSel + "\" >"; + return "<AttackTreeDiagramPanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + "\" heightSel=\"" + heightSel + "\" >"; } public String getXMLSelectedTail() { - return "</AttackTreePanelCopy>"; + return "</AttackTreeDiagramPanelCopy>"; } public String getXMLCloneHead() { - return "<AttackTreePanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + 0 + "\" >"; + return "<AttackTreeDiagramPanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + 0 + "\" >"; } public String getXMLCloneTail() { - return "</AttackTreePanelCopy>"; + return "</AttackTreeDiagramPanelCopy>"; } public void makeGraphicalOptimizations() { @@ -115,7 +115,7 @@ public class AttackTreeDiagramPanel extends TDiagramPanel { public boolean hasAutoConnect() { - return true; + return false; } public void setConnectorsToFront() { diff --git a/src/ui/atd/AttackTreeDiagramToolbar.java b/src/ui/atd/AttackTreeDiagramToolbar.java index 299035140a66babc14ad1d7118fc0d59e2773305..88ba5531d1c6ef0e7547f4f538d2d7dc8ff57b85 100755 --- a/src/ui/atd/AttackTreeDiagramToolbar.java +++ b/src/ui/atd/AttackTreeDiagramToolbar.java @@ -71,13 +71,19 @@ public class AttackTreeDiagramToolbar extends TToolBar { mgui.actions[TGUIAction.CONNECTOR_COMMENT].setEnabled(b); mgui.actions[TGUIAction.ATD_BLOCK].setEnabled(b); + mgui.actions[TGUIAction.ATD_COMPOSITION_CONNECTOR].setEnabled(b); + mgui.actions[TGUIAction.ATD_ATTACK].setEnabled(b); - mgui.actions[TGUIAction.ATD_CONNECTOR].setEnabled(b); - mgui.actions[TGUIAction.ATD_OR_CONSTRAINT].setEnabled(b); + + mgui.actions[TGUIAction.ATD_ATTACK_CONNECTOR].setEnabled(b); + + mgui.actions[TGUIAction.ATD_OR_CONSTRAINT].setEnabled(b); mgui.actions[TGUIAction.ATD_AND_CONSTRAINT].setEnabled(b); mgui.actions[TGUIAction.ATD_SEQUENCE_CONSTRAINT].setEnabled(b); mgui.actions[TGUIAction.ATD_BEFORE_CONSTRAINT].setEnabled(b); mgui.actions[TGUIAction.ATD_AFTER_CONSTRAINT].setEnabled(b); + + mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b); } @@ -100,6 +106,8 @@ public class AttackTreeDiagramToolbar extends TToolBar { button = this.add(mgui.actions[TGUIAction.ATD_BLOCK]); button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.ATD_COMPOSITION_CONNECTOR]); + button.addMouseListener(mgui.mouseHandler); this.addSeparator(); @@ -108,7 +116,7 @@ public class AttackTreeDiagramToolbar extends TToolBar { this.addSeparator(); - button = this.add(mgui.actions[TGUIAction.ATD_CONNECTOR]); + button = this.add(mgui.actions[TGUIAction.ATD_ATTACK_CONNECTOR]); button.addMouseListener(mgui.mouseHandler); this.addSeparator(); @@ -132,6 +140,12 @@ public class AttackTreeDiagramToolbar extends TToolBar { button = this.add(mgui.actions[TGUIAction.ATD_AFTER_CONSTRAINT]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_ATTR]); + button.addMouseListener(mgui.mouseHandler); + } diff --git a/src/ui/images/atdattack.gif b/src/ui/images/atdattack.gif new file mode 100644 index 0000000000000000000000000000000000000000..9452e935e4b81a09d70fec54b2cb4cf2970277d8 Binary files /dev/null and b/src/ui/images/atdattack.gif differ diff --git a/src/ui/images/atdblock.gif b/src/ui/images/atdblock.gif new file mode 100644 index 0000000000000000000000000000000000000000..ccf6119957025c95e36adf229cc700a862491e2e Binary files /dev/null and b/src/ui/images/atdblock.gif differ diff --git a/src/ui/images/ebrdd.gif b/src/ui/images/ebrdd.gif new file mode 100755 index 0000000000000000000000000000000000000000..a89c5899bce8da5941eb8cb439a518a608604305 Binary files /dev/null and b/src/ui/images/ebrdd.gif differ diff --git a/src/ui/tree/DiagramTreeRenderer.java b/src/ui/tree/DiagramTreeRenderer.java index 68e678397ca9bb64d4ba6229489db420afa5ebf4..28e96f934978130416cd2bdd8c06e202a95bc73e 100755 --- a/src/ui/tree/DiagramTreeRenderer.java +++ b/src/ui/tree/DiagramTreeRenderer.java @@ -53,6 +53,7 @@ import javax.swing.tree.*; import translator.*; import ui.*; import ui.ad.*; +import ui.atd.*; import ui.cd.*; import ui.iod.*; import ui.ebrdd.*; @@ -111,6 +112,9 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer { } else if (value instanceof RequirementPanel) { setIcon(IconManager.imgic1000); setToolTipText("TURTLE Requirement"); + } else if (value instanceof AttackTreePanel) { + setIcon(IconManager.imgic1074); + setToolTipText("TURTLE Requirement"); } else if (value instanceof TClassDiagramPanel) { setIcon(IconManager.imgic14); setToolTipText("TURTLE Class diagram"); @@ -135,6 +139,9 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer { } else if (value instanceof RequirementDiagramPanel) { setIcon(IconManager.imgic1000); setToolTipText("TURTLE Requirement Diagram"); + } else if (value instanceof AttackTreeDiagramPanel) { + setIcon(IconManager.imgic1074); + setToolTipText("Attack Tree Diagram (SysML Parametric diagram)"); } else if (value instanceof EBRDDPanel) { setIcon(IconManager.imgic1058); setToolTipText("Event-Based Requirement Description Diagram");