net.sourceforge.toscanaj.view.diagram
Class NodeView

java.lang.Object
  extended byorg.tockit.canvas.CanvasItem
      extended bynet.sourceforge.toscanaj.view.diagram.NodeView

public class NodeView
extends org.tockit.canvas.CanvasItem

class DiagramNode holds details on node position and size


Constructor Summary
NodeView(DiagramNode diagramNode, DiagramView diagramView, ConceptInterpretationContext context)
          Construct a nodeView for a Node.
 
Method Summary
 boolean containsPoint(java.awt.geom.Point2D point)
          Implements CanvasItem.containsPoint(Point2D).
 void draw(java.awt.Graphics2D graphics)
          Draws the node as circle.
 java.awt.geom.Rectangle2D getCanvasBounds(java.awt.Graphics2D g)
          Calculates the rectangle around this node.
 ConceptInterpretationContext getConceptInterpretationContext()
           
 DiagramNode getDiagramNode()
           
 DiagramView getDiagramView()
           
 java.awt.geom.Point2D getPosition()
           
protected  double getRadius(double maxRadius)
           
 double getRadiusX()
           
 double getRadiusY()
           
 int getSelectionState()
          Returns the information if and how the node is selected.
 boolean hasAutoRaise()
          Overwritten to avoid raising nodes.
 void setSelectedConcepts(Concept[] selectedConcepts)
          Recalculates if the node is selected and how.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeView

public NodeView(DiagramNode diagramNode,
                DiagramView diagramView,
                ConceptInterpretationContext context)
Construct a nodeView for a Node. The DiagramView is used for the callback when a node was selected.

Method Detail

getDiagramNode

public DiagramNode getDiagramNode()

getConceptInterpretationContext

public ConceptInterpretationContext getConceptInterpretationContext()

draw

public void draw(java.awt.Graphics2D graphics)
Draws the node as circle.


getRadiusY

public double getRadiusY()

getRadiusX

public double getRadiusX()

getRadius

protected double getRadius(double maxRadius)

containsPoint

public boolean containsPoint(java.awt.geom.Point2D point)
Implements CanvasItem.containsPoint(Point2D). This is currently not exact if the node is not a circle, the test is if a circle with the geometric average of the two radii is hit.


getCanvasBounds

public java.awt.geom.Rectangle2D getCanvasBounds(java.awt.Graphics2D g)
Calculates the rectangle around this node.


getPosition

public java.awt.geom.Point2D getPosition()

setSelectedConcepts

public void setSelectedConcepts(Concept[] selectedConcepts)
Recalculates if the node is selected and how.

See Also:
getSelectionState()

getSelectionState

public int getSelectionState()
Returns the information if and how the node is selected. The return values are: - NO_SELECTION: we don't have a selection at the moment - NOT_SELECTED: the node displays a concept which is neither in filter nor ideal of the selected concept - SELECTED_DIRECTLY: the node displays the selected concept - SELECTED_IN_FILTER: the node displays a concept which is in the filter of the selected concept - SELECTED_IN_IDEAL: the node displays a concept which is in the ideal of the selected concept

See Also:
DiagramView.setSelectedConcepts(Concept[])

hasAutoRaise

public boolean hasAutoRaise()
Overwritten to avoid raising nodes.


getDiagramView

public DiagramView getDiagramView()


The ToscanaJ project