org.jdesktop.swingx.renderer
Class DefaultTableRenderer

java.lang.Object
  extended by org.jdesktop.swingx.renderer.DefaultTableRenderer
All Implemented Interfaces:
Serializable, TableCellRenderer, RolloverRenderer

public class DefaultTableRenderer
extends Object
implements TableCellRenderer, RolloverRenderer, Serializable

Adapter to glue SwingX renderer support to core api.

See Also:
ComponentProvider, LabelProvider, CellContext, Serialized Form

Field Summary
protected  ComponentProvider componentController
           
 
Constructor Summary
DefaultTableRenderer()
          Instantiates a default table renderer with the default component controller.
DefaultTableRenderer(ComponentProvider componentController)
          Instantiates a default table renderer with the given componentController.
DefaultTableRenderer(StringValue converter)
          Instantiates a default table renderer with a default component controller using the given converter.
 
Method Summary
 void doClick()
          Same as AbstractButton.doClick().
 Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
          Returns a configured component, appropriate to render the given list cell.
 boolean isEnabled()
          
 void setBackground(Color background)
           
 void setForeground(Color foreground)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

componentController

protected ComponentProvider componentController
Constructor Detail

DefaultTableRenderer

public DefaultTableRenderer()
Instantiates a default table renderer with the default component controller.


DefaultTableRenderer

public DefaultTableRenderer(ComponentProvider componentController)
Instantiates a default table renderer with the given componentController. If the controller is null, creates and uses a default. The default controller is of type LabelProvider.

Parameters:
componentController - the provider of the configured component to use for cell rendering

DefaultTableRenderer

public DefaultTableRenderer(StringValue converter)
Instantiates a default table renderer with a default component controller using the given converter.

Parameters:
converter - the converter to use for mapping the content value to a String representation.
Method Detail

getTableCellRendererComponent

public Component getTableCellRendererComponent(JTable table,
                                               Object value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int row,
                                               int column)
Returns a configured component, appropriate to render the given list cell.

Specified by:
getTableCellRendererComponent in interface TableCellRenderer
Parameters:
table - the JTable
value - the value to assign to the cell at [row, column]
isSelected - true if cell is selected
hasFocus - true if cell has focus
row - the row of the cell to render
column - the column of the cell to render
Returns:
the default table cell renderer

setBackground

public void setBackground(Color background)
Parameters:
background -

setForeground

public void setForeground(Color foreground)
Parameters:
foreground -

doClick

public void doClick()
Same as AbstractButton.doClick(). It's up to client code to prepare the renderer's component before calling this method.

Specified by:
doClick in interface RolloverRenderer

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface RolloverRenderer
Returns:
true if rollover effects are on and clickable.