gdl.base
Class ContentNode

java.lang.Object
  extended by gdl.base.ContentNode

public class ContentNode
extends java.lang.Object

the data structure for a content node; contains a list of references and children as well as the content and the id. Furthermore, every node holds its representation on the piccolo canvas and the degree interval he gets assigned on a ring. The icon for every node is stored can be be retrieved if it is available.

Author:
Martin Suntinger

Constructor Summary
ContentNode(org.jdom.Element el, java.lang.String nodeTag, java.lang.String linkTag, java.lang.String idAttribute, java.lang.String connectionTypeAttribute, java.lang.String defaultIconLocation, boolean iconsAvailable, java.lang.String defaultIcon, java.lang.Object curSizeConfigSet)
           
 
Method Summary
 void addTemporaryChild(ContentNode c)
           
 void addToTmpWeightOfChildren(int c)
          a helper function to temporarly calculate the sum of all the node's children's sizes in the current graph
 java.lang.String getAttribute(java.lang.String attribute)
           
 edu.umd.cs.piccolo.PNode getCanvasPNode()
           
 int getCanvasPNodeIndex()
           
 java.lang.String[] getChildren()
           
 java.lang.String getContentAsString()
           
 java.lang.String getIcon()
           
 java.lang.String getId()
          get the id of the Content Node
 float getLowerDegreeInterval()
           
 float getNextPosDegree()
           
 float getNextPosRadius()
           
 float getPosDegree()
           
 float getPosRadius()
           
 java.lang.String[][] getReferences()
           
 int getSize()
          returns mapped pixel value of the node size according to the currently active size configuration set.
 int getSumOfWeight()
           
 java.util.LinkedList getTemporaryChildren()
           
 ContentNode getTemporaryFather()
           
 int getTmpWeightOfChildren()
           
 float getUpperDegreeInterval()
           
 void setCanvasPNode(edu.umd.cs.piccolo.PNode p)
          store the Node representation on the canvas
 void setCanvasPNodeIndex(int canvasPNodeIndex)
           
 void setCurPos(float r, float phi)
          used to set the position of the node on the canvas in polar coordinates
 void setDegreeInterval(float _lower, float _upper)
          set the degree interval of a content node for the specific ring he gets rendered on.
 void setNextPos(float r, float phi)
          temporarly store a nodes position: it is moved there afterwards by the nodeMover
 void setSizeConfigSet(java.lang.Object sizeConfigSet)
          set a new config set for the node size: the Config Set specifies how to map the size attribute values from the XML
 void setSumOfWeight(int sumOfWeight)
           
 void setTemporaryFather(ContentNode c)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentNode

public ContentNode(org.jdom.Element el,
                   java.lang.String nodeTag,
                   java.lang.String linkTag,
                   java.lang.String idAttribute,
                   java.lang.String connectionTypeAttribute,
                   java.lang.String defaultIconLocation,
                   boolean iconsAvailable,
                   java.lang.String defaultIcon,
                   java.lang.Object curSizeConfigSet)
Parameters:
el - a JDom Element containing the complete xml node element
nodeTag - a String that is used as the tag for nodes
linkTag - a String that is used as the tag vor connections
idAttribute - the attribute that is used as an identifier for nodes and references
connectionTypeAttribute - the XML attribute used to specify the connection type
defaultIconLocation - the default icon location
iconsAvailable - boolean flag indicating whether to use icons or not
defaultIcon - the default icon file to use if no icon exists for a node
curSizeConfigSet - Oject: can either be RangeConfigSet or SwitchConfigSet - the current rules for size mapping
Method Detail

setSizeConfigSet

public void setSizeConfigSet(java.lang.Object sizeConfigSet)
set a new config set for the node size: the Config Set specifies how to map the size attribute values from the XML

Parameters:
sizeConfigSet -

getId

public java.lang.String getId()
get the id of the Content Node

Returns:
A String representation of the node ID

getChildren

public java.lang.String[] getChildren()
Returns:
String [] array of all children's ids

getReferences

public java.lang.String[][] getReferences()
Returns:
String [][] array of all references of this node, including the type of reference

getAttribute

public java.lang.String getAttribute(java.lang.String attribute)
Parameters:
attribute - - the XML attribute you want to know
Returns:
the value (from the XML source) of the specified attribte

setDegreeInterval

public void setDegreeInterval(float _lower,
                              float _upper)
set the degree interval of a content node for the specific ring he gets rendered on.

Parameters:
_lower -
_upper -

getLowerDegreeInterval

public float getLowerDegreeInterval()
Returns:
the lower degree interval of the node on its current position (radial, between 0 and 360)

getUpperDegreeInterval

public float getUpperDegreeInterval()
Returns:
the upper degree interval of the node on its current position (radial, between 0 and 360)

addTemporaryChild

public void addTemporaryChild(ContentNode c)
Parameters:
c - a content node that temporarily is a child of the node in the current graph

getTemporaryChildren

public java.util.LinkedList getTemporaryChildren()
Returns:
a list of temporary children that were stored for one specific graph position

addToTmpWeightOfChildren

public void addToTmpWeightOfChildren(int c)
a helper function to temporarly calculate the sum of all the node's children's sizes in the current graph

Parameters:
c -

getTmpWeightOfChildren

public int getTmpWeightOfChildren()
Returns:
temporary weight of children of a node in one specific graph layout

setTemporaryFather

public void setTemporaryFather(ContentNode c)
Parameters:
c - ContentNode that is the father of the node in the current tree

getTemporaryFather

public ContentNode getTemporaryFather()
Returns:
the father of a node in the current tree

setCurPos

public void setCurPos(float r,
                      float phi)
used to set the position of the node on the canvas in polar coordinates

Parameters:
r -
phi -

getPosRadius

public float getPosRadius()
Returns:
the radius values of the current node's polor coordinates

getPosDegree

public float getPosDegree()
Returns:
the degree values of the current node's polor coordinates

setNextPos

public void setNextPos(float r,
                       float phi)
temporarly store a nodes position: it is moved there afterwards by the nodeMover

Parameters:
r -
phi -

getNextPosRadius

public float getNextPosRadius()

getNextPosDegree

public float getNextPosDegree()

setCanvasPNode

public void setCanvasPNode(edu.umd.cs.piccolo.PNode p)
store the Node representation on the canvas

Parameters:
p -

getCanvasPNode

public edu.umd.cs.piccolo.PNode getCanvasPNode()

getContentAsString

public java.lang.String getContentAsString()
Returns:
the content text of the node XML Element

getCanvasPNodeIndex

public int getCanvasPNodeIndex()
Returns:
the index of the node on the canvas

setCanvasPNodeIndex

public void setCanvasPNodeIndex(int canvasPNodeIndex)

getIcon

public java.lang.String getIcon()
Returns:
the icon location as an absolute path

getSize

public int getSize()
returns mapped pixel value of the node size according to the currently active size configuration set.

Returns:
the size of the node in pixels

getSumOfWeight

public int getSumOfWeight()

setSumOfWeight

public void setSumOfWeight(int sumOfWeight)