Package org.jdesktop.swingx.renderer
Class LabelProvider
- All Implemented Interfaces:
Serializable,UIDependent
A component provider which uses a
JLabel as rendering component. It configures the Label's text and icon property from the StringValue.
- Author:
- Jeanette Winzenburg
- See Also:
-
Field Summary
Fields inherited from class org.jdesktop.swingx.renderer.ComponentProvider
alignment, defaultVisuals, iconValue, rendererComponent, stringValue -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a LabelProvider with default to-String converter and LEADING horizontal alignment .LabelProvider(int alignment) Instantiates a LabelProvider with default to-String converter and given horizontal alignment.LabelProvider(StringValue converter) Instantiates a LabelProvider with the given to-String converter and LEADING horizontal alignment.LabelProvider(StringValue converter, int alignment) Instantiates a LabelProvider with given to-String converter and given horizontal alignment. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureState(CellContext context) Configures the rendering component's state from the given cell context.protected JLabelFactory method to create and return the component to use for rendering.protected voidformat(CellContext context) Formats the renderering component's content from the given cell context.Methods inherited from class org.jdesktop.swingx.renderer.ComponentProvider
configureContent, configureVisuals, createDefaultVisuals, getDefaultVisuals, getHorizontalAlignment, getRendererComponent, getString, getStringValue, getValueAsIcon, getValueAsString, setHorizontalAlignment, setIconValue, setStringValue, updateUI
-
Constructor Details
-
LabelProvider
public LabelProvider()Instantiates a LabelProvider with default to-String converter and LEADING horizontal alignment . -
LabelProvider
Instantiates a LabelProvider with the given to-String converter and LEADING horizontal alignment. If the converter is null, the default TO_STRING is used.- Parameters:
converter- the converter to use for mapping the cell value to a String representation.
-
LabelProvider
public LabelProvider(int alignment) Instantiates a LabelProvider with default to-String converter and given horizontal alignment.- Parameters:
alignment- the horizontal alignment.
-
LabelProvider
Instantiates a LabelProvider with given to-String converter and given horizontal alignment. If the converter is null, the default TO_STRING is used.- Parameters:
converter- the converter to use for mapping the cell value to a String representation.alignment- the horizontal alignment.
-
-
Method Details
-
createRendererComponent
Factory method to create and return the component to use for rendering.- Specified by:
createRendererComponentin classComponentProvider<JLabel>- Returns:
- the component to use for rendering.
-
configureState
Configures the rendering component's state from the given cell context. Here: sets the Label's horizontal alignment to the alignment as configured in the controller.- Specified by:
configureStatein classComponentProvider<JLabel>- Parameters:
context- the cell context to configure from, must not be null.
-
format
Formats the renderering component's content from the given cell context. Here: sets the labels's text and icon property to the value as returned by getValueAsString/Icon, respectively.- Specified by:
formatin classComponentProvider<JLabel>- Parameters:
context- the cellContext to use- See Also:
-