FileDocCategorySizeDatePackage
CategoryExplorerTree.javaAPI DocApache log4j 1.2.154585Sat Aug 25 00:09:38 BST 2007org.apache.log4j.lf5.viewer.categoryexplorer

CategoryExplorerTree

public class CategoryExplorerTree extends JTree
CategoryExplorerTree
author
Michael J. Sikorsky
author
Robert Shaw
author
Brent Sprecher
author
Brad Marlborough

Fields Summary
private static final long
serialVersionUID
protected CategoryExplorerModel
_model
protected boolean
_rootAlreadyExpanded
Constructors Summary
public CategoryExplorerTree(CategoryExplorerModel model)
Construct a CategoryExplorerTree with a specific model.


  //--------------------------------------------------------------------------
  //   Private Variables:
  //--------------------------------------------------------------------------

  //--------------------------------------------------------------------------
  //   Constructors:
  //--------------------------------------------------------------------------

            
     
    super(model);

    _model = model;
    init();
  
public CategoryExplorerTree()
Construct a CategoryExplorerTree and create a default CategoryExplorerModel.

    super();

    CategoryNode rootNode = new CategoryNode("Categories");

    _model = new CategoryExplorerModel(rootNode);

    setModel(_model);

    init();
  
Methods Summary
protected voidensureRootExpansion()

    _model.addTreeModelListener(new TreeModelAdapter() {
      public void treeNodesInserted(TreeModelEvent e) {
        expandRootNode();
      }
    });
  
protected voidexpandRootNode()

    if (_rootAlreadyExpanded) {
      return;
    }
    _rootAlreadyExpanded = true;
    TreePath path = new TreePath(_model.getRootCategoryNode().getPath());
    expandPath(path);
  
public org.apache.log4j.lf5.viewer.categoryexplorer.CategoryExplorerModelgetExplorerModel()

    return (_model);
  
public java.lang.StringgetToolTipText(java.awt.event.MouseEvent e)


    try {
      return super.getToolTipText(e);
    } catch (Exception ex) {
      return "";
    }

  
protected voidinit()

    // Put visible lines on the JTree.
    putClientProperty("JTree.lineStyle", "Angled");

    // Configure the Tree with the appropriate Renderers and Editors.

    CategoryNodeRenderer renderer = new CategoryNodeRenderer();
    setEditable(true);
    setCellRenderer(renderer);

    CategoryNodeEditor editor = new CategoryNodeEditor(_model);

    setCellEditor(new CategoryImmediateEditor(this,
        new CategoryNodeRenderer(),
        editor));
    setShowsRootHandles(true);

    setToolTipText("");

    ensureRootExpansion();