org.jdesktop.swingx.renderer
Class WrappingProvider

java.lang.Object
  extended by org.jdesktop.swingx.renderer.ComponentProvider<WrappingIconPanel>
      extended by org.jdesktop.swingx.renderer.WrappingProvider
All Implemented Interfaces:
Serializable, RolloverRenderer

public class WrappingProvider
extends ComponentProvider<WrappingIconPanel>
implements RolloverRenderer

Wrapping controller for usage in tree renderers. Handles the icon, delegates the value to the wrappee.

PENDING: ui specific focus rect variation (draw rect around icon) missing

PENDING: custom icons missing

See Also:
Serialized Form

Field Summary
protected  ComponentProvider wrappee
           
 
Fields inherited from class org.jdesktop.swingx.renderer.ComponentProvider
alignment, defaultVisuals, formatter, rendererComponent
 
Constructor Summary
WrappingProvider()
           
WrappingProvider(ComponentProvider wrapper)
           
WrappingProvider(StringValue converter)
           
 
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.
 boolean isEnabled()
          
protected  void restoreContextValue(CellContext context, Object oldValue)
           
 void setWrappee(ComponentProvider wrappee)
           
 
Methods inherited from class org.jdesktop.swingx.renderer.ComponentProvider
configureContent, configureVisuals, createRendererController, getHorizontalAlignment, getRendererController, getStringValue, getToStringConverter, setHorizontalAlignment, setToStringConverter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrappee

protected ComponentProvider wrappee
Constructor Detail

WrappingProvider

public WrappingProvider()

WrappingProvider

public WrappingProvider(ComponentProvider wrapper)

WrappingProvider

public WrappingProvider(StringValue converter)
Parameters:
converter -
Method Detail

setWrappee

public void setWrappee(ComponentProvider wrappee)

getRendererComponent

public WrappingIconPanel getRendererComponent(CellContext context)
Configures and returns an appropriate component to render a cell in the given context. If the context is null, returns the component in its current state.

Overrides:
getRendererComponent in class ComponentProvider<WrappingIconPanel>
Parameters:
context - the cell context to configure from
Returns:
a component to render a cell in the given context.

restoreContextValue

protected void restoreContextValue(CellContext context,
                                   Object oldValue)
Parameters:
context -
oldValue -

adjustContextValue

protected Object adjustContextValue(CellContext context)
Replace the context's value with the userobject if it's a treenode.

Subclasses may override but must guarantee to return the original value for restoring.

Parameters:
context - the context to adjust
Returns:
the old context value

configureState

protected void configureState(CellContext context)
Description copied from class: ComponentProvider
Configures the renderering component's state from the given cell context.

Specified by:
configureState in class ComponentProvider<WrappingIconPanel>
Parameters:
context - the cell context to configure from, must not be null.

createRendererComponent

protected WrappingIconPanel createRendererComponent()
Description copied from class: ComponentProvider
Factory method to create and return the component to use for rendering.

Specified by:
createRendererComponent in class ComponentProvider<WrappingIconPanel>
Returns:
the component to use for rendering.

format

protected void format(CellContext context)
Description copied from class: ComponentProvider
Formats the renderering component's content from the given cell context.

Specified by:
format in class ComponentProvider<WrappingIconPanel>
Parameters:
context - the cell context to configure from, must not be null.

doClick

public void doClick()
Same as AbstractButton.doClick(). It's up to client code to prepare the renderer's component before calling this method.

Specified by:
doClick in interface RolloverRenderer

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface RolloverRenderer
Returns:
true if rollover effects are on and clickable.