Author: bobtarling
Date: 2011-02-21 18:31:18-0800
New Revision: 19049
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Log:
Issue 6197: Expand tree structured commands into a flat structure before displaying - also displays exception to user if a panel fails to build.
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java?view=diff&pathrev=19049&r1=19048&r2=19049
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java 2011-02-21 18:31:18-0800
@@ -516,10 +516,23 @@
public JComponent getExpansion() {
+ List<Action> flatActions = new ArrayList<Action>();
+ for (Object o : actions) {
+ if (o instanceof Action) {
+ flatActions.add((Action) o);
+ } else {
+ Object[] oa = (Object[]) o;
+ for (int j = 0; j < oa.length; ++j) {
+ flatActions.add((Action) oa[j]);
+ }
+ }
+ }
+
+
final ToolBox tb =
- new ToolBox(2, actions.size() / 2 + actions.size() % 2, true);
- for (int i = 0; i < actions.size() / 2 + actions.size() % 2; ++i) {
- tb.add((Action) actions.get(i));
+ new ToolBox(2, flatActions.size() / 2 + flatActions.size() % 2, true);
+ for (int i = 0; i < flatActions.size() / 2 + flatActions.size() % 2; ++i) {
+ tb.add((Action) flatActions.get(i));
}
if (moveUpAction != null) {
tb.add(moveUpAction);
@@ -527,11 +540,11 @@
if (moveTopAction != null) {
tb.add(moveTopAction);
}
- if (actions.size() % 2 == 1) {
+ if (flatActions.size() % 2 == 1) {
tb.add(new JPanel());
}
- for (int i = actions.size() / 2 + actions.size() % 2; i < actions.size(); ++i) {
- tb.add((Action) actions.get(i));
+ for (int i = flatActions.size() / 2 + flatActions.size() % 2; i < flatActions.size(); ++i) {
+ tb.add((Action) flatActions.get(i));
}
if (moveDownAction != null) {
tb.add(moveDownAction);
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=19049&r1=19048&r2=19049
==============================================================================
--- 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 2011-02-21 18:31:18-0800
@@ -116,10 +116,15 @@
panel.add(LabelledLayout.getSeparator());
}
} catch (Exception e) {
- throw new IllegalStateException(
- "Exception caught building control " + prop.getControlType()
- + " for property " + prop.getPropertyName() + " on panel for "
- + target, e);
+ String message = "Exception caught building control " + prop.getControlType()
+ + " for property " + prop.getPropertyName() + " on panel for "
+ + target;
+ LOG.error(message, e);
+ try {
+ panel.add(new JLabel(message));
+ } catch (Exception ex) {
+ throw e;
+ }
}
}
}
@@ -274,7 +279,7 @@
} else {
final GetterSetterManager getterSetter =
GetterSetterManager.getGetterSetter(prop.getType());
-
+
if (getterSetter.contains(propertyName)) {
ExpressionModel model =
new ExpressionModel(propertyName, prop.getTypes().get(0), target, getterSetter);
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2706373
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.