diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java index 2c14e50e146d69b6353aa75c17ca6b8ddb0abefa..5a6c020acafa39207134c47be6f869d090787b09 100755 --- a/src/ui/IconManager.java +++ b/src/ui/IconManager.java @@ -104,7 +104,7 @@ public class IconManager { public static ImageIcon imgic800, imgic802, imgic804, imgic806, imgic808, imgic810, imgic812; public static ImageIcon imgic900, imgic902, imgic904, imgic906, imgic908, imgic910, imgic912, imgic914, imgic916, imgic918, imgic920, imgic922, imgic924, imgic926; // Requirement diagrams - public static ImageIcon imgic1000, imgic1002, imgic1004,imgic1006,imgic1008; + public static ImageIcon imgic1000, imgic1002, imgic1004,imgic1006,imgic1008, imgic1010, imgic1012; // TMLDD public static ImageIcon imgic1100, imgic1102, imgic1104, imgic1106, imgic1108; @@ -350,6 +350,8 @@ public class IconManager { private static String icon1004 = "images/reqobs.gif"; private static String icon1006 = "images/reqver.gif"; private static String icon1008 = "images/reqder.gif"; + private static String icon1010 = "images/reqcopy.gif"; + private static String icon1012 = "images/reqcomp.gif"; // TML private static String icon800 = "images/tmlcdevt.gif"; @@ -636,6 +638,8 @@ public class IconManager { imgic1004 = getIcon(icon1004); imgic1006 = getIcon(icon1006); imgic1008 = getIcon(icon1008); + imgic1010 = getIcon(icon1010); + imgic1012 = getIcon(icon1012); imgic1100 = getIcon(icon1100); imgic1102 = getIcon(icon1102); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index b16d674ab843215d854185c77783fbaf39508b3e..ecb14588f3a97028830ecd3c7d4d19d23fb88e03 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -5333,6 +5333,10 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TREQ_OBSERVER); } else if (command.equals(actions[TGUIAction.TREQ_DERIVE].getActionCommand())) { actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_DERIVE_REQ); + } else if (command.equals(actions[TGUIAction.TREQ_COPY].getActionCommand())) { + actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_COPY_REQ); + } else if (command.equals(actions[TGUIAction.TREQ_COMPOSITION].getActionCommand())) { + actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_COMPOSITION_REQ); } else if (command.equals(actions[TGUIAction.TREQ_VERIFY].getActionCommand())) { actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_VERIFY_REQ); } else if (command.equals(actions[TGUIAction.PROSMD_START].getActionCommand())) { diff --git a/src/ui/RequirementPanel.java b/src/ui/RequirementPanel.java index eb95c7a84f9d48a719c4b4ca962a67d2876f3eb0..93b183e31e39fcf36bcd98c7d41ce4ebf2a67f09 100755 --- a/src/ui/RequirementPanel.java +++ b/src/ui/RequirementPanel.java @@ -83,7 +83,7 @@ public class RequirementPanel extends TURTLEPanel { //Class diagram rdp = new RequirementDiagramPanel(mgui, toolBarReq); - rdp.setName("Requirement Diagram"); + rdp.setName(s); rdp.tp = this; tdp = rdp; panels.add(rdp); diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index f54d439824eb1029a6459eacca19e58f7f118c88..43ae62e96101e19b1edcfc08f6a0584fe487ae70 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -1,4 +1,4 @@ -/**Copyright or � or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille +/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille * * ludovic.apvrille AT enst.fr * @@ -109,6 +109,8 @@ public class TGComponentManager { public static final int CONNECTOR_COMMENT = 118; public static final int CONNECTOR_DERIVE_REQ = 119; + public static final int CONNECTOR_COPY_REQ = 128; + public static final int CONNECTOR_COMPOSITION_REQ = 129; public static final int CONNECTOR_VERIFY_REQ = 120; public static final int CONNECTOR_PROSMD = 121; @@ -820,6 +822,10 @@ public class TGComponentManager { return TREQ_OBSERVER; } else if (tgc instanceof TGConnectorDerive) { return CONNECTOR_DERIVE_REQ; + } else if (tgc instanceof TGConnectorCopy) { + return CONNECTOR_COPY_REQ; + } else if (tgc instanceof TGConnectorComposition) { + return CONNECTOR_COMPOSITION_REQ; } else if (tgc instanceof TGConnectorVerify) { return CONNECTOR_VERIFY_REQ; } else if (tgc instanceof ProSMDStartState) { @@ -986,6 +992,12 @@ public class TGComponentManager { break; case CONNECTOR_DERIVE_REQ: tgc = new TGConnectorDerive(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); + break; + case CONNECTOR_COPY_REQ: + tgc = new TGConnectorCopy(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); + break; + case CONNECTOR_COMPOSITION_REQ: + tgc = new TGConnectorComposition(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); break; case CONNECTOR_VERIFY_REQ: tgc = new TGConnectorVerify(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint); diff --git a/src/ui/TGConnectingPoint.java b/src/ui/TGConnectingPoint.java index 698d1c4de58b331f5dd6786b47c1fe0de6847113..ab3e651e6f6cec87bcc0f47b2d41bf0f7ec3ecdd 100755 --- a/src/ui/TGConnectingPoint.java +++ b/src/ui/TGConnectingPoint.java @@ -80,6 +80,14 @@ public class TGConnectingPoint implements CDElement { protected static final Color OUT = Color.cyan; protected static final Color INOUT = Color.orange; protected static final Color NO = Color.white; + + protected int orientation; + + public static final int NORTH=0; + public static final int EAST=1; + public static final int SOUTH=2; + public static final int WEST=3; + public TGConnectingPoint(CDElement _container, int _x, int _y, boolean _in, boolean _out) { container = _container; @@ -252,6 +260,10 @@ public class TGConnectingPoint implements CDElement { return "<TGConnectingPoint num=\"" + num + "\" id=\"" + getId() + "\" />\n"; } + public int getOrientation() { + return orientation; + } + /*protected boolean hasFather() { return (father != null); } diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index 0ff636450a339e36625aec07c20576fa2a824453..6f03ab36237f90d6550ca0ac2ee5a75da7c5552e 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -266,6 +266,8 @@ public class TGUIAction extends AbstractAction { public static final int TREQ_OBSERVER = 166; public static final int TREQ_DERIVE = 164; public static final int TREQ_VERIFY = 165; + public static final int TREQ_COPY = 258; + public static final int TREQ_COMPOSITION = 259; public static final int ACT_MODEL_CHECKING = 25; @@ -366,7 +368,7 @@ public class TGUIAction extends AbstractAction { public static final int PRUEBA_1 = 205; - public static final int NB_ACTION = 258; + public static final int NB_ACTION = 260; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -688,9 +690,11 @@ public class TGUIAction extends AbstractAction { // Requirement diagrams actions[TREQ_REQUIREMENT] = new TAction("add-treq-requirement", "Add a requirement", IconManager.imgic1002, IconManager.imgic1002, "Requirement", "Add a requirement to the currently opened requirement diagram", 0); actions[TREQ_OBSERVER] = new TAction("add-treq-observer", "Add an observer", IconManager.imgic1004, IconManager.imgic1004, "Observer", "Add an observer to the currently opened requirement diagram", 0); - actions[TREQ_DERIVE] = new TAction("add-treq-derive", "Add a <<derive>> link", IconManager.imgic1008, IconManager.imgic1008, "Derive", "Add a <<derive>> link between two requirements of the currently opened requirement diagram", 0); + actions[TREQ_DERIVE] = new TAction("add-treq-derive", "Add a <<deriveReqt>> link", IconManager.imgic1008, IconManager.imgic1008, "DeriveReqt", "Add a <<deriveReqt>> link between two requirements of the currently opened requirement diagram", 0); actions[TREQ_VERIFY] = new TAction("add-treq-verify", "Add a <<verify>> link", IconManager.imgic1006, IconManager.imgic1006, "Verify", "Add a <<verify>> link between an observer and a requirement of the currently opened requirement diagram", 0); - + actions[TREQ_COPY] = new TAction("add-treq-copy", "Add a <<copy>> link", IconManager.imgic1010, IconManager.imgic1010, "Copy", "Add a <<copy>> link between two requirements of the currently opened requirement diagram", 0); + actions[TREQ_COMPOSITION] = new TAction("add-treq-composition", "Add a <<derive>> link", IconManager.imgic1012, IconManager.imgic1012, "Composition", "Add a <<copy>> link between two requirements of the currently opened requirement diagram", 0); + // TURTLE-OS actions[TOS_TCLASS] = new TAction("add-tclass-os", "Add Tclass", IconManager.imgic104, IconManager.imgic104, "Tclass", "Add a TClass to the currently opened class diagram", 0); actions[TOS_ASSOCIATION] = new TAction("add-association-tos", "Add association", IconManager.imgic102, IconManager.imgic102, "Association", "Add an association between two tclasses of the currently opened TURTLE-OS class diagram", 0); diff --git a/src/ui/req/Requirement.java b/src/ui/req/Requirement.java index 24cd7168c7986b7eb04d8f76e60f80175e0d085d..fa06b6dedfaf822ae8e9375bee6e289bf68d28b6 100755 --- a/src/ui/req/Requirement.java +++ b/src/ui/req/Requirement.java @@ -108,32 +108,37 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit minWidth = 1; minHeight = lineHeight; - nbConnectingPoint = 24; + nbConnectingPoint = 28; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.25); - connectingPoint[1] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.5); - connectingPoint[2] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.75); - connectingPoint[3] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.25); - connectingPoint[4] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.5); - connectingPoint[5] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.75); - connectingPoint[6] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.25, 0.0); - connectingPoint[7] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 0.0); - connectingPoint[8] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.75, 0.0); - connectingPoint[9] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.25, 1.0); - connectingPoint[10] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0); - connectingPoint[11] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.75, 1.0); - connectingPoint[12] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.25); - connectingPoint[13] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.5); - connectingPoint[14] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.75); - connectingPoint[15] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.25); - connectingPoint[16] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.5); - connectingPoint[17] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.75); - connectingPoint[18] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.25, 0.0); - connectingPoint[19] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.5, 0.0); - connectingPoint[20] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 0.0); - connectingPoint[21] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.25, 1.0); - connectingPoint[22] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.5, 1.0); - connectingPoint[23] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 1.0); + connectingPoint[0] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.25, TGConnectingPoint.WEST); + connectingPoint[1] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.5, TGConnectingPoint.WEST); + connectingPoint[2] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, 0.75, TGConnectingPoint.WEST); + connectingPoint[3] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.25, TGConnectingPoint.EAST); + connectingPoint[4] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.5, TGConnectingPoint.EAST); + connectingPoint[5] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.75, TGConnectingPoint.EAST); + connectingPoint[6] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.25, 0.0, TGConnectingPoint.NORTH); + connectingPoint[7] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 0.0, TGConnectingPoint.NORTH); + connectingPoint[8] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.75, 0.0, TGConnectingPoint.NORTH); + connectingPoint[9] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.25, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[10] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[11] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.75, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[12] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.25, TGConnectingPoint.WEST); + connectingPoint[13] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.5, TGConnectingPoint.WEST); + connectingPoint[14] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.0, 0.75, TGConnectingPoint.WEST); + connectingPoint[15] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.25, TGConnectingPoint.EAST); + connectingPoint[16] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.5, TGConnectingPoint.EAST); + connectingPoint[17] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.75, TGConnectingPoint.EAST); + connectingPoint[18] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.25, 0.0, TGConnectingPoint.NORTH); + connectingPoint[19] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.5, 0.0, TGConnectingPoint.NORTH); + connectingPoint[20] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 0.0, TGConnectingPoint.NORTH); + connectingPoint[21] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.25, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[22] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.5, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[23] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[24] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[25] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[26] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0, TGConnectingPoint.SOUTH); + connectingPoint[27] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0, TGConnectingPoint.SOUTH); + addTGConnectingPointsCommentTop(); @@ -669,13 +674,24 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit w3 = graphics.getFontMetrics().stringWidth("Risk=\"" + criticality + "\"") + 2; w4 = Math.max(w4, w3); + if (type == 2) { + w3 = graphics.getFontMetrics().stringWidth("Attack Tree Node=\"" + attackTreeNode + "\"") + 2; + w4 = Math.max(w4, w3); + } + if (mode == 1) { resize(w4, lineHeight); return; } - int h = ((texts.length + 3) * currentFontSize) + lineHeight; + int h; + if (mode == 2) { + h = ((texts.length + 3) * currentFontSize) + lineHeight; + } else { + h = ((texts.length + 4) * currentFontSize) + lineHeight; + } + resize(w4, h); diff --git a/src/ui/req/RequirementDiagramToolBar.java b/src/ui/req/RequirementDiagramToolBar.java index 03037d798fe16592ad72d51ccee6522510266c72..0ff5a76c16ab9bf1ca5007758f635823eeae1e2a 100755 --- a/src/ui/req/RequirementDiagramToolBar.java +++ b/src/ui/req/RequirementDiagramToolBar.java @@ -73,6 +73,8 @@ public class RequirementDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.TREQ_OBSERVER].setEnabled(b); mgui.actions[TGUIAction.TREQ_VERIFY].setEnabled(b); mgui.actions[TGUIAction.TREQ_DERIVE].setEnabled(b); + mgui.actions[TGUIAction.TREQ_COPY].setEnabled(b); + mgui.actions[TGUIAction.TREQ_COMPOSITION].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b); @@ -104,8 +106,16 @@ public class RequirementDiagramToolBar extends TToolBar { this.addSeparator(); + button = this.add(mgui.actions[TGUIAction.TREQ_COMPOSITION]); + button.addMouseListener(mgui.mouseHandler); + button = this.add(mgui.actions[TGUIAction.TREQ_DERIVE]); button.addMouseListener(mgui.mouseHandler); + + button = this.add(mgui.actions[TGUIAction.TREQ_COPY]); + button.addMouseListener(mgui.mouseHandler); + + this.addSeparator(); button = this.add(mgui.actions[TGUIAction.TREQ_VERIFY]); button.addMouseListener(mgui.mouseHandler); diff --git a/src/ui/req/TAttributeRequirement.java b/src/ui/req/TAttributeRequirement.java index d2edeb399fc03fa526039c7b0233afc8ce050dc3..e4612059a9ade3204dc73fac7d01c2a8c4d11835 100755 --- a/src/ui/req/TAttributeRequirement.java +++ b/src/ui/req/TAttributeRequirement.java @@ -82,7 +82,7 @@ public class TAttributeRequirement extends TGCWithoutInternalComponent { nbConnectingPoint = 10; connectingPoint = new TGConnectingPoint[nbConnectingPoint]; - connectingPoint[0] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, .5); + /*connectingPoint[0] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.0, .5); connectingPoint[1] = new TGConnectingPointDerive(this, 0, 0, true, true, 1.0, 0.5); connectingPoint[2] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.25, 1.0); connectingPoint[3] = new TGConnectingPointDerive(this, 0, 0, true, true, 0.5, 1.0); @@ -91,7 +91,7 @@ public class TAttributeRequirement extends TGCWithoutInternalComponent { connectingPoint[6] = new TGConnectingPointVerify(this, 0, 0, true, false, 1.0, 0.5); connectingPoint[7] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.25, 1.0); connectingPoint[8] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.5, 1.0); - connectingPoint[9] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 1.0); + connectingPoint[9] = new TGConnectingPointVerify(this, 0, 0, true, false, 0.75, 1.0);*/ addTGConnectingPointsCommentDown(); moveable = false; diff --git a/src/ui/req/TGConnectingPointDerive.java b/src/ui/req/TGConnectingPointDerive.java index d3ea35ef03873e93c516fdbc1e58e41471f36b61..63b54d1950dba0032712a53076c1f44f40f54217 100755 --- a/src/ui/req/TGConnectingPointDerive.java +++ b/src/ui/req/TGConnectingPointDerive.java @@ -52,8 +52,9 @@ import ui.*; public class TGConnectingPointDerive extends TGConnectingPointWidthHeight { - public TGConnectingPointDerive(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { + public TGConnectingPointDerive(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h, int _orientation) { super(_container, _x, _y, _in, _out, _w, _h); + orientation = _orientation; } public boolean isCompatibleWith(int type) { @@ -62,6 +63,16 @@ public class TGConnectingPointDerive extends TGConnectingPointWidthHeight { //System.out.println("is compatible with:true"); return true; } + + if (type == TGComponentManager.CONNECTOR_COMPOSITION_REQ) { + //System.out.println("is compatible with:true"); + return true; + } + + if (type == TGComponentManager.CONNECTOR_COPY_REQ) { + //System.out.println("is compatible with:true"); + return true; + } //System.out.println("is compatible with:false"); return false; } diff --git a/src/ui/req/TGConnectingPointVerify.java b/src/ui/req/TGConnectingPointVerify.java index 37dfa2e01b7cbec73fa08d4580eeff40e0fdd677..f2dfb145251b3adb67a62197d7e31fbd945942fc 100755 --- a/src/ui/req/TGConnectingPointVerify.java +++ b/src/ui/req/TGConnectingPointVerify.java @@ -52,7 +52,12 @@ import ui.*; public class TGConnectingPointVerify extends TGConnectingPointWidthHeight { - public TGConnectingPointVerify(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { + public TGConnectingPointVerify(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h, int _orientation) { + super(_container, _x, _y, _in, _out, _w, _h); + orientation = _orientation; + } + + public TGConnectingPointVerify(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) { super(_container, _x, _y, _in, _out, _w, _h); } diff --git a/src/ui/req/TGConnectorComposition.java b/src/ui/req/TGConnectorComposition.java new file mode 100755 index 0000000000000000000000000000000000000000..46d61c05653e6eb1fcfa949e17b843cb8713f71c --- /dev/null +++ b/src/ui/req/TGConnectorComposition.java @@ -0,0 +1,131 @@ +/**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 TGConnectorComposition + * Connector to be used in requirement diagram. Connects two requirements: a child requirement + * to a parent requirement + * Creation: 04/02/2009 + * @version 1.0 04/02/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.req; + +import java.awt.*; +//import java.awt.geom.*; +import java.util.*; + +import myutil.*; + +import ui.*; + +public class TGConnectorComposition extends TGConnector { + int w, h; + private int radius = 5; + + public TGConnectorComposition(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); + value = "<<composition>>"; + } + + + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + + //g.drawLine(x1, y1, x2, y2); + //GraphicLib.dashedArrowWithLine(g, 1, 1, 0, x1, y1, x2, y2, false); + g.drawLine(x1, y1, x2, y2); + + int orientation = p2.getOrientation(); + + switch(orientation) { + case TGConnectingPoint.NORTH: + y2 = y2 - radius; + break; + case TGConnectingPoint.EAST: + x2 = x2 + radius; + break; + case TGConnectingPoint.SOUTH: + y2 = y2 + radius; + break; + case TGConnectingPoint.WEST: + x2 = x2 - radius; + break; + } + //g.drawLine(x1, y1, x2, y2 + radius); + Color c = g.getColor(); + g.setColor(Color.WHITE); + g.fillOval(x2-radius+1, y2-radius+1, (2*radius), (2*radius)); + g.setColor(c); + g.drawOval(x2-radius, y2-radius, 2*radius, 2*radius); + g.drawLine(x2, y2-radius, x2, y2+radius); + g.drawLine(x2-radius, y2, x2+radius, y2); + + // Indicate semantics + /*Font f = g.getFont(); + Font old = f; + if (f.getSize() != tdp.getFontSize()) { + f = f.deriveFont((float)tdp.getFontSize()); + g.setFont(f); + } + + w = g.getFontMetrics().stringWidth(value); + h = g.getFontMetrics().getHeight(); + g.drawString(value, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2); + g.setFont(old);*/ + } + + /*public TGComponent extraIsOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2 - h, w, h)) { + return this; + } + return null; + }*/ + + public int getType() { + return TGComponentManager.CONNECTOR_COMPOSITION_REQ; + } + +} + + + + + + + diff --git a/src/ui/req/TGConnectorCopy.java b/src/ui/req/TGConnectorCopy.java new file mode 100755 index 0000000000000000000000000000000000000000..f9767527c22a981f5a39178d7e5b7719c1d5c487 --- /dev/null +++ b/src/ui/req/TGConnectorCopy.java @@ -0,0 +1,104 @@ +/**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 TGConnectorCopy + * Connector to be used in requirement diagram. Connects two requirements + * Creation: 04/02/2009 + * @version 1.0 04/02/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.req; + +import java.awt.*; +//import java.awt.geom.*; +import java.util.*; + +import myutil.*; + +import ui.*; + +public class TGConnectorCopy extends TGConnector { + int w, h; + + public TGConnectorCopy(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); + value = "<<copy>>"; + } + + + protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + + //g.drawLine(x1, y1, x2, y2); + GraphicLib.dashedArrowWithLine(g, 1, 1, 0, x1, y1, x2, y2, false); + + // Indicate semantics + + Font f = g.getFont(); + Font old = f; + if (f.getSize() != tdp.getFontSize()) { + f = f.deriveFont((float)tdp.getFontSize()); + g.setFont(f); + } + + w = g.getFontMetrics().stringWidth(value); + h = g.getFontMetrics().getHeight(); + g.drawString(value, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2); + g.setFont(old); + } + + public TGComponent extraIsOnOnlyMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, (p1.getX() + p2.getX() - w) / 2, (p1.getY() + p2.getY())/2 - h, w, h)) { + return this; + } + return null; + } + + public int getType() { + return TGComponentManager.CONNECTOR_COPY_REQ; + } + +} + + + + + + + diff --git a/src/ui/req/TGConnectorDerive.java b/src/ui/req/TGConnectorDerive.java index ee0f3f99b0b2363f63c18e113fbe5da291e301df..977bf523a63068c0df7340cf69cacb8bea9b01d9 100755 --- a/src/ui/req/TGConnectorDerive.java +++ b/src/ui/req/TGConnectorDerive.java @@ -59,11 +59,12 @@ public class TGConnectorDerive extends TGConnector { public TGConnectorDerive(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); - value = "<<derive>>"; + value = "<<deriveReqt>>"; } protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){ + //g.drawLine(x1, y1, x2, y2); GraphicLib.dashedArrowWithLine(g, 1, 1, 0, x1, y1, x2, y2, false); diff --git a/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java b/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java index 1f7d5cb8ea5a5add3c53f8484d312085821f8d02..3f5c7f6ead3648ae0d16c6338dee9ac13e49ccde 100755 --- a/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java +++ b/src/ui/tmlcompd/TMLComponentTaskDiagramPanel.java @@ -251,7 +251,7 @@ public class TMLComponentTaskDiagramPanel extends TDiagramPanel implements TDPWi } public String getXMLHead() { - System.out.println("Name=" + name); + //System.out.println("Name=" + name); return "<TMLComponentTaskDiagramPanel name=\"" + name + "\"" + sizeParam() + displayParam() + zoomParam() +" >"; }