diff --git a/src/req/ebrdd/EBRDD.java b/src/req/ebrdd/EBRDD.java index c3901b307c664ea1f1578e93e90c7c29fbaa5b5c..ae5c55614e367332b2067ac7ec190f4776b05714 100644 --- a/src/req/ebrdd/EBRDD.java +++ b/src/req/ebrdd/EBRDD.java @@ -52,19 +52,46 @@ import myutil.*; public class EBRDD extends ArrayList<EBRDDComponent> { private String name; protected EBRDDStart ads; + protected ArrayList<EBRDDAttribute> variables; public EBRDD(EBRDDStart _ads, String _name) { name = _name; ads = _ads; + variables = new ArrayList<EBRDDAttribute>(); add(ads); } public EBRDD(String _name) { name = _name; ads = new EBRDDStart("Start", null); + variables = new ArrayList<EBRDDAttribute>(); add(ads); } + // Returns false if another attribute with the same name has already been defined + // Returns true otherwise. + public boolean addAttribute(EBRDDAttribute _attr) { + for(EBRDDAttribute attr: variables) { + if (attr.getName().equals(_attr.getName())) { + return false; + } + } + variables.add(_attr); + return true; + } + + public int getNbOfAttributes() { + return variables.size(); + } + + public EBRDDAttribute getAttributeByIndex(int _index) { + if ((_index < variables.size()) && (_index > -1)) { + return variables.get(_index); + } + + return null; + } + public String getName() { return name; } @@ -121,7 +148,11 @@ public class EBRDD extends ArrayList<EBRDDComponent> { } public String toString() { - StringBuffer sb = new StringBuffer("EBRDD="); + StringBuffer sb = new StringBuffer("EBRDD=\nvariables:\n"); + for(EBRDDAttribute attr: variables) { + sb.append(attr.toString() + "\n"); + } + sb.append("Activity diagram:\n"); if (ads != null) { exploreString(ads, sb, 0); diff --git a/src/req/ebrdd/EBRDDAttribute.java b/src/req/ebrdd/EBRDDAttribute.java new file mode 100755 index 0000000000000000000000000000000000000000..91d7cea2d32b539a767c67935a54377a44dad2d6 --- /dev/null +++ b/src/req/ebrdd/EBRDDAttribute.java @@ -0,0 +1,114 @@ +/**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 EBRDDAttribute + * Attributes for EBRDDs + * Creation: 14/10/2009 + * @version 1.0 14/10/2009 + * @author Ludovic APVRILLE + * @see + */ + + +package req.ebrdd; + +import tmltranslator.*; + + +public class EBRDDAttribute extends DIPLOElement { + + public TMLType type; + public String name; + public String initialValue; + + public EBRDDAttribute() { + } + + public EBRDDAttribute(String _name, String _initialValue, TMLType _type) { + name = _name; + type = _type; + initialValue = _initialValue; + } + + public String getName() { + return name; + } + + public TMLType getType() { + return type; + } + + public boolean isNat() { + return (type.getType() == TMLType.NATURAL); + } + + public boolean isBool() { + return (type.getType() == TMLType.BOOLEAN); + } + + public String getInitialValue() { + return initialValue; + } + + + + public String toString() { + if (hasInitialValue()) { + return name + " = " + getInitialValue() + ":" + type.toString(); + } + return name + ":" + type.toString(); + } + + public boolean hasInitialValue() { + return ((initialValue != null) && (initialValue.length() > 0)); + } + + public String getDefaultInitialValue() { + if (isNat()) { + return "0"; + } else { + if (isBool()) { + return "false"; + } + } + return "unknown"; + } + + + +} \ No newline at end of file diff --git a/src/ui/EBRDDTranslator.java b/src/ui/EBRDDTranslator.java index e25b79d45c362d47940578ef37c7324af7dea8ff..4c40f257b037b0932beee0a7b8c0067460db8e8b 100755 --- a/src/ui/EBRDDTranslator.java +++ b/src/ui/EBRDDTranslator.java @@ -51,6 +51,7 @@ import java.util.*; import myutil.*; import ui.ebrdd.*; import req.ebrdd.*; +import tmltranslator.*; public class EBRDDTranslator { @@ -137,8 +138,12 @@ public class EBRDDTranslator { req.ebrdd.EBRDDSequence seq; req.ebrdd.EBRDDStart start; req.ebrdd.EBRDDStop stop; + req.ebrdd.EBRDDAttribute attr; ESO eso; ERB erb; + TAttribute ta; + Vector vv; + TMLType tt; int i; int cpt=0; @@ -152,8 +157,31 @@ public class EBRDDTranslator { cpt++; tgc = (TGComponent)(iterator.next()); + // Variables + if (tgc instanceof EBRDDAttributeBox) { + vv = ((EBRDDAttributeBox)tgc).getAttributeList(); + for(int l=0; l<vv.size(); l++) { + ta = (TAttribute)(vv.get(l)); + if (ta.getType() == TAttribute.NATURAL) { + tt = new TMLType(TMLType.NATURAL); + } else if (ta.getType() == TAttribute.BOOLEAN) { + tt = new TMLType(TMLType.BOOLEAN); + } else { + tt = new TMLType(TMLType.OTHER); + } + attr = new EBRDDAttribute(ta.getId(), ta.getInitialValue(), tt); + System.out.println("Adding attribute :" + ta.getId()); + if (!ebrdd.addAttribute(attr)) { + CheckingError ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Duplicate declaration for variable " + ta.getId()); + ce.setTDiagramPanel(ebrddp); + ce.setTGComponent(tgc); + checkingErrors.add(ce); + } + } + + // Action - if (tgc instanceof ui.ebrdd.EBRDDActionState) { + } else if (tgc instanceof ui.ebrdd.EBRDDActionState) { acst = new req.ebrdd.EBRDDActionState("Action state"+cpt, tgc); acst.setAction(((ui.ebrdd.EBRDDActionState)tgc).getAction()); listE.addCor(acst, tgc); diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java index 412e487fa670f1e9382786c647043b2b15576f16..4808f529902ca7c39955255c897fd9caf39758ee 100755 --- a/src/ui/IconManager.java +++ b/src/ui/IconManager.java @@ -107,7 +107,7 @@ public class IconManager { 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, imgic1010, imgic1012, imgic1014; - public static ImageIcon imgic1050, imgic1052, imgic1054,imgic1056, imgic1058; + public static ImageIcon imgic1050, imgic1052, imgic1054,imgic1056, imgic1058, imgic1060; // TMLDD public static ImageIcon imgic1100, imgic1102, imgic1104, imgic1106, imgic1108; @@ -404,7 +404,7 @@ public class IconManager { private static String icon1054 = "images/ebrddeso.gif"; private static String icon1056 = "images/ebrdderb.gif"; private static String icon1058 = "images/ebrdd.gif"; - + private static String icon1060 = "images/ebrddvar.gif"; // DIPLODOCUS architecture @@ -709,6 +709,7 @@ public class IconManager { imgic1054 = getIcon(icon1054); imgic1056 = getIcon(icon1056); imgic1058 = getIcon(icon1058); + imgic1060 = getIcon(icon1060); imgic1100 = getIcon(icon1100); imgic1102 = getIcon(icon1102); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index b18872fad0e273b474b6cbf08db0381b77ab3352..37bcce5c85622f0d19a27b2ae406841f8da73c2e 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -5667,6 +5667,8 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.EBRDD_ACTION); } else if (command.equals(actions[TGUIAction.EBRDD_FOR_LOOP].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.EBRDD_FOR_LOOP); + } else if (command.equals(actions[TGUIAction.EBRDD_VARIABLE_DECLARATION].getActionCommand())) { + actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.EBRDD_VARIABLE_DECLARATION); } else if (command.equals(actions[TGUIAction.TMLAD_START].getActionCommand())) { actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.TMLAD_START_STATE); } else if (command.equals(actions[TGUIAction.TMLAD_STOP].getActionCommand())) { diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java index b13f963c97d8cc945bb8700459856bb7cfdcd03e..6242c98a76041c8ac24ee322dbd18cae32a7253c 100755 --- a/src/ui/TGComponentManager.java +++ b/src/ui/TGComponentManager.java @@ -222,6 +222,7 @@ public class TGComponentManager { public static final int EBRDD_SEQUENCE = 1306; public static final int EBRDD_ESO = 1307; public static final int EBRDD_ERB = 1308; + public static final int EBRDD_VARIABLE_DECLARATION = 1309; public static final int TREQ_REQUIREMENT = 900; public static final int TREQ_OBSERVER = 901; @@ -445,6 +446,9 @@ public class TGComponentManager { break; case EBRDD_FOR_LOOP: tgc = new EBRDDForLoop(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); + break; + case EBRDD_VARIABLE_DECLARATION: + tgc = new EBRDDAttributeBox(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); break; case EBRDD_SEQUENCE: tgc = new EBRDDSequence(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp); @@ -814,6 +818,8 @@ public class TGComponentManager { return EBRDD_ACTION; } else if (tgc instanceof EBRDDForLoop) { return EBRDD_FOR_LOOP; + } else if (tgc instanceof EBRDDAttributeBox) { + return EBRDD_VARIABLE_DECLARATION; } else if (tgc instanceof EBRDDSequence) { return EBRDD_SEQUENCE; } else if (tgc instanceof EBRDDESO) { diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index 6ea21f8a041ec016678e111463bb2da4aa64e903..4a4afff9331456e03c107c62dd30015222261ef5 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -219,6 +219,7 @@ public class TGUIAction extends AbstractAction { public static final int EBRDD_ESO = 280; public static final int EBRDD_ERB = 281; public static final int EBRDD_CONNECTOR_ERC = 282; + public static final int EBRDD_VARIABLE_DECLARATION = 283; // TURTLE-OS public static final int TOS_TCLASS = 189; @@ -393,7 +394,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 = 283; + public static final int NB_ACTION = 284; private static final TAction [] actions = new TAction[NB_ACTION]; @@ -693,6 +694,7 @@ public class TGUIAction extends AbstractAction { actions[EBRDD_CONNECTOR_ERC] = new TAction("add-ebrdd-erc-connector", "Connect two ESO / ERB operators together", IconManager.imgic1052, IconManager.imgic1052, "Connect two ESO / ERB operators together", "Connect two ESO / ERB operators of the currently opened Event-Based Requirement Description Diagram", 0); actions[EBRDD_ESO] = new TAction("add-ebrdd-eso", "Add ESO", IconManager.imgic1054, IconManager.imgic1054, "Event Sequencing Operator", "Add an Event Sequencing Operator to the currently opened Event-Based Requirement Description Diagram", 0); actions[EBRDD_ERB] = new TAction("add-ebrdd-erb", "Add ERB", IconManager.imgic1056, IconManager.imgic1056, "Event Reaction Block", "Add an Event Reaction Block to the currently opened Event-Based Requirement Description Diagram", 0); + actions[EBRDD_VARIABLE_DECLARATION] = new TAction("add-ebrdd-var-dec", "Add Variable Declaration", IconManager.imgic1060, IconManager.imgic1060, "Add Variable Declaration", "Add a variable declaration block to the currently opened Event-Based Requirement Description Diagram", 0); actions[TMLARCHI_EDIT] = new TAction("edit-tmlarchi-diagram", "Edit DIPLODOCUS architecture diagram", IconManager.imgic100, IconManager.imgic101, "Edit DIPLODOCUS architecture diagram", "Make it possible to edit the currently opened DIPLODOCUS architecture diagram", 0); actions[TMLARCHI_LINK] = new TAction("add-tmlarchi-link", "Add a link", IconManager.imgic202, IconManager.imgic202, "Link", "Add a link between two nodes of the currently opened DIPLODOCUS architecture diagram", 0); diff --git a/src/ui/ebrdd/EBRDDAttributeBox.java b/src/ui/ebrdd/EBRDDAttributeBox.java new file mode 100644 index 0000000000000000000000000000000000000000..1f6b5a7b6c52287f6e29bd20b26ff727da9b99e6 --- /dev/null +++ b/src/ui/ebrdd/EBRDDAttributeBox.java @@ -0,0 +1,341 @@ +/**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 EBRDDAttributeBox + * AttributeBox. To be used in EBRDDs + * Creation: 14/10/2009 + * @version 1.0 14/10/2009 + * @author Ludovic APVRILLE + * @see + */ + +package ui.ebrdd; + +import java.awt.*; +import java.util.*; +import javax.swing.*; + +import org.w3c.dom.*; + +import myutil.*; +import ui.*; +import ui.window.*; + +//import tmltranslator.*; + +public class EBRDDAttributeBox extends TGCWithoutInternalComponent { + public String oldValue; + protected String attributeText = "Variable"; + protected int textX = 5; + protected int textY = 20; + protected Vector myAttributes; + protected Vector forbiddenNames; + protected Graphics myG; + protected Color myColor; + protected boolean attributes; + protected boolean lastVisible; + + public EBRDDAttributeBox(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(200, 150); + + /*oldScaleFactor = tdp.getZoom(); + dtextX = textX * oldScaleFactor; + textX = (int)dtextX; + dtextX = dtextX - textX; + + minWidth = 1; + minHeight = 1;*/ + + minWidth = 50; + minHeight = 30; + width = minWidth; + height = minHeight; + + nbConnectingPoint = 0; + + addTGConnectingPointsComment(); + + nbInternalTGComponent = 0; + + moveable = true; + editable = true; + removable = true; + + setName("Variable declaration"); + + myImageIcon = IconManager.imgic1060; + + myAttributes = new Vector(); + + myColor = ColorManager.UML_NOTE_BG; + + forbiddenNames = new Vector(); + + //actionOnAdd(); + } + + public Vector getAttributeList() { + return myAttributes; + } + + public void setAttributeList(Vector attributes) { + myAttributes = attributes; + } + + public void setForbiddenNames(Vector v) { + forbiddenNames = v; + } + + public void internalDrawing(Graphics g) { + Graphics tmp = myG; + if (!tdp.isScaled()) { + myG = g; + } + if ((tmp == null) || (lastVisible != areVisible())){ + checkMySize(); + } + lastVisible = areVisible(); + int h = g.getFontMetrics().getHeight(); + //h = h + 2; + //h = h + 1; + g.drawRect(x, y, width, height); + g.setColor(myColor); + g.fillRect(x+1, y+1, width-1, height-1); + ColorManager.setColor(g, getState(), 0); + if (areVisible()) { + TAttribute a; + for(int i=0; i<myAttributes.size(); i++) { + a = (TAttribute)(myAttributes.elementAt(i)); + g.drawString(a.toString(), x + textX, y + textY + i* h); + } + } else if (myAttributes.size() >0) { + g.drawString("...", x + textX, y + textY); + } + } + + public void makeValue() { + value = ""; + TAttribute a; + for(int i=0; i<myAttributes.size(); i++) { + a = (TAttribute)(myAttributes.elementAt(i)); + value = value + a + "\n"; + } + //System.out.println("Value = " + value); + } + + public boolean areVisible() { + return tdp.areAttributesVisible(); + } + + public void calculateMyDesiredSize() { + if (myG == null) { + myG = tdp.getGraphics(); + } + + if (myG == null) { + return; + } + + if ((myAttributes.size() == 0) || (!areVisible())) { + //System.out.println("Min resize" + toString()); + minDesiredWidth = minWidth; + minDesiredHeight = minHeight; + lastVisible = areVisible(); + return; + } + + lastVisible = areVisible(); + + //System.out.println("Regular resize" + toString()); + int desiredWidth = minWidth; + int h = myG.getFontMetrics().getHeight(); + int desiredHeight = Math.max(minHeight, h * (myAttributes.size() -1) + minHeight); + + TAttribute a; + for(int i=0; i<myAttributes.size(); i++) { + a = (TAttribute)(myAttributes.elementAt(i)); + desiredWidth = Math.max(desiredWidth, myG.getFontMetrics().stringWidth(a.toString()) + 2 * textX); + } + + minDesiredWidth = desiredWidth; + minDesiredHeight = desiredHeight; + + width = Math.max(minDesiredWidth, minWidth); + height = Math.max(minDesiredHeight, minHeight); + } + + public void checkMySize() { + calculateMyDesiredSize(); + } + + public boolean editOndoubleClick(JFrame frame) { + String oldValue = value; + JDialogAttribute jda = new JDialogAttribute(myAttributes, forbiddenNames, frame, "Setting variables", attributeText); + setJDialogOptions(jda); + jda.setSize(650, 375); + GraphicLib.centerOnParent(jda); + jda.setVisible(true); // blocked until dialog has been closed + makeValue(); + if (oldValue.equals(value)) { + return false; + } + checkMySize(); + return true; + } + + protected void setJDialogOptions(JDialogAttribute jda) { + jda.addAccess(TAttribute.getStringAccess(TAttribute.PRIVATE)); + jda.addType(TAttribute.getStringType(TAttribute.NATURAL), true); + jda.addType(TAttribute.getStringType(TAttribute.BOOLEAN), true); + + //jda.enableInitialValue(true); + jda.enableRTLOTOSKeyword(true); + jda.enableJavaKeyword(true); + //jda.enableOtherTypes(true); + } + + + + public TGComponent isOnMe(int x1, int y1) { + if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) { + return this; + } + return null; + } + + protected String translateExtraParam() { + TAttribute a; + value = ""; + StringBuffer sb = new StringBuffer("<extraparam>\n"); + for(int i=0; i<myAttributes.size(); i++) { + //System.out.println("Attribute:" + i); + a = (TAttribute)(myAttributes.elementAt(i)); + //System.out.println("Attribute:" + i + " = " + a.getId()); + value = value + a + "\n"; + sb.append("<Attribute access=\""); + sb.append(a.getAccess()); + sb.append("\" id=\""); + sb.append(a.getId()); + sb.append("\" value=\""); + sb.append(a.getInitialValue()); + sb.append("\" type=\""); + sb.append(a.getType()); + sb.append("\" typeOther=\""); + sb.append(a.getTypeOther()); + sb.append("\" />\n"); + } + sb.append("</extraparam>\n"); + return new String(sb); + } + + public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{ + try { + NodeList nli; + Node n1, n2; + Element elt; + int access, type; + String typeOther; + String id, valueAtt; + + //System.out.println("Loading attributes"); + //System.out.println(nl.toString()); + + 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; j<nli.getLength(); j++) { + n2 = nli.item(j); + //System.out.println(n2); + if (n2.getNodeType() == Node.ELEMENT_NODE) { + elt = (Element) n2; + if (elt.getTagName().equals("Attribute")) { + //System.out.println("Analyzing attribute"); + access = Integer.decode(elt.getAttribute("access")).intValue(); + type = Integer.decode(elt.getAttribute("type")).intValue(); + try { + typeOther = elt.getAttribute("typeOther"); + } catch (Exception e) { + typeOther = ""; + } + id = elt.getAttribute("id"); + valueAtt = elt.getAttribute("value"); + + if (valueAtt.equals("null")) { + valueAtt = ""; + } + + //System.out.println("Studying attribute " + id); + if ((TAttribute.isAValidId(id, false, false)) && (TAttribute.isAValidInitialValue(type, valueAtt))) { + //System.out.println("Adding attribute " + id + " typeOther=" + typeOther); + TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther); + myAttributes.addElement(ta); + } + } + } + } + } + } + + } catch (Exception e) { + throw new MalformedModelingException(); + } + makeValue(); + } + + // Main Tree + + public int getChildCount() { + return myAttributes.size(); + } + + public Object getChild(int index) { + return myAttributes.elementAt(index); + } + + public int getIndexOfChild(Object child) { + return myAttributes.indexOf(child); + } + + public int getType() { + return TGComponentManager.EBRDD_VARIABLE_DECLARATION; + } +} diff --git a/src/ui/ebrdd/EBRDDToolBar.java b/src/ui/ebrdd/EBRDDToolBar.java index 1d1e2338004e4a12bac2d93f645c3442b2d430a3..86f4bf94b802c7535639cd6f1de20cf8af562588 100755 --- a/src/ui/ebrdd/EBRDDToolBar.java +++ b/src/ui/ebrdd/EBRDDToolBar.java @@ -73,6 +73,7 @@ public class EBRDDToolBar extends TToolBar { mgui.actions[TGUIAction.EBRDD_CONNECTOR_ERC].setEnabled(b); mgui.actions[TGUIAction.EBRDD_ESO].setEnabled(b); mgui.actions[TGUIAction.EBRDD_ERB].setEnabled(b); + mgui.actions[TGUIAction.EBRDD_VARIABLE_DECLARATION].setEnabled(b); mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); @@ -91,6 +92,11 @@ public class EBRDDToolBar extends TToolBar { button = this.add(mgui.actions[TGUIAction.UML_NOTE]); button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); + + button = this.add(mgui.actions[TGUIAction.EBRDD_VARIABLE_DECLARATION]); + button.addMouseListener(mgui.mouseHandler); + this.addSeparator(); button = this.add(mgui.actions[TGUIAction.EBRDD_CONNECTOR]); diff --git a/src/ui/images/ebrddvar.gif b/src/ui/images/ebrddvar.gif new file mode 100755 index 0000000000000000000000000000000000000000..c633067daa413f43d9b7e90c526db017ae68bcc8 Binary files /dev/null and b/src/ui/images/ebrddvar.gif differ diff --git a/src/ui/window/JDialogAttribute.java b/src/ui/window/JDialogAttribute.java index 368a18adb91333f1ca7a8cfdd75a46f1a251db4e..ba1843a6407e4fb10734bc7a1b501dec4e16ef22 100755 --- a/src/ui/window/JDialogAttribute.java +++ b/src/ui/window/JDialogAttribute.java @@ -149,7 +149,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe c1.anchor = GridBagConstraints.CENTER; panel1.add(new JLabel("access"), c1); panel1.add(new JLabel("identifier"), c1); - if (attrib.equals("Attribute")) { + if (attrib.equals("Attribute") || attrib.equals("Variable")) { panel1.add(new JLabel(" "), c1); panel1.add(new JLabel("initial value"), c1); } @@ -172,7 +172,7 @@ public class JDialogAttribute extends javax.swing.JDialog implements ActionListe initialValue.setColumns(5); initialValue.setEditable(true); - if (attrib.equals("Attribute")) { + if (attrib.equals("Attribute") || attrib.equals("Variable")) { panel1.add(new JLabel(" = "), c1); panel1.add(initialValue, c1); }