public class DefaultValueRenderer<T> extends java.lang.Object implements ValueRenderer<T>, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static com.simsilica.lemur.style.ElementId |
DEFAULT_ID |
Constructor and Description |
---|
DefaultValueRenderer()
Creates a value renderer with no preconfigured style, element ID, or
string function.
|
DefaultValueRenderer(com.simsilica.lemur.style.ElementId elementId,
java.lang.String style)
Creates a value renderer with the preconfigured elementID and style.
|
DefaultValueRenderer(com.simsilica.lemur.style.ElementId elementId,
java.lang.String style,
com.google.common.base.Function<? super T,java.lang.String> toString)
Creates a value renderer with a custom string function and the preconfigured
elementID and style.
|
DefaultValueRenderer(com.google.common.base.Function<? super T,java.lang.String> toString)
Creates a value renderer with the specified string function but no
configured element ID or style.
|
Modifier and Type | Method and Description |
---|---|
DefaultValueRenderer<T> |
clone() |
void |
configureStyle(com.simsilica.lemur.style.ElementId elementId,
java.lang.String style)
Default implementation uses the specified style unless the renderer
already has an elementId and style set.
|
protected com.simsilica.lemur.Label |
createView(T value,
boolean selected)
Called by getView() to create the new view when the existing
view doesn't exist.
|
com.simsilica.lemur.style.ElementId |
getElementId() |
com.google.common.base.Function<? super T,java.lang.String> |
getStringTransform() |
java.lang.String |
getStyle() |
com.simsilica.lemur.Panel |
getView(T value,
boolean selected,
com.simsilica.lemur.Panel existing)
Returns a new view Panel or returns a reconfigured version of
the existing Panel that will display the specified value.
|
void |
setElementId(com.simsilica.lemur.style.ElementId elementId)
Sets a preconfigured ElementId for created Panels.
|
void |
setStringTransform(com.google.common.base.Function<? super T,java.lang.String> toString)
Sets the function that will convert values to Strings.
|
void |
setStyle(java.lang.String style)
Sets a preconfigured style for created Panels.
|
protected java.lang.String |
valueToString(T value)
Called by getView() and createView() to conver the value
to a string.
|
public DefaultValueRenderer()
public DefaultValueRenderer(com.google.common.base.Function<? super T,java.lang.String> toString)
public DefaultValueRenderer(com.simsilica.lemur.style.ElementId elementId, java.lang.String style)
public DefaultValueRenderer(com.simsilica.lemur.style.ElementId elementId, java.lang.String style, com.google.common.base.Function<? super T,java.lang.String> toString)
public DefaultValueRenderer<T> clone()
clone
in class java.lang.Object
public void configureStyle(com.simsilica.lemur.style.ElementId elementId, java.lang.String style)
configureStyle
in interface ValueRenderer<T>
public void setStringTransform(com.google.common.base.Function<? super T,java.lang.String> toString)
public com.google.common.base.Function<? super T,java.lang.String> getStringTransform()
public void setElementId(com.simsilica.lemur.style.ElementId elementId)
public com.simsilica.lemur.style.ElementId getElementId()
public void setStyle(java.lang.String style)
public java.lang.String getStyle()
protected java.lang.String valueToString(T value)
protected com.simsilica.lemur.Label createView(T value, boolean selected)
public com.simsilica.lemur.Panel getView(T value, boolean selected, com.simsilica.lemur.Panel existing)
ValueRenderer
getView
in interface ValueRenderer<T>