Search this API

y.view
Class NodeCellRendererPainter

java.lang.Object
  extended by y.view.AbstractCustomNodePainter
      extended by y.view.NodeCellRendererPainter
All Implemented Interfaces:
GenericNodeRealizer.Painter

public class NodeCellRendererPainter
extends AbstractCustomNodePainter
implements GenericNodeRealizer.Painter

A GenericNodeRealizer.Painter implementation that uses NodeCellRenderer instances to render the contents of a node.

See Also:
NodeCellRenderer
 
Your browser does not support SVG content.

Field Summary
static DataMap USER_DATA_MAP
          A convenience DataMap implementation that maps to the userData property of the corresponding NodeRealizer of the Node that is passed to the DataProvider.get(Object) method.
 
Constructor Summary
NodeCellRendererPainter(NodeCellRenderer ncr, DataProvider dataProvider)
          Constructs a NodeCellRendererPainter using the given NodeCellRenderer and the DataProvider that provides access to the "value" that is passed to the renderer for each node being rendered.
 
Method Summary
 DataProvider getDataProvider()
          Returns the DataProvider that is used by the getNodeCellRendererComponent(Graph2DView, NodeRealizer,boolean) implementation to query the value for the node being rendered.
 NodeCellRenderer getNodeCellRenderer()
          Returns the NodeCellRenderer associated with this instance.
protected  java.awt.Component getNodeCellRendererComponent(Graph2DView view, NodeRealizer context, boolean selected)
          Callback method that determines the component for the rendering for a given Graph2DView and NodeRealizer.
protected  void paintNode(NodeRealizer context, java.awt.Graphics2D graphics, boolean sloppy)
          Callback method to be overwritten by subclasses called by AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D).
 void paintSloppy(NodeRealizer context, java.awt.Graphics2D graphics)
          Delegates to AbstractCustomNodePainter.paintNode(NodeRealizer, Graphics2D, boolean) if the node is visible.
 
Methods inherited from class y.view.AbstractCustomNodePainter
backupGraphics, createSelectionColor, getFillColor, getFillColor2, getFillPaint, getLineColor, getLinePaint, getLineStroke, initializeFill, initializeLine, paint, paintHotSpots, paintPorts, paintText, restoreGraphics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface y.view.GenericNodeRealizer.Painter
paint
 

Field Detail

USER_DATA_MAP

public static final DataMap USER_DATA_MAP
A convenience DataMap implementation that maps to the userData property of the corresponding NodeRealizer of the Node that is passed to the DataProvider.get(Object) method.

Constructor Detail

NodeCellRendererPainter

public NodeCellRendererPainter(NodeCellRenderer ncr,
                               DataProvider dataProvider)
Constructs a NodeCellRendererPainter using the given NodeCellRenderer and the DataProvider that provides access to the "value" that is passed to the renderer for each node being rendered.

Parameters:
ncr - the renderer used to receive the component to paint on
dataProvider - the instance that provides the value for the renderer for each node
See Also:
USER_DATA_MAP
Method Detail

getNodeCellRenderer

public NodeCellRenderer getNodeCellRenderer()
Returns the NodeCellRenderer associated with this instance.

Returns:
the current NodeCellRenderer instance associated with this instance.

getDataProvider

public DataProvider getDataProvider()
Returns the DataProvider that is used by the getNodeCellRendererComponent(Graph2DView, NodeRealizer,boolean) implementation to query the value for the node being rendered.

Returns:
the DataProvider that returns for each Node instance the corresponding value object.

paintSloppy

public void paintSloppy(NodeRealizer context,
                        java.awt.Graphics2D graphics)
Description copied from class: AbstractCustomNodePainter
Delegates to AbstractCustomNodePainter.paintNode(NodeRealizer, Graphics2D, boolean) if the node is visible.

Specified by:
paintSloppy in interface GenericNodeRealizer.Painter
Overrides:
paintSloppy in class AbstractCustomNodePainter
Parameters:
context - the context node
graphics - the graphics context to use

getNodeCellRendererComponent

protected java.awt.Component getNodeCellRendererComponent(Graph2DView view,
                                                          NodeRealizer context,
                                                          boolean selected)
Callback method that determines the component for the rendering for a given Graph2DView and NodeRealizer. This implementation queries the NodeCellRenderer associated to this instance.

Parameters:
view - the view where the component will be placed in
context - the node for which the component will be returned
selected - whether or not the component should indicate a selected state.
Returns:
a Component used for the actual rendering of the nodes graphics.

paintNode

protected void paintNode(NodeRealizer context,
                         java.awt.Graphics2D graphics,
                         boolean sloppy)
Description copied from class: AbstractCustomNodePainter
Callback method to be overwritten by subclasses called by AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D). This method is responsible for drawing the actual node only - neither the hotspots, nor the labels, should be painted by this method.

Specified by:
paintNode in class AbstractCustomNodePainter
Parameters:
context - the context node
graphics - the graphics context to use
sloppy - whether to draw the node sloppily
See Also:
AbstractCustomNodePainter.initializeLine(NodeRealizer, Graphics2D), AbstractCustomNodePainter.initializeFill(NodeRealizer, Graphics2D)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.