Cytoscape 2.8.0 API

ding.view
Class DNodeView

java.lang.Object
  extended by ding.view.DNodeView
All Implemented Interfaces:
Label, NodeView

public class DNodeView
extends Object
implements NodeView, Label

Ding implementation of GINY NodeView.

Author:
$author$

Field Summary
 
Fields inherited from interface giny.view.NodeView
DIAMOND, ELLIPSE, HEXAGON, OCTAGON, PARALELLOGRAM, RECTANGLE, ROUNDED_RECTANGLE, TRIANGLE, VEE
 
Fields inherited from interface giny.view.Label
CENTER, EAST, JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NONE, NORTH, NORTHEAST, NORTHWEST, SOURCE_BOUND, SOUTH, SOUTHEAST, SOUTHWEST, TARGET_BOUND, WEST
 
Method Summary
 boolean addCustomGraphic(CustomGraphic cg)
          Adds a given CustomGraphic, in draw order, to this DNodeView in a thread-safe way.
 CustomGraphic addCustomGraphic(Shape shape, Paint paint, byte anchor)
          Adds a custom graphic, in draw order, to this DNodeView in a thread-safe way.
 boolean containsCustomGraphic(CustomGraphic cg)
          A thread-safe way to determine if this DNodeView contains a given custom graphic.
 Iterator<CustomGraphic> customGraphicIterator()
          Return a non-null, read-only Iterator over all CustomGraphics contained in this DNodeView.
 Object customGraphicLock()
          Obtain the lock used for reading information about custom graphics.
 Stroke getBorder()
          DOCUMENT ME!
 Paint getBorderPaint()
          DOCUMENT ME!
 float getBorderWidth()
          DOCUMENT ME!
 ObjectPosition getCustomGraphicsPosition(CustomGraphic cg)
           
 int getDegree()
          DOCUMENT ME!
 List getEdgeViewsList(NodeView otherNodeView)
          DOCUMENT ME!
 Font getFont()
          DOCUMENT ME!
 int getGraphPerspectiveIndex()
          DOCUMENT ME!
 GraphView getGraphView()
          DOCUMENT ME!
 double getGreekThreshold()
          DOCUMENT ME!
 double getHeight()
          DOCUMENT ME!
 int getJustify()
          Deprecated. 
 Label getLabel()
          DOCUMENT ME!
 double getLabelOffsetX()
          Deprecated. 
 double getLabelOffsetY()
          Deprecated. 
 ObjectPosition getLabelPosition()
          Returns current label position as ObjkectPosition object.
 double getLabelWidth()
           
 Node getNode()
          DOCUMENT ME!
 int getNodeLabelAnchor()
          Deprecated. 
 int getNumCustomGraphics()
          A thread-safe method returning the number of custom graphics associated with this DNodeView.
 Point2D getOffset()
          DOCUMENT ME!
 ObjectPosition getPosition()
           
 int getRootGraphIndex()
          DOCUMENT ME!
 Paint getSelectedPaint()
          DOCUMENT ME!
 int getShape()
          DOCUMENT ME!
 String getText()
          DOCUMENT ME!
 int getTextAnchor()
          Deprecated. 
 Paint getTextPaint()
          DOCUMENT ME!
 String getToolTip()
          DOCUMENT ME!
 float getTransparency()
          DOCUMENT ME!
 Paint getUnselectedPaint()
          DOCUMENT ME!
 double getWidth()
          DOCUMENT ME!
 double getXPosition()
          DOCUMENT ME!
 double getYPosition()
          DOCUMENT ME!
 boolean isHidden()
           
 boolean isSelected()
          DOCUMENT ME!
 boolean nestedNetworkIsVisible()
          Determines whether a nested network should be rendered as part of a node's view or not.
 void removeAllCustomGraphics()
           
 boolean removeCustomGraphic(CustomGraphic cg)
          A thread-safe method for removing a given custom graphic from this DNodeView.
 void select()
          DOCUMENT ME!
 void setBorder(Stroke stroke)
          DOCUMENT ME!
 void setBorderPaint(Paint paint)
          DOCUMENT ME!
 void setBorderWidth(float width)
          DOCUMENT ME!
 CustomGraphic setCustomGraphicsPosition(CustomGraphic cg, ObjectPosition p)
           
 void setFont(Font font)
          DOCUMENT ME!
 void setGreekThreshold(double threshold)
          DOCUMENT ME!
 boolean setHeight(double height)
          DOCUMENT ME!
 void setJustify(int justify)
          Deprecated. 
 void setLabelOffsetX(double x)
          Deprecated. 
 void setLabelOffsetY(double y)
          Deprecated. 
 void setLabelPosition(ObjectPosition position)
          Set current label position.
 void setLabelWidth(double width)
           
 void setNestedNetworkView(DGraphView nestedNetworkView)
           
 void setNodeLabelAnchor(int position)
          Deprecated. 
 void setNodePosition(boolean animate)
          DOCUMENT ME!
 void setOffset(double x, double y)
          DOCUMENT ME!
 void setPosition(ObjectPosition p)
          Set position of label.
 void setPositionHint(int position)
          DOCUMENT ME!
 boolean setSelected(boolean selected)
          DOCUMENT ME!
 void setSelectedPaint(Paint paint)
          DOCUMENT ME!
 void setShape(int shape)
          DOCUMENT ME!
 void setText(String text)
          DOCUMENT ME!
 void setTextAnchor(int position)
          Deprecated. 
 void setTextPaint(Paint textPaint)
          DOCUMENT ME!
 void setToolTip(String tip)
          DOCUMENT ME!
 void setTransparency(float trans)
          DOCUMENT ME!
 void setUnselectedPaint(Paint paint)
          DOCUMENT ME!
 boolean setWidth(double width)
          DOCUMENT ME!
 void setXPosition(double xPos)
          DOCUMENT ME!
 void setXPosition(double xPos, boolean update)
          DOCUMENT ME!
 void setYPosition(double yPos)
          DOCUMENT ME!
 void setYPosition(double yPos, boolean update)
          DOCUMENT ME!
 void showNestedNetwork(boolean makeVisible)
          Set the visibility of a node's nested network when rendered.
 void unselect()
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getGraphView

public GraphView getGraphView()
DOCUMENT ME!

Specified by:
getGraphView in interface NodeView
Returns:
DOCUMENT ME!

getNode

public Node getNode()
DOCUMENT ME!

Specified by:
getNode in interface NodeView
Returns:
DOCUMENT ME!

getGraphPerspectiveIndex

public int getGraphPerspectiveIndex()
DOCUMENT ME!

Specified by:
getGraphPerspectiveIndex in interface NodeView
Returns:
DOCUMENT ME!

getRootGraphIndex

public int getRootGraphIndex()
DOCUMENT ME!

Specified by:
getRootGraphIndex in interface NodeView
Returns:
DOCUMENT ME!

getEdgeViewsList

public List getEdgeViewsList(NodeView otherNodeView)
DOCUMENT ME!

Specified by:
getEdgeViewsList in interface NodeView
Parameters:
otherNodeView - DOCUMENT ME!
Returns:
DOCUMENT ME!

getShape

public int getShape()
DOCUMENT ME!

Specified by:
getShape in interface NodeView
Returns:
DOCUMENT ME!

setSelectedPaint

public void setSelectedPaint(Paint paint)
DOCUMENT ME!

Specified by:
setSelectedPaint in interface NodeView
Parameters:
paint - DOCUMENT ME!

getSelectedPaint

public Paint getSelectedPaint()
DOCUMENT ME!

Specified by:
getSelectedPaint in interface NodeView
Returns:
DOCUMENT ME!

setUnselectedPaint

public void setUnselectedPaint(Paint paint)
DOCUMENT ME!

Specified by:
setUnselectedPaint in interface NodeView
Parameters:
paint - DOCUMENT ME!

getUnselectedPaint

public Paint getUnselectedPaint()
DOCUMENT ME!

Specified by:
getUnselectedPaint in interface NodeView
Returns:
DOCUMENT ME!

setBorderPaint

public void setBorderPaint(Paint paint)
DOCUMENT ME!

Specified by:
setBorderPaint in interface NodeView
Parameters:
paint - DOCUMENT ME!

getBorderPaint

public Paint getBorderPaint()
DOCUMENT ME!

Specified by:
getBorderPaint in interface NodeView
Returns:
DOCUMENT ME!

setBorderWidth

public void setBorderWidth(float width)
DOCUMENT ME!

Specified by:
setBorderWidth in interface NodeView
Parameters:
width - DOCUMENT ME!

getBorderWidth

public float getBorderWidth()
DOCUMENT ME!

Specified by:
getBorderWidth in interface NodeView
Returns:
DOCUMENT ME!

setBorder

public void setBorder(Stroke stroke)
DOCUMENT ME!

Specified by:
setBorder in interface NodeView
Parameters:
stroke - DOCUMENT ME!

getBorder

public Stroke getBorder()
DOCUMENT ME!

Specified by:
getBorder in interface NodeView
Returns:
DOCUMENT ME!

setTransparency

public void setTransparency(float trans)
DOCUMENT ME!

Specified by:
setTransparency in interface NodeView
Parameters:
trans - DOCUMENT ME!

getTransparency

public float getTransparency()
DOCUMENT ME!

Specified by:
getTransparency in interface NodeView
Returns:
DOCUMENT ME!

setWidth

public boolean setWidth(double width)
DOCUMENT ME!

Specified by:
setWidth in interface NodeView
Parameters:
width - DOCUMENT ME!
Returns:
DOCUMENT ME!

getWidth

public double getWidth()
DOCUMENT ME!

Specified by:
getWidth in interface NodeView
Returns:
DOCUMENT ME!

setHeight

public boolean setHeight(double height)
DOCUMENT ME!

Specified by:
setHeight in interface NodeView
Parameters:
height - DOCUMENT ME!
Returns:
DOCUMENT ME!

getHeight

public double getHeight()
DOCUMENT ME!

Specified by:
getHeight in interface NodeView
Returns:
DOCUMENT ME!

getLabel

public Label getLabel()
DOCUMENT ME!

Specified by:
getLabel in interface NodeView
Returns:
DOCUMENT ME!

getDegree

public int getDegree()
DOCUMENT ME!

Specified by:
getDegree in interface NodeView
Returns:
DOCUMENT ME!

setOffset

public void setOffset(double x,
                      double y)
DOCUMENT ME!

Specified by:
setOffset in interface NodeView
Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!

getOffset

public Point2D getOffset()
DOCUMENT ME!

Specified by:
getOffset in interface NodeView
Returns:
DOCUMENT ME!

setXPosition

public void setXPosition(double xPos)
DOCUMENT ME!

Specified by:
setXPosition in interface NodeView
Parameters:
xPos - DOCUMENT ME!

setXPosition

public void setXPosition(double xPos,
                         boolean update)
DOCUMENT ME!

Specified by:
setXPosition in interface NodeView
Parameters:
xPos - DOCUMENT ME!
update - DOCUMENT ME!

getXPosition

public double getXPosition()
DOCUMENT ME!

Specified by:
getXPosition in interface NodeView
Returns:
DOCUMENT ME!
See Also:
NodeView.setXPosition(double)

setYPosition

public void setYPosition(double yPos)
DOCUMENT ME!

Specified by:
setYPosition in interface NodeView
Parameters:
yPos - DOCUMENT ME!

setYPosition

public void setYPosition(double yPos,
                         boolean update)
DOCUMENT ME!

Specified by:
setYPosition in interface NodeView
Parameters:
yPos - DOCUMENT ME!
update - DOCUMENT ME!

getYPosition

public double getYPosition()
DOCUMENT ME!

Specified by:
getYPosition in interface NodeView
Returns:
DOCUMENT ME!
See Also:
NodeView.setYPosition(double)

setNodePosition

public void setNodePosition(boolean animate)
DOCUMENT ME!

Specified by:
setNodePosition in interface NodeView
Parameters:
animate - DOCUMENT ME!

select

public void select()
DOCUMENT ME!

Specified by:
select in interface NodeView

unselect

public void unselect()
DOCUMENT ME!

Specified by:
unselect in interface NodeView

isSelected

public boolean isSelected()
DOCUMENT ME!

Specified by:
isSelected in interface NodeView
Returns:
DOCUMENT ME!

setSelected

public boolean setSelected(boolean selected)
DOCUMENT ME!

Specified by:
setSelected in interface NodeView
Parameters:
selected - DOCUMENT ME!
Returns:
DOCUMENT ME!

isHidden

public final boolean isHidden()
Specified by:
isHidden in interface NodeView
Returns:
true if the NodeView is hidden, else false

setShape

public void setShape(int shape)
DOCUMENT ME!

Specified by:
setShape in interface NodeView
Parameters:
shape - DOCUMENT ME!

setToolTip

public void setToolTip(String tip)
DOCUMENT ME!

Specified by:
setToolTip in interface NodeView
Parameters:
tip - DOCUMENT ME!

getToolTip

public String getToolTip()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setPositionHint

public void setPositionHint(int position)
DOCUMENT ME!

Parameters:
position - DOCUMENT ME!

getTextPaint

public Paint getTextPaint()
DOCUMENT ME!

Specified by:
getTextPaint in interface Label
Returns:
DOCUMENT ME!

setTextPaint

public void setTextPaint(Paint textPaint)
DOCUMENT ME!

Specified by:
setTextPaint in interface Label
Parameters:
textPaint - DOCUMENT ME!

getGreekThreshold

public double getGreekThreshold()
DOCUMENT ME!

Specified by:
getGreekThreshold in interface Label
Returns:
DOCUMENT ME!

setGreekThreshold

public void setGreekThreshold(double threshold)
DOCUMENT ME!

Specified by:
setGreekThreshold in interface Label
Parameters:
threshold - DOCUMENT ME!

getText

public String getText()
DOCUMENT ME!

Specified by:
getText in interface Label
Returns:
DOCUMENT ME!

setText

public void setText(String text)
DOCUMENT ME!

Specified by:
setText in interface Label
Parameters:
text - DOCUMENT ME!

getFont

public Font getFont()
DOCUMENT ME!

Specified by:
getFont in interface Label
Returns:
DOCUMENT ME!

setFont

public void setFont(Font font)
DOCUMENT ME!

Specified by:
setFont in interface Label
Parameters:
font - DOCUMENT ME!

addCustomGraphic

public CustomGraphic addCustomGraphic(Shape shape,
                                      Paint paint,
                                      byte anchor)
Adds a custom graphic, in draw order, to this DNodeView in a thread-safe way. This is a convenience method that is equivalent to calling: addCustomGraphic (new CustomGraphic (shape,paint,anchor)) except the the new CustomGraphic created is returned.

Parameters:
shape -
paint -
anchor - The byte value from NodeDetails, that defines where the graphic anchor point lies on this DNodeView's extents rectangle. A common anchor is NodeDetails.ANCHOR_CENTER.
Returns:
The CustomGraphic added to this DNodeView.
Throws:
IllegalArgumentException - if shape or paint are null or anchor is not in the range 0 <= anchor <= NodeDetails.MAX_ANCHOR_VAL.
Since:
Cytoscape 2.6
See Also:
addCustomGraphic(CustomGraphic), CustomGraphic

addCustomGraphic

public boolean addCustomGraphic(CustomGraphic cg)
Adds a given CustomGraphic, in draw order, to this DNodeView in a thread-safe way. Each CustomGraphic 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 plugins, your additions may be interleaved with others.

A CustomGraphic 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.

Returns:
true if the CustomGraphic was added to this DNodeView. false if this DNodeView already contained this CustomGraphic.
Throws:
IllegalArgumentException - if shape or paint are null.
Since:
Cytoscape 2.6
See Also:
CustomGraphic

containsCustomGraphic

public boolean containsCustomGraphic(CustomGraphic cg)
A thread-safe way to determine if this DNodeView contains a given custom graphic.

Parameters:
cg - the CustomGraphic for which we are checking containment.
Since:
Cytoscape 2.6

customGraphicIterator

public Iterator<CustomGraphic> customGraphicIterator()
Return a non-null, read-only Iterator over all CustomGraphics contained in this DNodeView. The Iterator will return each CustomGraphic in draw order. The Iterator cannot be used to modify the underlying set of CustomGraphics.

Returns:
The CustomGraphics Iterator. If no CustomGraphics are associated with this DNOdeView, an empty Iterator is returned.
Throws:
UnsupportedOperationException - if an attempt is made to use the Iterator's remove() method.
Since:
Cytoscape 2.6

removeCustomGraphic

public boolean removeCustomGraphic(CustomGraphic cg)
A thread-safe method for removing a given custom graphic from this DNodeView.

Returns:
true if the custom graphic was found an removed. Returns false if cg is null or is not a custom graphic associated with this DNodeView.
Since:
Cytoscape 2.6

removeAllCustomGraphics

public void removeAllCustomGraphics()

getNumCustomGraphics

public int getNumCustomGraphics()
A thread-safe method returning the number of custom graphics associated with this DNodeView. If none are associated, zero is returned.

Since:
Cytoscape 2.6

customGraphicLock

public Object customGraphicLock()
Obtain the lock used for reading information about custom graphics. This is not needed for thread-safe custom graphic operations, but only needed for use with thread-compatible methods, such as customGraphicIterator(). For example, to iterate over all custom graphics without fear of the underlying custom graphics being mutated, you could perform:
    DNodeView dnv = ...;
    CustomGraphic cg = null;
    synchronized (dnv.customGraphicLock()) {
       Iterator cgIt = dnv.customGraphicIterator();
       while (cgIt.hasNext()) {
          cg = cgIt.next();
          // PERFORM your operations here.
       }
   }
 
NOTE: A better concurrency approach would be to return the read lock from a java.util.concurrent.locks.ReentrantReadWriteLock. However, this requires users to manually lock and unlock blocks of code where many times try{} finally{} blocks are needed and if any mistake are made, a DNodeView may be permanently locked. Since concurrency will most likely be very low, we opt for the simpler approach of having users use synchronized {} blocks on a standard lock object.

Returns:
the lock object used for custom graphics of this DNodeView.

setTextAnchor

@Deprecated
public void setTextAnchor(int position)
Deprecated. 

DOCUMENT ME!

Specified by:
setTextAnchor in interface Label
Parameters:
position - DOCUMENT ME!

getTextAnchor

@Deprecated
public int getTextAnchor()
Deprecated. 

DOCUMENT ME!

Specified by:
getTextAnchor in interface Label
Returns:
DOCUMENT ME!

setJustify

@Deprecated
public void setJustify(int justify)
Deprecated. 

DOCUMENT ME!

Specified by:
setJustify in interface Label
Parameters:
justify - DOCUMENT ME!

getJustify

@Deprecated
public int getJustify()
Deprecated. 

DOCUMENT ME!

Specified by:
getJustify in interface Label
Returns:
DOCUMENT ME!

setLabelOffsetX

@Deprecated
public void setLabelOffsetX(double x)
Deprecated. 

DOCUMENT ME!

Specified by:
setLabelOffsetX in interface NodeView
Parameters:
x - DOCUMENT ME!

getLabelOffsetX

@Deprecated
public double getLabelOffsetX()
Deprecated. 

DOCUMENT ME!

Specified by:
getLabelOffsetX in interface NodeView
Returns:
DOCUMENT ME!

setLabelOffsetY

@Deprecated
public void setLabelOffsetY(double y)
Deprecated. 

DOCUMENT ME!

Specified by:
setLabelOffsetY in interface NodeView
Parameters:
y - DOCUMENT ME!

getLabelOffsetY

@Deprecated
public double getLabelOffsetY()
Deprecated. 

DOCUMENT ME!

Specified by:
getLabelOffsetY in interface NodeView
Returns:
DOCUMENT ME!

setNodeLabelAnchor

@Deprecated
public void setNodeLabelAnchor(int position)
Deprecated. 

DOCUMENT ME!

Specified by:
setNodeLabelAnchor in interface NodeView
Parameters:
position - DOCUMENT ME!

getNodeLabelAnchor

@Deprecated
public int getNodeLabelAnchor()
Deprecated. 

DOCUMENT ME!

Specified by:
getNodeLabelAnchor in interface NodeView
Returns:
DOCUMENT ME!

getLabelWidth

public double getLabelWidth()
Specified by:
getLabelWidth in interface NodeView

setLabelWidth

public void setLabelWidth(double width)
Specified by:
setLabelWidth in interface NodeView

setNestedNetworkView

public void setNestedNetworkView(DGraphView nestedNetworkView)

nestedNetworkIsVisible

public boolean nestedNetworkIsVisible()
Determines whether a nested network should be rendered as part of a node's view or not.

Specified by:
nestedNetworkIsVisible in interface NodeView
Returns:
true if the node has a nested network and we want it rendered, else false.

showNestedNetwork

public void showNestedNetwork(boolean makeVisible)
Set the visibility of a node's nested network when rendered.

Specified by:
showNestedNetwork in interface NodeView
Parameters:
makeVisible - forces the visibility of a nested network. Please note that this call has no effect if a node has no associated nested network!

getPosition

public ObjectPosition getPosition()
Specified by:
getPosition in interface Label

setPosition

public void setPosition(ObjectPosition p)
Description copied from interface: Label
Set position of label. ObjectPosition is a consolidated data structure designed as the replacement of deprecated parameters below.

Specified by:
setPosition in interface Label

setCustomGraphicsPosition

public CustomGraphic setCustomGraphicsPosition(CustomGraphic cg,
                                               ObjectPosition p)

getCustomGraphicsPosition

public ObjectPosition getCustomGraphicsPosition(CustomGraphic cg)

getLabelPosition

public ObjectPosition getLabelPosition()
Description copied from interface: NodeView
Returns current label position as ObjkectPosition object.

Specified by:
getLabelPosition in interface NodeView
Returns:
label position as ObjectPosition

setLabelPosition

public void setLabelPosition(ObjectPosition position)
Description copied from interface: NodeView
Set current label position.

Specified by:
setLabelPosition in interface NodeView

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.