Note: core DefaultListCellRenderer shows either an icon or the element's toString representation, depending on whether or not the given value is of type icon or implementors. This renderer's empty/null provider constructor takes care of configuring the default provider with a converter which mimics that behaviour. When instantiating this renderer with any of the constructors which have converters as parameters, it's up to the client code to supply the appropriate converter, if needed:
StringValue sv = new StringValue() { public String getString(Object value) { if (value instanceof Icon) { return ""; } return StringValue.TO_STRING.getString(value); } }; StringValue lv = new MappedValue(sv, IconValue.ICON); listRenderer = new DefaultListRenderer(lv, alignment);
@author Jeanette Winzenburg @see ComponentProvider @see StringValue @see IconValue @see MappedValue
|
|