Search this API

y.view
Class ShadowNodePainter

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

public class ShadowNodePainter
extends java.lang.Object
implements GenericNodeRealizer.Painter

A decorating Painter that adds a drop shadow decoration to a delegate Painter instance.

 

Field Summary
static java.lang.String SHADOW_PAINTING_STYLE_ID
          Style property key to selectively turn off shadow painting.
 
Constructor Summary
ShadowNodePainter(GenericNodeRealizer.Painter painterDelegate)
          Create a shadow painter that decorates the painterDelegate with a drop shadow effect.
 
Method Summary
 GenericNodeRealizer.Painter getPainterDelegate()
          Returns the delegate painter that paints the node itself.
 java.awt.Color getShadowColor()
          Returns the color that is used for drawing the drop shadow.
 int getShadowDistanceX()
          Returns the horizontal distance of the drop shadow.
 int getShadowDistanceY()
          Returns the vertical distance of the drop shadow The default vertical offset is 2 pixels.
 void paint(NodeRealizer context, java.awt.Graphics2D graphics)
          Paints a drop shadow effect below the visual representation created by the delegate painter.
 void paintSloppy(NodeRealizer context, java.awt.Graphics2D graphics)
          Invokes the delegate painter's paintSloppy method.
 void setShadowColor(java.awt.Color shadowColor)
          Sets the color that is used for drawing the drop shadow.
 void setShadowDistance(int distanceX, int distanceY)
          Sets the horizontal and vertical distance of the drop shadow effect
 void setShadowDistanceX(int shadowDistanceX)
          Sets the horizontal distance of the drop shadow The default horizontal offset is 2 pixels.
 void setShadowDistanceY(int shadowDistanceY)
          Sets the vertical distance of the drop shadow The default vertical offset is 2 pixels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHADOW_PAINTING_STYLE_ID

public static final java.lang.String SHADOW_PAINTING_STYLE_ID
Style property key to selectively turn off shadow painting. An associated value of Boolean.FALSE will turn off shadow painting.

See Also:
YRenderingHints.isShadowPaintingEnabled(java.awt.Graphics2D), Constant Field Values
Constructor Detail

ShadowNodePainter

public ShadowNodePainter(GenericNodeRealizer.Painter painterDelegate)
Create a shadow painter that decorates the painterDelegate with a drop shadow effect.

Method Detail

getPainterDelegate

public GenericNodeRealizer.Painter getPainterDelegate()
Returns the delegate painter that paints the node itself.

Returns:
the delegate painter that paints the node itself.
See Also:
ShadowNodePainter(y.view.GenericNodeRealizer.Painter)

getShadowColor

public java.awt.Color getShadowColor()
Returns the color that is used for drawing the drop shadow. The default is a black shadow with an alpha value of 0.3.


setShadowColor

public void setShadowColor(java.awt.Color shadowColor)
Sets the color that is used for drawing the drop shadow. The default is a black shadow with an alpha value of 0.3.

Parameters:
shadowColor - the Color to use for the drop shadow

getShadowDistanceX

public int getShadowDistanceX()
Returns the horizontal distance of the drop shadow. The default horizontal distance is 2 pixels.


setShadowDistanceX

public void setShadowDistanceX(int shadowDistanceX)
Sets the horizontal distance of the drop shadow The default horizontal offset is 2 pixels.

Parameters:
shadowDistanceX - the horizontal distance of the shadow

getShadowDistanceY

public int getShadowDistanceY()
Returns the vertical distance of the drop shadow The default vertical offset is 2 pixels.


setShadowDistanceY

public void setShadowDistanceY(int shadowDistanceY)
Sets the vertical distance of the drop shadow The default vertical offset is 2 pixels.

Parameters:
shadowDistanceY - the vertical distance of the shadow

setShadowDistance

public void setShadowDistance(int distanceX,
                              int distanceY)
Sets the horizontal and vertical distance of the drop shadow effect

Parameters:
distanceX - the horizontal distance of the shadow
distanceY - the vertical distance of the shadow

paint

public void paint(NodeRealizer context,
                  java.awt.Graphics2D graphics)
Paints a drop shadow effect below the visual representation created by the delegate painter.

Invokes the delegate painter's paint method.

Specified by:
paint in interface GenericNodeRealizer.Painter

paintSloppy

public void paintSloppy(NodeRealizer context,
                        java.awt.Graphics2D graphics)
Invokes the delegate painter's paintSloppy method.

Specified by:
paintSloppy in interface GenericNodeRealizer.Painter

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