svn commit: r17008 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java

Bob Tarling <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2009-03-30 17:03:02-0700
New Revision: 17008

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

Log:
Move duplicate code to a single place. More code will follow this pattern in future.

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=17008&r1=17007&r2=17008
==============================================================================
--- 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-03-30 17:03:02-0700
@@ -490,32 +490,22 @@
                     true));
         } else if ("generalization".equals(prop.getName())) {
             model = new UMLGeneralizableElementGeneralizationListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("specialization".equals(prop.getName())) {
             model = new UMLGeneralizableElementSpecializationListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } 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();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } 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();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("ownedElement".equals(prop.getName())) {
             model = new UMLNamespaceOwnedElementListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("elementImport".equals(prop.getName())) {
             model = new UMLClassifierPackageImportsListModel();
             model.setTarget(target);
@@ -575,28 +565,16 @@
                     true, true));
         } else if ("literal".equals(prop.getName())) {
             model = new UMLEnumerationLiteralsListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("supplier".equals(prop.getName())) {
             model = new UMLDependencySupplierListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("client".equals(prop.getName())) {
             model = new UMLDependencyClientListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("connection".equals(prop.getName())) {
             model = new UMLAssociationConnectionListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("associationRole".equals(prop.getName())) {
             model = new UMLAssociationAssociationRoleListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("link".equals(prop.getName())) {
             model = new UMLAssociationLinkListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("specification".equals(prop.getName())) {
             model = new UMLAssociationEndSpecificationListModel();
             model.setTarget(target);
@@ -606,8 +584,6 @@
                     null, null, true));
         } else if ("qualifier".equals(prop.getName())) {
             model = new UMLAssociationEndQualifiersListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("annotatedElement".equals(prop.getName())) {
             model = new UMLCommentAnnotatedElementListModel();
             model.setTarget(target);
@@ -633,12 +609,8 @@
             list = new ScrollList(l);
         } else if ("extend".equals(prop.getName())) {
             model = new UMLUseCaseExtendListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("include".equals(prop.getName())) {
             model = new UMLUseCaseIncludeListModel();
-            model.setTarget(target);
-            list = new ScrollList(model);
         } else if ("extensionPoint".equals(prop.getName())) {
             if (Model.getFacade().isAUseCase(target)) {
                 model = new UMLUseCaseExtensionPointListModel();
@@ -819,6 +791,14 @@
             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);
+        }
+        
         if (list != null) {
             String name = prop.getName();

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

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.