Package org.jdesktop.swingx
Class JXTree.DelegatingRenderer
java.lang.Object
org.jdesktop.swingx.renderer.AbstractRenderer
org.jdesktop.swingx.renderer.DefaultTreeRenderer
org.jdesktop.swingx.JXTree.DelegatingRenderer
- All Implemented Interfaces:
Serializable
,TreeCellRenderer
,UIDependent
,StringValue
,RolloverRenderer
- Enclosing class:
- JXTree
public class JXTree.DelegatingRenderer
extends DefaultTreeRenderer
implements TreeCellRenderer, RolloverRenderer
A decorator for the original TreeCellRenderer. Needed to hook highlighters
after messaging the delegate.
PENDING JW: formally implement UIDependent? PENDING JW: missing updateUI anyway (got lost when pasted from JXList ;-) PENDING JW: missing override of updateUI in xtree ...
- See Also:
-
Field Summary
Fields inherited from class org.jdesktop.swingx.renderer.AbstractRenderer
componentController
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a DelegatingRenderer with tree's default renderer as delegate.DelegatingRenderer
(TreeCellRenderer delegate, IconValue iv, StringValue sv) Instantiates a DelegatingRenderer with the given delegate.DelegatingRenderer
(IconValue iv, StringValue sv) -
Method Summary
Modifier and TypeMethodDescriptionvoid
doClick()
Same as AbstractButton.doClick().Returns the delegate.getTreeCellRendererComponent
(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) Returns a configured component, appropriate to render the given tree cell.boolean
void
setClosedIcon
(Icon closedIcon) void
setDelegateRenderer
(TreeCellRenderer delegate) Sets the delegate.void
setLeafIcon
(Icon leafIcon) void
setOpenIcon
(Icon openIcon) Methods inherited from class org.jdesktop.swingx.renderer.DefaultTreeRenderer
createDefaultComponentProvider
Methods inherited from class org.jdesktop.swingx.renderer.AbstractRenderer
getComponentProvider, getString, setBackground, setForeground, updateUI
-
Constructor Details
-
DelegatingRenderer
public DelegatingRenderer()Instantiates a DelegatingRenderer with tree's default renderer as delegate. -
DelegatingRenderer
-
DelegatingRenderer
-
DelegatingRenderer
Instantiates a DelegatingRenderer with the given delegate. If the delegate is null, the default is created via the trees's factory method.- Parameters:
delegate
- the delegate to use, if not instanceof DefaultTreeCellRenderer the tree's default is created and used.iv
- the IconValue to use for mapping a custom icon for a given valuesv
- the converter to use for mapping the content value to a String representation.
-
-
Method Details
-
setDelegateRenderer
Sets the delegate. If the delegate is null, the default is created via the tree's factory method. Updates the folder/leaf icons. THINK: how to update? always override with this.icons, only if renderer's icons are null, update this icons if they are not, update all if only one is != null.... ??- Parameters:
delegate
- the delegate to use, if null the list's default is created and used.
-
setClosedIcon
-
setOpenIcon
-
setLeafIcon
-
getDelegateRenderer
Returns the delegate.- Returns:
- the delegate renderer used by this renderer, guaranteed to not-null.
-
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) Returns a configured component, appropriate to render the given tree cell.Overridden to apply the highlighters, if any, after calling the delegate. The decorators are not applied if the row is invalid.
- Specified by:
getTreeCellRendererComponent
in interfaceTreeCellRenderer
- Overrides:
getTreeCellRendererComponent
in classDefaultTreeRenderer
- Parameters:
tree
- theJTree
, might be nullvalue
- the value to assign to the cellselected
- true if cell is selectedexpanded
- true if the cell is expandedleaf
- true if the cell is a leafrow
- the row of the cell to renderhasFocus
- true if cell has focus- Returns:
- a component to render the given list cell.
-
isEnabled
public boolean isEnabled()Description copied from class:AbstractRenderer
- Specified by:
isEnabled
in interfaceRolloverRenderer
- Overrides:
isEnabled
in classAbstractRenderer
- Returns:
- true if rollover effects are on and clickable.
-
doClick
public void doClick()Description copied from class:AbstractRenderer
Same as AbstractButton.doClick(). It's up to client code to prepare the renderer's component before calling this method.- Specified by:
doClick
in interfaceRolloverRenderer
- Overrides:
doClick
in classAbstractRenderer
-