## org.apache.poi.contrib.poibrowser
Class ExtendableTreeCellRenderer

    java.lang.Object
      org.apache.poi.contrib.poibrowser.ExtendableTreeCellRenderer

All Implemented Interfaces:
  javax.swing.tree.TreeCellRenderer

public class ExtendableTreeCellRenderer
extends java.lang.Object
implements javax.swing.tree.TreeCellRenderer

This is a `TreeCellRenderer` implementation which is able to render arbitrary objects. The `ExtendableTreeCellRenderer` does not do the rendering itself but instead dispatches to class-specific renderers. A class/renderer pair must be registered using the `register(java.lang.Class, javax.swing.tree.TreeCellRenderer)` method. If a class has no registered renderer, the renderer of its closest superclass is used. Since the `ExtendableTreeCellRenderer` always has a default renderer for the `Object` class, rendering is always possible. The default `Object` renderer can be replaced by another renderer but it cannot be unregistered.

Since:
  2002-01-22
Version:
  $Id: ExtendableTreeCellRenderer.java,v 1.1.8.1 2004/02/22 11:22:14 glens Exp $
Author:
  Rainer Klute (klute@rainer-klute.de)

Field Summary
`protected java.util.Map` `renderers` Maps classes to renderers.

Constructor Summary
`ExtendableTreeCellRenderer()`

Method Summary
`protected javax.swing.tree.TreeCellRenderer` `findRenderer(java.lang.Class c)` Find the renderer for the specified class.
`java.awt.Component` `getTreeCellRendererComponent(javax.swing.JTree tree, java.lang.Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)` Renders an object in a tree cell depending of the object's class.
`void` `register(java.lang.Class c, javax.swing.tree.TreeCellRenderer renderer)` Registers a renderer for a class.
`void` `unregister(java.lang.Class c)` Unregisters a renderer for a class.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### renderers

    protected java.util.Map renderers

  Maps classes to renderers.

Constructor Detail

### ExtendableTreeCellRenderer

    public ExtendableTreeCellRenderer()

Method Detail

### register

    public void register(java.lang.Class c,
                         javax.swing.tree.TreeCellRenderer renderer)

  Registers a renderer for a class.

### unregister

    public void unregister(java.lang.Class c)

  Unregisters a renderer for a class. The renderer for the `Object` class cannot be unregistered.

### getTreeCellRendererComponent

    public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree,
                                                           java.lang.Object value,
                                                           boolean selected,
                                                           boolean expanded,
                                                           boolean leaf,
                                                           int row,
                                                           boolean hasFocus)

  Renders an object in a tree cell depending of the object's class.

  Specified by:
    `getTreeCellRendererComponent` in interface `javax.swing.tree.TreeCellRenderer`
  See Also:
    `TreeCellRenderer.getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)`

### findRenderer

    protected javax.swing.tree.TreeCellRenderer findRenderer(java.lang.Class c)

  Find the renderer for the specified class.

Copyright © 2003 Apache Software Foundation.