svn commit: r17016 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-04-01 16:26:50-0700
New Revision: 17016

Added:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ComponentFactory.java
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
Modified:
   trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java

Log:
Begin breaking factory into smaller more manageable parts

Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ComponentFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ComponentFactory.java?view=markup&pathrev=17016
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ComponentFactory.java	2009-04-01 16:26:50-0700
@@ -0,0 +1,45 @@
+// $Id: ActionAddOFSParameter.java 17015 2009-04-01 22:29:45Z bobtarling $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import javax.swing.JComponent;
+
+/**
+ * An interface to be implemented by all factories that create
+ * components for property panels.
+ * @author Bob Tarling
+ */
+public interface ComponentFactory {
+    
+    /**
+     * Create the Component for the given model element
+     * @param modelElement a UML model element
+     * @return a component with which the user can edit the model element
+     * value or navigate through the property panels.
+     */
+    JComponent createComponent(
+            final Object modelElement,
+            final String propName);
+}

Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java?view=markup&pathrev=17016
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java	2009-04-01 16:26:50-0700
@@ -0,0 +1,391 @@
+// $Id: SwingUIFactory.java 17009 2009-03-31 22:53:20Z bobtarling $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.JComponent;
+import javax.swing.JList;
+import org.argouml.model.Model;
+import org.argouml.uml.ui.ScrollList;
+import org.argouml.uml.ui.UMLLinkedList;
+import org.argouml.uml.ui.behavior.collaborations.ActionAddClassifierRoleBase;
+import org.argouml.uml.ui.behavior.collaborations.ActionAddMessagePredecessor;
+import org.argouml.uml.ui.behavior.collaborations.ActionRemoveClassifierRoleBase;
+import org.argouml.uml.ui.behavior.common_behavior.ActionAddContextSignal;
+import org.argouml.uml.ui.behavior.common_behavior.ActionAddCreateActionInstantiation;
+import org.argouml.uml.ui.behavior.common_behavior.ActionAddInstanceClassifier;
+import org.argouml.uml.ui.behavior.state_machines.ActionNewTransition;
+import org.argouml.uml.ui.behavior.use_cases.ActionAddExtendExtensionPoint;
+import org.argouml.uml.ui.behavior.use_cases.ActionNewExtendExtensionPoint;
+import org.argouml.uml.ui.behavior.use_cases.ActionNewUseCaseExtensionPoint;
+import org.argouml.uml.ui.foundation.core.ActionAddAssociationSpecification;
+import org.argouml.uml.ui.foundation.core.ActionAddClientDependencyAction;
+import org.argouml.uml.ui.foundation.core.ActionAddSupplierDependencyAction;
+
+/**
+ * Creates the XML Property panels
+ */
+class ListFactory implements ComponentFactory {
+    
+    public ListFactory() {
+    }
+    
+    public JComponent createComponent(
+            final Object modelElement,
+            final String propName) {
+        ScrollList list = null;
+        UMLModelElementListModel model = null;
+        if ("clientDependency".equals(propName)) {
+            model = new UMLModelElementClientDependencyListModel();
+            model.setTarget(modelElement); 
+            list = new ScrollList(new UMLMutableLinkedList(
+                    model,
+                    new ActionAddClientDependencyAction(),
+                    null,
+                    null,
+                    true));
+        } else if ("supplierDependency".equals(propName)) {
+            model = new UMLModelElementSupplierDependencyListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLMutableLinkedList(
+                    model,
+                    new ActionAddSupplierDependencyAction(),
+                    null,
+                    null,
+                    true));
+        } else if ("generalization".equals(propName)) {
+            model = new UMLGeneralizableElementGeneralizationListModel();
+        } else if ("specialization".equals(propName)) {
+            model = new UMLGeneralizableElementSpecializationListModel();
+        } else if ("attribute".equals(propName)) {
+            model = new UMLClassAttributeListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(model, true, false);
+        } else if ("association".equals(propName)) {
+            model = new UMLClassifierAssociationEndListModel();
+        } else if ("feature".equals(propName)) {
+            model = new UMLClassifierFeatureListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(model, true, false);
+        } else if ("operation".equals(propName)) {
+            model = new UMLClassOperationListModel();
+        } else if ("ownedElement".equals(propName)) {
+            model = new UMLNamespaceOwnedElementListModel();
+        } else if ("elementImport".equals(propName)) {
+            model = new UMLClassifierPackageImportsListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLMutableLinkedList(model,
+                    // TODO: It's OK to change the visibility of this actions?
+                    null, // new ActionAddPackageImport(),
+                    null,
+                    null, //new ActionRemovePackageImport(),
+                    true));
+        } else if ("parameter".equals(propName)) {
+            if (Model.getFacade().isAObjectFlowState(modelElement)) {
+                model = new UMLObjectFlowStateParameterListModel();
+                model.setTarget(modelElement);
+                JList l = new UMLMutableLinkedList(model,
+                        new ActionAddOFSParameter(),
+                        new ActionNewOFSParameter(),
+                        new ActionRemoveOFSParameter(),
+                        true); 
+                list = new ScrollList(l);
+                        
+            } else {
+                model = new UMLClassifierParameterListModel();
+                model.setTarget(modelElement);
+                list = new ScrollList(new UMLLinkedList(model, 
+                        true, false));
+            }
+        } else if ("raisedSignal".equals(propName)) {
+            model = new UMLOperationRaisedSignalsListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLLinkedList(model, 
+                    true, false));
+        } else if ("method".equals(propName)) {
+            model = new UMLOperationMethodsListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLLinkedList(model, 
+                    true, false));
+        } else if ("definedTag".equals(propName)) {
+            model = new UMLStereotypeTagDefinitionListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLLinkedList(model,
+                    true, false));
+        } else if ("baseClass".equals(propName)) {
+            model = new UMLStereotypeBaseClassListModel();
+            model.setTarget(modelElement);
+            UMLMutableLinkedList l = new UMLMutableLinkedList(
+                    new UMLStereotypeBaseClassListModel(), 
+                    new ActionAddStereotypeBaseClass(),
+                    null,
+                    new ActionDeleteStereotypeBaseClass(),
+                    true);
+            l.setCellRenderer(new DefaultListCellRenderer());
+            list = new ScrollList(l);
+        } else if ("extended_elements".equals(propName)) {
+            model = new UMLExtendedElementsListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList( new UMLLinkedList(model, 
+                    true, true));
+        } else if ("literal".equals(propName)) {
+            model = new UMLEnumerationLiteralsListModel();
+        } else if ("supplier".equals(propName)) {
+            model = new UMLDependencySupplierListModel();
+        } else if ("client".equals(propName)) {
+            model = new UMLDependencyClientListModel();
+        } else if ("connection".equals(propName)) {
+            model = new UMLAssociationConnectionListModel();
+        } else if ("associationRole".equals(propName)) {
+            model = new UMLAssociationAssociationRoleListModel();
+        } else if ("link".equals(propName)) {
+            model = new UMLAssociationLinkListModel();
+        } else if ("specification".equals(propName)) {
+            model = new UMLAssociationEndSpecificationListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLMutableLinkedList(
+                    model,
+                    ActionAddAssociationSpecification.getInstance(),
+                    null, null, true));
+        } else if ("qualifier".equals(propName)) {
+            model = new UMLAssociationEndQualifiersListModel();
+        } else if ("annotatedElement".equals(propName)) {
+            model = new UMLCommentAnnotatedElementListModel();
+            model.setTarget(modelElement);
+            UMLMutableLinkedList l = new UMLMutableLinkedList(
+                    model, null, null);            
+            l.setDeleteAction(new ActionDeleteAnnotatedElement());
+            list = new ScrollList(l);
+        } else if ("context".equals(propName)) {
+            model = new UMLSignalContextListModel();
+            model.setTarget(modelElement);
+            UMLMutableLinkedList l = new UMLMutableLinkedList(
+                    model,
+                    new ActionAddContextSignal(), null, 
+                    new ActionRemoveContextSignal(), true);
+            list = new ScrollList(l);
+        } else if ("reception".equals(propName)) {
+            model = new UMLSignalReceptionListModel();
+            model.setTarget(modelElement);
+            UMLMutableLinkedList l = new UMLMutableLinkedList(
+                    model,
+                    new ActionAddReceptionSignal(), null, 
+                    new ActionRemoveReceptionSignal(), true);
+            list = new ScrollList(l);
+        } else if ("extend".equals(propName)) {
+            model = new UMLUseCaseExtendListModel();
+        } else if ("include".equals(propName)) {
+            model = new UMLUseCaseIncludeListModel();
+        } else if ("extensionPoint".equals(propName)) {
+            if (Model.getFacade().isAUseCase(modelElement)) {
+                model = new UMLUseCaseExtensionPointListModel();
+                model.setTarget(modelElement);
+                JList l = new UMLMutableLinkedList(
+                            model, null,
+                            ActionNewUseCaseExtensionPoint.SINGLETON);
+                list = new ScrollList(l);
+            } else {
+                model = new UMLExtendExtensionPointListModel();
+                model.setTarget(modelElement);
+                JList l =
+                    new UMLMutableLinkedList(model, 
+                        ActionAddExtendExtensionPoint.getInstance(),
+                        ActionNewExtendExtensionPoint.SINGLETON);
+                list = new ScrollList(l);
+            }
+        } else if ("base".equals(propName)) {
+            model = new UMLClassifierRoleBaseListModel();
+            model.setTarget(modelElement);
+            JList l =
+                new UMLMutableLinkedList(model,
+                    ActionAddClassifierRoleBase.SINGLETON,
+                    null,
+                    ActionRemoveClassifierRoleBase.getInstance(),
+                    true);
+            list = new ScrollList(l);
+        } else if ("availableFeature".equals(propName)) {
+            model = new UMLClassifierRoleAvailableFeaturesListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("availableContents".equals(propName)) {
+            model = new UMLClassifierRoleAvailableContentsListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("predecessor".equals(propName)) {
+            model = new UMLMessagePredecessorListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model,
+                    ActionAddMessagePredecessor.getInstance(),
+                    null);
+            list = new ScrollList(l);
+        } else if ("actualArgument".equals(propName)) {
+            model = new UMLActionArgumentListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("instantiation".equals(propName)) {
+            model = new UMLCreateActionClassifierListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model,
+                    new ActionAddCreateActionInstantiation(), 
+                    null, null, true);
+            list = new ScrollList(l);
+        } else if ("constrainingElement".equals(propName)) {
+            model = new UMLCollaborationConstrainingElementListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("top".equals(propName)) {
+            model = new UMLStateMachineTopListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("transitions".equals(propName)) {
+            model = new UMLStateMachineTransitionListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("transition".equals(propName)) {
+            model = new UMLEventTransitionListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("submachineState".equals(propName)) {
+            model = new UMLStateMachineSubmachineStateListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("message".equals(propName)) {
+            model = new UMLInteractionMessagesListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("deployedComponent".equals(propName)) {
+            model = new UMLNodeDeployedComponentListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("residentElement".equals(propName)) {
+            model = new UMLComponentResidentListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("classifier".equals(propName)) {
+            model = new UMLInstanceClassifierListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model,
+                             new ActionAddInstanceClassifier(
+                                     Model.getMetaTypes().getClassifier()), 
+                                     null, null, true);
+            list = new ScrollList(l);
+        } else if ("resident".equals(propName)) {
+            model = new UMLContainerResidentListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);
+        } else if ("entry".equals(propName)) {
+            model = new UMLStateEntryListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLStateEntryList(model);
+            list = new ScrollList(l);
+        } else if ("exit".equals(propName)) {
+            model = new UMLStateExitListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLStateExitList(model);
+            list = new ScrollList(l);
+        } else if ("deferrableEvent".equals(propName)) {
+            model = new UMLStateDeferrableEventListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLStateDeferrableEventList(model);
+            list = new ScrollList(l);                    
+        } else if ("doActivity".equals(propName)) {
+            model = new UMLStateDoActivityListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLStateDoActivityList(model);
+            list = new ScrollList(l);
+        } else if ("outgoing".equals(propName)) {
+            model = new UMLStateVertexOutgoingListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);                    
+        } else if ("incoming".equals(propName)) {
+            model = new UMLStateVertexIncomingListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLLinkedList(model);
+            list = new ScrollList(l);                    
+        } else if ("classifierInState".equals(propName)) {
+            model = new UMLOFSStateListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model,
+                    new ActionAddOFSState(),
+                    null,
+                    new ActionRemoveOFSState(),
+                    true);
+            list = new ScrollList(l);
+        } else if ("internalTransition".equals(propName)) {
+            model = new UMLStateInternalTransitionListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model, null, 
+                    new ActionNewTransition());
+            list = new ScrollList(l);
+        } else if ("subvertex".equals(propName)) {
+            model = new UMLCompositeStateSubvertexListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLCompositeStateSubvertexList(model);
+            list = new ScrollList(l);
+        } else if ("contents".equals(propName)) {
+            model = new UMLPartitionContentListModel();
+            model.setTarget(modelElement);
+            JList l = new UMLMutableLinkedList(model,
+                    new ActionAddPartitionContent(),
+                    null);
+            list = new ScrollList(l);
+        } else if ("partition".equals(propName)) {
+            model = new UMLActivityGraphPartitionListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLLinkedList(model));
+        } else if ("signal".equals(propName)) {
+            model = new UMLSignalEventSignalListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLSignalEventSignalList(model));                    
+        } else if ("action".equals(propName)) {
+            model = new UMLActionSequenceActionListModel();
+            model.setTarget(modelElement);
+            list = new ScrollList(new UMLActionSequenceActionList(model));
+        }
+        
+        if (model != null && list == null) {
+            // If we have a model but no list then build the list with
+            // preferred constructor. Eventually all lists should be built
+            // this way.
+            model.setTarget(modelElement);
+            list = new ScrollList(model);
+        }
+        
+        return list;
+    }
+}

Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java?view=diff&pathrev=17016&r1=17015&r2=17016
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java	(original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java	2009-04-01 16:26:50-0700
@@ -24,18 +24,15 @@
 
 package org.argouml.core.propertypanels.ui;
 
-import javax.swing.DefaultListCellRenderer;
 import javax.swing.JComboBox;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
-import javax.swing.JList;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTextArea;
 import javax.swing.JTextField;
 import javax.swing.border.TitledBorder;
 
-import org.apache.log4j.Logger;
 import org.argouml.core.propertypanels.panel.UIFactory;
 import org.argouml.core.propertypanels.panel.XMLPropPanelFactory;
 import org.argouml.core.propertypanels.xml.XMLPropertyPanelsData;
@@ -43,13 +40,11 @@
 import org.argouml.i18n.Translator;
 import org.argouml.model.Model;
 import org.argouml.uml.ui.LabelledLayout;
-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.UMLLinkedList;
 import org.argouml.uml.ui.UMLPlainTextDocument;
 import org.argouml.uml.ui.UMLRadioButtonPanel;
 import org.argouml.uml.ui.UMLSearchableComboBox;
@@ -59,14 +54,7 @@
 import org.argouml.uml.ui.behavior.activity_graphs.ActionSetObjectFlowStateClassifier;
 import org.argouml.uml.ui.behavior.activity_graphs.UMLActionSynchCheckBox;
 import org.argouml.uml.ui.behavior.activity_graphs.UMLObjectFlowStateClassifierComboBoxModel;
-import org.argouml.uml.ui.behavior.collaborations.ActionAddClassifierRoleBase;
-import org.argouml.uml.ui.behavior.collaborations.ActionAddMessagePredecessor;
-import org.argouml.uml.ui.behavior.collaborations.ActionRemoveClassifierRoleBase;
-import org.argouml.uml.ui.behavior.common_behavior.ActionAddContextSignal;
-import org.argouml.uml.ui.behavior.common_behavior.ActionAddCreateActionInstantiation;
-import org.argouml.uml.ui.behavior.common_behavior.ActionAddInstanceClassifier;
 import org.argouml.uml.ui.behavior.common_behavior.UMLActionAsynchronousCheckBox;
-import org.argouml.uml.ui.behavior.state_machines.ActionNewTransition;
 import org.argouml.uml.ui.behavior.state_machines.ActionSetContextStateMachine;
 import org.argouml.uml.ui.behavior.state_machines.ActionSetStubStateReferenceState;
 import org.argouml.uml.ui.behavior.state_machines.ActionSetSubmachineStateSubmachine;
@@ -74,13 +62,7 @@
 import org.argouml.uml.ui.behavior.state_machines.UMLStubStateComboBoxModel;
 import org.argouml.uml.ui.behavior.state_machines.UMLSubmachineStateComboBoxModel;
 import org.argouml.uml.ui.behavior.state_machines.UMLSynchStateBoundDocument;
-import org.argouml.uml.ui.behavior.use_cases.ActionAddExtendExtensionPoint;
-import org.argouml.uml.ui.behavior.use_cases.ActionNewExtendExtensionPoint;
-import org.argouml.uml.ui.behavior.use_cases.ActionNewUseCaseExtensionPoint;
 import org.argouml.uml.ui.behavior.use_cases.UMLExtensionPointLocationDocument;
-import org.argouml.uml.ui.foundation.core.ActionAddAssociationSpecification;
-import org.argouml.uml.ui.foundation.core.ActionAddClientDependencyAction;
-import org.argouml.uml.ui.foundation.core.ActionAddSupplierDependencyAction;
 import org.argouml.uml.ui.foundation.core.ActionSetAssociationEndType;
 import org.argouml.uml.ui.foundation.core.ActionSetGeneralizationPowertype;
 import org.argouml.uml.ui.foundation.core.ActionSetModelElementNamespace;
@@ -141,8 +123,7 @@
     private JPanel buildPanel(XMLPropertyPanelsData data, Object target) {
         
         JPanel panel = new JPanel(new LabelledLayout());
-        
-        for (XMLPropertyPanelsDataRecord prop : data.getProperties()) {        
+        for (XMLPropertyPanelsDataRecord prop : data.getProperties()) {
             if ("text".equals(prop.getType())) {
                 buildTextboxPanel(panel, target, prop);
             } else if ("combo".equals(prop.getType())) {
@@ -382,344 +363,18 @@
         }
     }
 
-    private void buildList(JPanel panel, Object target, 
-            XMLPropertyPanelsDataRecord prop) {
-        
-        ScrollList list = null;
-        UMLModelElementListModel model = null;
-        if ("clientDependency".equals(prop.getName())) {
-            model = new UMLModelElementClientDependencyListModel();
-            model.setTarget(target); 
-            list = new ScrollList(new UMLMutableLinkedList(
-                    model,
-                    new ActionAddClientDependencyAction(),
-                    null,
-                    null,
-                    true));
-        } else if ("supplierDependency".equals(prop.getName())) {
-            model = new UMLModelElementSupplierDependencyListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLMutableLinkedList(
-                    model,
-                    new ActionAddSupplierDependencyAction(),
-                    null,
-                    null,
-                    true));
-        } else if ("generalization".equals(prop.getName())) {
-            model = new UMLGeneralizableElementGeneralizationListModel();
-        } else if ("specialization".equals(prop.getName())) {
-            model = new UMLGeneralizableElementSpecializationListModel();
-        } else if ("attribute".equals(prop.getName())) {
-            model = new UMLClassAttributeListModel();
-            model.setTarget(target);
-            list = new ScrollList(model, true, false);
-        } else if ("association".equals(prop.getName())) {
-            model = new UMLClassifierAssociationEndListModel();
-        } else if ("feature".equals(prop.getName())) {
-            model = new UMLClassifierFeatureListModel();
-            model.setTarget(target);
-            list = new ScrollList(model, true, false);
-        } else if ("operation".equals(prop.getName())) {
-            model = new UMLClassOperationListModel();
-        } else if ("ownedElement".equals(prop.getName())) {
-            model = new UMLNamespaceOwnedElementListModel();
-        } else if ("elementImport".equals(prop.getName())) {
-            model = new UMLClassifierPackageImportsListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLMutableLinkedList(model,
-                    // TODO: It's OK to change the visibility of this actions?
-                    null, // new ActionAddPackageImport(),
-                    null,
-                    null, //new ActionRemovePackageImport(),
-                    true));
-        } else if ("parameter".equals(prop.getName())) {
-            if (Model.getFacade().isAObjectFlowState(target)) {
-                model = new UMLObjectFlowStateParameterListModel();
-                model.setTarget(target);
-                JList l = new UMLMutableLinkedList(model,
-                        new ActionAddOFSParameter(),
-                        new ActionNewOFSParameter(),
-                        new ActionRemoveOFSParameter(),
-                        true); 
-                list = new ScrollList(l);
-                        
-            } else {
-                model = new UMLClassifierParameterListModel();
-                model.setTarget(target);
-                list = new ScrollList(new UMLLinkedList(model, 
-                        true, false));
-            }
-        } else if ("raisedSignal".equals(prop.getName())) {
-            model = new UMLOperationRaisedSignalsListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLLinkedList(model, 
-                    true, false));
-        } else if ("method".equals(prop.getName())) {
-            model = new UMLOperationMethodsListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLLinkedList(model, 
-                    true, false));
-        } else if ("definedTag".equals(prop.getName())) {
-            model = new UMLStereotypeTagDefinitionListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLLinkedList(model,
-                    true, false));
-        } else if ("baseClass".equals(prop.getName())) {
-            model = new UMLStereotypeBaseClassListModel();
-            model.setTarget(target);
-            UMLMutableLinkedList l = new UMLMutableLinkedList(
-                    new UMLStereotypeBaseClassListModel(), 
-                    new ActionAddStereotypeBaseClass(),
-                    null,
-                    new ActionDeleteStereotypeBaseClass(),
-                    true);
-            l.setCellRenderer(new DefaultListCellRenderer());
-            list = new ScrollList(l);
-        } else if ("extended_elements".equals(prop.getName())) {
-            model = new UMLExtendedElementsListModel();
-            model.setTarget(target);
-            list = new ScrollList( new UMLLinkedList(model, 
-                    true, true));
-        } else if ("literal".equals(prop.getName())) {
-            model = new UMLEnumerationLiteralsListModel();
-        } else if ("supplier".equals(prop.getName())) {
-            model = new UMLDependencySupplierListModel();
-        } else if ("client".equals(prop.getName())) {
-            model = new UMLDependencyClientListModel();
-        } else if ("connection".equals(prop.getName())) {
-            model = new UMLAssociationConnectionListModel();
-        } else if ("associationRole".equals(prop.getName())) {
-            model = new UMLAssociationAssociationRoleListModel();
-        } else if ("link".equals(prop.getName())) {
-            model = new UMLAssociationLinkListModel();
-        } else if ("specification".equals(prop.getName())) {
-            model = new UMLAssociationEndSpecificationListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLMutableLinkedList(
-                    model,
-                    ActionAddAssociationSpecification.getInstance(),
-                    null, null, true));
-        } else if ("qualifier".equals(prop.getName())) {
-            model = new UMLAssociationEndQualifiersListModel();
-        } else if ("annotatedElement".equals(prop.getName())) {
-            model = new UMLCommentAnnotatedElementListModel();
-            model.setTarget(target);
-            UMLMutableLinkedList l = new UMLMutableLinkedList(
-                    model, null, null);            
-            l.setDeleteAction(new ActionDeleteAnnotatedElement());
-            list = new ScrollList(l);
-        } else if ("context".equals(prop.getName())) {
-            model = new UMLSignalContextListModel();
-            model.setTarget(target);
-            UMLMutableLinkedList l = new UMLMutableLinkedList(
-                    model,
-                    new ActionAddContextSignal(), null, 
-                    new ActionRemoveContextSignal(), true);
-            list = new ScrollList(l);
-        } else if ("reception".equals(prop.getName())) {
-            model = new UMLSignalReceptionListModel();
-            model.setTarget(target);
-            UMLMutableLinkedList l = new UMLMutableLinkedList(
-                    model,
-                    new ActionAddReceptionSignal(), null, 
-                    new ActionRemoveReceptionSignal(), true);
-            list = new ScrollList(l);
-        } else if ("extend".equals(prop.getName())) {
-            model = new UMLUseCaseExtendListModel();
-        } else if ("include".equals(prop.getName())) {
-            model = new UMLUseCaseIncludeListModel();
-        } else if ("extensionPoint".equals(prop.getName())) {
-            if (Model.getFacade().isAUseCase(target)) {
-                model = new UMLUseCaseExtensionPointListModel();
-                model.setTarget(target);
-                JList l = new UMLMutableLinkedList(
-                            model, null,
-                            ActionNewUseCaseExtensionPoint.SINGLETON);
-                list = new ScrollList(l);
-            } else {
-                model = new UMLExtendExtensionPointListModel();
-                model.setTarget(target);
-                JList l =
-                    new UMLMutableLinkedList(model, 
-                        ActionAddExtendExtensionPoint.getInstance(),
-                        ActionNewExtendExtensionPoint.SINGLETON);
-                list = new ScrollList(l);
-            }
-        } else if ("base".equals(prop.getName())) {
-            model = new UMLClassifierRoleBaseListModel();
-            model.setTarget(target);
-            JList l =
-                new UMLMutableLinkedList(model,
-                    ActionAddClassifierRoleBase.SINGLETON,
-                    null,
-                    ActionRemoveClassifierRoleBase.getInstance(),
-                    true);
-            list = new ScrollList(l);
-        } else if ("availableFeature".equals(prop.getName())) {
-            model = new UMLClassifierRoleAvailableFeaturesListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("availableContents".equals(prop.getName())) {
-            model = new UMLClassifierRoleAvailableContentsListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("predecessor".equals(prop.getName())) {
-            model = new UMLMessagePredecessorListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model,
-                    ActionAddMessagePredecessor.getInstance(),
-                    null);
-            list = new ScrollList(l);
-        } else if ("actualArgument".equals(prop.getName())) {
-            model = new UMLActionArgumentListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("instantiation".equals(prop.getName())) {
-            model = new UMLCreateActionClassifierListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model,
-                    new ActionAddCreateActionInstantiation(), 
-                    null, null, true);
-            list = new ScrollList(l);
-        } else if ("constrainingElement".equals(prop.getName())) {
-            model = new UMLCollaborationConstrainingElementListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("top".equals(prop.getName())) {
-            model = new UMLStateMachineTopListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("transitions".equals(prop.getName())) {
-            model = new UMLStateMachineTransitionListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("transition".equals(prop.getName())) {
-            model = new UMLEventTransitionListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("submachineState".equals(prop.getName())) {
-            model = new UMLStateMachineSubmachineStateListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("message".equals(prop.getName())) {
-            model = new UMLInteractionMessagesListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("deployedComponent".equals(prop.getName())) {
-            model = new UMLNodeDeployedComponentListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("residentElement".equals(prop.getName())) {
-            model = new UMLComponentResidentListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("classifier".equals(prop.getName())) {
-            model = new UMLInstanceClassifierListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model,
-                             new ActionAddInstanceClassifier(
-                                     Model.getMetaTypes().getClassifier()), 
-                                     null, null, true);
-            list = new ScrollList(l);
-        } else if ("resident".equals(prop.getName())) {
-            model = new UMLContainerResidentListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);
-        } else if ("entry".equals(prop.getName())) {
-            model = new UMLStateEntryListModel();
-            model.setTarget(target);
-            JList l = new UMLStateEntryList(model);
-            list = new ScrollList(l);
-        } else if ("exit".equals(prop.getName())) {
-            model = new UMLStateExitListModel();
-            model.setTarget(target);
-            JList l = new UMLStateExitList(model);
-            list = new ScrollList(l);
-        } else if ("deferrableEvent".equals(prop.getName())) {
-            model = new UMLStateDeferrableEventListModel();
-            model.setTarget(target);
-            JList l = new UMLStateDeferrableEventList(model);
-            list = new ScrollList(l);                    
-        } else if ("doActivity".equals(prop.getName())) {
-            model = new UMLStateDoActivityListModel();
-            model.setTarget(target);
-            JList l = new UMLStateDoActivityList(model);
-            list = new ScrollList(l);
-        } else if ("outgoing".equals(prop.getName())) {
-            model = new UMLStateVertexOutgoingListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);                    
-        } else if ("incoming".equals(prop.getName())) {
-            model = new UMLStateVertexIncomingListModel();
-            model.setTarget(target);
-            JList l = new UMLLinkedList(model);
-            list = new ScrollList(l);                    
-        } else if ("classifierInState".equals(prop.getName())) {
-            model = new UMLOFSStateListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model,
-                    new ActionAddOFSState(),
-                    null,
-                    new ActionRemoveOFSState(),
-                    true);
-            list = new ScrollList(l);
-        } else if ("internalTransition".equals(prop.getName())) {
-            model = new UMLStateInternalTransitionListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model, null, 
-                    new ActionNewTransition());
-            list = new ScrollList(l);
-        } else if ("subvertex".equals(prop.getName())) {
-            model = new UMLCompositeStateSubvertexListModel();
-            model.setTarget(target);
-            JList l = new UMLCompositeStateSubvertexList(model);
-            list = new ScrollList(l);
-        } else if ("contents".equals(prop.getName())) {
-            model = new UMLPartitionContentListModel();
-            model.setTarget(target);
-            JList l = new UMLMutableLinkedList(model,
-                    new ActionAddPartitionContent(),
-                    null);
-            list = new ScrollList(l);
-        } else if ("partition".equals(prop.getName())) {
-            model = new UMLActivityGraphPartitionListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLLinkedList(model));
-        } else if ("signal".equals(prop.getName())) {
-            model = new UMLSignalEventSignalListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLSignalEventSignalList(model));                    
-        } else if ("action".equals(prop.getName())) {
-            model = new UMLActionSequenceActionListModel();
-            model.setTarget(target);
-            list = new ScrollList(new UMLActionSequenceActionList(model));
-        }
-        
-        if (model != null && list == null) {
-            // If we have a model but no list then build the list with
-            // preferred constructor. Eventually all lists should be built
-            // this way.
-            model.setTarget(target);
-            list = new ScrollList(model);
-        }
+    private void buildList(
+            final JPanel panel, Object target, 
+            final XMLPropertyPanelsDataRecord prop) {
+        
+        final ListFactory factory = new ListFactory();
+        final JComponent list =
+            factory.createComponent(target, prop.getName());
         
         if (list != null) {
-            String name = prop.getName();
+            final String name = prop.getName();
 
-            JLabel label = new JLabel(name);
+            final JLabel label = new JLabel(name);
             label.setLabelFor(list);
             panel.add(label);
             panel.add(list);

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1511671

To unsubscribe from this discussion, e-mail: [[email protected]].
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.