Search this API

y.view
Class AbstractCustomHotSpotPainter

java.lang.Object
  extended by y.view.AbstractCustomHotSpotPainter
All Implemented Interfaces:
GenericNodeRealizer.HotSpotHitTest, GenericNodeRealizer.HotSpotPainter

public abstract class AbstractCustomHotSpotPainter
extends java.lang.Object
implements GenericNodeRealizer.HotSpotPainter, GenericNodeRealizer.HotSpotHitTest

Abstract base class that can be used with customizations of GenericNodeRealizer instances. This base class contains utility functions and delegate the actual work to simpler abstract methods.

 
Your browser does not support SVG content.

Constructor Summary
AbstractCustomHotSpotPainter()
          Creates a new instance of AbstractCustomHotspotPainter that paints all 8 possible hot spots.
AbstractCustomHotSpotPainter(int mask)
          Creates a new instance of AbstractCustomHotspotPainter using a bit mask to determine which of the 8 possible hotspots to use.
 
Method Summary
 byte hotSpotHit(NodeRealizer context, double hx, double hy)
          Used as a callback for the GenericNodeRealizer.hotSpotHit(double, double) method.
protected  void initGraphics(NodeRealizer context, java.awt.Graphics2D graphics)
          Utility method used by paintHotSpots(NodeRealizer, java.awt.Graphics2D) to initialize the graphics context.
protected abstract  boolean isHit(byte hotSpot, double centerX, double centerY, double testX, double testY)
          Callback method used by hotSpotHit(NodeRealizer, double ,double)
protected abstract  void paint(byte hotSpot, double centerX, double centerY, java.awt.Graphics2D graphics)
          Callback method called during paintHotSpots(NodeRealizer, java.awt.Graphics2D)
 void paintHotSpots(NodeRealizer context, java.awt.Graphics2D graphics)
          Used as a callback for the GenericNodeRealizer.paintHotSpots(Graphics2D) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCustomHotSpotPainter

public AbstractCustomHotSpotPainter()
Creates a new instance of AbstractCustomHotspotPainter that paints all 8 possible hot spots.


AbstractCustomHotSpotPainter

public AbstractCustomHotSpotPainter(int mask)
Creates a new instance of AbstractCustomHotspotPainter using a bit mask to determine which of the 8 possible hotspots to use.

Parameters:
mask - the bit mask that specifies which hot spots to use. Consult the following table to determine which bit corresponds to which hot spot.
BitHot Spot
1north west
2north
3north east
4west
5east
6south west
7south
8south east
In this context bit 1 means the least significant bit. E.g. if bits 4 and 5 are set (i.e. mask equals 24) the western and eastern hot spots will be used.
Method Detail

paint

protected abstract void paint(byte hotSpot,
                              double centerX,
                              double centerY,
                              java.awt.Graphics2D graphics)
Callback method called during paintHotSpots(NodeRealizer, java.awt.Graphics2D)

Parameters:
hotSpot - a NodeRealizer HOTSPOT constant defining the type of hotspot to paint
centerX - the center of the hotspot
centerY - the center of the hotspot
graphics - the graphics to draw on

isHit

protected abstract boolean isHit(byte hotSpot,
                                 double centerX,
                                 double centerY,
                                 double testX,
                                 double testY)
Callback method used by hotSpotHit(NodeRealizer, double ,double)

Parameters:
hotSpot - a NodeRealizer HOTSPOT constant defining the type of hotspot to test
centerX - the center of the hotspot
centerY - the center of the hotspot
testX - the center of the hit-test
testY - the center of the hit-test
Returns:
whether the hotspot has been hit

initGraphics

protected void initGraphics(NodeRealizer context,
                            java.awt.Graphics2D graphics)
Utility method used by paintHotSpots(NodeRealizer, java.awt.Graphics2D) to initialize the graphics context.

Parameters:
context - the realizer to obtain the context from
graphics - the graphics to initialize

paintHotSpots

public void paintHotSpots(NodeRealizer context,
                          java.awt.Graphics2D graphics)
Description copied from interface: GenericNodeRealizer.HotSpotPainter
Used as a callback for the GenericNodeRealizer.paintHotSpots(Graphics2D) method.

Specified by:
paintHotSpots in interface GenericNodeRealizer.HotSpotPainter

hotSpotHit

public byte hotSpotHit(NodeRealizer context,
                       double hx,
                       double hy)
Description copied from interface: GenericNodeRealizer.HotSpotHitTest
Used as a callback for the GenericNodeRealizer.hotSpotHit(double, double) method.

Specified by:
hotSpotHit in interface GenericNodeRealizer.HotSpotHitTest

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