svn commit: r17964 - 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-02-04 11:45:03-0800
New Revision: 17964
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/meta/panels.xml
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManager.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManagerImpl.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SingleListFactory.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
Log:
Issue 5963: Determine correct newModelElement icon and action for attribute and operation panels
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=17964&r1=17963&r2=17964
==============================================================================
--- 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-02-04 11:45:03-0800
@@ -207,8 +207,8 @@
<!--
<list name="feature" type="Feature" />
-->
- <list name="feature" type="Attribute" label="label.attributes" />
- <list name="feature" type="Operation" label="label.operations" />
+ <list name="feature" type="org.omg.uml.foundation.core.Attribute" label="label.attributes" />
+ <list name="feature" type="org.omg.uml.foundation.core.Operation" label="label.operations" />
<list name="association" type="Classifier" />
<list name="ownedElement" type="ModelElement" label="label.owned-elements"/>
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManager.java?view=diff&pathrev=17964&r1=17963&r2=17964
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManager.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/model/GetterSetterManager.java 2010-02-04 11:45:03-0800
@@ -54,8 +54,8 @@
return getterSetterByPropertyName.containsKey(propertyName);
}
- public static GetterSetterManager getGetterSetter() {
- return new GetterSetterManagerImpl();
+ public static GetterSetterManager getGetterSetter(String type) {
+ return new GetterSetterManagerImpl(type);
}
protected abstract class BaseGetterSetter {
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=17964&r1=17963&r2=17964
==============================================================================
--- 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-02-04 11:45:03-0800
@@ -28,14 +28,14 @@
/**
* The constructor
*/
- public GetterSetterManagerImpl() {
- build();
+ public GetterSetterManagerImpl(String type) {
+ build(type);
}
/**
* Create all the getter/setters for this implementation
*/
- private void build() {
+ private void build(String type) {
addGetterSetter("isAbstract", new AbstractGetterSetter());
addGetterSetter("isLeaf", new LeafGetterSetter());
addGetterSetter("isRoot", new RootGetterSetter());
@@ -54,7 +54,7 @@
addGetterSetter("kind", new ParameterDirectionGetterSetter());
addGetterSetter("changeability", new ChangeabilityGetterSetter());
addGetterSetter("concurrency", new ConcurrencyGetterSetter());
- addGetterSetter("feature", new FeatureGetterSetter());
+ addGetterSetter("feature", new FeatureGetterSetter(type));
addGetterSetter("receiver", new ReceiverGetterSetter());
addGetterSetter("sender", new SenderGetterSetter());
addGetterSetter("body", new MethodExpressionGetterSetter());
@@ -557,10 +557,19 @@
private class FeatureGetterSetter extends ListGetterSetter {
+ private Class metaType;
+
+ public FeatureGetterSetter(String type) {
+ try {
+ metaType = Class.forName(type);
+ } catch (ClassNotFoundException e) {
+ // ignore
+ }
+ }
public Collection getOptions(Object modelElement, String type) {
- if ("Attribute".equals(type)) {
+ if (Model.getMetaTypes().getAttribute().equals(metaType)) {
return Model.getFacade().getAttributes(modelElement);
- } else if ("Operation".equals(type)) {
+ } else if (Model.getMetaTypes().getOperation().equals(metaType)) {
return Model.getFacade().getOperations(modelElement);
} else {
return Collections.EMPTY_LIST;
@@ -577,20 +586,11 @@
}
protected boolean isValidElement(Object element, String type) {
-
- if ("Attribute".equals(type)
- && !Model.getFacade().isAAttribute(element)) {
- return false;
- } else if ("Operation".equals(type)
- && !Model.getFacade().isAOperation(element)) {
- return false;
- }
-
return getOptions(element, type).contains(element);
}
public Object getMetaType() {
- return Model.getMetaTypes().getAttribute();
+ return metaType;
}
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java?view=diff&pathrev=17964&r1=17963&r2=17964
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java 2010-02-04 11:45:03-0800
@@ -210,7 +210,7 @@
if (model == null) {
final GetterSetterManager getterSetterManager =
- GetterSetterManager.getGetterSetter();
+ GetterSetterManager.getGetterSetter(type);
if (getterSetterManager.contains(propName)) {
model = new SimpleListModel(propName, type, modelElement, getterSetterManager);
}
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=17964&r1=17963&r2=17964
==============================================================================
--- 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-02-04 11:45:03-0800
@@ -124,7 +124,7 @@
if (model == null) {
final GetterSetterManager getterSetterManager =
- GetterSetterManager.getGetterSetter();
+ GetterSetterManager.getGetterSetter(type);
if (getterSetterManager.contains(propName)) {
model = new SimpleListModel(propName, type, modelElement, getterSetterManager);
}
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=17964&r1=17963&r2=17964
==============================================================================
--- 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-02-04 11:45:03-0800
@@ -201,7 +201,7 @@
addControl(panel, Translator.localize(prop.getLabel()), control);
}
} else {
- final GetterSetterManager getterSetter = GetterSetterManager.getGetterSetter();
+ final GetterSetterManager getterSetter = GetterSetterManager.getGetterSetter(prop.getType());
if (getterSetter.contains(propertyName)) {
ExpressionModel model = new ExpressionModel(propertyName, prop.getType(), target, getterSetter);
@@ -253,7 +253,7 @@
final String propertyName = prop.getName();
- final GetterSetterManager getterSetter = GetterSetterManager.getGetterSetter();
+ final GetterSetterManager getterSetter = GetterSetterManager.getGetterSetter(prop.getType());
if (getterSetter.contains(propertyName)) {
JPanel control = new RadioButtonPanel(
@@ -292,7 +292,8 @@
final String propertyName = prop.getName();
- final GetterSetterManager getterSetter = GetterSetterManager.getGetterSetter();
+ final GetterSetterManager getterSetter =
+ GetterSetterManager.getGetterSetter(prop.getType());
final String label = Translator.localize(prop.getLabel());
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2444969
To unsubscribe from this discussion, e-mail: [[email protected]].