Search this API

y.view
Class GeneralPathNodePainter

java.lang.Object
  extended by y.view.AbstractCustomNodePainter
      extended by y.view.GeneralPathNodePainter
All Implemented Interfaces:
GenericNodeRealizer.ContainsTest, GenericNodeRealizer.Painter

public class GeneralPathNodePainter
extends AbstractCustomNodePainter
implements GenericNodeRealizer.ContainsTest

A painter and contains test for GenericNodeRealizer that uses a pre-defined GeneralPath as the shape for nodes. GeneralPath instances that are used with this painter/contains test have to reside in the unit square, i.e. the bounds of these paths must lie in [0,1]x[0,1].

 

Constructor Summary
GeneralPathNodePainter(java.awt.geom.GeneralPath path)
          Initializes a new GeneralPathNodePainter instance.
 
Method Summary
 boolean contains(NodeRealizer context, double x, double y)
          Used as a callback for the GenericNodeRealizer.contains(double, double) method.
protected  java.awt.Color getFillColor(NodeRealizer context, boolean selected)
          Returns the fill color for the specified realizer.
protected  void paintNode(NodeRealizer context, java.awt.Graphics2D graphics, boolean sloppy)
          Callback method to be overwritten by subclasses called by AbstractCustomNodePainter.paint(NodeRealizer, Graphics2D).
 
Methods inherited from class y.view.AbstractCustomNodePainter
backupGraphics, createSelectionColor, getFillColor2, getFillPaint, getLineColor, getLinePaint, getLineStroke, initializeFill, initializeLine, paint, paintHotSpots, paintPorts, paintSloppy, paintText, restoreGraphics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeneralPathNodePainter

public GeneralPathNodePainter(java.awt.geom.GeneralPath path)
Initializes a new GeneralPathNodePainter instance.

Parameters:
path - the geometric shape used to represent nodes. Its bounds must lie in [0,1]x[0,1].
Method Detail

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)

getFillColor

protected java.awt.Color getFillColor(NodeRealizer context,
                                      boolean selected)
Returns the fill color for the specified realizer. Overwritten to always consider the specified realizer to be not selected.

Overrides:
getFillColor in class AbstractCustomNodePainter
Parameters:
selected - ignored. Always considered to be false.
context - the context node
Returns:
the color to use or null

contains

public boolean contains(NodeRealizer context,
                        double x,
                        double y)
Description copied from interface: GenericNodeRealizer.ContainsTest
Used as a callback for the GenericNodeRealizer.contains(double, double) method.

Specified by:
contains in interface GenericNodeRealizer.ContainsTest

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