svn commit: r18145 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels: meta model ui
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2010-03-24 07:11:33-0700
New Revision: 18145
Removed:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionEffectListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionGuardListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerListModel.java
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/RowSelector.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java
Log:
First commit with drop down button for creating guards, triggers and effects
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml?view=diff&pathrev=18145&r1=18144&r2=18145
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml 2010-03-24 07:11:33-0700
@@ -2861,9 +2861,9 @@
<separator />
<singlerow name="source" type="StateVertex" />
<singlerow name="target" type="StateVertex" />
- <singlerow name="guard" type="Guard" />
- <singlerow name="effect" type="Action" />
- <singlerow name="trigger" type="Event" />
+ <singlerow name="guard" type="org.omg.uml.behavioralelements.statemachines.Guard" />
+ <singlerow name="effect" type="org.omg.uml.behavioralelements.commonbehavior.CallAction,org.omg.uml.behavioralelements.commonbehavior.CreateAction,org.omg.uml.behavioralelements.commonbehavior.DestroyAction,org.omg.uml.behavioralelements.commonbehavior.ReturnAction,org.omg.uml.behavioralelements.commonbehavior.SendAction,org.omg.uml.behavioralelements.commonbehavior.TerminateAction,org.omg.uml.behavioralelements.commonbehavior.UninterpretedAction,org.omg.uml.behavioralelements.commonbehavior.ActionSequence" />
+ <singlerow name="trigger" type="org.omg.uml.behavioralelements.statemachines.CallEvent,org.omg.uml.behavioralelements.statemachines.ChangeEvent,org.omg.uml.behavioralelements.statemachines.SignalEvent,org.omg.uml.behavioralelements.statemachines.TimeEvent" />
<debug />
<attribute name="visibility" type="VisibilityKind" />
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml?view=diff&pathrev=18145&r1=18144&r2=18145
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels2.xml 2010-03-24 07:11:33-0700
@@ -2802,10 +2802,7 @@
<separator />
<singlerow name="source" type="StateVertex" />
<singlerow name="target" type="StateVertex" />
- <singlerow name="guard" type="Guard" />
- <singlerow name="effect" type="Action" />
- <singlerow name="trigger" type="Event" />
-
+ <singlerow name="trigger" type="org.eclipse.uml2.uml.CallEvent,org.eclipse.uml2.uml.ChangeEvent,org.eclipse.uml2.uml.SignalEvent,org.eclipse.uml2.uml.TimeEvent" />
<debug />
<attribute name="visibility" type="VisibilityKind" />
<attribute name="modifiers">
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java?view=diff&pathrev=18145&r1=18144&r2=18145
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java 2010-03-24 07:11:33-0700
@@ -13,6 +13,7 @@
package org.argouml.core.propertypanels.model;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -71,6 +72,9 @@
addGetterSetter("message", new MessageGetterSetter());
addGetterSetter("actualArgument", new ArgumentGetterSetter());
addGetterSetter("extensionPoint", new ExtensionPointGetterSetter());
+ addGetterSetter("guard", new GuardGetterSetter());
+ addGetterSetter("effect", new EffectGetterSetter());
+ addGetterSetter("trigger", new TriggerGetterSetter());
}
/**
@@ -840,6 +844,117 @@
}
}
+ private class GuardGetterSetter extends ListGetterSetter {
+
+ /**
+ * Get all the guards
+ * @param modelElement
+ * @param type
+ * @return
+ * @see org.argouml.core.propertypanels.model.GetterSetterManager.OptionGetterSetter#getOptions(java.lang.Object, java.lang.String)
+ */
+ public Collection getOptions(
+ final Object modelElement,
+ final String type) {
+ final ArrayList l = new ArrayList(1);
+ l.add(Model.getFacade().getGuard(modelElement));
+ return l;
+ }
+
+ public Object get(Object modelElement, String type) {
+ // not needed
+ return null;
+ }
+
+ public void set(Object element, Object x) {
+ // not needed
+ }
+
+ protected boolean isValidElement(
+ final Object element,
+ final String type) {
+ return getOptions(element, type).contains(element);
+ }
+
+ public Object getMetaType() {
+ return Model.getMetaTypes().getGuard();
+ }
+ }
+
+ private class EffectGetterSetter extends ListGetterSetter {
+
+ /**
+ * Get all the effects
+ * @param modelElement
+ * @param type
+ * @return
+ * @see org.argouml.core.propertypanels.model.GetterSetterManager.OptionGetterSetter#getOptions(java.lang.Object, java.lang.String)
+ */
+ public Collection getOptions(
+ final Object modelElement,
+ final String type) {
+ final ArrayList l = new ArrayList(1);
+ l.add(Model.getFacade().getEffect(modelElement));
+ return l;
+ }
+
+ public Object get(Object modelElement, String type) {
+ // not needed
+ return null;
+ }
+
+ public void set(Object element, Object x) {
+ // not needed
+ }
+
+ protected boolean isValidElement(
+ final Object element,
+ final String type) {
+ return getOptions(element, type).contains(element);
+ }
+
+ public Object getMetaType() {
+ return Model.getMetaTypes().getAction();
+ }
+ }
+
+ private class TriggerGetterSetter extends ListGetterSetter {
+
+ /**
+ * Get all the effects
+ * @param modelElement
+ * @param type
+ * @return
+ * @see org.argouml.core.propertypanels.model.GetterSetterManager.OptionGetterSetter#getOptions(java.lang.Object, java.lang.String)
+ */
+ public Collection getOptions(
+ final Object modelElement,
+ final String type) {
+ final ArrayList l = new ArrayList(1);
+ l.add(Model.getFacade().getTrigger(modelElement));
+ return l;
+ }
+
+ public Object get(Object modelElement, String type) {
+ // not needed
+ return null;
+ }
+
+ public void set(Object element, Object x) {
+ // not needed
+ }
+
+ protected boolean isValidElement(
+ final Object element,
+ final String type) {
+ return getOptions(element, type).contains(element);
+ }
+
+ public Object getMetaType() {
+ return Model.getMetaTypes().getEvent();
+ }
+ }
+
private class ParameterGetterSetter extends ListGetterSetter {
public Collection getOptions(Object modelElement, String type) {
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=18145&r1=18144&r2=18145
==============================================================================
--- 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 2010-03-24 07:11:33-0700
@@ -83,6 +83,8 @@
import org.tigris.swidgets.FlexiGridLayout;
import org.tigris.toolbar.ToolBar;
import org.tigris.toolbar.ToolBarFactory;
+import org.tigris.toolbar.toolbutton.PopupToolBoxButton;
+import org.tigris.toolbar.toolbutton.ToolButton;
/**
* A control for displaying the contents of a list model elements in a panel
@@ -298,6 +300,32 @@
moveDownAction = null;
moveTopAction = null;
moveBottomAction = null;
+ if (!readonly) {
+ // Create popup toolbutton if we have a single row
+ final ArrayList<Action> actions = new ArrayList<Action>(6);
+
+ for (Object meta : metaTypes) {
+ if (Model.getUmlFactory().isContainmentValid(meta, target)) {
+ final String label =
+ "button.new-" + Model.getMetaTypes().getName(meta).toLowerCase();
+ final Action createAction = new ActionCreateContainedModelElement(
+ meta,
+ target,
+ label);
+ actions.add(createAction);
+ }
+ }
+ if (!actions.isEmpty()) {
+ PopupToolBoxButton tb = new PopupToolBoxButton(actions.get(0), actions.size(), 1, true);
+ for (Action action : actions) {
+ tb.add(action);
+ }
+ JPanel buttonPanel =
+ new JPanel(new FlexiGridLayout(2, 1, FlexiGridLayout.ROWCOLPREFERRED));
+ buttonPanel.add(tb);
+ add(buttonPanel, BorderLayout.WEST);
+ }
+ }
} else {
if (!readonly) {
// TODO: Lets build this into a separate buildToolbar method
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java?view=diff&pathrev=18145&r1=18144&r2=18145
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java 2010-03-24 07:11:33-0700
@@ -104,12 +104,6 @@
model = new UMLTransitionSourceListModel(modelElement, propName);
} else if ("target".equals(propName)) {
model = new UMLTransitionTargetListModel(modelElement, propName);
- } else if ("guard".equals(propName)) {
- model = new UMLTransitionGuardListModel(modelElement, propName);
- } else if ("effect".equals(propName)) {
- model = new UMLTransitionEffectListModel(modelElement, propName);
- } else if ("trigger".equals(propName)) {
- model = new UMLTransitionTriggerListModel(modelElement, propName);
} else if ("transition".equals(propName)) {
model = new UMLGuardTransitionListModel(modelElement, propName);
} else if ("container".equals(propName)) {
Removed: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionEffectListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionEffectListModel.java?view=markup&pathrev=18144
Removed: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionGuardListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionGuardListModel.java?view=markup&pathrev=18144
Removed: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTransitionTriggerListModel.java?view=markup&pathrev=18144
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2464372
To unsubscribe from this discussion, e-mail: [[email protected]].