Search this API

y.option
Class RealizerCellRenderer

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

public class RealizerCellRenderer
extends Object
implements ListCellRenderer, 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()
           
RealizerCellRenderer(int itemWidth, int itemHeight)
           
 
Method Summary
protected  Icon createEdgeRealizerIcon(EdgeRealizer realizer, int iconWidth, int iconHeight)
          Creates an icon that displays the specified realizer.
protected  String createEdgeToolTipText(EdgeRealizer realizer)
          Creates a tool tip text for the icon that displays the specified realizer.
protected  Icon createNodeRealizerIcon(NodeRealizer realizer, int iconWidth, int iconHeight)
          Creates an icon that displays the specified realizer.
protected  String createNodeToolTipText(NodeRealizer realizer)
          Creates a tool tip text for the icon that displays the specified realizer.
 int getItemHeight()
           
 int getItemWidth()
           
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
           
 Component getTableCellRendererComponent(JTable table, 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()

RealizerCellRenderer

public RealizerCellRenderer(int itemWidth,
                            int itemHeight)
Method Detail

getItemWidth

public int getItemWidth()
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.

setItemHeight

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

Parameters:
itemHeight - the height

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
Specified by:
getListCellRendererComponent in interface ListCellRenderer

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Specified by:
getTableCellRendererComponent in interface TableCellRenderer

createNodeRealizerIcon

protected 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 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 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 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-2013,
yWorks GmbH.
All rights reserved.