Author: bobtarling
Date: 2009-12-11 05:20:52-0800
New Revision: 17636
Added:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/CheckBoxMeta.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PanelMeta.java
- copied, changed from r17625,
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PropertyMeta.java
- copied, changed from r17635,
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java
Removed:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XMLPropPanelFactory.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XmlSinglePanelHandler.java
Log:
Further refactoring so that class names make sense
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=17636&r1=17635&r2=17636
==============================================================================
---
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
2009-12-11 05:20:52-0800
@@ -32,8 +32,9 @@
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
-import org.argouml.core.propertypanels.xml.XMLPropertyPanelsData;
-import org.argouml.core.propertypanels.xml.XMLPropertyPanelsDataRecord;
+import org.argouml.core.propertypanels.xml.CheckBoxMeta;
+import org.argouml.core.propertypanels.xml.PanelMeta;
+import org.argouml.core.propertypanels.xml.PropertyMeta;
import org.argouml.i18n.Translator;
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLCheckBox2;
@@ -105,11 +106,11 @@
* @see
org.argouml.core.propertypanels.panel.UIFactory#createGUI(java.lang.Object)
*/
public JPanel createGUI (Object target, JPanel panel) throws Exception {
- XMLPropertyPanelsData data =
+ PanelMeta data =
XMLPropPanelFactory.getInstance().getPropertyPanelsData(
Model.getMetaTypes().getName(target));
- for (XMLPropertyPanelsDataRecord prop : data.getProperties()) {
+ for (PropertyMeta prop : data.getProperties()) {
if ("text".equals(prop.getType())) {
buildTextboxPanel(panel, target, prop);
} else if ("combo".equals(prop.getType())) {
@@ -134,7 +135,7 @@
private void buildTextArea(
final JPanel panel,
final Object target,
- final XMLPropertyPanelsDataRecord prop) {
+ final PropertyMeta prop) {
// TODO: Why do we need this as well as control? Why is it
// instantiated when its not always needed.
@@ -213,7 +214,7 @@
}
private void buildSingleRow(JPanel panel, Object target,
- XMLPropertyPanelsDataRecord prop) {
+ PropertyMeta prop) {
final SingleListFactory factory = new SingleListFactory();
final JComponent pane =
@@ -226,7 +227,7 @@
private void buildList(
final JPanel panel, Object target,
- final XMLPropertyPanelsDataRecord prop) {
+ final PropertyMeta prop) {
final ListFactory factory = new ListFactory();
final JComponent list =
@@ -244,7 +245,7 @@
* @return a radio button panel with the options
*/
private void buildOptionBox(JPanel panel, Object target,
- XMLPropertyPanelsDataRecord prop) {
+ PropertyMeta prop) {
UMLRadioButtonPanel control = null;
@@ -303,21 +304,23 @@
* @return a panel that contains the checkboxes
*/
private void buildCheckGroup(JPanel panel, Object target,
- XMLPropertyPanelsDataRecord prop) {
+ PropertyMeta prop) {
JPanel p = new JPanel(new GridLayout2());
TitledBorder border = new TitledBorder(prop.getName());
p.setBorder(border);
if ("modifiers".equals(prop.getName())) {
- for (XMLPropertyPanelsDataRecord data : prop.getCheckboxes()) {
+ for (CheckBoxMeta data : prop.getCheckboxes()) {
buildCheckBox(p, target, data);
}
}
addControl(panel, null, p);
}
- private void buildCheckBox(JPanel panel, Object target,
- XMLPropertyPanelsDataRecord p) {
+ private void buildCheckBox(
+ final JPanel panel,
+ final Object target,
+ final CheckBoxMeta p) {
UMLCheckBox2 checkbox = null;
if ("isAbstract".equals(p.getName())) {
@@ -362,7 +365,7 @@
private void buildComboPanel(
final JPanel panel,
final Object target,
- final XMLPropertyPanelsDataRecord prop) {
+ final PropertyMeta prop) {
JComponent comp = null;
if ("namespace".equals(prop.getName())) {
final UMLComboBoxModel2 model =
@@ -532,7 +535,7 @@
* of the options.
*/
private void buildTextboxPanel(JPanel panel, Object target,
- XMLPropertyPanelsDataRecord prop) {
+ PropertyMeta prop) {
JTextField tfield = null;
UMLPlainTextDocument document = null;
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XMLPropPanelFactory.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XMLPropPanelFactory.java?view=diff&pathrev=17636&r1=17635&r2=17636
==============================================================================
---
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XMLPropPanelFactory.java
(original)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/XMLPropPanelFactory.java
2009-12-11 05:20:52-0800
@@ -31,7 +31,7 @@
import javax.swing.JPanel;
import org.apache.log4j.Logger;
-import org.argouml.core.propertypanels.xml.XMLPropertyPanelsData;
+import org.argouml.core.propertypanels.xml.PanelMeta;
import org.argouml.core.propertypanels.xml.XmlSinglePanelHandler;
import org.argouml.i18n.Translator;
import org.argouml.model.Model;
@@ -49,7 +49,7 @@
private static final Logger LOG =
Logger.getLogger(XMLPropPanelFactory.class);
- private final Dictionary<String, XMLPropertyPanelsData> cache;
+ private final Dictionary<String, PanelMeta> cache;
private static XMLPropPanelFactory instance;
@@ -62,7 +62,7 @@
}
private XMLPropPanelFactory() throws Exception {
- cache = new Hashtable<String, XMLPropertyPanelsData>();
+ cache = new Hashtable<String, PanelMeta>();
parseXML();
}
@@ -115,7 +115,7 @@
}
}
- public XMLPropertyPanelsData getPropertyPanelsData (String forType) {
+ public PanelMeta getPropertyPanelsData (String forType) {
return cache.get(forType);
}
Added:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/CheckBoxMeta.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/CheckBoxMeta.java?view=markup&pathrev=17636
==============================================================================
--- (empty file)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/CheckBoxMeta.java
2009-12-11 05:20:52-0800
@@ -0,0 +1,49 @@
+// $Id: XMLPropertyPanelsDataRecord.java 17635 2009-12-11 12:22:07Z bobtarling
$
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.xml;
+
+/**
+ * The CheckBox data structure
+ *
+ * @author Bob Tarling
+ */
+public class CheckBoxMeta {
+
+ private String type;
+ private String name;
+
+ public CheckBoxMeta (String theType, String theName) {
+ this.type = theType;
+ this.name = theName;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
Copied:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PanelMeta.java
(from r17625,
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java)
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PanelMeta.java?view=diff&pathrev=17636&r1=17625&r2=17636
==============================================================================
---
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java
(original)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PanelMeta.java
2009-12-11 05:20:52-0800
@@ -38,46 +38,43 @@
*
* @author penyaskito
*/
-public class XMLPropertyPanelsData {
+public class PanelMeta {
/**
* Logger.
*/
private static final Logger LOG =
- Logger.getLogger(XMLPropertyPanelsData.class);
+ Logger.getLogger(PanelMeta.class);
/**
+ * The panel name
+ */
+ private final String name;
+
+ /**
* The info of the properties in the XML.
*/
- private List<XMLPropertyPanelsDataRecord> properties;
+ private final List<PropertyMeta> properties = new
LinkedList<PropertyMeta>();
/**
- * The info of the panels in the XML.
+ * The info of the panel in the XML.
*/
- private XMLPropertyPanelsDataRecord panel;
+ private PropertyMeta panel;
- public XMLPropertyPanelsData() {
- properties = new LinkedList<XMLPropertyPanelsDataRecord>();
+ public PanelMeta(String name) {
+ this.name = name;
}
- public void addProperty(XMLPropertyPanelsDataRecord record) {
+ public void addProperty(PropertyMeta record) {
properties.add(record);
}
- public void addPanel(XMLPropertyPanelsDataRecord record) {
- if (panel != null) {
- LOG.error("You tried to add a panel "
- + "when a previous one exist.");
- }
- panel = record;
- }
-
- public String getTitle() {
- return panel.getName();
+ public String getName() {
+ return name;
}
- public List<XMLPropertyPanelsDataRecord> getProperties () {
+ public List<PropertyMeta> getProperties () {
return Collections.unmodifiableList(properties);
}
}
Copied:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PropertyMeta.java
(from r17635,
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java)
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PropertyMeta.java?view=diff&pathrev=17636&r1=17635&r2=17636
==============================================================================
---
/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java
(original)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/PropertyMeta.java
2009-12-11 05:20:52-0800
@@ -33,19 +33,18 @@
*
* @author penyaskito
*/
-public class XMLPropertyPanelsDataRecord {
+public class PropertyMeta {
private String type;
private String name;
- private List<XMLPropertyPanelsDataRecord> children;
+ private List<CheckBoxMeta> checkboxes = new LinkedList<CheckBoxMeta>();
// TODO: this is a tree node, we must refine the tree structure
- public XMLPropertyPanelsDataRecord (String theType, String theName) {
+ public PropertyMeta (String theType, String theName) {
this.type = theType;
this.name = theName;
- children = new LinkedList<XMLPropertyPanelsDataRecord>();
}
public String getType() {
@@ -56,11 +55,11 @@
return name;
}
- public List<XMLPropertyPanelsDataRecord> getCheckboxes() {
- return Collections.unmodifiableList(children);
+ public List<CheckBoxMeta> getCheckboxes() {
+ return Collections.unmodifiableList(checkboxes);
}
- public void addCheckbox(XMLPropertyPanelsDataRecord child) {
- children.add(child);
+ public void addCheckbox(CheckBoxMeta child) {
+ checkboxes.add(child);
}
}
Removed:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsData.java?view=markup&pathrev=17635
Removed:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsDataRecord.java?view=markup&pathrev=17635
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java?view=diff&pathrev=17636&r1=17635&r2=17636
==============================================================================
---
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
(original)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XMLPropertyPanelsHandler.java
2009-12-11 05:20:52-0800
@@ -38,33 +38,34 @@
/**
* The panel that will host the controls.
*/
- private final XMLPropertyPanelsData data;
- private XMLPropertyPanelsDataRecord current = null;
+ private final PanelMeta data;
+ private PropertyMeta current = null;
/**
* Default constructor.
* @param theData The XMLPropertyPanelsData that will
* host the info read.
*/
- public XMLPropertyPanelsHandler(XMLPropertyPanelsData theData) {
+ public XMLPropertyPanelsHandler(PanelMeta theData) {
this.data = theData;
}
public void startElement(String namespaceURI, String localName,
String qName, Attributes attr) throws SAXException {
- XMLPropertyPanelsDataRecord record =
- new XMLPropertyPanelsDataRecord(localName, attr.getValue("name"));
if (isChild(localName)) {
+ CheckBoxMeta record =
+ new CheckBoxMeta(localName, attr.getValue("name"));
current.addCheckbox(record);
- }
- else if (hasChildren(localName)) {
- current = record;
- data.addProperty(record);
- }
- else {
+ } else {
+ PropertyMeta record =
+ new PropertyMeta(localName, attr.getValue("name"));
+ if (hasChildren(localName)) {
+ current = record;
+ }
data.addProperty(record);
}
+
}
private boolean isChild(String elementName) {
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XmlSinglePanelHandler.java
Url:
http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XmlSinglePanelHandler.java?view=diff&pathrev=17636&r1=17635&r2=17636
==============================================================================
---
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XmlSinglePanelHandler.java
(original)
+++
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/xml/XmlSinglePanelHandler.java
2009-12-11 05:20:52-0800
@@ -40,14 +40,14 @@
/**
* The panel that will host the controls.
*/
- private final Dictionary<String, XMLPropertyPanelsData> data;
+ private final Dictionary<String, PanelMeta> data;
/**
* the panel that we are traversing
*/
- private XMLPropertyPanelsData currentPanel = null;
+ private PanelMeta currentPanel = null;
- private XMLPropertyPanelsDataRecord current = null;
+ private PropertyMeta current = null;
/**
* Default constructor.
@@ -55,7 +55,7 @@
* host the info read.
*/
public XmlSinglePanelHandler(
- Dictionary<String, XMLPropertyPanelsData> theData) {
+ Dictionary<String, PanelMeta> theData) {
this.data = theData;
}
@@ -67,24 +67,20 @@
}
if ("panel".equals(localName)) {
if (this.currentPanel == null) {
- currentPanel = new XMLPropertyPanelsData();
- currentPanel.addPanel(
- new XMLPropertyPanelsDataRecord(localName,
- attr.getValue("name")));
+ currentPanel = new PanelMeta(attr.getValue("name"));
}
- }
- else {
- XMLPropertyPanelsDataRecord record =
- new XMLPropertyPanelsDataRecord(localName,
- attr.getValue("name"));
+ } else {
if (isChild(localName)) {
+ CheckBoxMeta record =
+ new CheckBoxMeta(localName, attr.getValue("name"));
current.addCheckbox(record);
- }
- else if (hasChildren(localName)) {
- current = record;
- currentPanel.addProperty(record);
- }
- else {
+ } else {
+ PropertyMeta record =
+ new PropertyMeta(localName,
+ attr.getValue("name"));
+ if (hasChildren(localName)) {
+ current = record;
+ }
currentPanel.addProperty(record);
}
}
@@ -94,7 +90,7 @@
public void endElement(String namespaceURI, String localName,
String qName) throws SAXException {
if ("panel".equals(localName)) {
- data.put(currentPanel.getTitle(), currentPanel);
+ data.put(currentPanel.getName(), currentPanel);
currentPanel = null;
}
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2429776
To unsubscribe from this discussion, e-mail:
[[email protected]].