org.knime.base.node.mine.decisiontree2.view.graph
Class NodeWidget<K>

java.lang.Object
  extended by org.knime.base.node.mine.decisiontree2.view.graph.NodeWidget<K>
Type Parameters:
K - The type of the user object.
All Implemented Interfaces:
MouseListener, EventListener
Direct Known Subclasses:
ComponentNodeWidget

public abstract class NodeWidget<K>
extends Object
implements MouseListener

The visual representation of a node in an HierarchicalGraphView.

Author:
Heiko Hofer

Constructor Summary
NodeWidget(HierarchicalGraphView<K> graph, K object)
          Creates a new instance.
 
Method Summary
abstract  String getConnectorLabelAbove()
          Get the label that should be painted on the connector above the NodeWidget.
abstract  String getConnectorLabelBelow()
          Get the label that should be painted on the connector below the NodeWidget.
protected  HierarchicalGraphView<K> getGraphView()
          Get the graph where this NodeWidget is element of.
abstract  Dimension getPreferredSize()
          Get the preferred size.
 float getScaleFactor()
          Set the scale factor.
(package private)  Dimension getSize()
          Get the current size.
protected  K getUserObject()
          Get the user object of this NodeWidget.
protected abstract  void paint(Component c, Graphics2D g, int x, int y, int width, int height)
          Paint this NodeWidget using the given Graphics2D.
 void paint(Component c, Graphics2D g, Rectangle r)
          Paint this NodeWidget using the given Graphics2D.
 void setScaleFactor(float scale)
          Get the scale factor.
(package private)  void setSize(Dimension size)
          Set the size of this NodeWidget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 

Constructor Detail

NodeWidget

public NodeWidget(HierarchicalGraphView<K> graph,
                  K object)
Creates a new instance.

Parameters:
graph - the graph where this NodeWidget is element of
object - the user object
Method Detail

getPreferredSize

public abstract Dimension getPreferredSize()
Get the preferred size.

Returns:
the preferred size

paint

protected abstract void paint(Component c,
                              Graphics2D g,
                              int x,
                              int y,
                              int width,
                              int height)
Paint this NodeWidget using the given Graphics2D.

Parameters:
c - the component to paint on
g - the graphics
x - the x coordinate in the component
y - the y coordinate in the component
width - the width of the widget
height - the height of the widget

paint

public void paint(Component c,
                  Graphics2D g,
                  Rectangle r)
Paint this NodeWidget using the given Graphics2D.

Parameters:
c - the component to paint on
g - the graphics
r - position and size on the component

getConnectorLabelAbove

public abstract String getConnectorLabelAbove()
Get the label that should be painted on the connector above the NodeWidget.

Returns:
the label painted above

getConnectorLabelBelow

public abstract String getConnectorLabelBelow()
Get the label that should be painted on the connector below the NodeWidget.

Returns:
the label painted below

getSize

final Dimension getSize()
Get the current size.

Returns:
the size

setSize

final void setSize(Dimension size)
Set the size of this NodeWidget.

Parameters:
size - the size to set

getScaleFactor

public float getScaleFactor()
Set the scale factor.

Returns:
the scale factor

setScaleFactor

public void setScaleFactor(float scale)
Get the scale factor.

Parameters:
scale - the scale factor to set

getGraphView

protected final HierarchicalGraphView<K> getGraphView()
Get the graph where this NodeWidget is element of.

Returns:
the graph

getUserObject

protected final K getUserObject()
Get the user object of this NodeWidget.

Returns:
the user object


Copyright, 2003 - 2012. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.