Author: kono
Date: 2010-09-20 18:22:11 -0700 (Mon, 20 Sep 2010)
New Revision: 21957
Added:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNode.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNodeFactory.java
Modified:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexicon.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualProperty.java
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/AbstractViewTest.java
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/StringVisualProperty.java
Log:
Refactored version of visual property tree. Tree structure is now managed in
wrapper object VisualLexiconNode.
Modified:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -34,8 +34,6 @@
*/
package org.cytoscape.view.model;
-import java.util.Collection;
-import java.util.HashSet;
/**
* An abstract implementation of VisualProperty that omits the methods dealing
@@ -57,12 +55,6 @@
protected boolean isIgnoreDefault = false;
- // Accepts all kinds of data types, so data compatibility checking is
- // developer's responsibility.
- protected final Collection<VisualProperty<?>> children;
-
- protected VisualProperty<?> parent;
-
/**
* Constructor with all required immutable field values.
*
@@ -71,16 +63,10 @@
* @param id
* @param name
*/
- public AbstractVisualProperty(final T defaultValue, final String id,
- final String name, final VisualProperty<?> parent) {
+ public AbstractVisualProperty(final T defaultValue, final String id,
final String name) {
this.defaultValue = defaultValue;
this.id = id;
this.name = name;
- this.children = new HashSet<VisualProperty<?>>();
- this.parent = parent;
-
- if(parent != null)
- parent.getChildren().add(this);
}
@@ -115,16 +101,4 @@
return this.isIgnoreDefault;
}
-
- @Override
- public VisualProperty<?> getParent() {
- return this.parent;
- }
-
-
- @Override
- public Collection<VisualProperty<?>> getChildren() {
- return this.children;
- }
-
}
Modified:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexicon.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexicon.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexicon.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -67,6 +67,9 @@
Set<VisualProperty<?>> getAllVisualProperties();
+ VisualLexiconNode getVisualLexiconNode(final VisualProperty<?> vp);
+
+
/**
* Get collection of visual properties for a given object type
(node/edge/network).
*
Added:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNode.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNode.java
(rev 0)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNode.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -0,0 +1,32 @@
+package org.cytoscape.view.model;
+
+import java.util.Collection;
+
+public interface VisualLexiconNode {
+
+
+ /**
+ * Wrapped object.
+ *
+ * Since VisualProperty itself does not have any hierarchical
structure,
+ * such relationship is implemented by this wrapper.
+ *
+ * @return
+ */
+ VisualProperty<?> getVisualProperty();
+
+
+ /**
+ * Get the parent of this VP node. The relationship is immutable, i.e.,
+ * cannot change parent/child relationship.
+ */
+ VisualLexiconNode getParent();
+
+ /**
+ * Returns all children of this node.
+ *
+ * @return all child nodes.
+ */
+ Collection<VisualLexiconNode> getChildren();
+
+}
Added:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNodeFactory.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNodeFactory.java
(rev 0)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconNodeFactory.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -0,0 +1,15 @@
+package org.cytoscape.view.model;
+
+public interface VisualLexiconNodeFactory {
+
+ /**
+ * Simple factory to create tree node for VisualLexicon.
+ *
+ * @param vp visual property to be wrapped by the tree node.
+ * @param parent parent of new tree node.
+ *
+ * @return new tree node in the lexicon.
+ */
+ VisualLexiconNode createNode(final VisualProperty<?> vp, final
VisualLexiconNode parent);
+
+}
Modified:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualProperty.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualProperty.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualProperty.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -34,12 +34,13 @@
*/
package org.cytoscape.view.model;
-import java.util.Collection;
/**
- * An object which represents
+ * An object which represents a type of visual entity, such as node color,
size, etc.
*
+ * Visual Property itself does NOT have any hierarchy/dependency. It will be
implemented in VisualLexicon.
+ *
* @param <T> the dataType of the VisualProperty, ie. what kind of objects are
the values
*/
public interface VisualProperty<T> {
@@ -100,19 +101,5 @@
* @return
*/
boolean isIgnoreDefault();
-
-
- // New feature: Tree-like structure for visual properties.
-
- /**
- * Get the parent of this VP node.
- * The relationship is immutable, i.e., cannot change parent/child
relationship.
- */
- VisualProperty<?> getParent();
-
- /**
- *
- * @return
- */
- Collection<VisualProperty<?>> getChildren();
+
}
Modified:
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/AbstractViewTest.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/AbstractViewTest.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/AbstractViewTest.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -17,8 +17,8 @@
@Before
public void setUp() throws Exception {
- integerVP = new IntegerVisualProperty(Integer.valueOf(0),
"integerVP", "INTVP", null);
- stringVP = new StringVisualProperty("", "stringVP", "STRVP",
null);
+ integerVP = new IntegerVisualProperty(Integer.valueOf(0),
"integerVP", "INTVP");
+ stringVP = new StringVisualProperty("", "stringVP", "STRVP");
}
Modified:
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -38,9 +38,9 @@
class IntegerVisualProperty extends AbstractVisualProperty<Integer> {
- public IntegerVisualProperty(final Integer def, final String id, final
String name,final VisualProperty<?> parent) {
+ public IntegerVisualProperty(final Integer def, final String id, final
String name) {
// isolated node. No parent/children.
- super(def, id, name, null);
+ super(def, id, name);
}
Modified:
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/StringVisualProperty.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/StringVisualProperty.java
2010-09-20 23:24:23 UTC (rev 21956)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/StringVisualProperty.java
2010-09-21 01:22:11 UTC (rev 21957)
@@ -3,9 +3,9 @@
public class StringVisualProperty extends AbstractVisualProperty<String> {
public StringVisualProperty(final String defaultValue, final String id,
- final String name, final VisualProperty<?> parent) {
+ final String name) {
// isolated node. No parent/children.
- super(defaultValue, id, name, null);
+ super(defaultValue, id, name);
}
public String parseSerializableString(final String text) {
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.