svn commit: r15198 - 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-08 03:46:49-0700
New Revision: 15198

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

Log:
Lists are created and added to the original panel.

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=15198&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=15197&r2=15198
==============================================================================
--- 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 03:46:49-0700
@@ -164,18 +164,8 @@
                     panel.add(p);
                 }
             }
-            else if ("list".equals(prop.getType())) {
-                JPanel p = new JPanel();               
-                JComponent list = buildList(target, prop);
-                if (list != null) {
-                    p.add(list);
-                    list.setPreferredSize(new Dimension(200, 80));
-                    JScrollPane scrollPane = new JScrollPane(p);
-                    JLabel lbl = new JLabel(prop.getName());
-                    lbl.setLabelFor(scrollPane);
-                    panel.add(lbl);
-                    panel.add(scrollPane);
-                }
+            else if ("list".equals(prop.getType())) {                    
+                buildList(panel, target, prop);
             }
             else if ("textarea".equals(prop.getType())) {
                 JPanel p = buildTextArea(target, prop);
@@ -226,29 +216,30 @@
         return null;
     }
 
-    protected JComponent buildList(Object target, 
+    private void buildList(JPanel panel, Object target, 
             XMLPropertyPanelsDataRecord prop) {
-        JComponent list = null;
+        
+        ScrollList list = null;
         UMLModelElementListModel2 model = null;
         if ("client_dependency".equals(prop.getName())) {
             model = new UMLModelElementClientDependencyListModel();
             model.setTarget(target); 
-            list = new UMLMutableLinkedList(
+            list = new ScrollList(new UMLMutableLinkedList(
                     model,
                     new ActionAddClientDependencyAction(),
                     null,
                     null,
-                    true);           
+                    true));
         }
         else if ("supplier_dependency".equals(prop.getName())) {
             model = new UMLModelElementSupplierDependencyListModel();
             model.setTarget(target);
-            list = new UMLMutableLinkedList(
+            list = new ScrollList(new UMLMutableLinkedList(
                     model,
                     new ActionAddSupplierDependencyAction(),
                     null,
                     null,
-                    true);        
+                    true));
         }
         else if ("generalizations".equals(prop.getName())) {
             model = new UMLGeneralizableElementGeneralizationListModel();
@@ -288,15 +279,22 @@
         else if ("imported_elements".equals(prop.getName())) {
             model = new UMLClassifierPackageImportsListModel();
             model.setTarget(target);
-            list = new UMLMutableLinkedList(model,
+            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);
+                    true));
         }
 
-        return list;
+        if (list != null) {
+            String name = prop.getName();
+
+            JLabel label = new JLabel(name);
+            label.setLabelFor(list);
+            panel.add(label);
+            panel.add(list);
+        }
     }
 
     /**
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.