net.mtu.eggplant.util.gui
Class SmartRenderer
java.lang.Object
net.mtu.eggplant.util.gui.SmartRenderer
- All Implemented Interfaces:
- ListCellRenderer, TableCellRenderer, TreeCellRenderer
public class SmartRenderer
- extends Object
- implements ListCellRenderer, TableCellRenderer, TreeCellRenderer
Class that knows how to render lots of things. If you want to create a
renderer, just subclass this SmartRenderer and override the
getStringValue() method. For any object that is not a known type toString
is used. Null values are always displayed as "NULL". This class counts on
the fact that the default renderers for list, trable and tree all return a
subclass of JLabel. If that ever changes, this class breaks.
Known types
- Version:
- $Revision$
Method Summary |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
|
String |
getStringValue(Object value)
Get the string representation of this object. |
Component |
getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
|
Component |
getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SmartRenderer
public SmartRenderer()
getListCellRendererComponent
public final Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
- Specified by:
getListCellRendererComponent
in interface ListCellRenderer
getTableCellRendererComponent
public final Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column)
- Specified by:
getTableCellRendererComponent
in interface TableCellRenderer
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
- Specified by:
getTreeCellRendererComponent
in interface TreeCellRenderer
getStringValue
public String getStringValue(Object value)
- Get the string representation of this object.