|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.renderer.ComponentProvider<WrappingIconPanel>
org.jdesktop.swingx.renderer.WrappingProvider
public class WrappingProvider
Wrapping ComponentProvider for usage in tree rendering. Handles the icon
itself, delegates the node content to the wrappee. Value-based icon and
content mapping can be configured by custom IconValue
s and
StringValue, respectively.
An example of how to configure a file tree by using the system icons and display names
StringValue sv = new StringValue() {
public String getString(Object value) {
if (value instanceof File) {
return FileSystemView.getFileSystemView().getSystemDisplayName(
(File) value);
}
return TO_STRING.getString(value);
}
};
IconValue iv = new IconValue() {
public Icon getIcon(Object value) {
if (value instanceof File) {
return FileSystemView.getFileSystemView().getSystemIcon(
(File) value);
}
return null;
}
};
TreeCellRenderer r = new DefaultTreeRenderer(iv, sv);
tree.setCellRenderer(r);
treeTable.setTreeCellRenderer(r);
PENDING: ui specific focus rect variation (draw rect around icon) missing
Field Summary | |
---|---|
protected ComponentProvider |
wrappee
|
Fields inherited from class org.jdesktop.swingx.renderer.ComponentProvider |
---|
alignment, defaultVisuals, formatter, rendererComponent |
Constructor Summary | |
---|---|
WrappingProvider()
Instantiates a WrappingProvider with default LabelProvider. |
|
WrappingProvider(ComponentProvider delegate)
Instantiates a WrappingProvider with the given delegate provider for the node content. |
|
WrappingProvider(IconValue iconValue)
Instantiates a WrappingProvider with default wrappee. |
|
WrappingProvider(IconValue iconValue,
StringValue wrappeeStringValue)
Instantiates a WrappingProvider with default wrappee. |
|
WrappingProvider(StringValue wrappeeStringValue)
Instantiates a WrappingProvider with default wrappee configured with the given StringValue. |
Method Summary | |
---|---|
protected Object |
adjustContextValue(CellContext context)
Replace the context's value with the userobject if it's a treenode. |
protected void |
configureState(CellContext context)
Configures the renderering component's state from the given cell context. |
protected WrappingIconPanel |
createRendererComponent()
Factory method to create and return the component to use for rendering. |
void |
doClick()
Same as AbstractButton.doClick(). |
protected void |
format(CellContext context)
Formats the renderering component's content from the given cell context. |
WrappingIconPanel |
getRendererComponent(CellContext context)
Configures and returns an appropriate component to render a cell in the given context. |
protected Icon |
getValueAsIcon(CellContext context)
Returns a Icon representation of the content. |
ComponentProvider |
getWrappee()
Returns the delegate provider used to render the node content. |
boolean |
isEnabled()
|
protected void |
restoreContextValue(CellContext context,
Object oldValue)
Restores the context value to the old value. |
void |
setWrappee(ComponentProvider delegate)
Sets the given provider as delegate for the node content. |
Methods inherited from class org.jdesktop.swingx.renderer.ComponentProvider |
---|
configureContent, configureVisuals, createRendererController, getHorizontalAlignment, getRendererController, getStringValue, getToStringConverter, getValueAsString, setHorizontalAlignment, setToStringConverter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ComponentProvider wrappee
Constructor Detail |
---|
public WrappingProvider()
public WrappingProvider(IconValue iconValue, StringValue wrappeeStringValue)
iconValue
- the IconValue to use for configuring the icon.public WrappingProvider(IconValue iconValue)
iconValue
- the IconValue to use for configuring the icon.public WrappingProvider(StringValue wrappeeStringValue)
wrappeeStringValue
- the StringValue to use in the wrappee.public WrappingProvider(ComponentProvider delegate)
delegate
- the provider to use as delegateMethod Detail |
---|
public void setWrappee(ComponentProvider delegate)
PENDING: rename to setDelegate?
delegate
- the provider to use as delegate.public ComponentProvider getWrappee()
public WrappingIconPanel getRendererComponent(CellContext context)
getRendererComponent
in class ComponentProvider<WrappingIconPanel>
context
- the cell context to configure from
protected void restoreContextValue(CellContext context, Object oldValue)
context
- the CellContext to restore.oldValue
- the value to restore the context to.protected Object adjustContextValue(CellContext context)
Subclasses may override but must guarantee to return the original value for restoring.
context
- the context to adjust
protected void configureState(CellContext context)
ComponentProvider
configureState
in class ComponentProvider<WrappingIconPanel>
context
- the cell context to configure from, must not be null.protected WrappingIconPanel createRendererComponent()
ComponentProvider
createRendererComponent
in class ComponentProvider<WrappingIconPanel>
protected void format(CellContext context)
Here: implemented to set the icon.
format
in class ComponentProvider<WrappingIconPanel>
context
- the cell context to configure from, must not be null.protected Icon getValueAsIcon(CellContext context)
This method messages the
IconValue
to get the Icon rep. Meant as
a convenience for subclasses.
Overridden to fallback to the default icons supplied by the context if super returns null. PENDING: make fallback configurable - null icons might be valid.
getValueAsIcon
in class ComponentProvider<WrappingIconPanel>
context
- the cell context, must not be null.
public void doClick()
doClick
in interface RolloverRenderer
public boolean isEnabled()
isEnabled
in interface RolloverRenderer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |