svn commit: r13784 - trunk/src_new/org/argouml/ui

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-11-17 18:44:34-0800
New Revision: 13784

Modified:
   trunk/src_new/org/argouml/ui/DetailsPane.java
   trunk/src_new/org/argouml/ui/MultiEditorPane.java

Log:
Make dependencies visible instead of hidden in argo.ini

Modified: trunk/src_new/org/argouml/ui/DetailsPane.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/DetailsPane.java?view=diff&rev=13784&p1=trunk/src_new/org/argouml/ui/DetailsPane.java&p2=trunk/src_new/org/argouml/ui/DetailsPane.java&r1=13783&r2=13784
==============================================================================
--- trunk/src_new/org/argouml/ui/DetailsPane.java	(original)
+++ trunk/src_new/org/argouml/ui/DetailsPane.java	2007-11-17 18:44:34-0800
@@ -51,8 +51,14 @@
 import org.argouml.ui.targetmanager.TargetListener;
 import org.argouml.ui.targetmanager.TargetManager;
 import org.argouml.uml.ui.PropPanel;
+import org.argouml.uml.ui.TabConstraints;
+import org.argouml.uml.ui.TabDocumentation;
 import org.argouml.uml.ui.TabModelTarget;
 import org.argouml.uml.ui.TabProps;
+import org.argouml.uml.ui.TabSrc;
+import org.argouml.uml.ui.TabStereotype;
+import org.argouml.uml.ui.TabStyle;
+import org.argouml.uml.ui.TabTaggedValues;
 import org.argouml.util.ConfigLoader;
 import org.tigris.swidgets.Orientable;
 import org.tigris.swidgets.Orientation;
@@ -79,9 +85,50 @@
      */
     private static final Logger LOG = Logger.getLogger(DetailsPane.class);
 
-    ////////////////////////////////////////////////////////////////
-    // instance variables
-
+    /**
+     * Classes for tabs to be included in the property panel.
+     * (previously stored in org/argouml/argo.ini)
+     * TODO: This is just used to track dependencies for now.  When
+     * we want to actually switch over to using this and dropping
+     * argo.ini, we'll want the form below which contains instances
+     * instead of classes.
+     */
+    private static final Class[] tabClasses = new Class[] {
+        org.argouml.cognitive.ui.TabToDo.class, 
+        TabProps.class,
+        TabDocumentation.class, 
+        TabStyle.class,
+        // TabDocs
+        TabSrc.class,
+        // TabJavaSrc | TabSrc
+        TabConstraints.class, 
+        TabStereotype.class, 
+        TabTaggedValues.class,
+        org.argouml.cognitive.checklist.ui.TabChecklist.class,
+        // TabHistory
+        // TabHash
+    };
+
+    /**
+     * Classes for tabs to be included in the property panel.
+     * (previously stored in org/argouml/argo.ini)
+     */
+//    private final JPanel[] tabs = new JPanel[] {
+//        new org.argouml.cognitive.ui.TabToDo(), 
+//        new TabProps(),
+//        new TabDocumentation(), 
+//        new TabStyle(),
+//        // TabDocs
+//        new TabSrc(),
+//        // TabJavaSrc | TabSrc
+//        new TabConstraints(), 
+//        new TabStereotype(), 
+//        new TabTaggedValues(),
+//        new org.argouml.cognitive.checklist.ui.TabChecklist(),
+//        // TabHistory
+//        // TabHash
+//    };
+    
     /**
      * The top level pane, which is a tabbed pane.
      */
@@ -96,6 +143,9 @@
      * The list of all the tabs, which are JPanels, in the JTabbedPane tabs.
      */
     private List<JPanel> tabPanelList = new ArrayList<JPanel>();
+    // TODO: switch to the following when we create tabs ourselves
+//    private List<JPanel> tabPanelList = 
+//        new ArrayList<JPanel>(Arrays.asList(tabs));
 
     /**
      * index of the selected tab in the JTabbedPane.
@@ -124,8 +174,6 @@
     private void removeTargetListener(TargetListener listener) {
         listenerList.remove(TargetListener.class, listener);
     }
-    ////////////////////////////////////////////////////////////////
-    // constructors
 
     /**
      * Gets all of the tabPanels from the ConfigLoader, then
@@ -141,7 +189,10 @@
     public DetailsPane(String compassPoint, Orientation orientation) {
         LOG.info("making DetailsPane(" + compassPoint + ")");
 
+        // TODO: Instantiate our required tabs directly instead of using
+        // reflection in ConfigLoader.
         ConfigLoader.loadTabs(tabPanelList, compassPoint, orientation);
+        
         setLayout(new BorderLayout());
         setFont(new Font("Dialog", Font.PLAIN, 10));
         add(topLevelTabbedPane, BorderLayout.CENTER);
@@ -183,8 +234,6 @@
         topLevelTabbedPane.addChangeListener(this);
     }
 
-    ////////////////////////////////////////////////////////////////
-    // accessors
 
     /**
      * Returns the JTabbedPane that contains all details panels.
@@ -336,12 +385,11 @@
     /*
      * @see java.awt.Component#getMinimumSize()
      */
+    @Override
     public Dimension getMinimumSize() {
         return new Dimension(100, 100);
     }
 
-    ////////////////////////////////////////////////////////////////
-    // actions
 
     /**
      * Get the index of the tab with the given name.

Modified: trunk/src_new/org/argouml/ui/MultiEditorPane.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/MultiEditorPane.java?view=diff&rev=13784&p1=trunk/src_new/org/argouml/ui/MultiEditorPane.java&p2=trunk/src_new/org/argouml/ui/MultiEditorPane.java&r1=13783&r2=13784
==============================================================================
--- trunk/src_new/org/argouml/ui/MultiEditorPane.java	(original)
+++ trunk/src_new/org/argouml/ui/MultiEditorPane.java	2007-11-17 18:44:34-0800
@@ -59,18 +59,45 @@
 
     /** logger */
     private static final Logger LOG = Logger.getLogger(MultiEditorPane.class);
-
-    ////////////////////////////////////////////////////////////////
-    // instance variables
+    
+    /**
+     * Classes for tabs to be included in the property panel.
+     * (previously stored in org/argouml/argo.ini)
+     * TODO: This is just used to track dependencies for now.  When
+     * we want to actually switch over to using this and dropping
+     * argo.ini, we'll want the form below which contains instances
+     * instead of classes.
+     */
+    private static final Class[] tabClasses = new Class[] {
+        org.argouml.uml.diagram.ui.TabDiagram.class,
+        // org.argouml.ui.TabTable
+        // TabMetrics
+        // TabJavaSrc | TabSrc
+        // TabUMLDisplay
+        // TabHash
+    };
+    
+    /**
+     * Classes for tabs to be included in the property panel.
+     * (previously stored in org/argouml/argo.ini)
+     */
+//    private final JPanel[] tabInstances = new JPanel[] {
+//        new org.argouml.uml.diagram.ui.TabDiagram(),
+//        // org.argouml.ui.TabTable
+//        // TabMetrics
+//        // TabJavaSrc | TabSrc
+//        // TabUMLDisplay
+//        // TabHash
+//    };
 
     private JTabbedPane tabs = new JTabbedPane(SwingConstants.BOTTOM);
 
-    private List tabPanels = new ArrayList();
+    private List<JPanel> tabPanels = new ArrayList<JPanel>();
+//    private List<JPanel> tabPanels = 
+//        new ArrayList<JPanel>(Arrays.asList(tabInstances));
+    
     private Component lastTab;
 
-    ////////////////////////////////////////////////////////////////
-    // constructors
-
     /**
      * Constructs the MultiEditorPane. This is the pane in which the tabs with
      * the diagrams are drawn in ArgoUML. The MultiEditorPane is a JTabbedPane
@@ -80,25 +107,28 @@
      */
     public MultiEditorPane() {
         LOG.info("making MultiEditorPane");
+        
+        // TODO: Instantiate our required tabs directly instead of using
+        // reflection in ConfigLoader.
         ConfigLoader.loadTabs(tabPanels, "multi", Horizontal.getInstance());
 
         setLayout(new BorderLayout());
         add(tabs, BorderLayout.CENTER);
 
-        // _tabs.addChangeListener(this);
         for (int i = 0; i < tabPanels.size(); i++) {
             String title = "tab";
-            JPanel t = (JPanel) tabPanels.get(i);
+            JPanel t = tabPanels.get(i);
             if (t instanceof AbstractArgoJPanel) {
                 title = ((AbstractArgoJPanel) t).getTitle();
             }
+            // TODO: I18N
             tabs.addTab("As " + title, t);
             tabs.setEnabledAt(i, false);
             if (t instanceof TargetListener) {
                 TargetManager.getInstance()
 		    .addTargetListener((TargetListener) t);
             }
-        } /* end for */
+        }
 
         tabs.addChangeListener(this);
         tabs.addMouseListener(this);
@@ -108,6 +138,7 @@
     /*
      * @see java.awt.Component#getPreferredSize()
      */
+    @Override
     public Dimension getPreferredSize() {
         return new Dimension(400, 500);
     }
@@ -115,6 +146,7 @@
     /*
      * @see java.awt.Component#getMinimumSize()
      */
+    @Override
     public Dimension getMinimumSize() {
         return new Dimension(100, 100);
     }
@@ -154,9 +186,6 @@
         }
     }
 
-    ////////////////////////////////////////////////////////////////
-    // actions
-
     /**
      * Returns the index of a tab with a certain name in the JTabbedPane which
      * is the component shown by the multieditorpane. At the moment (version
@@ -168,8 +197,9 @@
     public int getIndexOfNamedTab(String tabName) {
         for (int i = 0; i < tabPanels.size(); i++) {
             String title = tabs.getTitleAt(i);
-            if (title != null && title.equals(tabName))
+            if (title != null && title.equals(tabName)) {
                 return i;
+            }
         }
         return -1;
     }
@@ -181,8 +211,9 @@
      */
     public void selectTabNamed(String tabName) {
         int index = getIndexOfNamedTab(tabName);
-        if (index != -1)
+        if (index != -1) {
             tabs.setSelectedIndex(index);
+        }
     }
 
     /**
@@ -217,8 +248,9 @@
         LOG.debug(
             "MultiEditorPane state changed:" + lastTab.getClass().getName());
         lastTab.setVisible(true);
-        if (lastTab instanceof TabModelTarget)
+        if (lastTab instanceof TabModelTarget) {
              ((TabModelTarget) lastTab).refresh();
+        }
     }
 
     /*
@@ -332,4 +364,3 @@
 
 }
 
-/* end class MultiEditorPane */
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.