Author: bszanto
Date: 2008-08-11 09:24:46-0700
New Revision: 15545
Modified:
branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java
branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java
branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java
Log:
Added [1] a new init() method in the CreateWizard interface, that initializes the wizard before each use (this prevents from having the values from the previous wizard, when it's launched), [2] a name field for the in parameter, [3] model string for using operations. Also fixed a few minor bugs.
Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java?view=diff&rev=15545&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java&r1=15544&r2=15545
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java (original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/ui/CmdCreateNodeWizard.java 2008-08-11 09:24:46-0700
@@ -64,6 +64,7 @@
@Override
public void actionPerformed(ActionEvent e) {
+ wizard.init();
// displays the wizard that returns the node to be created
node = wizard.display();
Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java?view=diff&rev=15545&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java&r1=15544&r2=15545
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java (original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/static_structure/ui/ClassCreateWizard.java 2008-08-11 09:24:46-0700
@@ -71,15 +71,22 @@
private Object classNode = null;
/** Attributes */
- private Vector<Attribute> attributes = new Vector<Attribute>();
+ private Vector<Attribute> attributes;
/** Operations */
- private Vector<Operation> operations = new Vector<Operation>();
+ private Vector<Operation> operations;
/**
* Constructor
*/
public ClassCreateWizard() {
+ }
+
+ public void init() {
+ classNode = null;
+ attributes = new Vector<Attribute>();
+ operations = new Vector<Operation>();
+
dialog = new JDialog();
dialog.setTitle(Translator.localize("dialog.title.wizard-class"));
dialog.setSize(WIDTH, HEIGHT);
@@ -87,8 +94,7 @@
dialog.setLocation((screenSize.width - WIDTH) / 2,
(screenSize.height - HEIGHT) / 2);
dialog.setResizable(false);
- dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.getContentPane().setLayout(new BorderLayout());
@@ -107,7 +113,8 @@
pnlAtt.setLayout(new BoxLayout(pnlAtt, BoxLayout.PAGE_AXIS));
JPanel pnlOp = new JPanel();
pnlOp.setBorder(BorderFactory.createTitledBorder(Translator
- .localize("label.operations")));
+ .localize("label.operations")
+ + " [ visibility returnType opName (inType paramName) ]"));
pnlOp.setLayout(new BoxLayout(pnlOp, BoxLayout.PAGE_AXIS));
for (int i = 0; i < 4; i++) {
attributes.add(new Attribute());
@@ -236,13 +243,13 @@
Object vis = null;
int index = visibility.getSelectedIndex();
switch (index) {
- case 1:
+ case 0:
vis = vk.getPublic();
break;
- case 2:
+ case 1:
vis = vk.getPackage();
break;
- case 3:
+ case 2:
vis = vk.getProtected();
break;
default:
@@ -261,14 +268,17 @@
}
class Operation extends JPanel {
- /** Name field */
- private JTextField name;
/** Visibility field */
private JComboBox visibility;
- /** In type field */
- private UMLComboBox2 inType;
/** Return type field */
private UMLComboBox2 outType;
+ /** Name field */
+ private JTextField name;
+ /** In type field */
+ private UMLComboBox2 inType;
+ /** Name field */
+ private JTextField paramName;
+
/** In parameter */
private Object inParam = null;
/** Return parameter */
@@ -288,34 +298,41 @@
"protected(#)", "private(-)" };
visibility = new JComboBox(vis);
visibility.setPreferredSize(
- new Dimension((int) (1.5 * ClassCreateWizard.WIDTH / 10), 25));
-
+ new Dimension((int) (1.3 * ClassCreateWizard.WIDTH / 10), 25));
+
UMLComboBoxModel2 model = new UMLStructuralFeatureTypeComboBoxModel();
- inParam = Model.getCoreFactory().createParameter();
- model.setTarget(inParam);
- inType = new UMLComboBox2(model,
+ returnParam = Model.getCoreFactory().createParameter();
+ model.setTarget(returnParam);
+ outType = new UMLComboBox2(model,
ActionSetStructuralFeatureType.getInstance());
- inType.setSelectedIndex(0);
- inType.setPreferredSize(
- new Dimension((int) (2.7 * ClassCreateWizard.WIDTH / 10), 25));
-
+// outType.setSelectedIndex(0);
+ outType.setPreferredSize(
+ new Dimension((2 * ClassCreateWizard.WIDTH / 10), 25));
+
name = new JTextField();
name.setPreferredSize(
- new Dimension(2 * ClassCreateWizard.WIDTH / 10, 25));
+ new Dimension((int) (1.7 * ClassCreateWizard.WIDTH / 10), 25));
model = new UMLStructuralFeatureTypeComboBoxModel();
- returnParam = Model.getCoreFactory().createParameter();
- model.setTarget(returnParam);
- outType = new UMLComboBox2(model,
+ inParam = Model.getCoreFactory().createParameter();
+ model.setTarget(inParam);
+ inType = new UMLComboBox2(model,
ActionSetStructuralFeatureType.getInstance());
- outType.setSelectedIndex(0);
- outType.setPreferredSize(
- new Dimension((int) (2.7 * ClassCreateWizard.WIDTH / 10), 25));
+// inType.setSelectedIndex(0);
+ inType.setPreferredSize(
+ new Dimension((2 * ClassCreateWizard.WIDTH / 10), 25));
+
+ paramName = new JTextField();
+ paramName.setPreferredSize(
+ new Dimension((int) (1.7 * ClassCreateWizard.WIDTH / 10), 25));
this.add(visibility);
- this.add(inType);
- this.add(name);
this.add(outType);
+ this.add(name);
+ this.add(new JLabel("("));
+ this.add(inType);
+ this.add(paramName);
+ this.add(new JLabel(")"));
}
/**
@@ -332,13 +349,13 @@
Object vis = null;
int index = visibility.getSelectedIndex();
switch (index) {
- case 1:
+ case 0:
vis = vk.getPublic();
break;
- case 2:
+ case 1:
vis = vk.getPackage();
break;
- case 3:
+ case 2:
vis = vk.getProtected();
break;
default:
@@ -347,15 +364,20 @@
help.setVisibility(operation, vis);
// the return param
- help.setType(returnParam, outType.getSelectedObjects()[0]);
- help.setKind(returnParam,
- Model.getDirectionKind().getReturnParameter());
- help.addParameter(operation, returnParam);
+ if (outType.getSelectedIndex() != -1) {
+ help.setType(returnParam, outType.getSelectedObjects()[0]);
+ help.setKind(returnParam,
+ Model.getDirectionKind().getReturnParameter());
+ help.addParameter(operation, returnParam);
+ }
// the in param
- help.setType(inParam, inType.getSelectedObjects()[0]);
- help.setKind(inParam, Model.getDirectionKind().getInParameter());
- help.addParameter(operation, inParam);
+ if (inType.getSelectedIndex() != -1) {
+ help.setType(inParam, inType.getSelectedObjects()[0]);
+ help.setKind(inParam, Model.getDirectionKind().getInParameter());
+ help.setName(inParam, paramName.getText());
+ help.addParameter(operation, inParam);
+ }
} else {
operation = null;
}
Modified: branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java?view=diff&rev=15545&p1=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java&p2=branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java&r1=15544&r2=15545
==============================================================================
--- branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java (original)
+++ branches/gsoc2008/feature4_5142_bszanto/src/org/argouml/uml/diagram/ui/CreateWizard.java 2008-08-11 09:24:46-0700
@@ -33,6 +33,11 @@
public interface CreateWizard {
/**
+ * Initializes the wizard.
+ */
+ public void init();
+
+ /**
* Displays the wizard.
* @return the object to be created, null otherwise (if the object should
* not be created)
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.