Author: kono
Date: 2010-09-16 18:25:47 -0700 (Thu, 16 Sep 2010)
New Revision: 21913
Added:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/EdgeViewChangeMicroListener.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NetworkViewChangeMicroListener.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NodeViewChangeMicroListener.java
Removed:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/BasicVisualLexicon.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/EdgeViewChangeMicroListener.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NetworkViewChangeMicroListener.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NodeViewChangeMicroListener.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/ThreeDVisualLexicon.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/TwoDVisualLexicon.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconManager.java
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/visualproperties/
Modified:
core3/viewmodel-api/branches/vp-tree/pom.xml
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 VP tree. VisualLexicons are moved to presentation layer.
Modified: core3/viewmodel-api/branches/vp-tree/pom.xml
===================================================================
--- core3/viewmodel-api/branches/vp-tree/pom.xml 2010-09-17 00:06:51 UTC
(rev 21912)
+++ core3/viewmodel-api/branches/vp-tree/pom.xml 2010-09-17 01:25:47 UTC
(rev 21913)
@@ -117,11 +117,7 @@
<artifactId>model-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.cytoscape</groupId>
- <artifactId>event-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
+
<!-- unit tests -->
<dependency>
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -60,6 +60,7 @@
// Accepts all kinds of data types, so data compatibility checking is
// developer's responsibility.
protected final Collection<VisualProperty<?>> children;
+
protected VisualProperty<?> parent;
/**
@@ -71,13 +72,15 @@
* @param name
*/
public AbstractVisualProperty(final T defaultValue, final String id,
- final String name) {
+ final String name, final VisualProperty<?> parent) {
this.defaultValue = defaultValue;
this.id = id;
this.name = name;
this.children = new HashSet<VisualProperty<?>>();
}
+
+ @Override
@SuppressWarnings("unchecked")
public Class<T> getType() {
if (defaultValue != null)
@@ -86,33 +89,38 @@
return null;
}
+
+ @Override
public T getDefault() {
return defaultValue;
}
+
+ @Override
public String getIdString() {
return id;
}
+ @Override
public String getDisplayName() {
return name;
}
+ @Override
public boolean isIgnoreDefault() {
return this.isIgnoreDefault;
}
+
+ @Override
public VisualProperty<?> getParent() {
return this.parent;
}
+
+ @Override
public Collection<VisualProperty<?>> getChildren() {
return this.children;
}
- @Override
- public void setParent(VisualProperty<?> parent) {
- this.parent = parent;
- }
-
}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/BasicVisualLexicon.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/BasicVisualLexicon.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/BasicVisualLexicon.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,128 +0,0 @@
-package org.cytoscape.view.model;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-
-/**
- * Basic tree implementation of a visual lexicon. All rendering engine should
use this class
- * to implement their own version of lexicon.
- *
- * This tree has minimum set of method required to implement VizMapper.
- *
- * This is an immutable tree, except the rendering engine's root.
- *
- * @author kono
- *
- */
-public abstract class BasicVisualLexicon implements VisualLexicon {
-
- //
- private final Map<String, VisualProperty<?>> visualPropertyMap;
-
- // Root of this tree.
- protected final VisualProperty<NullDataType> rootVisualProperty;
-
-
- /**
- * Insert a root node to the tree and build it.
- *
- * @param rootVisualProperty
- */
- public BasicVisualLexicon(final VisualProperty<NullDataType>
rootVisualProperty) {
- this.visualPropertyMap = new HashMap<String,
VisualProperty<?>>();
- this.rootVisualProperty = rootVisualProperty;
- visualPropertyMap.put(rootVisualProperty.getIdString(),
rootVisualProperty);
- }
-
-
- // Returns all visual properties as a set.
- public Set<VisualProperty<?>> getAllVisualProperties() {
- System.out.println("Keys = " +
visualPropertyMap.keySet().size());
- System.out.println("Values = " +
visualPropertyMap.values().size());
-
- return new
HashSet<VisualProperty<?>>(visualPropertyMap.values());
- }
-
-
- /**
- * Add a new VP as a leaf.
- *
- * @param prop
- * @param parent
- */
- protected void insertVisualProperty(final VisualProperty<?> prop, final
VisualProperty<?> parent) {
- //Sanity check
- if(prop == null)
- throw new NullPointerException("Cannot add null to the
lexicon tree.");
- if(parent == null)
- throw new NullPointerException("Parent Visual Property
should not be null.");
-
- if(this.visualPropertyMap.containsValue(prop))
- throw new IllegalArgumentException("The Visual Property
already exists: " + prop.getDisplayName());
-
- if(!this.visualPropertyMap.containsValue(parent))
- throw new IllegalArgumentException("Parent Visual
Property does not exist in the tree.");
-
- prop.setParent(parent);
- this.visualPropertyMap.put(prop.getIdString(), prop);
- parent.getChildren().add(prop);
- }
-
-
- public Collection<VisualProperty<?>> getChildren(final
VisualProperty<?> prop) {
- if(prop == null)
- throw new NullPointerException("Target visual property
cannot be null.");
-
- if(!this.visualPropertyMap.containsValue(prop))
- throw new IllegalArgumentException("No such Visual
Property in the Lexicon.");
-
- return getChildNodes(prop);
- }
-
-
- @Override
- public VisualProperty<NullDataType> getRootVisualProperty() {
- return this.rootVisualProperty;
- }
-
-
- private Set<VisualProperty<?>> getChildNodes(VisualProperty<?> prop) {
- final Set<VisualProperty<?>> children = new
HashSet<VisualProperty<?>>();
-
- // if this is a leaf node, return empty set
- if(prop.getChildren().size() == 0)
- return children;
-
- Collection<VisualProperty<?>> currentChildren =
prop.getChildren();
- children.addAll(currentChildren);
- for(VisualProperty<?> vp: currentChildren)
- children.addAll(getChildNodes(vp));
-
- return children;
- }
-
-
- @Override
- public VisualProperty<?> getVisualProperty(String idString) {
- return this.visualPropertyMap.get(idString);
- }
-
-
- @Override
- public void mergeLexicon(VisualLexicon toBeMerged) {
- // Set the root to this tree's root node.
- final VisualProperty<NullDataType> oldRoot =
toBeMerged.getRootVisualProperty();
-
- rootVisualProperty.getChildren().add(oldRoot);
-
- // Add all VP to the map
- Set<VisualProperty<?>> newVPs =
toBeMerged.getAllVisualProperties();
- for(VisualProperty<?> vp:newVPs)
- this.visualPropertyMap.put(vp.getIdString(), vp);
- }
-
-}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/EdgeViewChangeMicroListener.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/EdgeViewChangeMicroListener.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/EdgeViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,13 +0,0 @@
-package org.cytoscape.view.model;
-
-import org.cytoscape.event.CyMicroListener;
-import org.cytoscape.model.CyEdge;
-
-public interface EdgeViewChangeMicroListener extends CyMicroListener {
-
- /**
- * The method called when the specified VisualProperty is set to the
- * specified value in the View being listened to.
- */
- void edgeVisualPropertySet(final View<CyEdge> target, final
VisualProperty<?> vp, final Object value);
-}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NetworkViewChangeMicroListener.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NetworkViewChangeMicroListener.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NetworkViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,13 +0,0 @@
-package org.cytoscape.view.model;
-
-import org.cytoscape.event.CyMicroListener;
-import org.cytoscape.model.CyNetwork;
-
-public interface NetworkViewChangeMicroListener extends CyMicroListener {
-
- /**
- * The method called when the specified VisualProperty is set to the
- * specified value in the View being listened to.
- */
- void networkVisualPropertySet(final View<CyNetwork> target, final
VisualProperty<?> vp, final Object value);
-}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NodeViewChangeMicroListener.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NodeViewChangeMicroListener.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NodeViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,54 +0,0 @@
-
-/*
- Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
-
- The Cytoscape Consortium is:
- - Institute for Systems Biology
- - University of California San Diego
- - Memorial Sloan-Kettering Cancer Center
- - Institut Pasteur
- - Agilent Technologies
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- 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
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.view.model;
-
-import org.cytoscape.event.CyMicroListener;
-import org.cytoscape.model.CyNode;
-
-
-/**
- * An interface to indicate that a View has changed. The intent is for
- * a Presentation to implement this interface so that the presentation
- * can be updated based on what has changed in the View.
- */
-public interface NodeViewChangeMicroListener extends CyMicroListener {
-
- /**
- * The method called when the specified VisualProperty is set to the
- * specified value in the View being listened to.
- */
- void nodeVisualPropertySet(final View<CyNode> target, final
VisualProperty<?> vp, final Object value);
-}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/ThreeDVisualLexicon.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/ThreeDVisualLexicon.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/ThreeDVisualLexicon.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,28 +0,0 @@
-package org.cytoscape.view.model;
-
-import org.cytoscape.view.model.visualproperties.DoubleVisualProperty;
-
-public class ThreeDVisualLexicon extends TwoDVisualLexicon {
-
- public static final VisualProperty<Double> NODE_Z_LOCATION = new
DoubleVisualProperty(
- 0.0, "NODE_Z_LOCATION", "Node Z Location", true);
-
- public static final VisualProperty<Double> NODE_Z_SIZE = new
DoubleVisualProperty(
- 0.0, "NODE_Z_SIZE", "Node z size (depth)");
-
- public static final VisualProperty<Double> NETWORK_CENTER_Z_LOCATION =
new DoubleVisualProperty(
- 0.0, "NETWORK_CENTER_Z_LOCATION", "Network Center Z
Location");
-
- public static final VisualProperty<Double> NETWORK_DEPTH = new
DoubleVisualProperty(
- 0.0, "NETWORK_DEPTH", "Network Depth");
-
- public ThreeDVisualLexicon() {
- super();
-
- insertVisualProperty(NODE_Z_LOCATION, NODE_LOCATION);
- insertVisualProperty(NODE_Z_SIZE, NODE_SIZE);
- insertVisualProperty(NETWORK_CENTER_Z_LOCATION,
NETWORK_CENTER_LOCATION);
- insertVisualProperty(NETWORK_DEPTH, NETWORK_SIZE);
-
- }
-}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/TwoDVisualLexicon.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/TwoDVisualLexicon.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/TwoDVisualLexicon.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,227 +0,0 @@
-/*
- Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
-
- The Cytoscape Consortium is:
- - Institute for Systems Biology
- - University of California San Diego
- - Memorial Sloan-Kettering Cancer Center
- - Institut Pasteur
- - Agilent Technologies
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- 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
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-package org.cytoscape.view.model;
-
-import java.awt.Color;
-import java.awt.Paint;
-
-import org.cytoscape.view.model.visualproperties.BooleanVisualProperty;
-import org.cytoscape.view.model.visualproperties.StringVisualProperty;
-import org.cytoscape.view.model.visualproperties.ColorVisualProperty;
-import
org.cytoscape.view.model.visualproperties.DefaultVisualizableVisualProperty;
-import org.cytoscape.view.model.visualproperties.DoubleVisualProperty;
-import org.cytoscape.view.model.visualproperties.NullVisualProperty;
-
-/**
- * Should be implemented as a service. 'Renderer' is simply anything that
- * provides VisualProperties. With a 'VisualProperties as annotations' this
- * won't be needed.
- */
-public class TwoDVisualLexicon extends BasicVisualLexicon {
-
- public static final VisualProperty<NullDataType> ENGINE_ROOT = new
NullVisualProperty(
- "RENDERING_ENGINE_ROOT", "Rndering Engine Root");
-
- public static final VisualProperty<Visualizable> NETWORK = new
DefaultVisualizableVisualProperty(
- "NETWORK", "Network Visual Property");
- public static final VisualProperty<Visualizable> NODE = new
DefaultVisualizableVisualProperty(
- "NODE", "Node Visual Property");
- public static final VisualProperty<Visualizable> EDGE = new
DefaultVisualizableVisualProperty(
- "EDGE", "Edge Visual Property");
-
-
- public static final VisualProperty<Paint> NODE_PAINT = new
ColorVisualProperty(
- Color.RED, "NODE_PAINT", "Node Paint");
- public static final VisualProperty<? extends Paint> NODE_COLOR = new
ColorVisualProperty(
- Color.RED, "NODE_COLOR", "Node Color");
- public static final VisualProperty<? extends Paint> NODE_SELECTED_COLOR
= new ColorVisualProperty(
- Color.YELLOW, "NODE_SELECTED_COLOR", "Node Selected
Color");
- public static final VisualProperty<? extends Paint> NODE_LABEL_COLOR =
new ColorVisualProperty(
- Color.BLACK, "NODE_LABEL_COLOR", "Node Label Color");
-
-
- public static final VisualProperty<String> NODE_TEXT = new
StringVisualProperty(
- "", "NODE_TEXT", "Node Text");
- public static final VisualProperty<String> NODE_LABEL = new
StringVisualProperty(
- "", "NODE_LABEL", "Node Label");
-
-
- public static final VisualProperty<Double> NODE_LOCATION = new
DoubleVisualProperty(
- Double.NaN, "NODE_LOCATION", "Node Location", true);
- public static final VisualProperty<Double> NODE_X_LOCATION = new
DoubleVisualProperty(
- Double.NaN, "NODE_X_LOCATION", "Node X Location", true);
- public static final VisualProperty<Double> NODE_Y_LOCATION = new
DoubleVisualProperty(
- Double.NaN, "NODE_Y_LOCATION", "Node Y Location", true);
-
-
- public static final VisualProperty<Double> NODE_SIZE = new
DoubleVisualProperty(
- 50.0, "NODE_SIZE", "Node size");
- public static final VisualProperty<Double> NODE_X_SIZE = new
DoubleVisualProperty(
- 50.0, "NODE_X_SIZE", "Node X size (width)");
- public static final VisualProperty<Double> NODE_Y_SIZE = new
DoubleVisualProperty(
- 30.0, "NODE_Y_SIZE", "Node y size (height)");
-
-
-
- public static final VisualProperty<Boolean> NODE_VISIBLE = new
BooleanVisualProperty(
- true, "NODE_VISIBLE", "Node Visible");
-
- public static final VisualProperty<Boolean> NODE_SELECTED = new
BooleanVisualProperty(
- false, "NODE_SELECTED", "Node Selected");
-
-
- public static final VisualProperty<? extends Paint> EDGE_PAINT = new
ColorVisualProperty(
- Color.gray, "EDGE_PAINT", "Edge Paint");
- public static final VisualProperty<? extends Paint> EDGE_COLOR = new
ColorVisualProperty(
- Color.gray, "EDGE_COLOR", "Edge Color");
- public static final VisualProperty<? extends Paint> EDGE_LABEL_COLOR =
new ColorVisualProperty(
- Color.BLACK, "EDGE_LABEL_COLOR", "Edge Label Color");
-
-
- public static final VisualProperty<String> EDGE_TEXT = new
StringVisualProperty(
- "", "EDGE_TEXT", "Edge Text");
- public static final VisualProperty<String> EDGE_LABEL = new
StringVisualProperty(
- "", "EDGE_LABEL", "Edge Label");
-
-
- public static final VisualProperty<Double> EDGE_SIZE = new
DoubleVisualProperty(
- 1d, "EDGE_SIZE", "Edge Size");
- public static final VisualProperty<Double> EDGE_WIDTH = new
DoubleVisualProperty(
- 1d, "EDGE_WIDTH", "Edge Width");
-
-
- public static final VisualProperty<Boolean> EDGE_VISIBLE = new
BooleanVisualProperty(
- true, "EDGE_VISIBLE", "Edge Visible");
-
- public static final VisualProperty<Boolean> EDGE_SELECTED = new
BooleanVisualProperty(
- false, "EDGE_SELECTED", "Edge Selected");
-
-
- public static final VisualProperty<Double> NETWORK_SCALE_FACTOR = new
DoubleVisualProperty(
- 1.0, "NETWORK_SCALE_FACTOR", "Network Scale Factor");
-
- public static final VisualProperty<Double> NETWORK_CENTER_LOCATION =
new DoubleVisualProperty(
- 0.0, "NETWORK_CENTER_LOCATION", "Network Center
Location");
- public static final VisualProperty<Double> NETWORK_CENTER_X_LOCATION =
new DoubleVisualProperty(
- 0.0, "NETWORK_CENTER_X_LOCATION", "Network Center X
Location");
- public static final VisualProperty<Double> NETWORK_CENTER_Y_LOCATION =
new DoubleVisualProperty(
- 0.0, "NETWORK_CENTER_Y_LOCATION", "Network Center Y
Location");
-
-
- public static final VisualProperty<Double> NETWORK_SIZE = new
DoubleVisualProperty(
- 100.0, "NETWORK_SIZE", "Network Size");
- public static final VisualProperty<Double> NETWORK_WIDTH = new
DoubleVisualProperty(
- 100.0, "NETWORK_WIDTH", "Network Width");
- public static final VisualProperty<Double> NETWORK_HEIGHT = new
DoubleVisualProperty(
- 100.0, "NETWORK_HEIGHT", "Network Height");
-
-
-
- public static final VisualProperty<String> NETWORK_TEXT = new
StringVisualProperty(
- "", "NETWORK_TEXT", "Network Text");
- public static final VisualProperty<String> NETWORK_TITLE = new
StringVisualProperty(
- "", "NETWORK_TITLE", "Network Title");
-
- public static final VisualProperty<Paint> NETWORK_PAINT = new
ColorVisualProperty(
- Color.WHITE, "NETWORK_PAINT", "Network Paint");
- public static final VisualProperty<? extends Paint>
NETWORK_BACKGROUND_COLOR = new ColorVisualProperty(
- Color.WHITE, "NETWORK_BACKGROUND_COLOR", "Network
Background Color");
-
-
- public TwoDVisualLexicon() {
- this(ENGINE_ROOT);
- }
-
- /**
- * Build basic VP tree.
- *
- * @param rootVisualProperty
- */
- public TwoDVisualLexicon(final VisualProperty<NullDataType> root) {
- super(root);
-
- // 2nd Level: Network and Table
- insertVisualProperty(NETWORK, root);
-
- // 3rd Level: Network VP
- insertVisualProperty(NODE, NETWORK);
- insertVisualProperty(EDGE, NETWORK);
- insertVisualProperty(NETWORK_TEXT, NETWORK);
- insertVisualProperty(NETWORK_PAINT, NETWORK);
- insertVisualProperty(NETWORK_SIZE, NETWORK);
- insertVisualProperty(NETWORK_CENTER_LOCATION, NETWORK);
- insertVisualProperty(NETWORK_SCALE_FACTOR, NETWORK);
-
- // 4th Level: Node VP
- insertVisualProperty(NODE_LOCATION, NODE);
- insertVisualProperty(NODE_PAINT, NODE);
- insertVisualProperty(NODE_SIZE, NODE);
- insertVisualProperty(NODE_TEXT, NODE);
- insertVisualProperty(NODE_VISIBLE, NODE);
- insertVisualProperty(NODE_SELECTED, NODE);
-
- // 4th Level: Edge VP
- insertVisualProperty(EDGE_PAINT, EDGE);
- insertVisualProperty(EDGE_SIZE, EDGE);
- insertVisualProperty(EDGE_TEXT, EDGE);
- insertVisualProperty(EDGE_VISIBLE, EDGE);
- insertVisualProperty(EDGE_SELECTED, EDGE);
-
- // 4th Level: Network VP leaves
- insertVisualProperty(NETWORK_TITLE, NETWORK_TEXT);
- insertVisualProperty(NETWORK_BACKGROUND_COLOR, NETWORK_PAINT);
- insertVisualProperty(NETWORK_WIDTH, NETWORK_SIZE);
- insertVisualProperty(NETWORK_HEIGHT, NETWORK_SIZE);
- insertVisualProperty(NETWORK_CENTER_X_LOCATION,
NETWORK_CENTER_LOCATION);
- insertVisualProperty(NETWORK_CENTER_Y_LOCATION,
NETWORK_CENTER_LOCATION);
-
-
- // 5th Level: leaf Visual Properties
- insertVisualProperty(NODE_X_LOCATION, NODE_LOCATION);
- insertVisualProperty(NODE_Y_LOCATION, NODE_LOCATION);
- insertVisualProperty(NODE_COLOR, NODE_PAINT);
- insertVisualProperty(NODE_LABEL_COLOR, NODE_PAINT);
- insertVisualProperty(NODE_SELECTED_COLOR, NODE_PAINT);
- insertVisualProperty(NODE_X_SIZE, NODE_SIZE);
- insertVisualProperty(NODE_Y_SIZE, NODE_SIZE);
- insertVisualProperty(NODE_LABEL, NODE_TEXT);
-
- insertVisualProperty(EDGE_COLOR, EDGE_PAINT);
- insertVisualProperty(EDGE_LABEL_COLOR, EDGE_PAINT);
- insertVisualProperty(EDGE_WIDTH, EDGE_SIZE);
- insertVisualProperty(EDGE_LABEL, EDGE_TEXT);
- }
-
-}
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexicon.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -35,7 +35,6 @@
package org.cytoscape.view.model;
import java.util.Collection;
-import java.util.Map;
import java.util.Set;
/**
@@ -74,22 +73,8 @@
* @param prop
* any visual property
*
- * @return Collection of visual properties for the type
+ * @return Collection of visual properties for the type.
*/
- Collection<VisualProperty<?>> getChildren(final VisualProperty<?> prop);
-
-
- /**
- * DOCUMENT ME!
- *
- * @param name
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- VisualProperty<?> getVisualProperty(String idString);
-
-
- void mergeLexicon(final VisualLexicon toBeMerged);
-
+ Collection<VisualProperty<?>> getAllDescendants(final
VisualProperty<Visualizable> prop);
+
}
Deleted:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconManager.java
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconManager.java
2010-09-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualLexiconManager.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -1,29 +0,0 @@
-package org.cytoscape.view.model;
-
-import java.util.Map;
-
-/**
- * Collection of Lexicons. This is the superset of VisualLexicons. All Visual
- * Properties will be available from this root object.
- *
- */
-public interface VisualLexiconManager {
-
- /**
- * OSGi service listener method. Of course, this can be called from any
POJO
- * (without OSGi).
- *
- * @param lexicon
- * @param props
- */
-
- @SuppressWarnings("unchecked")
- // This for Spring DM.
- public void addVisualLexicon(VisualLexicon lexicon, Map props);
-
- @SuppressWarnings("unchecked")
- public void removeVisualLexicon(VisualLexicon lexicon, Map props);
-
- public VisualLexicon getLexicon();
-
-}
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/VisualProperty.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -111,7 +111,6 @@
* The relationship is immutable, i.e., cannot change parent/child
relationship.
*/
VisualProperty<?> getParent();
- void setParent(VisualProperty<?> parent);
/**
*
Copied:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/EdgeViewChangeMicroListener.java
(from rev 21871,
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/EdgeViewChangeMicroListener.java)
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/EdgeViewChangeMicroListener.java
(rev 0)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/EdgeViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -0,0 +1,15 @@
+package org.cytoscape.view.model.events;
+
+import org.cytoscape.event.CyMicroListener;
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.VisualProperty;
+
+public interface EdgeViewChangeMicroListener extends CyMicroListener {
+
+ /**
+ * The method called when the specified VisualProperty is set to the
+ * specified value in the View being listened to.
+ */
+ void edgeVisualPropertySet(final View<CyEdge> target, final
VisualProperty<?> vp, final Object value);
+}
Copied:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NetworkViewChangeMicroListener.java
(from rev 21871,
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NetworkViewChangeMicroListener.java)
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NetworkViewChangeMicroListener.java
(rev 0)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NetworkViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -0,0 +1,15 @@
+package org.cytoscape.view.model.events;
+
+import org.cytoscape.event.CyMicroListener;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.VisualProperty;
+
+public interface NetworkViewChangeMicroListener extends CyMicroListener {
+
+ /**
+ * The method called when the specified VisualProperty is set to the
+ * specified value in the View being listened to.
+ */
+ void networkVisualPropertySet(final View<CyNetwork> target, final
VisualProperty<?> vp, final Object value);
+}
Copied:
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NodeViewChangeMicroListener.java
(from rev 21871,
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/NodeViewChangeMicroListener.java)
===================================================================
---
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NodeViewChangeMicroListener.java
(rev 0)
+++
core3/viewmodel-api/branches/vp-tree/src/main/java/org/cytoscape/view/model/events/NodeViewChangeMicroListener.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -0,0 +1,56 @@
+
+/*
+ Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ 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
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.view.model.events;
+
+import org.cytoscape.event.CyMicroListener;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.view.model.View;
+import org.cytoscape.view.model.VisualProperty;
+
+
+/**
+ * An interface to indicate that a View has changed. The intent is for
+ * a Presentation to implement this interface so that the presentation
+ * can be updated based on what has changed in the View.
+ */
+public interface NodeViewChangeMicroListener extends CyMicroListener {
+
+ /**
+ * The method called when the specified VisualProperty is set to the
+ * specified value in the View being listened to.
+ */
+ void nodeVisualPropertySet(final View<CyNode> target, final
VisualProperty<?> vp, final Object value);
+}
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/AbstractViewTest.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -17,8 +17,8 @@
@Before
public void setUp() throws Exception {
- integerVP = new IntegerVisualProperty(Integer.valueOf(0),
"integerVP", "INTVP");
- stringVP = new StringVisualProperty("", "stringVP", "STRVP");
+ integerVP = new IntegerVisualProperty(Integer.valueOf(0),
"integerVP", "INTVP", null);
+ stringVP = new StringVisualProperty("", "stringVP", "STRVP",
null);
}
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -38,9 +38,9 @@
class IntegerVisualProperty extends AbstractVisualProperty<Integer> {
- public IntegerVisualProperty(final Integer def, final String id, final
String name) {
+ public IntegerVisualProperty(final Integer def, final String id, final
String name,final VisualProperty<?> parent) {
// isolated node. No parent/children.
- super(def, id, name);
+ super(def, id, name, null);
}
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-17 00:06:51 UTC (rev 21912)
+++
core3/viewmodel-api/branches/vp-tree/src/test/java/org/cytoscape/view/model/StringVisualProperty.java
2010-09-17 01:25:47 UTC (rev 21913)
@@ -3,9 +3,9 @@
public class StringVisualProperty extends AbstractVisualProperty<String> {
public StringVisualProperty(final String defaultValue, final String id,
- final String name) {
+ final String name, final VisualProperty<?> parent) {
// isolated node. No parent/children.
- super(defaultValue, id, name);
+ super(defaultValue, id, name, null);
}
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.