Author: kono
Date: 2011-04-04 19:02:26 -0700 (Mon, 04 Apr 2011)
New Revision: 24669
Added:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/DNodeShape.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/LineTypeImpl.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/NodeShapeImpl.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualPropertyValue.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/LineTypeVisualProperty.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/NodeShapeVisualProperty.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/VisualPropertyValue.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/LineType.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/NodeShape.java
Removed:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/visualproperty/NodeShapeTwoDVisualProperty.java
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DVisualLexicon.java
core3/presentation-api/trunk/osgi.bnd
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/RichVisualLexicon.java
core3/presentation-api/trunk/src/test/java/org/cytoscape/view/presentation/RichVisualLexiconTest.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRange.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRangeImpl.java
Log:
LineType and NodeShape interfaces are created. Still refactoring ding layer.
Added:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/DNodeShape.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/DNodeShape.java
(rev 0)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/DNodeShape.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,105 @@
+package org.cytoscape.ding;
+
+import java.awt.Shape;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.cytoscape.graph.render.immed.GraphGraphics;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
+import org.cytoscape.view.presentation.property.VisualPropertyValue;
+import org.cytoscape.view.presentation.property.values.NodeShape;
+
+public class DNodeShape implements NodeShape {
+
+ private static final DNodeShape RECTANGLE = new DNodeShape(
+ GraphGraphics.SHAPE_RECTANGLE,
+ NodeShapeVisualProperty.RECTANGLE.getDisplayName(),
+
NodeShapeVisualProperty.RECTANGLE.getSerializableString());
+ private static final DNodeShape ROUND_RECTANGLE = new DNodeShape(
+ GraphGraphics.SHAPE_ROUNDED_RECTANGLE,
+
NodeShapeVisualProperty.ROUND_RECTANGLE.getDisplayName(),
+
NodeShapeVisualProperty.ROUND_RECTANGLE.getSerializableString());
+ private static final DNodeShape TRIANGLE = new DNodeShape(
+ GraphGraphics.SHAPE_TRIANGLE,
+ NodeShapeVisualProperty.TRIANGLE.getDisplayName(),
+
NodeShapeVisualProperty.TRIANGLE.getSerializableString());
+ private static final DNodeShape PARALLELOGRAM = new DNodeShape(
+ GraphGraphics.SHAPE_PARALLELOGRAM,
+ NodeShapeVisualProperty.PARALLELOGRAM.getDisplayName(),
+
NodeShapeVisualProperty.PARALLELOGRAM.getSerializableString());
+ private static final DNodeShape DIAMOND = new DNodeShape(
+ GraphGraphics.SHAPE_DIAMOND,
+ NodeShapeVisualProperty.DIAMOND.getDisplayName(),
+
NodeShapeVisualProperty.DIAMOND.getSerializableString());
+ private static final DNodeShape ELLIPSE = new DNodeShape(
+ GraphGraphics.SHAPE_ELLIPSE,
+ NodeShapeVisualProperty.ELLIPSE.getDisplayName(),
+
NodeShapeVisualProperty.ELLIPSE.getSerializableString());
+ private static final DNodeShape HEXAGON = new DNodeShape(
+ GraphGraphics.SHAPE_HEXAGON,
+ NodeShapeVisualProperty.HEXAGON.getDisplayName(),
+
NodeShapeVisualProperty.HEXAGON.getSerializableString());
+ private static final DNodeShape OCTAGON = new DNodeShape(
+ GraphGraphics.SHAPE_OCTAGON,
+ NodeShapeVisualProperty.OCTAGON.getDisplayName(),
+
NodeShapeVisualProperty.OCTAGON.getSerializableString());
+
+ private static final Map<NodeShape, DNodeShape> DEF_SHAPE_MAP;
+
+ static {
+ DEF_SHAPE_MAP = new HashMap<NodeShape, DNodeShape>();
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.RECTANGLE, RECTANGLE);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.DIAMOND, DIAMOND);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.ELLIPSE, ELLIPSE);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.HEXAGON, HEXAGON);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.OCTAGON, OCTAGON);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.PARALLELOGRAM,
PARALLELOGRAM);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.ROUND_RECTANGLE,
ROUND_RECTANGLE);
+ DEF_SHAPE_MAP.put(NodeShapeVisualProperty.TRIANGLE, TRIANGLE);
+ }
+
+ public static final DNodeShape getDShape(final NodeShape shape) {
+ return DEF_SHAPE_MAP.get(shape);
+ }
+
+ private final Byte rendererShapeID;
+
+ private final String displayName;
+ private final String serializableString;
+
+ private static final Map<Byte, Shape> nodeShapes = GraphGraphics
+ .getNodeShapes();
+
+ public DNodeShape(final Byte rendererShapeID, final String displayName,
+ final String serializableString) {
+ this.displayName = displayName;
+ this.serializableString = serializableString;
+
+ this.rendererShapeID = rendererShapeID;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ @Override
+ public String getSerializableString() {
+ return serializableString;
+ }
+
+ @Override
+ public VisualPropertyValue parseSerializableString(String
serializableString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Byte getNativeShape() {
+ return this.rendererShapeID;
+ }
+
+ public Shape getShape() {
+ return nodeShapes.get(rendererShapeID);
+ }
+
+}
Deleted:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -1,182 +0,0 @@
-/*
- Copyright (c) 2006, 2007, 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.ding;
-
-import java.awt.Shape;
-import java.util.Map;
-
-import org.cytoscape.graph.render.immed.GraphGraphics;
-
-/**
- * Defines node shapes used in DING rendering engine.
- * This enum wires shape definitions to actual rendering code in graph-render
bundle.
- *
- */
-public enum NodeShape {
-
- RECT(GraphGraphics.SHAPE_RECTANGLE, "Rectangle"),
- ROUND_RECT(GraphGraphics.SHAPE_ROUNDED_RECTANGLE, "Round Rectangle"),
- TRIANGLE(GraphGraphics.SHAPE_TRIANGLE, "Triangle"),
- PARALLELOGRAM(GraphGraphics.SHAPE_PARALLELOGRAM, "Parallelogram"),
- DIAMOND(GraphGraphics.SHAPE_DIAMOND, "Diamond"),
- ELLIPSE(GraphGraphics.SHAPE_ELLIPSE, "Ellipse"),
- HEXAGON(GraphGraphics.SHAPE_HEXAGON, "Hexagon"),
- OCTAGON(GraphGraphics.SHAPE_OCTAGON, "Octagon");
-
- private final Byte rendererShapeID;
- private final String displayName;
-
- private static final Map<Byte, Shape> nodeShapes =
GraphGraphics.getNodeShapes();
-
- private NodeShape(final Byte rendererShapeID, final String displayName)
{
- this.rendererShapeID = rendererShapeID;
- this.displayName = displayName;
- }
-
-
- /**
- * Display name will be used for toString() method.
- */
- @Override public String toString() {
- return displayName;
- }
-
- public Byte getNativeShape() {
- return this.rendererShapeID;
- }
-
-
- /**
- * Get a node shape from a given string.
- *
- * @param text DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static NodeShape parseNodeShapeText(final String text) {
- String trimed = text.trim();
-
- for (NodeShape shape : values()) {
- if (getNodeShapeText(shape).equalsIgnoreCase(trimed))
- return shape;
- }
-
- // Unknown shape: return rectangle.
- return NodeShape.RECT;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static String[] valuesAsString() {
- final int length = values().length;
- final String[] nameArray = new String[length];
-
- for (int i = 0; i < length; i++)
- nameArray[i] = values()[i].getShapeName();
-
- return nameArray;
- }
-
- /**
- * Get name of the shape.
- *
- * @return DOCUMENT ME!
- */
- public String getShapeName() {
- return displayName;
- }
-
-
- /**
- * DOCUMENT ME!
- *
- * @param shape
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static String getNodeShapeText(NodeShape shape) {
- String nstext = shape.name();
- nstext = nstext.replaceAll("_", "");
-
- return nstext.toLowerCase();
- }
-
-
- /**
- * Convert from Giny shape to Cytoscape NodeShape enum.
- *
- * @param ginyShape
- * @return
- */
- public static NodeShape getNodeShape(final Byte ginyShape) {
- for (NodeShape shape : values()) {
- if (shape.rendererShapeID == ginyShape)
- return shape;
- }
-
- // Unknown. Return rectangle as the def val.
- return NodeShape.RECT;
- }
-
-
- /**
- * Returns a Shape object for the NodeShape in question.
- */
- public Shape getShape() {
- return nodeShapes.get(rendererShapeID);
- }
-
-// /**
-// * DOCUMENT ME!
-// *
-// * @return DOCUMENT ME!
-// */
-// public static Map<Object, Icon> getIconSet() {
-// Map<Object, Icon> nodeShapeIcons = new HashMap<Object, Icon>();
-//
-// for (NodeShape shape : values()) {
-// NodeIcon icon = new
NodeIcon(nodeShapes.get(shape.getGinyShape()),
-//
VisualPropertyIcon.DEFAULT_ICON_SIZE,
-//
VisualPropertyIcon.DEFAULT_ICON_SIZE, shape.getShapeName());
-// nodeShapeIcons.put(shape, icon);
-// }
-//
-// return nodeShapeIcons;
-// }
-}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -8,6 +8,7 @@
import org.cytoscape.model.CyNode;
import org.cytoscape.view.model.View;
+import org.cytoscape.view.presentation.property.values.NodeShape;
/**
@@ -205,7 +206,7 @@
* <B>Note:</B> calling setPathTo( Shape ), allows one to define their
own
* java.awt.Shape ( i.e. A picture of Johnny Cash )
*/
- public void setShape(NodeShape shape) ;
+ public void setShape(final NodeShape shape) ;
/**
* Sets what the tooltip will be for this NodeView
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsRange.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -30,4 +30,10 @@
return new
HashSet<CyCustomGraphics>(manager.getAllCustomGraphics());
}
+ @Override
+ public void addRangeValue(CyCustomGraphics newValue) {
+ // TODO Auto-generated method stub
+
+ }
+
}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/icon/VisualPropertyIconFactory.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -6,10 +6,12 @@
import javax.swing.Icon;
-import org.cytoscape.ding.NodeShape;
+import org.cytoscape.ding.DNodeShape;
import org.cytoscape.ding.ObjectPosition;
import org.cytoscape.ding.customgraphics.CyCustomGraphics;
import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
+import org.cytoscape.view.presentation.property.values.NodeShape;
/**
@@ -27,7 +29,14 @@
if(value instanceof Color) {
icon = new ColorIcon((Color) value, w, h,
value.toString());
} else if(value instanceof NodeShape) {
- icon = new NodeIcon(((NodeShape) value).getShape(), w,
h, ((NodeShape) value).getShapeName());
+ final DNodeShape dShape;
+ if(NodeShapeVisualProperty.isDefaultShape((NodeShape)
value))
+ dShape = DNodeShape.getDShape((NodeShape)
value);
+ else
+ dShape = (DNodeShape) value;
+
+ System.out.println("\n\n\n\n===========>>> Creating
shape icon: " + dShape);
+ icon = new NodeIcon(dShape.getShape(), w, h,
dShape.getDisplayName());
} else if(value instanceof Stroke) {
icon = new StrokeIcon((Stroke) value, w, h,
value.toString());
} else if(value instanceof CyCustomGraphics) {
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -28,18 +28,21 @@
package org.cytoscape.ding.impl;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Paint;
+import java.awt.TexturePaint;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.cytoscape.ding.DNodeShape;
+import org.cytoscape.ding.Label;
import org.cytoscape.graph.render.stateful.CustomGraphic;
import org.cytoscape.graph.render.stateful.NodeDetails;
import org.cytoscape.util.intr.IntObjHash;
-import org.cytoscape.ding.Label;
-import org.cytoscape.ding.NodeShape;
-import java.awt.*;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
/*
* Access to the methods of this class should be synchronized externally if
* there is a threat of multiple threads.
@@ -149,7 +152,7 @@
* The shape argument must be pre-checked for correctness.
* A negative shape value has the special meaning to remove overridden
shape.
*/
- void overrideShape(int node, NodeShape shape) {
+ void overrideShape(int node, DNodeShape shape) {
// if ((shape < 0) || (shape == super.shape(node)))
// m_shapes.remove(new Integer(node));
// else
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -53,11 +53,11 @@
import javax.imageio.ImageIO;
+import org.cytoscape.ding.DNodeShape;
import org.cytoscape.ding.EdgeView;
import org.cytoscape.ding.GraphView;
import org.cytoscape.ding.GraphViewChangeListener;
import org.cytoscape.ding.Label;
-import org.cytoscape.ding.NodeShape;
import org.cytoscape.ding.NodeView;
import org.cytoscape.ding.ObjectPosition;
import org.cytoscape.ding.customgraphics.CyCustomGraphics;
@@ -74,6 +74,8 @@
import org.cytoscape.view.model.VisualLexiconNode;
import org.cytoscape.view.model.VisualProperty;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
+import org.cytoscape.view.presentation.property.values.NodeShape;
/**
@@ -552,7 +554,7 @@
if (!(Math.max(w, h) < (1.99d * Math.min(w, h)))
&& (getShape() ==
GraphGraphics.SHAPE_ROUNDED_RECTANGLE))
- setShape(NodeShape.RECT);
+ setShape(NodeShapeVisualProperty.RECTANGLE);
graphView.m_contentChanged = true;
@@ -921,7 +923,13 @@
*/
@Override public void setShape(final NodeShape shape) {
synchronized (graphView.m_lock) {
- graphView.m_nodeDetails.overrideShape(m_inx, shape);
+ final DNodeShape dShape;
+ if(NodeShapeVisualProperty.isDefaultShape(shape))
+ dShape = DNodeShape.getDShape(shape);
+ else
+ dShape = (DNodeShape) shape;
+
+ graphView.m_nodeDetails.overrideShape(m_inx, dShape);
graphView.m_contentChanged = true;
}
}
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DVisualLexicon.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DVisualLexicon.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DVisualLexicon.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -44,7 +44,7 @@
import java.util.Set;
import org.cytoscape.ding.ArrowShape;
-import org.cytoscape.ding.NodeShape;
+import org.cytoscape.ding.DNodeShape;
import org.cytoscape.ding.ObjectPosition;
import org.cytoscape.ding.customgraphics.CustomGraphicsManager;
import org.cytoscape.ding.customgraphics.CustomGraphicsRange;
@@ -54,25 +54,30 @@
import org.cytoscape.ding.impl.visualproperty.CustomGraphicsVisualProperty;
import org.cytoscape.ding.impl.visualproperty.FontTwoDVisualProperty;
import org.cytoscape.ding.impl.visualproperty.IntegerTwoDVisualProperty;
-import org.cytoscape.ding.impl.visualproperty.NodeShapeTwoDVisualProperty;
import org.cytoscape.ding.impl.visualproperty.ObjectPositionVisualProperty;
import org.cytoscape.ding.impl.visualproperty.StrokeTwoDVisualProperty;
+import org.cytoscape.graph.render.immed.GraphGraphics;
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
+import org.cytoscape.view.model.DiscreteRange;
import org.cytoscape.view.model.NullDataType;
import org.cytoscape.view.model.VisualProperty;
import org.cytoscape.view.model.Visualizable;
+import org.cytoscape.view.presentation.internal.property.values.NodeShapeImpl;
import org.cytoscape.view.presentation.property.BooleanVisualProperty;
import
org.cytoscape.view.presentation.property.DefaultVisualizableVisualProperty;
import org.cytoscape.view.presentation.property.DoubleVisualProperty;
+import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
import org.cytoscape.view.presentation.property.NullVisualProperty;
import org.cytoscape.view.presentation.property.PaintVisualProperty;
+import org.cytoscape.view.presentation.property.RichVisualLexicon;
import org.cytoscape.view.presentation.property.StringVisualProperty;
-import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
+import org.cytoscape.view.presentation.property.values.NodeShape;
-public class DVisualLexicon extends MinimalVisualLexicon {
+public class DVisualLexicon extends RichVisualLexicon {
private static final int DEF_FONT_SIZE = 12;
private static final double DEF_BORDER_WIDTH = 2.0d;
@@ -94,8 +99,8 @@
Boolean.TRUE, "NETWORK_EDGE_SELECTION", "Network Edge
Selection", CyNetwork.class);
- public static final VisualProperty<NodeShape> NODE_SHAPE = new
NodeShapeTwoDVisualProperty(
- NodeShape.ROUND_RECT, "NODE_SHAPE", "Node Shape");
+// public static final VisualProperty<NodeShape> NODE_SHAPE = new
NodeShapeTwoDVisualProperty(
+// NodeShape.ROUND_RECT, "NODE_SHAPE", "Node Shape");
public static final VisualProperty<Paint> NODE_SELECTED_PAINT = new
PaintVisualProperty(
Color.YELLOW, MinimalVisualLexicon.PAINT_RANGE,
"NODE_SELECTED_PAINT", "Node Selected Paint", CyNode.class);
@@ -260,6 +265,10 @@
ObjectPositionImpl.DEFAULT_POSITION,
"EDGE_LABEL_POSITION",
"Edge Label Position", CyEdge.class);
+
+ // Ding specific node shapes.
+ private static final NodeShape VEE = new
DNodeShape(GraphGraphics.SHAPE_VEE, "V", "VEE");
+
static {
CG_POSITIONS.add(NODE_CUSTOMGRAPHICS_POSITION_1);
CG_POSITIONS.add(NODE_CUSTOMGRAPHICS_POSITION_2);
@@ -306,6 +315,12 @@
public DVisualLexicon(final CustomGraphicsManager manager) {
super(DING_ROOT);
+ // Add new Shapes to the default
+
((DiscreteRange<NodeShape>)NODE_SHAPE.getRange()).addRangeValue(VEE);
+
+ // Add Ding-dependent line types.
+
+
CG_RANGE.setManager(manager);
addVisualProperty(NETWORK_NODE_SELECTION, NETWORK);
@@ -320,7 +335,7 @@
addVisualProperty(NODE_LABEL_POSITION, NODE);
addVisualProperty(NODE_LABEL_FONT_FACE, NODE);
- addVisualProperty(NODE_SHAPE, NODE);
+// addVisualProperty(NODE_SHAPE, NODE);
addVisualProperty(NODE_SELECTED_PAINT, NODE_PAINT);
addVisualProperty(NODE_BORDER_WIDTH, NODE);
addVisualProperty(NODE_BORDER_STROKE, NODE);
@@ -385,7 +400,7 @@
addVisualProperty(EDGE_TOOLTIP, EDGE);
addVisualProperty(EDGE_LABEL_POSITION, EDGE);
addVisualProperty(EDGE_LABEL_FONT_FACE, EDGE);
- addVisualProperty(EDGE_LABEL_FONT_SIZE, EDGE);
+ addVisualProperty(EDGE_LABEL_FONT_SIZE, EDGE);
createLookupMap();
}
Deleted:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/visualproperty/NodeShapeTwoDVisualProperty.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/visualproperty/NodeShapeTwoDVisualProperty.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/visualproperty/NodeShapeTwoDVisualProperty.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -1,100 +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.ding.impl.visualproperty;
-
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-
-import org.cytoscape.ding.NodeShape;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.AbstractVisualProperty;
-import org.cytoscape.view.model.DiscreteRangeImpl;
-import org.cytoscape.view.model.Range;
-
-public class NodeShapeTwoDVisualProperty extends
- AbstractVisualProperty<NodeShape> {
-
- private static final Range<NodeShape> NODE_SHAPE_RANGE;
-
- /** key -> valid_cytoscape_key */
- private static final Map<String, String> shapeKeys = new
Hashtable<String, String>();
-
- static {
- final Set<NodeShape> shapeSet = new HashSet<NodeShape>();
- for (final NodeShape shape : NodeShape.values())
- shapeSet.add(shape);
- NODE_SHAPE_RANGE = new
DiscreteRangeImpl<NodeShape>(NodeShape.class,
- shapeSet);
-
- // Let's be nice and also support regular and Cytoscape XGMML
shapes?
- shapeKeys.put("SQUARE", "RECT");
- shapeKeys.put("RECTANGLE", "RECT");
- shapeKeys.put("BOX", "RECT");
- shapeKeys.put("ROUNDRECT", "ROUND_RECT");
- shapeKeys.put("ROUND_RECTANGLE", "ROUND_RECT");
- shapeKeys.put("RHOMBUS", "PARALLELOGRAM");
- shapeKeys.put("V", "VEE");
- shapeKeys.put("CIRCLE", "ELLIPSE");
- shapeKeys.put("VER_ELLIPSIS", "ELLIPSE");
- shapeKeys.put("HOR_ELLIPSIS", "ELLIPSE");
- }
-
- public NodeShapeTwoDVisualProperty(final NodeShape def, final String id,
- final String name) {
- super(def, NODE_SHAPE_RANGE, id, name, CyNode.class);
- }
-
- public String toSerializableString(final NodeShape value) {
- return value.toString();
- }
-
- public NodeShape parseSerializableString(final String text) {
- NodeShape shape = null;
-
- if (text != null) {
- String key = text.trim().toUpperCase();
- String validKey = shapeKeys.get(key);
-
- if (validKey == null)
- validKey = key;
-
- shape = NodeShape.valueOf(validKey);
- }
-
- return shape;
- }
-}
Modified: core3/presentation-api/trunk/osgi.bnd
===================================================================
--- core3/presentation-api/trunk/osgi.bnd 2011-04-05 00:58:09 UTC (rev
24668)
+++ core3/presentation-api/trunk/osgi.bnd 2011-04-05 02:02:26 UTC (rev
24669)
@@ -3,5 +3,5 @@
#-----------------------------------------------------------------
Import-Package: *
-Export-Package: org.cytoscape.view.presentation,
org.cytoscape.view.presentation.property, org.cytoscape.view.presentation.events
+Export-Package: org.cytoscape.view.presentation,
org.cytoscape.view.presentation.property,
org.cytoscape.view.presentation.events,
org.cytoscape.view.presentation.property.values
Private-Package: org.cytoscape.view.presentation.internal.*
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/LineTypeImpl.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/LineTypeImpl.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/LineTypeImpl.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,19 @@
+package org.cytoscape.view.presentation.internal.property.values;
+
+import org.cytoscape.view.presentation.property.AbstractVisualPropertyValue;
+import org.cytoscape.view.presentation.property.VisualPropertyValue;
+import org.cytoscape.view.presentation.property.values.LineType;
+
+public class LineTypeImpl extends AbstractVisualPropertyValue implements
LineType {
+
+ public LineTypeImpl(String displayName, String serializableString) {
+ super(displayName, serializableString);
+ }
+
+ @Override
+ public VisualPropertyValue parseSerializableString(String
serializableString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/NodeShapeImpl.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/NodeShapeImpl.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/internal/property/values/NodeShapeImpl.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,19 @@
+package org.cytoscape.view.presentation.internal.property.values;
+
+import org.cytoscape.view.presentation.property.AbstractVisualPropertyValue;
+import org.cytoscape.view.presentation.property.VisualPropertyValue;
+import org.cytoscape.view.presentation.property.values.NodeShape;
+
+public class NodeShapeImpl extends AbstractVisualPropertyValue implements
NodeShape {
+
+ public NodeShapeImpl(final String displayName, final String
serializableString) {
+ super(displayName, serializableString);
+ }
+
+ @Override
+ public VisualPropertyValue parseSerializableString(String
serializableString) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualPropertyValue.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualPropertyValue.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualPropertyValue.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,23 @@
+package org.cytoscape.view.presentation.property;
+
+public abstract class AbstractVisualPropertyValue implements
VisualPropertyValue {
+
+ private final String displayName;
+ private final String serializableString;
+
+ public AbstractVisualPropertyValue(final String displayName, final
String serializableString) {
+ this.displayName = displayName;
+ this.serializableString = serializableString;
+ }
+
+ @Override
+ public String getDisplayName() {
+ return this.displayName;
+ }
+
+ @Override
+ public String getSerializableString() {
+ return this.serializableString;
+ }
+
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/LineTypeVisualProperty.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/LineTypeVisualProperty.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/LineTypeVisualProperty.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,60 @@
+package org.cytoscape.view.presentation.property;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.cytoscape.view.model.AbstractVisualProperty;
+import org.cytoscape.view.model.DiscreteRange;
+import org.cytoscape.view.model.DiscreteRangeImpl;
+import org.cytoscape.view.presentation.internal.property.values.LineTypeImpl;
+import org.cytoscape.view.presentation.property.values.LineType;
+
+public class LineTypeVisualProperty extends AbstractVisualProperty<LineType> {
+
+ public static final LineType SOLID = new LineTypeImpl("Solid", "SOLID");
+ public static final LineType LONG_DASH = new LineTypeImpl("Dash",
"LONG_DASH");
+ public static final LineType EQUAL_DASH = new LineTypeImpl("Equal
Dash", "EQUAL_DASH");
+ public static final LineType DASH_DOT = new LineTypeImpl( "Dash Dot",
"DASH_DOT");
+ public static final LineType DOT = new LineTypeImpl("Dots", "DOT");
+// public static final LineType ZIGZAG("zigzag", new ZigzagStroke(1.0f)),
+// public static final LineType SINEWAVE("sinewave", new
SineWaveStroke(1.0f)),
+// public static final LineType VERTICAL_SLASH("vertical_slash",new
VerticalSlashStroke(1.0f,PipeStroke.Type.VERTICAL)),
+// public static final LineType FORWARD_SLASH("forward_slash",new
ForwardSlashStroke(1.0f,PipeStroke.Type.FORWARD)),
+// public static final LineType BACKWARD_SLASH("backward_slash",new
BackwardSlashStroke(1.0f,PipeStroke.Type.BACKWARD)),
+// public static final LineType PARALLEL_LINES("parallel_lines", new
ParallelStroke(1.0f)),
+// public static final LineType CONTIGUOUS_ARROW("contiguous_arrow", new
ContiguousArrowStroke(1.0f)),
+// public static final LineType SEPARATE_ARROW("separate_arrow", new
SeparateArrowStroke(1.0f));
+
+ private static DiscreteRange<LineType> LINE_TYPE_RANGE;
+ private static final Set<LineType> lineTypes;
+
+ static {
+ lineTypes = new HashSet<LineType>();
+
+ lineTypes.add(SOLID);
+ lineTypes.add(LONG_DASH);
+ lineTypes.add(EQUAL_DASH);
+ lineTypes.add(DASH_DOT);
+ lineTypes.add(DOT);
+
+ LINE_TYPE_RANGE = new
DiscreteRangeImpl<LineType>(LineType.class, new HashSet<LineType>(lineTypes));
+ }
+
+ public LineTypeVisualProperty(LineType defaultValue,
+ String id, String displayName, Class<?>
targetObjectDataType) {
+ super(defaultValue, LINE_TYPE_RANGE, id, displayName,
targetObjectDataType);
+ }
+
+ @Override
+ public String toSerializableString(LineType value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public LineType parseSerializableString(String value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/NodeShapeVisualProperty.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/NodeShapeVisualProperty.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/NodeShapeVisualProperty.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,65 @@
+package org.cytoscape.view.presentation.property;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.cytoscape.view.model.AbstractVisualProperty;
+import org.cytoscape.view.model.DiscreteRange;
+import org.cytoscape.view.model.DiscreteRangeImpl;
+import org.cytoscape.view.presentation.internal.property.values.NodeShapeImpl;
+import org.cytoscape.view.presentation.property.values.NodeShape;
+
+public final class NodeShapeVisualProperty extends
AbstractVisualProperty<NodeShape> {
+
+ // Presets
+ public static final NodeShape RECTANGLE = new
NodeShapeImpl("Rectangle", "RECTANGLE");
+ public static final NodeShape ROUND_RECTANGLE = new
NodeShapeImpl("Round Rectangle", "ROUND_RECTANGLE");
+ public static final NodeShape TRIANGLE = new NodeShapeImpl("Triangle",
"TRIANGLE");
+ public static final NodeShape PARALLELOGRAM = new
NodeShapeImpl("Parallelogram", "PARALLELOGRAM");
+ public static final NodeShape DIAMOND = new NodeShapeImpl("Diamond",
"DIAMOND");
+ public static final NodeShape ELLIPSE = new NodeShapeImpl("Ellipse",
"ELLIPSE");
+ public static final NodeShape HEXAGON = new NodeShapeImpl("Hexagon",
"HEXAGON");
+ public static final NodeShape OCTAGON = new NodeShapeImpl("Octagon",
"OCTAGON");
+
+ private static final DiscreteRange<NodeShape> NODE_SHAPE_RANGE;
+
+ private static final Set<NodeShape> DEFAULT_SHAPES;
+
+ static {
+ DEFAULT_SHAPES = new HashSet<NodeShape>();
+ DEFAULT_SHAPES.add(RECTANGLE);
+ DEFAULT_SHAPES.add(ROUND_RECTANGLE);
+ DEFAULT_SHAPES.add(TRIANGLE);
+ DEFAULT_SHAPES.add(PARALLELOGRAM);
+ DEFAULT_SHAPES.add(DIAMOND);
+ DEFAULT_SHAPES.add(ELLIPSE);
+ DEFAULT_SHAPES.add(HEXAGON);
+ DEFAULT_SHAPES.add(OCTAGON);
+
+ NODE_SHAPE_RANGE = new
DiscreteRangeImpl<NodeShape>(NodeShape.class, new
HashSet<NodeShape>(DEFAULT_SHAPES));
+ }
+
+ public NodeShapeVisualProperty(NodeShape defaultValue, String id,
+ String displayName, Class<?> targetObjectDataType) {
+ super(defaultValue, NODE_SHAPE_RANGE, id, displayName,
+ targetObjectDataType);
+ }
+
+ @Override
+ public String toSerializableString(NodeShape value) {
+ return value.getSerializableString();
+ }
+
+ @Override
+ public NodeShape parseSerializableString(String value) {
+ // TODO
+ return null;
+ }
+
+ public static boolean isDefaultShape(final NodeShape shape) {
+ if(DEFAULT_SHAPES.contains(shape))
+ return true;
+ else
+ return false;
+ }
+}
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/RichVisualLexicon.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/RichVisualLexicon.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/RichVisualLexicon.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -4,6 +4,7 @@
import org.cytoscape.model.CyNode;
import org.cytoscape.view.model.NullDataType;
import org.cytoscape.view.model.VisualProperty;
+import org.cytoscape.view.presentation.property.values.NodeShape;
/**
* Minimal set of Visual Properties for 3D rendering engines.
@@ -11,6 +12,7 @@
*/
public class RichVisualLexicon extends MinimalVisualLexicon {
+ // 3D-related props
public static final VisualProperty<Double> NODE_Z_LOCATION = new
DoubleVisualProperty(
0.0, ARBITRARY_DOUBLE_RANGE, "NODE_Z_LOCATION", "Node Z
Location", true, CyNode.class);
@@ -22,6 +24,10 @@
public static final VisualProperty<Double> NETWORK_DEPTH = new
DoubleVisualProperty(
0.0, NONE_ZERO_POSITIVE_DOUBLE_RANGE, "NETWORK_DEPTH",
"Network Depth", CyNetwork.class);
+
+
+ public static final VisualProperty<NodeShape> NODE_SHAPE = new
NodeShapeVisualProperty(
+ NodeShapeVisualProperty.RECTANGLE, "NODE_SHAPE", "Node
Shape", CyNode.class);
/**
* Construct a {@linkplain VisalLexicon} for 3D rendering engine.
@@ -37,6 +43,8 @@
addVisualProperty(NETWORK_CENTER_Z_LOCATION, NETWORK);
addVisualProperty(NETWORK_DEPTH, NETWORK_SIZE);
+
+ addVisualProperty(NODE_SHAPE, NODE);
}
}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/VisualPropertyValue.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/VisualPropertyValue.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/VisualPropertyValue.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,9 @@
+package org.cytoscape.view.presentation.property;
+
+
+public interface VisualPropertyValue {
+ String getDisplayName();
+
+ String getSerializableString();
+ VisualPropertyValue parseSerializableString(final String
serializableString);
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/LineType.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/LineType.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/LineType.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,6 @@
+package org.cytoscape.view.presentation.property.values;
+
+import org.cytoscape.view.presentation.property.VisualPropertyValue;
+
+public interface LineType extends VisualPropertyValue {
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/NodeShape.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/NodeShape.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/values/NodeShape.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -0,0 +1,7 @@
+package org.cytoscape.view.presentation.property.values;
+
+import org.cytoscape.view.presentation.property.VisualPropertyValue;
+
+public interface NodeShape extends VisualPropertyValue {
+
+}
Modified:
core3/presentation-api/trunk/src/test/java/org/cytoscape/view/presentation/RichVisualLexiconTest.java
===================================================================
---
core3/presentation-api/trunk/src/test/java/org/cytoscape/view/presentation/RichVisualLexiconTest.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/presentation-api/trunk/src/test/java/org/cytoscape/view/presentation/RichVisualLexiconTest.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -33,7 +33,7 @@
@Test
public void test2DLexicon() throws Exception {
- assertEquals(33, richLex.getAllVisualProperties().size());
+ assertEquals(34, richLex.getAllVisualProperties().size());
}
@Test
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRange.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRange.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRange.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -13,4 +13,12 @@
*
*/
Set<T> values();
+
+
+ /**
+ * Add a new range value.
+ *
+ * @param newValue new range value.
+ */
+ void addRangeValue(T newValue);
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRangeImpl.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRangeImpl.java
2011-04-05 00:58:09 UTC (rev 24668)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DiscreteRangeImpl.java
2011-04-05 02:02:26 UTC (rev 24669)
@@ -1,5 +1,6 @@
package org.cytoscape.view.model;
+import java.util.Collections;
import java.util.Set;
public final class DiscreteRangeImpl<T> implements DiscreteRange<T> {
@@ -24,7 +25,13 @@
@Override
public Set<T> values() {
- return values;
+ // This is immutable to prevent add/remove operation by 3rd
party developers.
+ return Collections.unmodifiableSet(values);
}
+ @Override
+ public void addRangeValue(final T newValue) {
+ values.add(newValue);
+ }
+
}
--
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.