Decision Center API

ilog.webui.dhtml.components
Interface IlxWListCellRenderer

All Known Implementing Classes:
IlxWDefaultListCellRenderer

public interface IlxWListCellRenderer

Identifies components that can be used as "rubber stamps" to render the cells in an IlxWList. For example, to use a IlxWLabel as a IlxWListCellRenderer, you would write something like this:

 class MyCellRenderer extends IlxWLabel implements IlxWListCellRenderer {

     public IlxWComponent getListCellRendererComponent(

         IlxWList list,

         Object value,

         int index,

         boolean isSelected)

     {

         setText(value.toString());

         if (isSelected) {

           getStyle().set("backgroundColor", "red");

           getStyle().set("color", "white");

         } else {

           getStyle().set("backgroundColor", "white");

           getStyle().set("color", "black");

         }

         return this;

     }

 }

 

See Also:

Method Summary
 IlxWComponent getListCellRendererComponent(IlxWList list, Object value, int index, boolean isSelected)
          Return a component that has been configured to display the specified value.
 

Method Detail

getListCellRendererComponent

IlxWComponent getListCellRendererComponent(IlxWList list,
                                           Object value,
                                           int index,
                                           boolean isSelected)
Return a component that has been configured to display the specified value. That component's print method is then called to "render" the cell.

Parameters:
list - The IlxWList we want to render.
value - The value returned by list.getModel().getElementAt(index).
index - The cells index.
isSelected - True if the specified cell was selected.
Returns:
A component whose print() method will render the specified value.
See Also:
IlxWList, ListSelectionModel, ListModel

Decision Center API

© Copyright IBM Corp. 1987, 2013