diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java index 3000047093383babe194b9821cefe288088bd21a..3556b51d04444c6ea260a05a9eadf78889be4af7 100755 --- a/src/ui/ColorManager.java +++ b/src/ui/ColorManager.java @@ -160,6 +160,11 @@ public class ColorManager { public static Color AVATAR_EXPIRE_TIMER = new Color(255, 180, 105); + public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(160, 212, 221); + //public static Color AVATAR_ASSUMPTION_ATTRIBUTES = new Color(183, 225, 203); + //public static Color AVATAR_ASSUMPTION_TOP = new Color(141, 181, 161); + public static Color AVATAR_ASSUMPTION_TOP = new Color(131, 209, 221); + public static Color AVATAR_REQUIREMENT_TOP = new Color(228, 241, 242); public static Color AVATAR_REQUIREMENT_ATTRIBUTES = new Color(205, 196, 109); diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java index fe6f9ab6e252d3a2398a7ed768218f91e802d8d3..93aef7a2d080328b10c758649597abff4ba78668 100755 --- a/src/ui/IconManager.java +++ b/src/ui/IconManager.java @@ -144,7 +144,8 @@ public class IconManager { public static ImageIcon imgic5020, imgic5022, imgic5024, imgic5026, imgic5028; public static ImageIcon imgic5030, imgic5032, imgic5034, imgic5036, imgic5038; public static ImageIcon imgic5040, imgic5042, imgic5044, imgic5046, imgic5048; - public static ImageIcon imgic5050, imgic5052, imgic5054, imgic5056; + public static ImageIcon imgic5050, imgic5052, imgic5054, imgic5056, imgic5058; + public static ImageIcon imgic5060, imgic5062, imgic5064, imgic5066; public static ImageIcon imgic5100, imgic5102, imgic5104, imgic5106, imgic5108; public static ImageIcon imgic5110, imgic5112; @@ -435,6 +436,7 @@ public class IconManager { private static String icon1012 = "images/reqcomp.gif"; private static String icon1014 = "images/ebrddobs.gif"; private static String icon1016 = "images/reqref.gif"; + // EBRDD @@ -535,6 +537,11 @@ public class IconManager { private static String icon5052 = "images/avatarpartition.gif"; private static String icon5054 = "images/alignpartition.gif"; private static String icon5056 = "images/avatarreceivesignal.gif"; + private static String icon5058 = "images/avatarmaddiag.gif"; + private static String icon5060 = "images/avatarmadaspt.gif"; + private static String icon5062 = "images/avatarmadeltref.gif"; + private static String icon5064 = "images/avatarmadversioning.gif"; + private static String icon5066 = "images/avatarmadimpact.gif"; private static String icon5100 = "images/avatarhead16.gif"; private static String icon5102 = "images/avatarhead32.gif"; @@ -905,7 +912,12 @@ public class IconManager { imgic5050 = getIcon(icon5050); imgic5052 = getIcon(icon5052); imgic5054 = getIcon(icon5054); - imgic5056 = getIcon(icon5056); + imgic5056 = getIcon(icon5056); + imgic5058 = getIcon(icon5058); + imgic5060 = getIcon(icon5060); + imgic5062 = getIcon(icon5062); + imgic5064 = getIcon(icon5064); + imgic5066 = getIcon(icon5066); imgic5100 = getIcon(icon5100); imgic5102 = getIcon(icon5102); diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java index 09ebb31008a7a46a02cf48c3b71aa8093cde8a29..518c6a24e46c626daaf06bf6c2f6197c1b87c714 100755 --- a/src/ui/MainGUI.java +++ b/src/ui/MainGUI.java @@ -195,6 +195,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { public final static byte MODEL_PROVERIF_OK = 45; public final static byte EDIT_PROVERIF_OK = 46; public final static byte AVATAR_SYNTAXCHECKING_OK = 47; + public final static byte PANEL_CHANGED = 48; public final static int INCREMENT = 10; @@ -555,7 +556,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_VIEW_WAVE].setEnabled(true); actions[TGUIAction.EXTERNAL_ACTION_1].setEnabled(true); actions[TGUIAction.EXTERNAL_ACTION_2].setEnabled(true); - actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(true); + //actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(true); actions[TGUIAction.ACT_VIEW_RG_DIPLODOCUS].setEnabled(ConfigurationTTool.GGraphPath != null); actions[TGUIAction.ACT_VIEW_STAT_AUTDIPLODOCUS].setEnabled(ConfigurationTTool.GGraphPath != null); if (mainBar != null) { @@ -566,9 +567,9 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_MERGE].setEnabled(true); actions[TGUIAction.ACT_NEW_DESIGN].setEnabled(true); actions[TGUIAction.ACT_NEW_ANALYSIS].setEnabled(true); - actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(true); - actions[TGUIAction.ACT_ONECLICK_RTLOTOS_RG].setEnabled(true); - actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(true); + //actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(true); + //actions[TGUIAction.ACT_ONECLICK_RTLOTOS_RG].setEnabled(true); + //actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(true); actions[TGUIAction.ACT_SAVE_AS].setEnabled(true); actions[TGUIAction.ACT_IMPORT_LIB].setEnabled(true); actions[TGUIAction.ACT_SAVE].setEnabled(false); @@ -603,6 +604,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_GEN_RTLOTOS].setEnabled(true); actions[TGUIAction.ACT_PROJECTION].setEnabled(false); break; + case MODEL_UPPAAL_OK: //actions[TGUIAction.ACT_SAVE_TIF].setEnabled(true); //actions[TGUIAction.ACT_GEN_RTLOTOS].setEnabled(true); @@ -694,6 +696,29 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { actions[TGUIAction.ACT_GEN_AUTS].setEnabled(false); actions[TGUIAction.ACT_PROJECTION].setEnabled(false); break; + + case PANEL_CHANGED: + actions[TGUIAction.ACT_GEN_RTLOTOS].setEnabled(false); + actions[TGUIAction.ACT_GEN_LOTOS].setEnabled(false); + actions[TGUIAction.ACT_GEN_JAVA].setEnabled(false); + actions[TGUIAction.ACT_SIMU_JAVA].setEnabled(false); + actions[TGUIAction.ACT_GEN_DESIGN].setEnabled(false); + actions[TGUIAction.ACT_GEN_SYSTEMC].setEnabled(false); + actions[TGUIAction.ACT_GEN_TMLTXT].setEnabled(false); + actions[TGUIAction.ACT_GEN_AUT].setEnabled(false); + actions[TGUIAction.ACT_GEN_AUTS].setEnabled(false); + actions[TGUIAction.ACT_GEN_UPPAAL].setEnabled(false); + actions[TGUIAction.ACT_GEN_PROVERIF].setEnabled(false); + actions[TGUIAction.ACT_CHECKCODE].setEnabled(false); + actions[TGUIAction.ACT_SIMULATION].setEnabled(false); + actions[TGUIAction.ACT_VALIDATION].setEnabled(false); + actions[TGUIAction.ACT_PROJECTION].setEnabled(false); + actions[TGUIAction.ACT_AVATAR_SIM].setEnabled(false); + actions[TGUIAction.ACT_AVATAR_FV_UPPAAL].setEnabled(false); + actions[TGUIAction.ACT_AVATAR_FV_PROVERIF].setEnabled(false); + actions[TGUIAction.ACT_AVATAR_FV_STATICANALYSIS].setEnabled(false); + actions[TGUIAction.ACT_AVATAR_EXECUTABLE_GENERATION].setEnabled(false); + case MODEL_SAVED: actions[TGUIAction.ACT_SAVE].setEnabled(false); break; @@ -2794,7 +2819,7 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { NCPanel ncp = (NCPanel) tp; b = gtm.translateNC(ncp); if (b) { - setMode(MainGUI.MODEL_OK); + //setMode(MainGUI.MODEL_OK_NC); ret = true; if (!automatic) { JOptionPane.showMessageDialog(frame, @@ -5765,8 +5790,13 @@ public class MainGUI implements ActionListener, WindowListener, KeyListener { } else { mainBar.showAvatarActions(false); } - setEditMode(); + + setMode(PANEL_CHANGED); + + setEditMode(); setPanelMode(); + + } catch (Exception ex) { //TraceManager.addDev("Exception pane action: " + ex.getMessage()); } diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java index 6fe632860207f95d986357c24a5eb0290c83a80d..56462fa39eb44a6dff77af3dc7e56963d548db62 100755 --- a/src/ui/TGUIAction.java +++ b/src/ui/TGUIAction.java @@ -932,12 +932,12 @@ public class TGUIAction extends AbstractAction { // AVATAR Modeling Assumptions Diagram actions[AMAD_EDIT] = new TAction("edit-amad-diagram", "Edit AVATAR Modeling Assumptions Diagram", IconManager.imgic100, IconManager.imgic101, "Edit AVATAR Modeling Assumptions Diagram", "Make it possible to edit the currently opened AVATAR Modeling Assumption diagram", 0); - actions[AMAD_ASSUMPTION] = new TAction("add-amad-assumption", "Add an assumption", IconManager.imgic5006, IconManager.imgic5006, "Assumption", "Add an assumption to the currently opened avatar Modeling Assumptions Diagram", 0); - actions[AMAD_DIAGRAM_REFERENCE] = new TAction("add-amad-diagram-reference", "Add a diagram reference", IconManager.imgic5006, IconManager.imgic5006, "Diagram reference", "Add a diagram reference to the currently opened avatar Modeling Assumptions Diagram", 0); - actions[AMAD_ELEMENT_REFERENCE] = new TAction("add-amad-element-reference", "Add a reference to an modeling element", IconManager.imgic5006, IconManager.imgic5006, "Element reference", "Add a reference to an model element in the currently opened avatar Modeling Assumptions Diagram", 0); + actions[AMAD_ASSUMPTION] = new TAction("add-amad-assumption", "Add an assumption", IconManager.imgic5060, IconManager.imgic5060, "Assumption", "Add an assumption to the currently opened avatar Modeling Assumptions Diagram", 0); + actions[AMAD_DIAGRAM_REFERENCE] = new TAction("add-amad-diagram-reference", "Add a diagram reference", IconManager.imgic5058, IconManager.imgic5058, "Diagram reference", "Add a diagram reference to the currently opened avatar Modeling Assumptions Diagram", 0); + actions[AMAD_ELEMENT_REFERENCE] = new TAction("add-amad-element-reference", "Add a reference to an modeling element", IconManager.imgic5062, IconManager.imgic5062, "Element reference", "Add a reference to an model element in the currently opened avatar Modeling Assumptions Diagram", 0); actions[AMAD_COMPOSITION_CONNECTOR] = new TAction("add-amad-composition", "Add a composition link", IconManager.imgic1012, IconManager.imgic1012, "Composition", "Add a composition link between two assumptions of the currently opened avatar Modeling Assumptions diagram", 0); - actions[AMAD_VERSIONING_CONNECTOR] = new TAction("add-amad-versioning", "Add a versioning link", IconManager.imgic1012, IconManager.imgic1012, "Versioning", "Add a versioning link between two assumptions of the currently opened avatar Modeling Assumptions diagram", 0); - actions[AMAD_IMPACT_CONNECTOR] = new TAction("add-amad-impact", "Add an impact link", IconManager.imgic1012, IconManager.imgic1012, "Impact", "Add an impact link between an assumption and an model element, in the currently opened avatar Modeling Assumptions diagram", 0); + actions[AMAD_VERSIONING_CONNECTOR] = new TAction("add-amad-versioning", "Add a versioning link", IconManager.imgic5064, IconManager.imgic5064, "Versioning", "Add a versioning link between two assumptions of the currently opened avatar Modeling Assumptions diagram", 0); + actions[AMAD_IMPACT_CONNECTOR] = new TAction("add-amad-impact", "Add an impact link", IconManager.imgic5066, IconManager.imgic5066, "Impact", "Add an impact link between an assumption and an model element, in the currently opened avatar Modeling Assumptions diagram", 0); // AVATAR Requirement Diagrams diff --git a/src/ui/ad/TActivityDiagramToolBar.java b/src/ui/ad/TActivityDiagramToolBar.java index 051f76aae3d75970b4db14fc74f46dc42c4e1a33..c48020e6aa302a4ed07e98d3a774b8d760bd42aa 100755 --- a/src/ui/ad/TActivityDiagramToolBar.java +++ b/src/ui/ad/TActivityDiagramToolBar.java @@ -86,6 +86,11 @@ public class TActivityDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_RTLOTOS_RG].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/avatarbd/AvatarBDToolBar.java b/src/ui/avatarbd/AvatarBDToolBar.java index 664f9f7330a3e5dd618d9b99519bd7ce66888f24..b340ba07ca1f572a44a0bd6c1a9cd5726474aa33 100644 --- a/src/ui/avatarbd/AvatarBDToolBar.java +++ b/src/ui/avatarbd/AvatarBDToolBar.java @@ -83,6 +83,8 @@ public class AvatarBDToolBar extends TToolBar { //mgui.actions[TGUIAction.ATD_CONSTRAINT].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); } diff --git a/src/ui/avatarmad/AvatarMADAssumption.java b/src/ui/avatarmad/AvatarMADAssumption.java index f516a5543adda7155d5d32da5398fd9bbf386eb5..7c6c51341079db7a232547d6489659682f9cba5a 100644 --- a/src/ui/avatarmad/AvatarMADAssumption.java +++ b/src/ui/avatarmad/AvatarMADAssumption.java @@ -75,20 +75,20 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem private int currentFontSize = -1; private boolean displayText = true; - protected final static String[] ASSUMPTION_TYPE_STR = {"<<System Assumption>>", "<<Environment Assumption>>", "<<Method Assumption>>"}; - protected final static int NB_ASSUMPTION_TYPE = 3; + public final static String[] ASSUMPTION_TYPE_STR = {"<<System Assumption>>", "<<Environment Assumption>>", "<<Method Assumption>>"}; + - protected final static String[] DURABILITY_TYPE = {"Permanent", "Temporary"}; - protected final static int NB_DURABILITY_TYPE = 2; + public final static String[] DURABILITY_TYPE = {"Undefined", "Permanent", "Temporary"}; + + + public final static String[] SOURCE_TYPE = {"Undefined", "End-user", "Stakeholder", "Model creator"}; - protected final static String[] SOURCE_TYPE = {"End-user", "Stakeholder", "Model creator"}; - protected final static int NB_SOURCE_TYPE = 3; - protected final static String[] STATUS_TYPE = {"Applied", "Alleviated"}; - protected final static int NB_STATUS_TYPE = 2; + public final static String[] STATUS_TYPE = {"Undefined", "Applied", "Alleviated"}; + + + public final static String[] LIMITATION_TYPE = {"Undefined", "Language", "Tool", "Method"}; - protected final static String[] LIMITATION_TYPE = {"Language", "Tool", "Method"}; - protected final static int NB_LIMITATION_TYPE = 2; protected String text; protected String []texts; @@ -173,7 +173,7 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem } oldValue = value; - myImageIcon = IconManager.imgic5100; + myImageIcon = IconManager.imgic5060; text = "Assumption description:\nDouble-click to edit"; @@ -220,9 +220,9 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem g.drawRect(x, y, width, height); g.drawLine(x, y+lineHeight, x+width, y+lineHeight); - g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + g.setColor(ColorManager.AVATAR_ASSUMPTION_TOP); g.fillRect(x+1, y+1, width-1, lineHeight-1); - g.setColor(ColorManager.AVATAR_REQUIREMENT_ATTRIBUTES); + g.setColor(ColorManager.AVATAR_ASSUMPTION_ATTRIBUTES); g.fillRect(x+1, y+1+lineHeight, width-1, height-1-lineHeight); ColorManager.setColor(g, getState(), 0); if ((lineHeight > 23) && (width > 23)){ @@ -290,6 +290,23 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem size += currentFontSize; } + if (size < (height - 2)) { + drawLimitedString(g, "Durability=\"" + DURABILITY_TYPE[durability] + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + if (size < (height - 2)) { + drawLimitedString(g, "Source=\"" + SOURCE_TYPE[source] + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + if (size < (height - 2)) { + drawLimitedString(g, "Status=\"" + STATUS_TYPE[status] + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + if (size < (height - 2)) { + drawLimitedString(g, "Limitation=\"" + LIMITATION_TYPE[limitation] + "\"", x + textX, y + size, width, 0); + size += currentFontSize; + } + } + } + } + // Type and risk /*if (size < (height - 2)) { drawLimitedString(g, "Kind=\"" + kind + "\"", x + textX, y + size, width, 0); @@ -321,101 +338,63 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem } public boolean editOndoubleClick(JFrame frame, int _x, int _y) { - // On the name ? - oldValue = value; - - if ((displayText) && (_y <= (y + lineHeight))) { - String text = getName() + ": "; - if (hasFather()) { - text = getTopLevelName() + " / " + text; - } - String s = (String)JOptionPane.showInputDialog(frame, text, - "setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101, - null, - getValue()); - - 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 Assumption: the new name is not a valid name", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return false; - } - - if (!tdp.isRequirementNameUnique(s)) { - JOptionPane.showMessageDialog(frame, - "Could not change the name of the Assumption: the new name is already in use", - "Error", - JOptionPane.INFORMATION_MESSAGE); - return false; - } - - - int size = graphics.getFontMetrics().stringWidth(s) + iconSize + 5; - minDesiredWidth = Math.max(size, minWidth); - if (minDesiredWidth != width) { - newSizeForSon(null); - } - setValue(s); - - if (tdp.actionOnDoubleClick(this)) { - return true; - } else { - JOptionPane.showMessageDialog(frame, - "Could not change the name of the Assumption: this name is already in use", - "Error", - JOptionPane.INFORMATION_MESSAGE); - setValue(oldValue); - } - } - return false; - } - return editAttributes(); - - } - - public boolean editAttributes() { - //String oldValue = value; - /*String atn = null; - String va = null; - - if (reqType == SECURITY_REQ) { - atn = attackTreeNode; - } - - - if (reqType == SAFETY_REQ) { - va = violatedAction; - } - - JDialogRequirement jdr = new JDialogRequirement(tdp.getGUI().getFrame(), "Setting attributes of Requirement " + getRequirementName(), id, text, kind, criticality, va, reqType, atn, referenceElements); - jdr.setSize(750, 400); - GraphicLib.centerOnParent(jdr); - jdr.show(); + JDialogAssumption jda = new JDialogAssumption(tdp.getGUI().getFrame(), "Setting attributes of Assumption " + getAssumptionName(), getAssumptionName(), text, type, durability, source, status, limitation); + jda.setSize(850, 500); + GraphicLib.centerOnParent(jda); + jda.show(); - if (!jdr.isRegularClose()) { + if (!jda.isRegularClose()) { return false; - }*/ + } - - /*if (reqType == SAFETY_REQ) { - violatedAction = jdr.getViolatedAction(); + String s = jda.getName(); + + text = jda.getText(); + makeValue(); + + type = jda.getType(); + durability = jda.getDurability(); + source = jda.getSource(); + status = jda.getStatus(); + limitation = jda.getLimitation(); + + + 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 Assumption: the new name is not a valid name", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + if (!tdp.isRequirementNameUnique(s)) { + JOptionPane.showMessageDialog(frame, + "Could not change the name of the Assumption: the new name is already in use", + "Error", + JOptionPane.INFORMATION_MESSAGE); + return false; + } + + + int size = graphics.getFontMetrics().stringWidth(s) + iconSize + 5; + minDesiredWidth = Math.max(size, minWidth); + if (minDesiredWidth != width) { + newSizeForSon(null); + } + setValue(s); } - if (reqType == SECURITY_REQ) { - attackTreeNode = jdr.getAttackTreeNode(); - } - referenceElements = jdr.getReferenceElements(); - id = jdr.getId(); - text = jdr.getText(); - kind = jdr.getKind(); - criticality = jdr.getCriticality();*/ - - makeValue(); + + return true; - } + + // On the name ? + + + } + public void rescale(double scaleFactor){ dlineHeight = (lineHeight + dlineHeight) / oldScaleFactor * scaleFactor; @@ -508,7 +487,7 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem } text += GTURTLEModeling.decodeString(s) + "\n"; - } else if (elt.getTagName().equals("Type")) { + } else if (elt.getTagName().equals("type")) { //System.out.println("Analyzing line2"); s = elt.getAttribute("data"); if (s.equals("null")) { @@ -520,10 +499,74 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem type = 0; } } - if ((type > (NB_ASSUMPTION_TYPE-1)) || (type < 0)) { + if ((type > (ASSUMPTION_TYPE_STR.length-1)) || (type < 0)) { type = 0; } + } else if (elt.getTagName().equals("durability")) { + //System.out.println("Analyzing line2"); + s = elt.getAttribute("data"); + if (s.equals("null")) { + durability = 0; + } else { + try { + durability = Integer.decode(s).intValue(); + } catch (Exception e) { + durability = 0; + } + } + if ((durability > (DURABILITY_TYPE.length-1)) || (durability < 0)) { + type = 0; + } + + } else if (elt.getTagName().equals("source")) { + //System.out.println("Analyzing line2"); + s = elt.getAttribute("data"); + if (s.equals("null")) { + source = 0; + } else { + try { + source = Integer.decode(s).intValue(); + } catch (Exception e) { + source = 0; + } + } + if ((source > (SOURCE_TYPE.length-1)) || (source < 0)) { + source = 0; + } + + } else if (elt.getTagName().equals("status")) { + //System.out.println("Analyzing line2"); + s = elt.getAttribute("data"); + if (s.equals("null")) { + status = 0; + } else { + try { + status = Integer.decode(s).intValue(); + } catch (Exception e) { + status = 0; + } + } + if ((status > (STATUS_TYPE.length-1)) || (status < 0)) { + status = 0; + } + + } else if (elt.getTagName().equals("limitation")) { + //System.out.println("Analyzing line2"); + s = elt.getAttribute("data"); + if (s.equals("null")) { + limitation = 0; + } else { + try { + limitation = Integer.decode(s).intValue(); + } catch (Exception e) { + limitation = 0; + } + } + if ((limitation > (LIMITATION_TYPE.length-1)) || (limitation < 0)) { + limitation = 0; + } + } //System.out.println("Analyzing line4"); } @@ -542,6 +585,10 @@ public class AvatarMADAssumption extends TGCScalableWithInternalComponent implem } + public String getAssumptionName() { + return value; + } + public String getText() { return text; } diff --git a/src/ui/avatarmad/AvatarMADDiagramReference.java b/src/ui/avatarmad/AvatarMADDiagramReference.java index 7fc130e78d7cfe38dd875e6c9e67726ecf781bec..43661e9fb7ae8f28c3c5b912ae140eb8edd3fb6c 100644 --- a/src/ui/avatarmad/AvatarMADDiagramReference.java +++ b/src/ui/avatarmad/AvatarMADDiagramReference.java @@ -131,7 +131,7 @@ public class AvatarMADDiagramReference extends TGCScalableWithInternalComponent //value = tdp.findRequirementName("Requirement_"); oldValue = value; - myImageIcon = IconManager.imgic5100; + myImageIcon = IconManager.imgic5058; diagramText = "no diagram"; @@ -171,9 +171,9 @@ public class AvatarMADDiagramReference extends TGCScalableWithInternalComponent g.drawRect(x, y, width, height); g.drawLine(x, y+lineHeight, x+width, y+lineHeight); - g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + g.setColor(ColorManager.AVATAR_ASSUMPTION_TOP); g.fillRect(x+1, y+1, width-1, lineHeight-1); - g.setColor(ColorManager.AVATAR_REQUIREMENT_ATTRIBUTES); + g.setColor(ColorManager.AVATAR_ASSUMPTION_ATTRIBUTES); g.fillRect(x+1, y+1+lineHeight, width-1, height-1-lineHeight); ColorManager.setColor(g, getState(), 0); if ((lineHeight > 23) && (width > 23)){ diff --git a/src/ui/avatarmad/AvatarMADElementReference.java b/src/ui/avatarmad/AvatarMADElementReference.java index 3f213e7b3852ec1df48996ea75eada48d71a67bd..e25c386439e902616ef57ec52e9f79a3dab08814 100644 --- a/src/ui/avatarmad/AvatarMADElementReference.java +++ b/src/ui/avatarmad/AvatarMADElementReference.java @@ -131,7 +131,7 @@ public class AvatarMADElementReference extends TGCScalableWithInternalComponent //value = tdp.findRequirementName("Requirement_"); oldValue = value; - myImageIcon = IconManager.imgic5100; + myImageIcon = IconManager.imgic5062; actionOnAdd(); @@ -170,9 +170,9 @@ public class AvatarMADElementReference extends TGCScalableWithInternalComponent g.drawRect(x, y, width, height); g.drawLine(x, y+lineHeight, x+width, y+lineHeight); - g.setColor(ColorManager.AVATAR_REQUIREMENT_TOP); + g.setColor(ColorManager.AVATAR_ASSUMPTION_TOP); g.fillRect(x+1, y+1, width-1, lineHeight-1); - g.setColor(ColorManager.AVATAR_REQUIREMENT_ATTRIBUTES); + g.setColor(ColorManager.AVATAR_ASSUMPTION_ATTRIBUTES); g.fillRect(x+1, y+1+lineHeight, width-1, height-1-lineHeight); ColorManager.setColor(g, getState(), 0); if ((lineHeight > 23) && (width > 23)){ diff --git a/src/ui/avatarrd/AvatarRDRequirement.java b/src/ui/avatarrd/AvatarRDRequirement.java index b0831c16a476aff496a112374d2f821a82d1b625..ea8af892a2c116a9e430d2078b4c72535deffd54 100755 --- a/src/ui/avatarrd/AvatarRDRequirement.java +++ b/src/ui/avatarrd/AvatarRDRequirement.java @@ -187,7 +187,7 @@ public class AvatarRDRequirement extends TGCScalableWithInternalComponent implem } oldValue = value; - myImageIcon = IconManager.imgic5100; + myImageIcon = IconManager.imgic5006; text = "Requirement description:\nDouble-click to edit"; diff --git a/src/ui/avatarsmd/AvatarSMDToolBar.java b/src/ui/avatarsmd/AvatarSMDToolBar.java index b39bd7174b8daaf46d7a3164abc63eb3f50bb681..43d32d3e3a0d42519ef62ec67a7097f729de6be8 100755 --- a/src/ui/avatarsmd/AvatarSMDToolBar.java +++ b/src/ui/avatarsmd/AvatarSMDToolBar.java @@ -86,6 +86,8 @@ public class AvatarSMDToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_TOGGLE_AVATAR_ID].setEnabled(b); + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/cd/TClassDiagramToolBar.java b/src/ui/cd/TClassDiagramToolBar.java index 05a9a2611f3b4ec270c627cd6e08e54516559b1e..101263dfd9fc13792c2955d11e52943276d900d6 100755 --- a/src/ui/cd/TClassDiagramToolBar.java +++ b/src/ui/cd/TClassDiagramToolBar.java @@ -76,6 +76,10 @@ public class TClassDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_TOGGLE_ATTRIBUTES].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_GATES].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_SYNCHRO].setEnabled(b); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_RTLOTOS_RG].setEnabled(b); mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); diff --git a/src/ui/ncdd/NCDiagramToolBar.java b/src/ui/ncdd/NCDiagramToolBar.java index 644f6b8051361b185c9c4937a0bbac855db863c9..018a345a1d2acf26601c146e3ea2d548d4c58027 100755 --- a/src/ui/ncdd/NCDiagramToolBar.java +++ b/src/ui/ncdd/NCDiagramToolBar.java @@ -73,6 +73,9 @@ public class NCDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/procsd/ProCSDComponent.java b/src/ui/procsd/ProCSDComponent.java index ce1f51746e2b028dd053c63cc8206e62aa8c0d72..900f03737d9166a2ed08b7323595dde8b96ba3bb 100755 --- a/src/ui/procsd/ProCSDComponent.java +++ b/src/ui/procsd/ProCSDComponent.java @@ -281,6 +281,15 @@ public class ProCSDComponent extends TGCWithInternalComponent implements addInternalComponent(tgc, 0); return true; } + + if ((tgc instanceof ProCSDInPort) || (tgc instanceof ProCSDOutPort)) { + // Set its coordinates + tgc.setFather(this); + tgc.setDrawingZone(true); + //((ProCSDComponent) tgc).resizeWithFather(); + addInternalComponent(tgc, 0); + return true; + } return false; diff --git a/src/ui/procsd/ProactiveCSDToolBar.java b/src/ui/procsd/ProactiveCSDToolBar.java index f3af5572910007c72ea966072580cf83edad1aa9..bc3ba46def2847002892e889bc62022f7fb853ef 100755 --- a/src/ui/procsd/ProactiveCSDToolBar.java +++ b/src/ui/procsd/ProactiveCSDToolBar.java @@ -78,6 +78,9 @@ public class ProactiveCSDToolBar extends TToolBar { //Enable the new action created by Solange //mgui.actions[TGUIAction.PRUEBA_1].setEnabled(b); + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); diff --git a/src/ui/procsd/TGConnectorProCSD.java b/src/ui/procsd/TGConnectorProCSD.java index 7c180a566ad2b37e93e882bf20a8082ee40a0932..12b8ca574a4cfafd3d15f340f9c050d7a47bdeb9 100644 --- a/src/ui/procsd/TGConnectorProCSD.java +++ b/src/ui/procsd/TGConnectorProCSD.java @@ -116,12 +116,14 @@ public class TGConnectorProCSD extends TGConnectorAssociationProCSD { TGComponent father1 =((ProCSDPort)p1.getFather()).getFather(); TGComponent father2 =((ProCSDPort)p2.getFather()).getFather(); + if ((father1 != null) && (father2 != null)) { if (father1.getFather() == father2) { TGConnectingPoint tmp=p1; p1=p2; p2=tmp; } + } } } else @@ -133,11 +135,14 @@ public class TGConnectorProCSD extends TGConnectorAssociationProCSD { TGComponent father1 =((ProCSDPort)p1.getFather()).getFather(); TGComponent father2 =((ProCSDPort)p2.getFather()).getFather(); - if (father2.getFather() == father1) - { - TGConnectingPoint tmp=p1; - p1=p2; - p2=tmp; + + if ((father1 != null) && (father2 != null)) { + if (father2.getFather() == father1) + { + TGConnectingPoint tmp=p1; + p1=p2; + p2=tmp; + } } } diff --git a/src/ui/prosmd/ProactiveSMDToolBar.java b/src/ui/prosmd/ProactiveSMDToolBar.java index fa94bd4479ababe434eb2c5ae827497b869b84d9..ccf516172278daefc5c088ef5d8cb0cd1854c3b1 100755 --- a/src/ui/prosmd/ProactiveSMDToolBar.java +++ b/src/ui/prosmd/ProactiveSMDToolBar.java @@ -85,6 +85,9 @@ public class ProactiveSMDToolBar extends TToolBar { mgui.actions[TGUIAction.AD_TIME_LIMITED_OFFER_WITH_LATENCY].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_JAVA].setEnabled(b); mgui.actions[TGUIAction.ACT_ENHANCE].setEnabled(b);*/ + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); diff --git a/src/ui/tmlad/TMLActivityDiagramToolBar.java b/src/ui/tmlad/TMLActivityDiagramToolBar.java index c3f82a16c5c85d3a2e85874cc0ef902bca17b0ec..d054d2a2ce0dfa343c471a53fccf2f8f17f2fdab 100755 --- a/src/ui/tmlad/TMLActivityDiagramToolBar.java +++ b/src/ui/tmlad/TMLActivityDiagramToolBar.java @@ -95,6 +95,11 @@ public class TMLActivityDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/tmlcd/TMLTaskDiagramToolBar.java b/src/ui/tmlcd/TMLTaskDiagramToolBar.java index 8d45a3d8e42225a6ef1d922837835d86fe7fb9a5..a4508e6db8f9b229c9e56dbfca8b040b460cec04 100755 --- a/src/ui/tmlcd/TMLTaskDiagramToolBar.java +++ b/src/ui/tmlcd/TMLTaskDiagramToolBar.java @@ -75,6 +75,11 @@ public class TMLTaskDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false); mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/tmlcompd/TMLComponentTaskDiagramToolBar.java b/src/ui/tmlcompd/TMLComponentTaskDiagramToolBar.java index 16de11684fcf0125caf5e8f08adaa70913e360ee..43ba3a3813d147f1b2135d222eb6976099105311 100755 --- a/src/ui/tmlcompd/TMLComponentTaskDiagramToolBar.java +++ b/src/ui/tmlcompd/TMLComponentTaskDiagramToolBar.java @@ -74,6 +74,10 @@ public class TMLComponentTaskDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b); mgui.actions[TGUIAction.ACT_TOGGLE_DIPLO_ID].setEnabled(b); + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); + mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(b); mgui.updateZoomInfo(); diff --git a/src/ui/tmldd/TMLArchiDiagramToolBar.java b/src/ui/tmldd/TMLArchiDiagramToolBar.java index 2fe3c48fcbcef05fba5c2d9648037fdbbee74450..a1ff5e0d6a9aa48808c6af3d301d2d317a30d51e 100755 --- a/src/ui/tmldd/TMLArchiDiagramToolBar.java +++ b/src/ui/tmldd/TMLArchiDiagramToolBar.java @@ -76,6 +76,11 @@ public class TMLArchiDiagramToolBar extends TToolBar { mgui.actions[TGUIAction.ACT_TOGGLE_DIPLO_ID].setEnabled(b); mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false); + + mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b); + mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b); + mgui.actions[TGUIAction.ACT_SIMU_SYSTEMC].setEnabled(b); + mgui.updateZoomInfo(); } diff --git a/src/ui/tree/DiagramTreeRenderer.java b/src/ui/tree/DiagramTreeRenderer.java index b37b3f3681b1b55fa01cadebcd0e1af2d3b2b5f6..a09a1e607bd1c8f3f4198e9703b5ac29e9aa6991 100755 --- a/src/ui/tree/DiagramTreeRenderer.java +++ b/src/ui/tree/DiagramTreeRenderer.java @@ -75,6 +75,7 @@ import ui.avatarbd.*; import ui.avatarsmd.*; import ui.avatarrd.*; import ui.avatarpd.*; +import ui.avatarmad.*; public class DiagramTreeRenderer extends DefaultTreeCellRenderer { @@ -249,6 +250,18 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer { setIcon(IconManager.imgic5108); setToolTipText(value.toString()); + } else if (value instanceof SearchTree) { + setIcon(IconManager.imgic56); + setToolTipText(value.toString()); + + } else if (value instanceof AvatarMADsPanel) { + setIcon(IconManager.imgic5060); + setToolTipText("Panel for Avatar Modeling Assumptions Diagram"); + + } else if (value instanceof AvatarMADPanel) { + setIcon(IconManager.imgic5060); + setToolTipText("Avatar Modeling Assumptions Diagram"); + } else { setToolTipText(null); } diff --git a/src/ui/window/JDialogAssumption.java b/src/ui/window/JDialogAssumption.java new file mode 100755 index 0000000000000000000000000000000000000000..de900cf4b1c281f32b17512d4991e50de5b65511 --- /dev/null +++ b/src/ui/window/JDialogAssumption.java @@ -0,0 +1,292 @@ +/**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 JDialogAssumption + * Dialog for managing attributes of assummptions + * Creation: 04/09/2013 + * @version 1.0 04/09/2013 + * @author Ludovic APVRILLE + * @see + */ + +package ui.window; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +//import javax.swing.event.*; +//import java.util.*; + +import ui.*; +import ui.avatarmad.*; + + +public class JDialogAssumption extends javax.swing.JDialog implements ActionListener { + + + private boolean regularClose; + + private JPanel panel1, panel2; + private Frame frame; + private String name; + private int type, durability, source, status, limitation; + private String text; + + // Panel1 + private JComboBox typeBox; + private JTextField nameField; + protected JTextArea jta; + + //Panel2 + private JComboBox durabilityBox, sourceBox, statusBox, limitationBox; + + + // Main Panel + private JButton closeButton; + private JButton cancelButton; + + /** Creates new form */ + public JDialogAssumption(Frame _frame, String _title, String _name, String _text, int _type, int _durability, int _source, int _status, int _limitation) { + super(_frame, _title, true); + frame = _frame; + name = _name; + text = _text; + type = _type; + durability = _durability; + source = _source; + status = _status; + limitation = _limitation; + + + initComponents(); + myInitComponents(); + pack(); + } + + private void myInitComponents() { + } + + private void initComponents() { + int i; + + Container c = getContentPane(); + GridBagLayout gridbag0 = new GridBagLayout(); + GridBagLayout gridbag1 = new GridBagLayout(); + GridBagLayout gridbag2 = new GridBagLayout(); + GridBagConstraints c0 = new GridBagConstraints(); + GridBagConstraints c1 = new GridBagConstraints(); + GridBagConstraints c2 = new GridBagConstraints(); + + setFont(new Font("Helvetica", Font.PLAIN, 14)); + c.setLayout(gridbag0); + + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + panel1 = new JPanel(); + panel1.setLayout(gridbag1); + + panel1.setBorder(new javax.swing.border.TitledBorder("Main attributes")); + + panel1.setPreferredSize(new Dimension(300, 350)); + + panel2 = new JPanel(); + panel2.setLayout(gridbag2); + panel2.setBorder(new javax.swing.border.TitledBorder("Other attributes:")); + panel2.setPreferredSize(new Dimension(300, 250)); + + //c1.gridwidth = GridBagConstraints.REMAINDER; //end row + c1.gridheight = 1; + c1.weighty = 1.0; + c1.weightx = 1.0; + + c1.gridwidth = 1; + JLabel label = new JLabel("type:"); + panel1.add(label, c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + typeBox = new JComboBox(AvatarMADAssumption.ASSUMPTION_TYPE_STR); + typeBox.setSelectedIndex(type); + panel1.add(typeBox, c1); + + c1.gridwidth = 1; + label = new JLabel("name:"); + panel1.add(label, c1); + c1.gridwidth = GridBagConstraints.REMAINDER; //end row + nameField = new JTextField(name, 40); + panel1.add(nameField, c1); + + c1.gridheight = 7; + + jta = new JTextArea(); + jta.setEditable(true); + jta.setMargin(new Insets(10, 10, 10, 10)); + jta.setTabSize(3); + jta.append(text); + jta.setFont(new Font("times", Font.PLAIN, 12)); + + JScrollPane jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + //jsp.setPreferredSize(new Dimension(300, 250)); + panel1.add(jsp, c1); + //} + + // Panel2 + c2.gridwidth = 1; + c2.gridheight = 1; + c2.weighty = 1.0; + c2.weightx = 1.0; + c2.fill = GridBagConstraints.HORIZONTAL; + + c2.gridwidth = 1; + label = new JLabel("durability:"); + panel2.add(label, c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + durabilityBox = new JComboBox(AvatarMADAssumption.DURABILITY_TYPE); + durabilityBox.setSelectedIndex(durability); + panel2.add(durabilityBox, c2); + + c2.gridwidth = 1; + label = new JLabel("source:"); + panel2.add(label, c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + sourceBox = new JComboBox(AvatarMADAssumption.SOURCE_TYPE); + sourceBox.setSelectedIndex(source); + panel2.add(sourceBox, c2); + + c2.gridwidth = 1; + label = new JLabel("status:"); + panel2.add(label, c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + statusBox = new JComboBox(AvatarMADAssumption.STATUS_TYPE); + statusBox.setSelectedIndex(status); + panel2.add(statusBox, c2); + + c2.gridwidth = 1; + label = new JLabel("limitation:"); + panel2.add(label, c2); + c2.gridwidth = GridBagConstraints.REMAINDER; //end row + limitationBox = new JComboBox(AvatarMADAssumption.LIMITATION_TYPE); + limitationBox.setSelectedIndex(limitation); + panel2.add(limitationBox, c2); + + + // main panel; + c0.gridwidth = 1; + c0.gridheight = 10; + c0.weighty = 1.0; + c0.weightx = 1.0; + + c.add(panel1, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + c.add(panel2, c0); + + c0.gridwidth = 1; + c0.gridheight = 1; + c0.fill = GridBagConstraints.HORIZONTAL; + closeButton = new JButton("Save and Close", IconManager.imgic25); + //closeButton.setPreferredSize(new Dimension(600, 50)); + closeButton.addActionListener(this); + c.add(closeButton, c0); + c0.gridwidth = GridBagConstraints.REMAINDER; //end row + cancelButton = new JButton("Cancel", IconManager.imgic27); + cancelButton.addActionListener(this); + c.add(cancelButton, c0); + } + + public void actionPerformed(ActionEvent evt) { + /* if (evt.getSource() == typeBox) { + boolean b = ((Boolean)(initValues.elementAt(typeBox.getSelectedIndex()))).booleanValue(); + initialValue.setEnabled(b); + return; + }*/ + + + String command = evt.getActionCommand(); + + // Compare the action command to the known actions. + if (command.equals("Save and Close")) { + closeDialog(); + } else if (command.equals("Cancel")) { + cancelDialog(); + } + } + + + + public void closeDialog() { + regularClose = true; + dispose(); + } + + public void cancelDialog() { + dispose(); + } + + public boolean isRegularClose() { + return regularClose; + } + + public String getName() { + return nameField.getText(); + } + + public String getText() { + return jta.getText(); + } + + public int getType() { + return typeBox.getSelectedIndex(); + } + + public int getDurability() { + return durabilityBox.getSelectedIndex(); + } + + public int getSource() { + return sourceBox.getSelectedIndex(); + } + + public int getStatus() { + return statusBox.getSelectedIndex(); + } + + public int getLimitation() { + return limitationBox.getSelectedIndex(); + } + + + +}