Author: penyaskito
Date: 2008-06-28 04:38:14-0700
New Revision: 15095
Modified:
branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
Log:
When we parse the tree, we take care of it the node can have children. The Factory now creates the checkboxes necessary for classes and interfaces.
Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java?view=diff&rev=15095&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java&r1=15094&r2=15095
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java (original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/panel/UIFactory.java 2008-06-28 04:38:14-0700
@@ -154,34 +154,40 @@
if ("modifiers".equals(prop.getName())) {
// TODO: The checkboxes must be explicitly said at the
// XML. Interface and UmlClass differ on "derived"
- UMLCheckBox2 abstractCbx =
- new UMLGeneralizableElementAbstractCheckBox();
- abstractCbx.setTarget(target);
- panel.add(abstractCbx);
- UMLCheckBox2 leafCbx =
- new UMLGeneralizableElementLeafCheckBox();
- leafCbx.setTarget(target);
- panel.add(leafCbx);
- UMLCheckBox2 rootCbx =
- new UMLGeneralizableElementRootCheckBox();
- rootCbx.setTarget(target);
- panel.add(rootCbx);
- UMLCheckBox2 derivedCbx =
- new UMLDerivedCheckBox();
- derivedCbx.setTarget(target);
- panel.add(derivedCbx);
-
- // TODO: this must be created only if the target is
- // a class, so I disable it until we are able of
- // nesting checkboxes to a checkgroup
-// UMLCheckBox2 activeCbx =
-// new UMLClassActiveCheckBox();
-// activeCbx.setTarget(target);
-// panel.add(activeCbx);
+ // we must build the checkboxes
+ for (XMLPropertyPanelsDataRecord p : prop.getChildren()) {
+ UMLCheckBox2 checkbox = buildCheckBox(target, p);
+ panel.add(checkbox);
+ }
}
return panel;
}
+ protected UMLCheckBox2 buildCheckBox(Object target,
+ XMLPropertyPanelsDataRecord p) {
+ UMLCheckBox2 checkbox = null;
+
+ if ("abstract".equals(p.getName())) {
+ checkbox = new UMLGeneralizableElementAbstractCheckBox();
+ }
+ else if ("leaf".equals(p.getName())) {
+ checkbox = new UMLGeneralizableElementLeafCheckBox();
+ }
+ else if ("root".equals(p.getName())) {
+ checkbox = new UMLGeneralizableElementRootCheckBox();
+ }
+ else if ("derived".equals(p.getName())) {
+ checkbox = new UMLDerivedCheckBox();
+ }
+ else if ("active".equals(p.getName())) {
+ checkbox = new UMLClassActiveCheckBox();
+ }
+ if (checkbox != null) {
+ checkbox.setTarget(target);
+ }
+ return checkbox;
+ }
+
/**
* @param target
* @param prop
Modified: branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java?view=diff&rev=15095&p1=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java&p2=branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java&r1=15094&r2=15095
==============================================================================
--- branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java (original)
+++ branches/xmlpropertypanels-penyaskito-soc08/argouml-core-propertypanels-scratch/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java 2008-06-28 04:38:14-0700
@@ -38,7 +38,8 @@
/**
* The panel that will host the controls.
*/
- private final XMLPropertyPanelsData data;
+ private final XMLPropertyPanelsData data;
+ private XMLPropertyPanelsDataRecord current = null;
/**
* Default constructor.
@@ -65,8 +66,36 @@
// }
XMLPropertyPanelsDataRecord record =
new XMLPropertyPanelsDataRecord(localName, attr.getValue("name"));
- data.addProperty(record);
+ if (isChild(localName)) {
+ current.addChild(record);
+ }
+ else if (hasChilds(localName)) {
+ current = record;
+ data.addProperty(record);
+ }
+ else {
+ data.addProperty(record);
+ }
+
+ }
+
+ private boolean isChild(String elementName) {
+ if ("checkbox".equals(elementName)) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ private boolean hasChilds(String elementName) {
+ if ("checkgroup".equals(elementName)) {
+ return true;
+ }
+ else {
+ return false;
+ }
}
}
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.