org.jdesktop.swingx.renderer
Class DefaultListRenderer

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

public class DefaultListRenderer
extends Object
implements ListCellRenderer, RolloverRenderer, Serializable

Adapter to glue SwingX renderer support to core api.

See Also:
Serialized Form

Field Summary
protected  CellContext<JList> cellContext
           
protected  ComponentProvider componentController
           
 
Constructor Summary
DefaultListRenderer()
          Instantiates a default list renderer with the default component controller.
DefaultListRenderer(ComponentProvider componentController)
          Instantiates a ListCellRenderer with the given componentController.
DefaultListRenderer(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 getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
          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

cellContext

protected CellContext<JList> cellContext
Constructor Detail

DefaultListRenderer

public DefaultListRenderer()
Instantiates a default list renderer with the default component controller.


DefaultListRenderer

public DefaultListRenderer(ComponentProvider componentController)
Instantiates a ListCellRenderer with the given componentController. If the controller is null, creates and uses a default.

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

DefaultListRenderer

public DefaultListRenderer(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

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
Returns a configured component, appropriate to render the given list cell.

Specified by:
getListCellRendererComponent in interface ListCellRenderer
Parameters:
list - the JList to render on
value - the value to assign to the cell
isSelected - true if cell is selected
cellHasFocus - true if cell has focus
index - the row index (in view coordinates) of the cell to render
Returns:
a component to render the given list cell.
See Also:
JList, ListSelectionModel, ListModel

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.