svn commit: r15173 - branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: penyaskito
Date: 2008-07-06 09:11:08-0700
New Revision: 15173

Modified:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java

Log:
Adding support for 'type' combos. Started work on 'multiplicity'

Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java?view=diff&rev=15173&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&r1=15172&r2=15173
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	(original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java	2008-07-06 09:11:08-0700
@@ -41,9 +41,12 @@
 import org.argouml.i18n.Translator;
 import org.argouml.uml.ui.ScrollList;
 import org.argouml.uml.ui.UMLCheckBox2;
+import org.argouml.uml.ui.UMLComboBox2;
+import org.argouml.uml.ui.UMLComboBoxModel2;
 import org.argouml.uml.ui.UMLComboBoxNavigator;
 import org.argouml.uml.ui.UMLDerivedCheckBox;
 import org.argouml.uml.ui.UMLModelElementListModel2;
+import org.argouml.uml.ui.UMLMultiplicityPanel;
 import org.argouml.uml.ui.UMLMutableLinkedList;
 import org.argouml.uml.ui.UMLRadioButtonPanel;
 import org.argouml.uml.ui.UMLSearchableComboBox;
@@ -51,6 +54,7 @@
 import org.argouml.uml.ui.foundation.core.ActionAddClientDependencyAction;
 import org.argouml.uml.ui.foundation.core.ActionAddSupplierDependencyAction;
 import org.argouml.uml.ui.foundation.core.ActionSetModelElementNamespace;
+import org.argouml.uml.ui.foundation.core.ActionSetStructuralFeatureType;
 import org.argouml.uml.ui.foundation.core.UMLClassActiveCheckBox;
 import org.argouml.uml.ui.foundation.core.UMLClassAttributeListModel;
 import org.argouml.uml.ui.foundation.core.UMLClassOperationListModel;
@@ -66,6 +70,7 @@
 import org.argouml.uml.ui.foundation.core.UMLModelElementSupplierDependencyListModel;
 import org.argouml.uml.ui.foundation.core.UMLModelElementVisibilityRadioButtonPanel;
 import org.argouml.uml.ui.foundation.core.UMLNamespaceOwnedElementListModel;
+import org.argouml.uml.ui.foundation.core.UMLStructuralFeatureTypeComboBoxModel;
 import org.argouml.uml.ui.model_management.UMLClassifierPackageImportsListModel;
 import org.tigris.swidgets.LabelledLayout;
 import org.xml.sax.InputSource;
@@ -124,19 +129,27 @@
             
             if ("text".equals(prop.getType())) {
                 JPanel p = buildTextboxPanel(target, prop);
-                panel.add(p);
+                if (p != null) {
+                    panel.add(p);
+                }
             }
             else if ("combo".equals(prop.getType())) {
                 JPanel p = buildComboPanel(target, prop);
-                panel.add(p);
+                if (p != null) {
+                    panel.add(p);
+                }
             }
             else if ("checkgroup".equals(prop.getType())) {
                 JPanel p = buildCheckGroup(target, prop);
-                panel.add(p);
+                if (p != null) {
+                    panel.add(p);
+                }
             }
             else if ("optionbox".equals(prop.getType())) {
                 JPanel p = buildOptionBox(target, prop);
-                panel.add(p);
+                if (p != null) {
+                    panel.add(p);
+                }
             }
             else if ("list".equals(prop.getType())) {
                 JPanel p = new JPanel();               
@@ -266,7 +279,9 @@
             // we must build the checkboxes
             for (XMLPropertyPanelsDataRecord data : prop.getChildren()) {
                 UMLCheckBox2 checkbox = buildCheckBox(target, data);
-                p.add(checkbox);
+                if (checkbox != null) {
+                    p.add(checkbox);
+                }
             }                            
         }
         return p;
@@ -310,19 +325,37 @@
         JLabel label = new JLabel(name);
         p.add(label);
 
+        UMLComboBoxModel2 model = null;
+        JComboBox combo = null;
+        
         if ("namespace".equals(prop.getName())) {
-            UMLModelElementNamespaceComboBoxModel namespaceModel =
+            model = 
                 new UMLModelElementNamespaceComboBoxModel();                    
-            namespaceModel.setTarget(target);
-            JComboBox namespaceSelector = new UMLSearchableComboBox(
-                    namespaceModel,
+            model.setTarget(target);
+            combo = new UMLSearchableComboBox(
+                    model,
                     new ActionSetModelElementNamespace(), true);
             
-            p.add(namespaceSelector);
+            p.add(combo);
+            // TODO: What about an
+            // UMLSearchableNavigableComboBox?
             p.add(new UMLComboBoxNavigator(
                     Translator.localize(
                     "label.namespace.navigate.tooltip"),
-                    namespaceSelector));
+                    combo));
+        }
+        if ("type".equals(prop.getName())) {
+            model =  new UMLStructuralFeatureTypeComboBoxModel();
+            model.setTarget(target);
+            combo = new UMLComboBox2(
+                    model,
+                    ActionSetStructuralFeatureType.getInstance());
+            p.add(combo);
+        }
+        if ("multiplicity".equals(prop.getName())) {            
+            UMLMultiplicityPanel mPanel = new UMLMultiplicityPanel();
+            // mPanel.setTarget(target);
+            p.add(mPanel);
         }
         return p;
     }
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.