com.arsdigita.bebop.list
Interface ListCellRenderer
- All Known Implementing Classes:
- DefaultListCellRenderer
- public interface ListCellRenderer
Produce a component to output one item in a
List
. For example, to output the item either as a link
that, when clicked, will make the item selected or, if the item is
selected will display it as a bold label, you would write the following
code:
public class MyListCellRenderer implements ListCellRenderer {
public Component getComponent(List list, PageState state, Object value,
String key, int index, boolean isSelected) {
Label l = new Label(value.toString());
if (isSelected) {
l.setFontWeight(Label.BOLD);
return l;
}
return new ControlLink(l);
}
}
This is actually exactly what the DefaultListCellRenderer
does.
- Version:
- $Id: //core-platform/dev/src/com/arsdigita/bebop/list/ListCellRenderer.java#9 $
- Author:
- David Lutterkort
- See Also:
List
,
DefaultListCellRenderer
,
ListModel
versionId
public static final String versionId
- See Also:
- Constant Field Values
getComponent
public Component getComponent(List list,
PageState state,
Object value,
String key,
int index,
boolean isSelected)
- Return a component that has been configured to display the specified
value. That component's
generateXML
or print
method is then called to "render" the cell.
- Parameters:
list
- the List
in which this item is being displayed.state
- represents the state of the current request.value
- the value returned by
list.getModel(state).getElement()
key
- the value returned by
list.getModel(state).getKey()
index
- the number of the item in the listisSelected
- true is the item is selected
- Returns:
- the component used to generate the output for the list item
Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2337 UTC