pedviz.view
Class NodeView

java.lang.Object
  extended by pedviz.view.DefaultNodeView
      extended by pedviz.view.NodeView
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
SugiyamaNodeView

public class NodeView
extends DefaultNodeView
implements java.lang.Comparable

This class contains all informations that are needed for drawing a Node object in a GraphView.It saves also whether the node is selected or highlighted.

Author:
lukas forer

Constructor Summary
NodeView(Node node, DefaultNodeView defaultNodeView)
          Constructs a NodeView for the given Node object with the given DefaultNodeView as template.
 
Method Summary
 void addNodeViewListener(NodeViewListener listener)
           
 float calcWidth(int nodeSize, int gap)
          Calcs the node's width.
 java.lang.Object clone()
          Clones the NodeView.
 int compareTo(java.lang.Object arg0)
          Compares two nodeviews.
 java.awt.geom.Rectangle2D.Float getBounds()
          Returns the bounds of the node.
 java.awt.Color[] getColors()
          Returns the Color array.
 java.lang.Object getData()
          Returns the stored Object.
 java.lang.String getHint()
          Return the hint-text.
 java.util.ArrayList<EdgeView> getInEdges()
          Returns a collection of all in-edges.
 Node getNode()
          Returns the Node object for the NodeView.
 java.util.ArrayList<NodeView> getNodes()
          Returns a collection of all subnodes.
 java.util.ArrayList<EdgeView> getOutEdges()
          Returns a collection of all out-edges.
 float getPosX()
          Returns the position on the X-axis.
 float getPosY()
          Returns the position on the X-axis.
 float getPosZ()
          Returns the position on the X-axis.
 boolean isHidden()
          Returns true, if the node is hidden.
 boolean isHighlighted()
          Checks if the node is highlighted.
 boolean isMomLeft()
           
 boolean isMouseOver()
          Checks if the mouse is over the node.
 boolean isSelected()
          Checks if the node is selected.
 void removeNodeViewListener(NodeViewListener listener)
           
 void reset(DefaultNodeView defaultNodeView)
          Resets all settings do the given DefaultNodeView object.
 void setBounds(double x, double y, double size)
          Sets the bounds of this node.
 void setColors(java.awt.Color[] colors)
          Sets the Color array.
 void setData(java.lang.Object data)
          Sets the Object that will be stored.
 void setHidden(boolean hidden)
           
 void setMomLeft(boolean momLeft)
           
 void setPosX(float x)
          Sets the position on the X-axis.
 void setPosY(float y)
          Sets the position on the Y-axis.
 void setPosZ(float z)
          Sets the position on the Z-axis.
 void sortSubNodes()
          Sorts all subnodes.
 
Methods inherited from class pedviz.view.DefaultNodeView
addHintAttribute, addSymbol, getBorderColor, getBorderWidth, getColor, getGap, getHeight, getHighlightedColor, getMouseOverColor, getSelectedColor, getSize, getSymbols, isExpand, setBorderColor, setBorderWidth, setColor, setExpand, setGap, setHighlightedColor, setHintAttribute, setHintText, setMouseOverColor, setSelectedColor, setSize, setSymbols
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeView

public NodeView(Node node,
                DefaultNodeView defaultNodeView)
Constructs a NodeView for the given Node object with the given DefaultNodeView as template.

Parameters:
node - node
defaultNodeView - DefaultNodeView
Method Detail

clone

public java.lang.Object clone()
Clones the NodeView.

Overrides:
clone in class java.lang.Object

getNode

public Node getNode()
Returns the Node object for the NodeView.

Returns:
Node object

isSelected

public boolean isSelected()
Checks if the node is selected.

Returns:
true, if the node is selected

isHighlighted

public boolean isHighlighted()
Checks if the node is highlighted.

Returns:
true, if the node is highlighted

isMouseOver

public boolean isMouseOver()
Checks if the mouse is over the node.

Returns:

getHint

public java.lang.String getHint()
Return the hint-text.

Returns:

getPosX

public float getPosX()
Returns the position on the X-axis.

Returns:
position on the X-axis

getPosY

public float getPosY()
Returns the position on the X-axis.

Returns:
position on the Y-axis

getPosZ

public float getPosZ()
Returns the position on the X-axis.

Returns:
position on the Z-axis

getBounds

public java.awt.geom.Rectangle2D.Float getBounds()
Returns the bounds of the node.

Returns:
bounds of the node

setBounds

public void setBounds(double x,
                      double y,
                      double size)
Sets the bounds of this node.

Parameters:
x - left position
y - top position
size - width

getData

public java.lang.Object getData()
Returns the stored Object.

Returns:
stored Object

setData

public void setData(java.lang.Object data)
Sets the Object that will be stored.

Parameters:
data -

setColors

public void setColors(java.awt.Color[] colors)
Sets the Color array.

Parameters:
colors - the Color array.

getColors

public java.awt.Color[] getColors()
Returns the Color array.

Returns:
the Color array.

isHidden

public boolean isHidden()
Returns true, if the node is hidden.

Returns:
true, if the node is hidden.

setHidden

public void setHidden(boolean hidden)
Parameters:
hidden -

getNodes

public java.util.ArrayList<NodeView> getNodes()
Returns a collection of all subnodes.

Returns:
a collection of all subnodes.

getInEdges

public java.util.ArrayList<EdgeView> getInEdges()
Returns a collection of all in-edges.

Returns:
a collection of all in-edges.

getOutEdges

public java.util.ArrayList<EdgeView> getOutEdges()
Returns a collection of all out-edges.

Returns:
a collection of all out-nedges.

setPosX

public void setPosX(float x)
Sets the position on the X-axis.

Parameters:
x - the position on the X-axis.

setPosY

public void setPosY(float y)
Sets the position on the Y-axis.

Parameters:
y - the position on the Y-axis.

setPosZ

public void setPosZ(float z)
Sets the position on the Z-axis.

Parameters:
z - the position on the Z-axis.

sortSubNodes

public void sortSubNodes()
Sorts all subnodes.


compareTo

public int compareTo(java.lang.Object arg0)
Compares two nodeviews.

Specified by:
compareTo in interface java.lang.Comparable

reset

public void reset(DefaultNodeView defaultNodeView)
Resets all settings do the given DefaultNodeView object.

Parameters:
defaultNodeView -

calcWidth

public float calcWidth(int nodeSize,
                       int gap)
Calcs the node's width.

Parameters:
nodeSize - the size of node
gap - the gap between sub nodes
Returns:
the node's width

addNodeViewListener

public void addNodeViewListener(NodeViewListener listener)

removeNodeViewListener

public void removeNodeViewListener(NodeViewListener listener)

isMomLeft

public boolean isMomLeft()

setMomLeft

public void setMomLeft(boolean momLeft)