Author: scooter
Date: 2012-09-11 08:51:21 -0700 (Tue, 11 Sep 2012)
New Revision: 30342
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/AbstractDCustomGraphics.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsPropertyImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/NullCustomGraphics.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/ImageCustomGraphicImpl.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/URLImageCustomGraphics.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientLayerCustomGraphics.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientOvalLayer.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientRoundRectangleLayer.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/PaintCustomGraphic.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphicsmgr/internal/PersistImageTask.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsPositionCalculator.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/immed/GraphGraphics.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/GraphRenderer.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/NodeDetails.java
Log:
Continuing evolution. Turns out that deserialization was never implemented for
anything other than URLImages, so lots of work still to be done before hooking
this up for outsize users....
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/AbstractDCustomGraphics.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/AbstractDCustomGraphics.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/AbstractDCustomGraphics.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -8,9 +8,9 @@
import java.util.TreeSet;
import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
-public abstract class AbstractDCustomGraphics<T extends CustomGraphic>
implements
+public abstract class AbstractDCustomGraphics<T extends CustomGraphicLayer>
implements
CyCustomGraphics<T>, Taggable {
protected static final String DELIMITER = ",";
@@ -98,7 +98,7 @@
// This will be used prop file.
- public String toString() {
+ public String toSerializableString() {
String tagStr = "";
// Build tags as a string
if (tags.size() != 0) {
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsPropertyImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsPropertyImpl.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/CustomGraphicsPropertyImpl.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -2,10 +2,7 @@
import org.cytoscape.ding.customgraphics.vector.CustomGraphicsProperty;
-import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics;
-
-public class CustomGraphicsPropertyImpl<T> implements
- CustomGraphicsProperty<T> {
+public class CustomGraphicsPropertyImpl<T> implements
CustomGraphicsProperty<T> {
private T value;
private final T defaultValue;
@@ -15,20 +12,14 @@
this.value = defaultValue;
}
-
-
public T getDefaultValue() {
return defaultValue;
}
-
-
public T getValue() {
return value;
}
-
-
public void setValue(Object value) {
if(this.value.getClass().isAssignableFrom(value.getClass()) ==
false)
throw new IllegalArgumentException("The value type is
not compatible.");
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/NullCustomGraphics.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/NullCustomGraphics.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/NullCustomGraphics.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -9,14 +9,14 @@
import org.cytoscape.ding.customgraphics.bitmap.URLImageCustomGraphics;
import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
/**
* Null object for Custom Graphics. This is used to reset custom graphics on
* node views.
*
*/
-public class NullCustomGraphics extends AbstractDCustomGraphics<CustomGraphic>
{
+public class NullCustomGraphics extends
AbstractDCustomGraphics<CustomGraphicLayer> {
private static final String DEF_IMAGE_FILE = "images/no_image.png";
public static BufferedImage DEF_IMAGE;
@@ -30,9 +30,9 @@
}
}
- static final CyCustomGraphics<CustomGraphic> NULL = new
NullCustomGraphics();
+ static final CyCustomGraphics<CustomGraphicLayer> NULL = new
NullCustomGraphics();
- public static CyCustomGraphics<CustomGraphic> getNullObject() {
+ public static CyCustomGraphics<CustomGraphicLayer> getNullObject() {
return NULL;
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/ImageCustomGraphicImpl.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/ImageCustomGraphicImpl.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/ImageCustomGraphicImpl.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -7,11 +7,11 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
-import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
+import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphicLayer;
import org.cytoscape.ding.customgraphics.paint.TexturePaintFactory;
-public class ImageCustomGraphicImpl implements ImageCustomGraphic {
+public class ImageCustomGraphicImpl implements ImageCustomGraphicLayer {
private Rectangle2D bounds;
private TexturePaintFactory pf;
@@ -30,7 +30,7 @@
return pf.getPaint(bounds);
}
- public CustomGraphic transform(AffineTransform xform) {
+ public CustomGraphicLayer transform(AffineTransform xform) {
Shape s = xform.createTransformedShape(bounds);
return new ImageCustomGraphicImpl(s.getBounds2D(), pf);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/URLImageCustomGraphics.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/URLImageCustomGraphics.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/bitmap/URLImageCustomGraphics.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -15,9 +15,9 @@
import org.cytoscape.ding.customgraphics.bitmap.ImageCustomGraphicImpl;
import org.cytoscape.ding.customgraphics.paint.TexturePaintFactory;
import org.cytoscape.graph.render.stateful.PaintFactory;
-import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphicLayer;
-public class URLImageCustomGraphics <ImageCustomGraphic>
+public class URLImageCustomGraphics <ImageCustomGraphicLayer>
extends AbstractDCustomGraphics {
private static final String DEF_IMAGE_FILE = "images/no_image.png";
@@ -34,7 +34,7 @@
private static final String DEF_TAG = "bitmap image";
- private ImageCustomGraphic icg;
+ private ImageCustomGraphicLayer icg;
private BufferedImage originalImage;
private BufferedImage scaledImage;
@@ -144,4 +144,14 @@
return this.sourceUrl;
}
+ @Override
+ public String toString() {
+ if (this.sourceUrl == null && displayName == null) {
+ return "Empty image";
+ } else if (this.sourceUrl != null) {
+ return "Image: "+this.sourceUrl.toString();
+ } else
+ return "Image: "+displayName;
+ }
+
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientLayerCustomGraphics.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientLayerCustomGraphics.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientLayerCustomGraphics.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -26,6 +26,9 @@
// Shape of this paint
protected Shape shape;
+
+ // User-visible name of this graphic
+ private final String NAME;
private static final float FIT = 0.9f;
@@ -49,6 +52,7 @@
public GradientLayerCustomGraphics(final Long id, final String name) {
super(id, name);
+ NAME = name;
width = DEF_W;
height = DEF_H;
props = new HashMap<String, CustomGraphicsProperty<?>>();
@@ -89,4 +93,8 @@
return rendered;
}
+
+ public String toString() {
+ return NAME;
+ }
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientOvalLayer.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientOvalLayer.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientOvalLayer.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -5,12 +5,12 @@
import java.awt.geom.Ellipse2D;
import org.cytoscape.ding.customgraphics.paint.GradientPaintFactory;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
public class GradientOvalLayer extends GradientLayerCustomGraphics {
// Name of this custom graphics.
- private static final String NAME = "Glossy Oval Layer";
+ private static final String NAME = "Oval Gradient";
public GradientOvalLayer(final Long id) {
@@ -33,7 +33,7 @@
layers.clear();
shape = new Ellipse2D.Double(-width / 2, -height / 2, width,
height);
paintFactory = new GradientPaintFactory(c1.getValue(),
c2.getValue());
- final CustomGraphic cg = new PaintCustomGraphic(shape,
paintFactory);
+ final CustomGraphicLayer cg = new PaintCustomGraphic(shape,
paintFactory);
layers.add(cg);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientRoundRectangleLayer.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientRoundRectangleLayer.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/GradientRoundRectangleLayer.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -5,12 +5,12 @@
import java.awt.geom.RoundRectangle2D;
import org.cytoscape.ding.customgraphics.paint.GradientPaintFactory;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
public class GradientRoundRectangleLayer extends GradientLayerCustomGraphics {
// Name of this custom graphics.
- private static final String NAME = "Glossy Round Rectangle Layer";
+ private static final String NAME = "Round Rectangle Gradient";
private int r =20;
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/PaintCustomGraphic.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/PaintCustomGraphic.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphics/vector/PaintCustomGraphic.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -7,7 +7,7 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import org.cytoscape.view.presentation.customgraphics.PaintedShape;
import org.cytoscape.graph.render.stateful.PaintFactory;
@@ -37,7 +37,7 @@
public Stroke getStroke() { return null; }
public Paint getStrokePaint() { return null; }
- public CustomGraphic transform(AffineTransform xform) {
+ public CustomGraphicLayer transform(AffineTransform xform) {
Shape s = xform.createTransformedShape(shape);
return new PaintCustomGraphic(s, pf);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphicsmgr/internal/PersistImageTask.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphicsmgr/internal/PersistImageTask.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/customgraphicsmgr/internal/PersistImageTask.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -67,6 +67,7 @@
for (final CyCustomGraphics<?> cg :
manager.getAllCustomGraphics()) {
// Save ONLY bitmap image Custom Graphics.
+ // TODO: Why?
if (cg instanceof NullCustomGraphics
|| cg instanceof URLImageCustomGraphics
== false)
continue;
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -50,7 +50,7 @@
import org.cytoscape.model.CyNode;
import org.cytoscape.view.model.View;
import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import org.cytoscape.view.presentation.property.values.LineType;
import org.cytoscape.view.presentation.property.values.NodeShape;
@@ -87,7 +87,7 @@
Map<CyNode, Double> m_labelOffsetXs = new WeakHashMap<CyNode, Double>();
Map<CyNode, Double> m_labelOffsetYs = new WeakHashMap<CyNode, Double>();
Map<CyNode, Double> m_width = new WeakHashMap<CyNode, Double>();
- Map<CyNode, List<CustomGraphic>> m_customGraphics = new
WeakHashMap<CyNode, List<CustomGraphic>>();
+ Map<CyNode, List<CustomGraphicLayer>> m_customGraphics = new
WeakHashMap<CyNode, List<CustomGraphicLayer>>();
Map<CyNode, Integer> m_nodeTansparencies = new WeakHashMap<CyNode,
Integer>();
Map<CyNode, Integer> m_nodeBorderTansparencies = new
WeakHashMap<CyNode, Integer>();
Map<CyNode, Integer> m_nodeLabelTansparencies = new WeakHashMap<CyNode,
Integer>();
@@ -149,7 +149,7 @@
m_labelOffsetYs = new WeakHashMap<CyNode, Double>();
m_width = new WeakHashMap<CyNode, Double>();
m_selectedPaints = new WeakHashMap<CyNode, Paint>();
- m_customGraphics = new WeakHashMap<CyNode,
List<CustomGraphic>>();
+ m_customGraphics = new WeakHashMap<CyNode,
List<CustomGraphicLayer>>();
this.m_nodeTansparencies = new WeakHashMap<CyNode, Integer>();
this.m_nodeBorderTansparencies = new WeakHashMap<CyNode,
Integer>();
this.m_nodeLabelTansparencies = new WeakHashMap<CyNode,
Integer>();
@@ -679,7 +679,7 @@
}
@Override
- public Iterator<CustomGraphic> customGraphics(final CyNode node) {
+ public Iterator<CustomGraphicLayer> customGraphics(final CyNode node) {
final DNodeView dnv = (DNodeView) dGraphView.getDNodeView(node);
return dnv.customGraphicIterator();
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeView.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -60,7 +60,7 @@
import org.cytoscape.ding.NodeView;
import org.cytoscape.ding.ObjectPosition;
import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import org.cytoscape.ding.customgraphics.NullCustomGraphics;
import org.cytoscape.ding.customgraphics.vector.VectorCustomGraphics;
import org.cytoscape.ding.impl.customgraphics.CustomGraphicsPositionCalculator;
@@ -85,7 +85,7 @@
*/
public class DNodeView extends AbstractDViewModel<CyNode> implements NodeView,
Label {
- private final static Set<CustomGraphic> EMPTY_CUSTOM_GRAPHICS = new
LinkedHashSet<CustomGraphic>(0);
+ private final static Set<CustomGraphicLayer> EMPTY_CUSTOM_GRAPHICS =
new LinkedHashSet<CustomGraphicLayer>(0);
// Affects size of the nested network image relative to the node size:
private static final float NESTED_IMAGE_SCALE_FACTOR = 0.6f;
@@ -157,7 +157,7 @@
// custom graphics is important. For space considerations, we
// keep _customGraphics null when there are no custom
// graphics--event though this is a bit more complicated:
- private LinkedHashSet<CustomGraphic> orderedCustomGraphicLayers;
+ private LinkedHashSet<CustomGraphicLayer> orderedCustomGraphicLayers;
// CG_LOCK is used for synchronizing custom graphics operations on this
// DNodeView.
@@ -166,12 +166,12 @@
// object assuming it takes up the least amount of memory:
private final Object[] CG_LOCK = new Object[0];
- // Map from NodeCustomGraphics Visual Property to native CustomGraphics
+ // Map from NodeCustomGraphics Visual Property to native
CustomGraphicLayers
// objects.
- private final Map<VisualProperty<?>, Set<CustomGraphic>> cgMap;
+ private final Map<VisualProperty<?>, Set<CustomGraphicLayer>> cgMap;
// Locations of Custom Graphics
- private Map<CustomGraphic, ObjectPosition> graphicsPositions;
+ private Map<CustomGraphicLayer, ObjectPosition> graphicsPositions;
// Label position
private ObjectPosition labelPosition;
@@ -199,7 +199,7 @@
this.netViewMgr = netViewMgr;
// Initialize custom graphics pool.
- cgMap = new HashMap<VisualProperty<?>, Set<CustomGraphic>>();
+ cgMap = new HashMap<VisualProperty<?>,
Set<CustomGraphicLayer>>();
this.graphView = graphView;
}
@@ -734,33 +734,33 @@
}
/**
- * Adds a given CustomGraphic, <EM>in draw order</EM>, to this
DNodeView in
- * a thread-safe way. Each CustomGraphic will be drawn in the order is
was
+ * Adds a given CustomGraphicLayer, <EM>in draw order</EM>, to this
DNodeView in
+ * a thread-safe way. Each CustomGraphicLayer will be drawn in the
order is was
* added. So, if you care about draw order (as for overlapping
graphics),
* make sure you add them in the order you desire. Note that since
- * CustomGraphics may be added by multiple apps, your additions may be
+ * CustomGraphicLayers may be added by multiple apps, your additions
may be
* interleaved with others.
*
* <P>
- * A CustomGraphic can only be associated with a DNodeView once. If you
wish
+ * A CustomGraphicLayer can only be associated with a DNodeView once.
If you wish
* to have a custom graphic, with the same paint and shape information,
* occur in multiple places in the draw order, simply create a new
- * CustomGraphic and add it.
+ * CustomGraphicLayer and add it.
*
* @since Cytoscape 2.6
* @throws IllegalArgumentException
* if shape or paint are null.
- * @return true if the CustomGraphic was added to this DNodeView. false
if
- * this DNodeView already contained this CustomGraphic.
- * @see org.cytoscape.graph.render.stateful.CustomGraphic
+ * @return true if the CustomGraphicLayer was added to this DNodeView.
false if
+ * this DNodeView already contained this CustomGraphicLayer.
+ * @see
org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer
*/
- public boolean addCustomGraphic(final CustomGraphic cg) {
+ public boolean addCustomGraphic(final CustomGraphicLayer cg) {
boolean retVal = false;
synchronized (CG_LOCK) {
// Lazy instantiation
if (orderedCustomGraphicLayers == null) {
- orderedCustomGraphicLayers = new
LinkedHashSet<CustomGraphic>();
- graphicsPositions = new HashMap<CustomGraphic,
ObjectPosition>();
+ orderedCustomGraphicLayers = new
LinkedHashSet<CustomGraphicLayer>();
+ graphicsPositions = new
HashMap<CustomGraphicLayer, ObjectPosition>();
}
if (orderedCustomGraphicLayers.contains(cg))
@@ -777,10 +777,10 @@
* graphic.
*
* @param cg
- * the CustomGraphic for which we are checking containment.
+ * the CustomGraphicLayer for which we are checking
containment.
* @since Cytoscape 2.6
*/
- public boolean containsCustomGraphic(final CustomGraphic cg) {
+ public boolean containsCustomGraphic(final CustomGraphicLayer cg) {
synchronized (CG_LOCK) {
if (orderedCustomGraphicLayers == null)
return false;
@@ -789,25 +789,25 @@
}
/**
- * Return a read-only Iterator over all CustomGraphics contained
- * in this DNodeView. The Iterator will return each CustomGraphic in
draw
+ * Return a read-only Iterator over all CustomGraphicLayers contained
+ * in this DNodeView. The Iterator will return each CustomGraphicLayer
in draw
* order. The Iterator cannot be used to modify the underlying set of
- * CustomGraphics.
+ * CustomGraphicLayers.
*
- * @return The CustomGraphics Iterator. If no CustomGraphics are
associated
+ * @return The CustomGraphicLayers Iterator. If no CustomGraphicLayers
are associated
* with this DNOdeView, null is returned.
* @throws UnsupportedOperationException
* if an attempt is made to use the Iterator's remove()
method.
*/
- public Iterator<CustomGraphic> customGraphicIterator() {
+ public Iterator<CustomGraphicLayer> customGraphicIterator() {
synchronized (CG_LOCK) {
- final Set<CustomGraphic> toIterate;
+ final Set<CustomGraphicLayer> toIterate;
if (orderedCustomGraphicLayers == null)
toIterate = EMPTY_CUSTOM_GRAPHICS;
else
toIterate = orderedCustomGraphicLayers;
- return new ReadOnlyIterator<CustomGraphic>(toIterate);
+ return new
ReadOnlyIterator<CustomGraphicLayer>(toIterate);
}
}
@@ -820,7 +820,7 @@
* DNodeView.
* @since Cytoscape 2.6
*/
- public boolean removeCustomGraphic(CustomGraphic cg) {
+ public boolean removeCustomGraphic(CustomGraphicLayer cg) {
boolean retVal = false;
synchronized (CG_LOCK) {
if (orderedCustomGraphicLayers != null) {
@@ -1035,14 +1035,14 @@
}
}
- private CustomGraphic moveCustomGraphicsToNewPosition(final
CustomGraphic cg, final ObjectPosition newPosition) {
+ private CustomGraphicLayer moveCustomGraphicsToNewPosition(final
CustomGraphicLayer cg, final ObjectPosition newPosition) {
if (cg == null || newPosition == null)
- throw new NullPointerException("CustomGraphic and
Position cannot be null.");
+ throw new NullPointerException("CustomGraphicLayer and
Position cannot be null.");
removeCustomGraphic(cg);
// Create new graphics
- final CustomGraphic newCg =
CustomGraphicsPositionCalculator.transform(newPosition, this, cg);
+ final CustomGraphicLayer newCg =
CustomGraphicsPositionCalculator.transform(newPosition, this, cg);
this.addCustomGraphic(newCg);
graphicsPositions.put(newCg, newPosition);
@@ -1120,19 +1120,19 @@
} else if (vp == DVisualLexicon.NODE_LABEL_POSITION) {
this.setLabelPosition((ObjectPosition) value);
} else if (vp instanceof CustomGraphicsVisualProperty) {
- applyCustomGraphics(vp,
(CyCustomGraphics<CustomGraphic>) value);
+ applyCustomGraphics(vp,
(CyCustomGraphics<CustomGraphicLayer>) value);
} else if (vp instanceof ObjectPositionVisualProperty) {
applyCustomGraphicsPosition(vp, (ObjectPosition) value);
}
}
- private void applyCustomGraphics(final VisualProperty<?> vp, final
CyCustomGraphics<CustomGraphic> customGraphics) {
- Set<CustomGraphic> dCustomGraphicsSet = cgMap.get(vp);
+ private void applyCustomGraphics(final VisualProperty<?> vp, final
CyCustomGraphics<CustomGraphicLayer> customGraphics) {
+ Set<CustomGraphicLayer> dCustomGraphicsSet = cgMap.get(vp);
if (dCustomGraphicsSet == null)
- dCustomGraphicsSet = new HashSet<CustomGraphic>();
+ dCustomGraphicsSet = new HashSet<CustomGraphicLayer>();
- for (final CustomGraphic cg : dCustomGraphicsSet)
+ for (final CustomGraphicLayer cg : dCustomGraphicsSet)
removeCustomGraphic(cg);
dCustomGraphicsSet.clear();
@@ -1140,7 +1140,7 @@
if (customGraphics == null || customGraphics instanceof
NullCustomGraphics)
return;
- final List<CustomGraphic> layers = customGraphics.getLayers();
+ final List<CustomGraphicLayer> layers =
customGraphics.getLayers();
// No need to update
if (layers == null || layers.size() == 0)
@@ -1162,9 +1162,9 @@
final ObjectPosition positionValue =
getVisualProperty(cgPositionVP);
final Double customSize = getVisualProperty(cgSizeVP);
- for (CustomGraphic newCG : layers) {
+ for (CustomGraphicLayer newCG : layers) {
// Assume it's a Ding layer
- CustomGraphic finalCG = newCG;
+ CustomGraphicLayer finalCG = newCG;
if (sync) {
// Size is locked to node size.
@@ -1202,14 +1202,14 @@
if (parent == null)
throw new NullPointerException("Associated Custom
Graphics VP is missing for " + vp.getDisplayName());
- final Set<CustomGraphic> currentCG = cgMap.get(parent);
+ final Set<CustomGraphicLayer> currentCG = cgMap.get(parent);
if (currentCG == null || currentCG.size() == 0)
return;
- final Set<CustomGraphic> newList = new HashSet<CustomGraphic>();
+ final Set<CustomGraphicLayer> newList = new
HashSet<CustomGraphicLayer>();
- for (CustomGraphic g : currentCG)
+ for (CustomGraphicLayer g : currentCG)
newList.add(moveCustomGraphicsToNewPosition(g,
position));
currentCG.clear();
@@ -1218,8 +1218,8 @@
this.cgMap.put(parent, currentCG);
}
- private CustomGraphic syncSize(CyCustomGraphics<?> graphics,
- final CustomGraphic cg, double width,
double height) {
+ private CustomGraphicLayer
syncSize(CyCustomGraphics<CustomGraphicLayer> graphics,
+ final CustomGraphicLayer cg, double
width, double height) {
// final double nodeW = this.getWidth();
// final double nodeH = this.getHeight();
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsPositionCalculator.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsPositionCalculator.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/customgraphics/CustomGraphicsPositionCalculator.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -8,7 +8,7 @@
import org.cytoscape.ding.ObjectPosition;
import org.cytoscape.ding.Position;
import org.cytoscape.ding.impl.DNodeView;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import org.cytoscape.graph.render.stateful.PaintFactory;
public class CustomGraphicsPositionCalculator {
@@ -45,7 +45,7 @@
* @param cg
* @return
*/
- public static CustomGraphic transform(final ObjectPosition p, final
DNodeView nv, final CustomGraphic cg) {
+ public static CustomGraphicLayer transform(final ObjectPosition p,
final DNodeView nv, final CustomGraphicLayer cg) {
final Position anc = p.getAnchor();
final Position ancN = p.getTargetAnchor();
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -3,25 +3,25 @@
import org.cytoscape.ding.DummyCustomGraphics;
import org.cytoscape.ding.customgraphics.CustomGraphicsRange;
import org.cytoscape.view.presentation.customgraphics.CyCustomGraphics;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import org.cytoscape.ding.customgraphics.NullCustomGraphics;
import org.cytoscape.model.CyIdentifiable;
import org.cytoscape.view.model.AbstractVisualProperty;
public class CustomGraphicsVisualProperty extends
AbstractVisualProperty<CyCustomGraphics> {
- public CustomGraphicsVisualProperty(final
CyCustomGraphics<CustomGraphic> defaultValue,
+ public CustomGraphicsVisualProperty(final
CyCustomGraphics<CustomGraphicLayer> defaultValue,
final CustomGraphicsRange customGraphicsRange, String
id, String displayName, Class<? extends CyIdentifiable> targetObjectDataType) {
super(defaultValue, customGraphicsRange, id, displayName,
targetObjectDataType);
}
@Override
public String toSerializableString(final CyCustomGraphics value) {
- return value.toString();
+ return value.toSerializableString();
}
@Override
- public CyCustomGraphics<CustomGraphic> parseSerializableString(String
value) {
+ public CyCustomGraphics<CustomGraphicLayer>
parseSerializableString(String value) {
// Return dummy if something is assigned. This should be
replaced after loading session.
if(NullCustomGraphics.getNullObject().toString().equals(value)
|| value.contains("NullCustomGraphics")) {
return NullCustomGraphics.getNullObject();
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/immed/GraphGraphics.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/immed/GraphGraphics.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/immed/GraphGraphics.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -61,8 +61,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
-import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
+import org.cytoscape.view.presentation.customgraphics.ImageCustomGraphicLayer;
import org.cytoscape.view.presentation.customgraphics.PaintedShape;
import org.cytoscape.graph.render.immed.arrow.Arrow;
@@ -2028,7 +2028,7 @@
* previously.
*
* @param cg
- * the CustomGraphic
+ * the CustomGraphicLayer
* @param xOffset
* in node coordinates, a value to add to the X coordinates
of
* the shape's definition.
@@ -2036,7 +2036,7 @@
* in node coordinates, a value to add to the Y coordinates
of
* the shape's definition.
*/
- public final void drawCustomGraphicFull(final CustomGraphic cg,
+ public final void drawCustomGraphicFull(final CustomGraphicLayer cg,
final float xOffset, final
float yOffset) {
if (m_debug) {
checkDispatchThread();
@@ -2057,9 +2057,9 @@
}
m_g2d.setPaint(ps.getPaint());
m_g2d.fill(shape);
- } else if(cg instanceof ImageCustomGraphic) {
+ } else if(cg instanceof ImageCustomGraphicLayer) {
Rectangle bounds = cg.getBounds();
- final BufferedImage bImg =
((ImageCustomGraphic)cg).getPaint(bounds).getImage();
+ final BufferedImage bImg =
((ImageCustomGraphicLayer)cg).getPaint(bounds).getImage();
m_g2d.drawImage(bImg, bounds.x, bounds.y, bounds.width,
bounds.height, null);
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/GraphRenderer.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/GraphRenderer.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/GraphRenderer.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -44,7 +44,7 @@
import org.cytoscape.spacial.SpacialEntry2DEnumerator;
import org.cytoscape.spacial.SpacialIndex2D;
import org.cytoscape.util.intr.LongHash;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
/**
@@ -1086,11 +1086,11 @@
// draw custom graphics on top of nested networks
// don't allow our custom graphics to mutate while we
iterate over them:
synchronized (nodeDetails.customGraphicsLock(cyNode)) {
- // This iterator will return CustomGraphics in
rendering order:
- Iterator<CustomGraphic> dNodeIt =
nodeDetails.customGraphics(cyNode);
- CustomGraphic cg = null;
+ // This iterator will return
CustomGraphicLayers in rendering order:
+ Iterator<CustomGraphicLayer> dNodeIt =
nodeDetails.customGraphics(cyNode);
+ CustomGraphicLayer cg = null;
// The graphic index used to retrieve non
custom graphic info corresponds to the zero-based
- // index of the CustomGraphic returned by the
iterator:
+ // index of the CustomGraphicLayer returned by
the iterator:
int graphicInx = 0;
while (dNodeIt.hasNext()) {
cg = dNodeIt.next();
@@ -1101,8 +1101,6 @@
doubleBuff1[2] = floatBuff1[2];
doubleBuff1[3] = floatBuff1[3];
lemma_computeAnchor(NodeDetails.ANCHOR_CENTER, doubleBuff1, doubleBuff2);
-
//grafx.drawCustomGraphicFull(cg.getShape(), (float) (doubleBuff2[0] +
offsetVectorX), (float) (doubleBuff2[1] + offsetVectorY),
- //
cg.getPaint());
grafx.drawCustomGraphicFull(cg, (float)
(doubleBuff2[0] + offsetVectorX),
(float)
(doubleBuff2[1] + offsetVectorY));
graphicInx++;
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/NodeDetails.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/NodeDetails.java
2012-09-11 15:49:41 UTC (rev 30341)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/graph/render/stateful/NodeDetails.java
2012-09-11 15:51:21 UTC (rev 30342)
@@ -29,7 +29,7 @@
import org.cytoscape.graph.render.immed.GraphGraphics;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.presentation.customgraphics.CustomGraphic;
+import org.cytoscape.view.presentation.customgraphics.CustomGraphicLayer;
import java.awt.BasicStroke;
import java.awt.Color;
@@ -422,13 +422,13 @@
}
/**
- * Return a non-null, read-only Iterator over all CustomGraphics
contained
- * in this Node. The Iterator will return each CustomGraphic in draw
order.
+ * Return a non-null, read-only Iterator over all CustomGraphicLayers
contained
+ * in this Node. The Iterator will return each CustomGraphicLayer in
draw order.
* The Iterator cannot be used to modify the underlying set of
- * CustomGraphics. NOTE: This method should be abstract, but since it
isn't,
+ * CustomGraphicLayers. NOTE: This method should be abstract, but since
it isn't,
* any real use should override this method in a subclass.
*
- * @return The CustomGraphics Iterator. If no CustomGraphics are
associated
+ * @return The CustomGraphicLayers Iterator. If no CustomGraphicLayers
are associated
* with this Node, an empty Iterator is returned.
* @throws UnsupportedOperationException
* if an attempt is made to use the Iterator's remove()
method.
@@ -437,15 +437,15 @@
*/
// Should probably be getCustomGraphics(), but all the methods
// seem to have this form.
- public Iterator<CustomGraphic> customGraphics(final CyNode node) {
- return new Iterator<CustomGraphic>() {
- private Iterator<CustomGraphic> _iterator = new
ArrayList<CustomGraphic>(0).iterator();
+ public Iterator<CustomGraphicLayer> customGraphics(final CyNode node) {
+ return new Iterator<CustomGraphicLayer>() {
+ private Iterator<CustomGraphicLayer> _iterator = new
ArrayList<CustomGraphicLayer>(0).iterator();
public boolean hasNext() {
return _iterator.hasNext();
}
- public CustomGraphic next() {
+ public CustomGraphicLayer next() {
return _iterator.next();
}
@@ -459,13 +459,13 @@
* Return the object used for synchronizing custom graphics operations
for a
* given Node. This is used in conjunction with the customGraphics()
* Iterator to allow iteration over the custom graphics without fear of
the
- * underlying CustomGraphics mutating. For example:
+ * underlying CustomGraphicLayers mutating. For example:
*
* <PRE>
* NodeDetails nd = ...;
* synchronized (nd.customGraphicsLock(node)) {
- * Iterator<CustomGraphic> dNodeIt = nodeDetails.customGraphics
(node);
- * CustomGraphic cg = null;
+ * Iterator<CustomGraphicLayer> dNodeIt =
nodeDetails.customGraphics (node);
+ * CustomGraphicLayer cg = null;
* while (dNodeIt.hasNext()) {
* cg = dNodeIt.next();
* // DO STUFF WITH cg HERE.
--
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.