Search this API

y.view
Class SelectionPortPainter

java.lang.Object
  extended by y.view.SelectionPortPainter
All Implemented Interfaces:
NodePort.Painter

public class SelectionPortPainter
extends java.lang.Object
implements NodePort.Painter

A decorator for NodePort.Painter implementation that draws a special "is selected" marker.

 

Field Summary
static byte STYLE_FRAMED
          Selection style that draws a black rectangle around the selected node port.
static byte STYLE_SMOOTHED
          Selection style that draws a black and rounded rectangle around the selected node port.
static byte STYLE_WEDGES
          Selection style that draws four black wedges around the selected node port.
 
Constructor Summary
SelectionPortPainter(NodePort.Painter painter)
          Initializes a new SelectionPortPainter instance.
 
Method Summary
 byte getStyle()
          Determines the selection style to highlight selected node ports.
protected  boolean initializeLine(NodeRealizer context, NodePort port, java.awt.Graphics2D g)
          Initializes the graphics context for the drawing of the selection marker of the specified port.
 void paint(NodePort port, java.awt.Graphics2D g)
          Paints the specified port.
 void setStyle(byte style)
          Specifies the selection style to highlight selected node ports.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STYLE_WEDGES

public static final byte STYLE_WEDGES
Selection style that draws four black wedges around the selected node port.

See Also:
setStyle(byte), getStyle(), Constant Field Values

STYLE_FRAMED

public static final byte STYLE_FRAMED
Selection style that draws a black rectangle around the selected node port.

See Also:
setStyle(byte), getStyle(), Constant Field Values

STYLE_SMOOTHED

public static final byte STYLE_SMOOTHED
Selection style that draws a black and rounded rectangle around the selected node port.

See Also:
setStyle(byte), getStyle(), Constant Field Values
Constructor Detail

SelectionPortPainter

public SelectionPortPainter(NodePort.Painter painter)
Initializes a new SelectionPortPainter instance.

Parameters:
painter - the decorated painter implementation.
Method Detail

getStyle

public byte getStyle()
Determines the selection style to highlight selected node ports.

The default selection style is STYLE_WEDGES.

Returns:
one of STYLE_WEDGES, STYLE_FRAMED, and STYLE_SMOOTHED.
See Also:
setStyle(byte)

setStyle

public void setStyle(byte style)
Specifies the selection style to highlight selected node ports.

The default selection style is STYLE_WEDGES.

Parameters:
style - on of STYLE_WEDGES, STYLE_FRAMED, and STYLE_SMOOTHED.
Throws:
java.lang.IllegalArgumentException - if the specified style does not equal one of the aforementioned style constants.
See Also:
getStyle()

paint

public void paint(NodePort port,
                  java.awt.Graphics2D g)
Description copied from interface: NodePort.Painter
Paints the specified port.

Callback method for NodePort.paint(java.awt.Graphics2D).

Specified by:
paint in interface NodePort.Painter
Parameters:
port - the port instance to paint.
g - the graphics context to paint upon.

initializeLine

protected boolean initializeLine(NodeRealizer context,
                                 NodePort port,
                                 java.awt.Graphics2D g)
Initializes the graphics context for the drawing of the selection marker of the specified port. If this method returns false no marker should be drawn. Called from paint.

Parameters:
context - the realizer whose NodePorts are painted.
port - the NodePort instance that is painted.
g - the graphics context to paint upon.
Returns:
true if the selection marker of the specified port should be drawn; false otherwise.
See Also:
paint(NodePort, java.awt.Graphics2D)

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