svn commit: r17459 - trunk/src/argouml-app/src/org/argouml/uml: diagram/ui reveng
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-11-08 06:23:50-0800
New Revision: 17459
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAttributesCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEnumLiteralsCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigExtensionPointsCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigOperationsCompartment.java
trunk/src/argouml-app/src/org/argouml/uml/reveng/DiagramInterface.java
Log:
Provide a method to determine the model element type a compartment holds
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAttributesCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAttributesCompartment.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAttributesCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigAttributesCompartment.java 2009-11-08 06:23:50-0800
@@ -94,4 +94,14 @@
public String getName() {
return "attributes";
}
+
+
+ /**
+ * Returns the meta type for Attribute to indicate the type of model
+ * element within this compartment.
+ * @return a model element type
+ */
+ public Object getCompartmentType() {
+ return Model.getMetaTypes().getAttribute();
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartment.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartment.java 2009-11-08 06:23:50-0800
@@ -188,4 +188,10 @@
*/
public abstract String getName();
+ /**
+ * Implemented in the subclass to indicate the primary type of model element
+ * the compartment is designed to hold.
+ * @return a model element type
+ */
+ public abstract Object getCompartmentType();
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java 2009-11-08 06:23:50-0800
@@ -153,6 +153,23 @@
super(owner, bounds, settings);
initialize();
}
+
+ /**
+ * Get the compartment that lists model elements of the given type.
+ * This can also be used to test of a Fig contains a particular type
+ * of compartment by checking for a null return.
+ * @param metaType the model element type for which the compartment is
+ * required.
+ * @return a compartment fig or null if the compartment is not contained.
+ */
+ public FigCompartment getCompartment(Object metaType) {
+ for (FigCompartment f : compartments) {
+ if (f.getCompartmentType() == metaType) {
+ return f;
+ }
+ }
+ return null;
+ }
@Override
public void addFig(Fig fig) {
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEnumLiteralsCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEnumLiteralsCompartment.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEnumLiteralsCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEnumLiteralsCompartment.java 2009-11-08 06:23:50-0800
@@ -101,4 +101,13 @@
/* TODO: The UML does not seem to define this name. Or is it? */
return "enumeration literals";
}
+
+ /**
+ * Returns the meta type for Enumeration-Literal to indicate the type of
+ * model element within this compartment.
+ * @return a model element type
+ */
+ public Object getCompartmentType() {
+ return Model.getMetaTypes().getEnumerationLiteral();
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigExtensionPointsCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigExtensionPointsCompartment.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigExtensionPointsCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigExtensionPointsCompartment.java 2009-11-08 06:23:50-0800
@@ -81,5 +81,13 @@
public String getName() {
return "extension points";
}
-
+
+ /**
+ * Returns the meta type for ExtensionPoint to indicate the type of model
+ * element within this compartment.
+ * @return a model element type
+ */
+ public Object getCompartmentType() {
+ return Model.getMetaTypes().getExtensionPoint();
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigOperationsCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigOperationsCompartment.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigOperationsCompartment.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigOperationsCompartment.java 2009-11-08 06:23:50-0800
@@ -102,5 +102,13 @@
public String getName() {
return "operations";
}
-
+
+ /**
+ * Returns the meta type for Operation to indicate the type of model
+ * element within this compartment.
+ * @return a model element type
+ */
+ public Object getCompartmentType() {
+ return Model.getMetaTypes().getOperation();
+ }
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/reveng/DiagramInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/reveng/DiagramInterface.java?view=diff&pathrev=17459&r1=17458&r2=17459
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/reveng/DiagramInterface.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/reveng/DiagramInterface.java 2009-11-08 06:23:50-0800
@@ -303,7 +303,10 @@
currentLayer.putInPosition(newFig);
newFig.setOperationsVisible(!minimise);
- if (Model.getFacade().isAClass(classifier)) {
+ if (Model.getFacade().isAClass(classifier)) {
+ // TODO We should be able to replace method calls on
+ // AttributesCompartmentContainer with the likes of
+ // newFig.getCompartment(Model.getMetaTypes().getAttribute()).setVisible(!minimise);
((AttributesCompartmentContainer) newFig).setAttributesVisible(
!minimise);
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2415570
To unsubscribe from this discussion, e-mail: [[email protected]].