svn commit: r17943 - 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: 2010-01-31 01:17:30-0800
New Revision: 17943

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

Log:
Refactor panel label code into its own method

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=17943&r1=17942&r2=17943
==============================================================================
--- 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	2010-01-31 01:17:30-0800
@@ -76,19 +76,14 @@
      * @throws Exception If something goes wrong
      * @see org.argouml.core.propertypanels.panel.UIFactory#createGUI(java.lang.Object)
      */
-    public JPanel createGUI (Object target, JPanel panel) throws Exception {
+    public void createGUI (
+            final Object target,
+            final JPanel panel) throws Exception {
         PanelMeta data = 
             XMLPropPanelFactory.getInstance().getPropertyPanelsData(
                     Model.getMetaTypes().getName(target));
         
-        final String metaTypeName = Model.getMetaTypes().getName(target);
-        ToolBarFactory tbf = new ToolBarFactory(new Object[0]);
-        tbf.setRollover(true);
-        JToolBar tb = tbf.createToolBar();
-        tb.add(new JLabel(metaTypeName, ResourceLoaderWrapper.lookupIconResource(metaTypeName), JLabel.LEFT));
-        tb.add(new ActionNewStereotype());
-        
-        panel.add(tb);
+        createLabel(target, panel);
         
         for (PropertyMeta prop : data.getProperties()) {
             if ("text".equals(prop.getControlType())) {
@@ -109,9 +104,25 @@
                 panel.add(LabelledLayout.getSeparator());
             }
         }
-        return panel;
     }
 
+    /**
+     * Create the label with icon and description for the panel.
+     * @param target
+     * @param panel
+     */
+    private void createLabel (Object target, JPanel panel) {
+        final String metaTypeName = Model.getMetaTypes().getName(target);
+        ToolBarFactory tbf = new ToolBarFactory(new Object[0]);
+        tbf.setRollover(true);
+        JToolBar tb = tbf.createToolBar();
+        tb.add(new JLabel(metaTypeName, ResourceLoaderWrapper.lookupIconResource(metaTypeName), JLabel.LEFT));
+        // We only have this here until we have stereotypes
+        // list on property panel
+        tb.add(new ActionNewStereotype());
+        panel.add(tb);
+    }
+    
     private void buildTextArea(
             final JPanel panel,
             final Object target,

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

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.