Search this API

y.option
Class RealizerCellRenderer

java.lang.Object
  extended by y.option.RealizerCellRenderer
All Implemented Interfaces:
javax.swing.ListCellRenderer, javax.swing.table.TableCellRenderer

public class RealizerCellRenderer
extends java.lang.Object
implements javax.swing.ListCellRenderer, javax.swing.table.TableCellRenderer

ListCellRenderer and TableCellRenderer implementation that renders objects of type NodeRealizer and EdgeRealizer nicely.

 

Nested Class Summary
static class RealizerCellRenderer.EdgeRealizerIcon
          A special icon that renders an edge realizer
static class RealizerCellRenderer.NodeRealizerIcon
          This is a special icon that renders a realizer into an icon
 
Constructor Summary
RealizerCellRenderer()
          Initializes a new RealizerCellRenderer instance with initial width and height set to 50.
RealizerCellRenderer(int itemWidth, int itemHeight)
          Initializes a new RealizerCellRenderer instance with the specified width and height.
 
Method Summary
protected  javax.swing.Icon createEdgeRealizerIcon(EdgeRealizer realizer, int iconWidth, int iconHeight)
          Creates an icon that displays the specified realizer.
protected  java.lang.String createEdgeToolTipText(EdgeRealizer realizer)
          Creates a tool tip text for the icon that displays the specified realizer.
protected  javax.swing.Icon createNodeRealizerIcon(NodeRealizer realizer, int iconWidth, int iconHeight)
          Creates an icon that displays the specified realizer.
protected  java.lang.String createNodeToolTipText(NodeRealizer realizer)
          Creates a tool tip text for the icon that displays the specified realizer.
 int getItemHeight()
          Returns the preferred height set for the renderer.
 int getItemWidth()
          Returns the preferred width for the renderer.
 java.awt.Component getListCellRendererComponent(javax.swing.JList list, java.lang.Object value, int index, boolean isSelected, boolean cellHasFocus)
           
 java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
           
 void setItemHeight(int itemHeight)
          Sets the preferred height for the renderer.
 void setItemWidth(int itemWidth)
          Sets the preferred width for the renderer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealizerCellRenderer

public RealizerCellRenderer()
Initializes a new RealizerCellRenderer instance with initial width and height set to 50.


RealizerCellRenderer

public RealizerCellRenderer(int itemWidth,
                            int itemHeight)
Initializes a new RealizerCellRenderer instance with the specified width and height.

Parameters:
itemWidth - the initial preferred width of this renderer.
itemHeight - the initial preferred height of this renderer.
Method Detail

getItemWidth

public int getItemWidth()
Returns the preferred width for the renderer.

Returns:
the preferred width for the renderer.

setItemWidth

public void setItemWidth(int itemWidth)
Sets the preferred width for the renderer.

Parameters:
itemWidth - the width

getItemHeight

public int getItemHeight()
Returns the preferred height set for the renderer.

Returns:
the preferred height set for the renderer.

setItemHeight

public void setItemHeight(int itemHeight)
Sets the preferred height for the renderer.

Parameters:
itemHeight - the height

getListCellRendererComponent

public java.awt.Component getListCellRendererComponent(javax.swing.JList list,
                                                       java.lang.Object value,
                                                       int index,
                                                       boolean isSelected,
                                                       boolean cellHasFocus)
Specified by:
getListCellRendererComponent in interface javax.swing.ListCellRenderer

getTableCellRendererComponent

public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table,
                                                        java.lang.Object value,
                                                        boolean isSelected,
                                                        boolean hasFocus,
                                                        int row,
                                                        int column)
Specified by:
getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer

createNodeRealizerIcon

protected javax.swing.Icon createNodeRealizerIcon(NodeRealizer realizer,
                                                  int iconWidth,
                                                  int iconHeight)
Creates an icon that displays the specified realizer. Used in getListCellRendererComponent(javax.swing.JList, Object, int, boolean, boolean) and getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) to create icons for the renderer component.

Parameters:
realizer - the node visualization to display.
iconWidth - the desired width of the created icon.
iconHeight - the desired height of the created icon.
Returns:
an icon that displays the specified realizer.

createEdgeRealizerIcon

protected javax.swing.Icon createEdgeRealizerIcon(EdgeRealizer realizer,
                                                  int iconWidth,
                                                  int iconHeight)
Creates an icon that displays the specified realizer. Used in getListCellRendererComponent(javax.swing.JList, Object, int, boolean, boolean) and getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) to create icons for the renderer component.

Parameters:
realizer - the edge visualization to display.
iconWidth - the desired width of the created icon.
iconHeight - the desired height of the created icon.
Returns:
an icon that displays the specified realizer.

createNodeToolTipText

protected java.lang.String createNodeToolTipText(NodeRealizer realizer)
Creates a tool tip text for the icon that displays the specified realizer. Used in getListCellRendererComponent(javax.swing.JList, Object, int, boolean, boolean) and getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) to create tool tip texts for the renderer component.

Parameters:
realizer - the node visualization to display.
Returns:
a tool tip text for the specified realizer.

createEdgeToolTipText

protected java.lang.String createEdgeToolTipText(EdgeRealizer realizer)
Creates a tool tip text for the icon that displays the specified realizer. Used in getListCellRendererComponent(javax.swing.JList, Object, int, boolean, boolean) and getTableCellRendererComponent(javax.swing.JTable, Object, boolean, boolean, int, int) to create tool tip texts for the renderer component.

Parameters:
realizer - the edge visualization to display.
Returns:
a tool tip text for the specified realizer.

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