svn commit: r15208 - branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels: panel xml

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

Added:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Generalization.xml   (contents, props changed)
Modified:
   branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java

Log:
A panel for Generalization.

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=15208&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=15207&r2=15208
==============================================================================
--- 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-08 09:38:37-0700
@@ -71,6 +71,7 @@
 import org.argouml.uml.ui.UMLTextField2;
 import org.argouml.uml.ui.foundation.core.ActionAddClientDependencyAction;
 import org.argouml.uml.ui.foundation.core.ActionAddSupplierDependencyAction;
+import org.argouml.uml.ui.foundation.core.ActionSetGeneralizationPowertype;
 import org.argouml.uml.ui.foundation.core.ActionSetModelElementNamespace;
 import org.argouml.uml.ui.foundation.core.ActionSetStructuralFeatureType;
 import org.argouml.uml.ui.foundation.core.UMLBehavioralFeatureQueryCheckBox;
@@ -80,6 +81,7 @@
 import org.argouml.uml.ui.foundation.core.UMLClassifierAssociationEndListModel;
 import org.argouml.uml.ui.foundation.core.UMLClassifierFeatureListModel;
 import org.argouml.uml.ui.foundation.core.UMLClassifierParameterListModel;
+import org.argouml.uml.ui.foundation.core.UMLDiscriminatorNameDocument;
 import org.argouml.uml.ui.foundation.core.UMLEnumerationLiteralsListModel;
 import org.argouml.uml.ui.foundation.core.UMLFeatureOwnerListModel;
 import org.argouml.uml.ui.foundation.core.UMLFeatureOwnerScopeCheckBox;
@@ -88,7 +90,11 @@
 import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementLeafCheckBox;
 import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementRootCheckBox;
 import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementSpecializationListModel;
+import org.argouml.uml.ui.foundation.core.UMLGeneralizationChildListModel;
+import org.argouml.uml.ui.foundation.core.UMLGeneralizationParentListModel;
+import org.argouml.uml.ui.foundation.core.UMLGeneralizationPowertypeComboBoxModel;
 import org.argouml.uml.ui.foundation.core.UMLModelElementClientDependencyListModel;
+import org.argouml.uml.ui.foundation.core.UMLModelElementNameDocument;
 import org.argouml.uml.ui.foundation.core.UMLModelElementNamespaceComboBoxModel;
 import org.argouml.uml.ui.foundation.core.UMLModelElementSupplierDependencyListModel;
 import org.argouml.uml.ui.foundation.core.UMLModelElementVisibilityRadioButtonPanel;
@@ -155,8 +161,7 @@
         
         panel = new JPanel(new LabelledLayout());
         
-        for (XMLPropertyPanelsDataRecord prop : data.getProperties()) {
-            String label = prop.getName();
+        for (XMLPropertyPanelsDataRecord prop : data.getProperties()) {        
             if ("text".equals(prop.getType())) {
                 buildTextboxPanel(panel, target, prop);
             }
@@ -244,6 +249,16 @@
             model.setTarget(target);
             pane = new UMLSingleRowSelector(model);
         }
+        else if ("parent".equals(prop.getName())) {
+            model = new UMLGeneralizationParentListModel();
+            model.setTarget(target);
+            pane = new UMLSingleRowSelector(model);
+        }
+        else if ("child".equals(prop.getName())) {
+            model = new UMLGeneralizationChildListModel();
+            model.setTarget(target);
+            pane = new UMLSingleRowSelector(model);
+        }
         else if ("feature".equals(prop.getName())) {
             model = new UMLParameterBehavioralFeatListModel();
             model.setTarget(target);
@@ -511,7 +526,7 @@
                     "label.namespace.navigate.tooltip"),
                     combo);
         }
-        if ("type".equals(prop.getName())) {
+        else if ("type".equals(prop.getName())) {
             final UMLComboBoxModel2 model =
                 new UMLStructuralFeatureTypeComboBoxModel();
             model.setTarget(target);           
@@ -522,7 +537,16 @@
                     ActionSetStructuralFeatureType.getInstance());
             comp = combo;
         }
-        if ("multiplicity".equals(prop.getName())) {            
+        else if ("powertype".equals(prop.getName())) {
+            final UMLComboBoxModel2 model = 
+                new UMLGeneralizationPowertypeComboBoxModel();
+            model.setTarget(target);
+            final JComboBox combo = new UMLComboBox2(
+                    model,
+                    ActionSetGeneralizationPowertype.getInstance());
+            comp = combo;
+        }
+        else if ("multiplicity".equals(prop.getName())) {            
             final UMLMultiplicityPanel mPanel = new UMLMultiplicityPanel();
             mPanel.setTarget(target);
             comp = mPanel;
@@ -546,22 +570,26 @@
     private void buildTextboxPanel(JPanel panel, Object target,
             XMLPropertyPanelsDataRecord prop) {
        
-        String name = prop.getName();
-        JLabel label = new JLabel(name);
-
-        // TODO: if the XML is invalid, this will explode 
-        GenericUMLPlainTextDocument document = 
-            new GenericUMLPlainTextDocument(name);
-        document.setTarget(target);
-        JTextField tfield = 
-            new UMLTextField2(document);
-        tfield.setColumns(20);
-
-        label.setLabelFor(tfield);
-        
-        panel.add(label);        
-        panel.add(tfield);
+        JTextField tfield = null;
+        UMLPlainTextDocument document = null;
+        if ("name".equals(prop.getName())) {
+            document = new UMLModelElementNameDocument();            
+        }
+        else if ("discriminator".equals(prop.getName())) {
+            document = new UMLDiscriminatorNameDocument();            
+        }
         
+        if (document != null) {
+            document.setTarget(target);
+            tfield = new UMLTextField2(document);
+        }        
+        if (tfield != null) {
+            String name = prop.getName();
+            JLabel label = new JLabel(name);
+            label.setLabelFor(tfield);
+            panel.add(label);
+            panel.add(tfield);
+        }        
     }
 
 

Added: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Generalization.xml
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Generalization.xml?view=auto&rev=15208
==============================================================================
--- (empty file)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/Generalization.xml	2008-07-08 09:38:37-0700
@@ -0,0 +1,10 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<panel>	
+	<text name='name' />
+	<text name='discriminator' />
+	<combo name='namespace' />
+	<separator />
+	<singlerow name='parent' />
+	<singlerow name='child' />
+	<combo name='powertype' />
+</panel>
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.