Author: tfmorris
Date: 2007-11-22 21:43:00-0800
New Revision: 13811
Modified:
trunk/src_new/org/argouml/ui/DetailsPane.java
trunk/src_new/org/argouml/ui/MultiEditorPane.java
trunk/src_new/org/argouml/util/ConfigLoader.java
Log:
Build details panels directly instead of using ConfigLoader and 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=13811&p1=trunk/src_new/org/argouml/ui/DetailsPane.java&p2=trunk/src_new/org/argouml/ui/DetailsPane.java&r1=13810&r2=13811
==============================================================================
--- trunk/src_new/org/argouml/ui/DetailsPane.java (original)
+++ trunk/src_new/org/argouml/ui/DetailsPane.java 2007-11-22 21:43:00-0800
@@ -32,6 +32,7 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -47,6 +48,7 @@
import org.argouml.model.Model;
import org.argouml.swingext.LeftArrowIcon;
import org.argouml.swingext.UpArrowIcon;
+import org.argouml.ui.ProjectBrowser.Position;
import org.argouml.ui.targetmanager.TargetEvent;
import org.argouml.ui.targetmanager.TargetListener;
import org.argouml.ui.targetmanager.TargetManager;
@@ -59,7 +61,6 @@
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;
@@ -86,50 +87,6 @@
private static final Logger LOG = Logger.getLogger(DetailsPane.class);
/**
- * 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.
*/
private JTabbedPane topLevelTabbedPane = new JTabbedPane();
@@ -139,13 +96,11 @@
*/
private Object currentTarget;
+
/**
* 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.
@@ -186,16 +141,14 @@
* Registers listeners.<p>
*
* @param compassPoint the position for which to build the pane
- * @param orientation is the orientation.
+ * @param theOrientation is the orientation.
*/
public DetailsPane(String compassPoint, Orientation theOrientation) {
LOG.info("making DetailsPane(" + compassPoint + ")");
orientation = theOrientation;
- // TODO: Instantiate our required tabs directly instead of using
- // reflection in ConfigLoader.
- ConfigLoader.loadTabs(tabPanelList, compassPoint, orientation);
+ loadTabs(compassPoint, theOrientation);
setOrientation(orientation);
@@ -240,7 +193,27 @@
topLevelTabbedPane.addChangeListener(this);
}
-
+ // TODO: Some parts of ArgoUML have preliminary support for multiple
+ // details panels, but we currently only support the default South (bottom) panel
+ private void loadTabs(String direction, Orientation orientation) {
+ if (Position.South.toString().equalsIgnoreCase(direction)) {
+ tabPanelList.addAll(Arrays.asList(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,
+ }));
+ }
+ }
+
/**
* Returns the JTabbedPane that contains all details panels.
*
@@ -497,13 +470,13 @@
// update the previously selected tab
if (lastNonNullTab >= 0) {
- Object tab = tabPanelList.get(lastNonNullTab);
+ JPanel tab = tabPanelList.get(lastNonNullTab);
if (tab instanceof TargetListener) {
// not visible any more - so remove as listener
removeTargetListener((TargetListener) tab);
}
}
- Object target = TargetManager.getInstance().getTarget();
+ Object target = TargetManager.getInstance().getSingleTarget();
if (sel instanceof TabToDoTarget) {
((TabToDoTarget) sel).setTarget(target);
@@ -513,6 +486,11 @@
if (sel instanceof TargetListener) {
removeTargetListener((TargetListener) sel);
addTargetListener((TargetListener) sel);
+ // Newly selected tab may have stale target info, so generate
+ // a new set target event for it to refresh it
+ ((TargetListener) sel).targetSet(new TargetEvent(this,
+ TargetEvent.TARGET_SET, new Object[] {},
+ new Object[] {target}));
}
if (target != null
@@ -656,7 +634,9 @@
*/
private void enableTabs(Object target) {
- // iterate through the tabbed panels to determine wether they
+ // TODO: Quick return here for target == null? - tfm
+
+ // iterate through the tabbed panels to determine whether they
// should be enabled.
for (int i = 0; i < tabPanelList.size(); i++) {
JPanel tab = tabPanelList.get(i);
@@ -669,6 +649,8 @@
shouldEnable = true;
}
}
+ // TODO: Do we want all enabled tabs to listen or only the one
+ // that is selected/visible? - tfm
removeTargetListener((TargetListener) tab);
if (shouldEnable) {
addTargetListener((TargetListener) tab);
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=13811&p1=trunk/src_new/org/argouml/ui/MultiEditorPane.java&p2=trunk/src_new/org/argouml/ui/MultiEditorPane.java&r1=13810&r2=13811
==============================================================================
--- trunk/src_new/org/argouml/ui/MultiEditorPane.java (original)
+++ trunk/src_new/org/argouml/ui/MultiEditorPane.java 2007-11-22 21:43:00-0800
@@ -31,6 +31,7 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import javax.swing.JPanel;
@@ -44,8 +45,6 @@
import org.argouml.ui.targetmanager.TargetListener;
import org.argouml.ui.targetmanager.TargetManager;
import org.argouml.uml.ui.TabModelTarget;
-import org.argouml.util.ConfigLoader;
-import org.tigris.swidgets.Horizontal;
/**
* The upper right pane in the ArgoUML user interface. It may have several
@@ -59,42 +58,24 @@
/** logger */
private static final Logger LOG = Logger.getLogger(MultiEditorPane.class);
-
+
/**
* 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,
+ private final JPanel[] tabInstances = new JPanel[] {
+ new org.argouml.uml.diagram.ui.TabDiagram(),
// 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<JPanel> tabPanels = new ArrayList<JPanel>();
-// private List<JPanel> tabPanels =
-// new ArrayList<JPanel>(Arrays.asList(tabInstances));
+ private List<JPanel> tabPanels =
+ new ArrayList<JPanel>(Arrays.asList(tabInstances));
private Component lastTab;
@@ -107,10 +88,6 @@
*/
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);
@@ -249,7 +226,7 @@
"MultiEditorPane state changed:" + lastTab.getClass().getName());
lastTab.setVisible(true);
if (lastTab instanceof TabModelTarget) {
- ((TabModelTarget) lastTab).refresh();
+ ((TabModelTarget) lastTab).refresh();
}
}
Modified: trunk/src_new/org/argouml/util/ConfigLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/util/ConfigLoader.java?view=diff&rev=13811&p1=trunk/src_new/org/argouml/util/ConfigLoader.java&p2=trunk/src_new/org/argouml/util/ConfigLoader.java&r1=13810&r2=13811
==============================================================================
--- trunk/src_new/org/argouml/util/ConfigLoader.java (original)
+++ trunk/src_new/org/argouml/util/ConfigLoader.java 2007-11-22 21:43:00-0800
@@ -41,10 +41,12 @@
import org.argouml.application.api.Argo;
import org.argouml.configuration.Configuration;
import org.argouml.configuration.ConfigurationKey;
+import org.tigris.swidgets.Horizontal;
import org.tigris.swidgets.Orientation;
/**
- * This class loads property panel tab classes specified by a configuration file.
+ * This class loads property panel tab classes specified by a configuration
+ * file.
*/
public class ConfigLoader {
@@ -53,7 +55,7 @@
private static final String CONFIG_FILE_PROPERTY = "argo.config";
private static final String DEFAULT_CONFIG_FILE = "/org/argouml/argo.ini";
private static String tabPath = "org.argouml";
- private static Orientation tabPropsOrientation;
+ private static Orientation tabPropsOrientation = Horizontal.getInstance();
/**
* @return the orientation
@@ -143,7 +145,7 @@
is = ConfigLoader.class.getResourceAsStream(configFile);
}
if (is == null) {
- LOG.error("Unable to instantiate a config file reader");
+ LOG.error("Unable to instantiate a config file reader");
return null;
}
try {
@@ -277,11 +279,11 @@
private static void updateOrientation(List<JPanel> tabs,
Orientation orientation) {
- for (JPanel tab : tabs) {
- if (tab instanceof org.argouml.uml.ui.TabProps) {
- tabPropsOrientation = orientation;
- }
- }
+// for (JPanel tab : tabs) {
+// if (tab instanceof org.argouml.uml.ui.TabProps) {
+// tabPropsOrientation = orientation;
+// }
+// }
}
}
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.