Search this API

y.option
Class RealizerCellRenderer.EdgeRealizerIcon

java.lang.Object
  extended by y.option.RealizerCellRenderer.EdgeRealizerIcon
All Implemented Interfaces:
javax.swing.Icon
Enclosing class:
RealizerCellRenderer

public static class RealizerCellRenderer.EdgeRealizerIcon
extends java.lang.Object
implements javax.swing.Icon

A special icon that renders an edge realizer

 

Constructor Summary
RealizerCellRenderer.EdgeRealizerIcon(EdgeRealizer realizer, int width, int height)
          Creates an icon for the given realizer.
 
Method Summary
protected  YPoint calculateSourceBend(EdgeRealizer realizer, int iconWidth, int iconHeight)
          Calculates the location of the first control point in the displayed edge visualization.
protected  YPoint calculateTargetBend(EdgeRealizer realizer, int iconWidth, int iconHeight)
          Calculates the location of the second control point in the displayed edge visualization.
 int getIconHeight()
          Returns the height of this icon.
 int getIconWidth()
          Returns the width of this icon.
 boolean isDrawingBends()
          Returns true if the bends of the realizer are drawn.
 void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
          Draws the icon at the specified location.
protected  void paintRealizer(EdgeRealizer er, java.awt.Graphics2D gfx)
          Paints the given edge realizer.
 void setDrawingBends(boolean drawingBends)
          Sets whether the bends of the realizer are drawn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealizerCellRenderer.EdgeRealizerIcon

public RealizerCellRenderer.EdgeRealizerIcon(EdgeRealizer realizer,
                                             int width,
                                             int height)
Creates an icon for the given realizer.

Parameters:
realizer - the realizer to create an icon for
width - the width of the icon
height - the height of the icon
Method Detail

isDrawingBends

public boolean isDrawingBends()
Returns true if the bends of the realizer are drawn.

Returns:
true if the bends are drawn
See Also:
setDrawingBends(boolean)

setDrawingBends

public void setDrawingBends(boolean drawingBends)
Sets whether the bends of the realizer are drawn.

Parameters:
drawingBends - if true the bends are drawn
See Also:
isDrawingBends()

calculateSourceBend

protected YPoint calculateSourceBend(EdgeRealizer realizer,
                                     int iconWidth,
                                     int iconHeight)
Calculates the location of the first control point in the displayed edge visualization. The calculated point must be within [0, iconWidth]x[0, iconHeight].

Parameters:
realizer - the displayed edge visualization.
iconWidth - the width of the icon.
iconHeight - the height of the icon.
Returns:
the location of the first control point in the displayed edge.

calculateTargetBend

protected YPoint calculateTargetBend(EdgeRealizer realizer,
                                     int iconWidth,
                                     int iconHeight)
Calculates the location of the second control point in the displayed edge visualization. The calculated point must be within [0, iconWidth]x[0, iconHeight].

Parameters:
realizer - the displayed edge visualization.
iconWidth - the width of the icon.
iconHeight - the height of the icon.
Returns:
the location of the last control point in the displayed edge.

getIconHeight

public int getIconHeight()
Returns the height of this icon.

Specified by:
getIconHeight in interface javax.swing.Icon
Returns:
the height of this icon.

getIconWidth

public int getIconWidth()
Returns the width of this icon.

Specified by:
getIconWidth in interface javax.swing.Icon
Returns:
the width of this icon.

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Draws the icon at the specified location. Calls paintRealizer(y.view.EdgeRealizer, java.awt.Graphics2D).

Specified by:
paintIcon in interface javax.swing.Icon
Parameters:
c - ignored
g - the graphics context to draw upon.
x - x-coordinate of the icon's location.
y - y-coordinate of the icon's location.

paintRealizer

protected void paintRealizer(EdgeRealizer er,
                             java.awt.Graphics2D gfx)
Paints the given edge realizer. The actual painting is delegated to the realizer, so changing the visible attributes of the realizer will influence the drawing on subsequent runs of this method without the need to reinitialize this icon.

Called from paintIcon(java.awt.Component, java.awt.Graphics, int, int). The calling method will dispose the graphics context afterwards.


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