// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   RootDirectoryTreeCellRenderer.java

package hep.rootio.util;

import hep.rootio.RootClass;
import hep.rootio.interfaces.*;

import java.awt.Component;
import java.io.IOException;
import javax.swing.*;
import javax.swing.tree.DefaultTreeCellRenderer;

public class RootDirectoryTreeCellRenderer extends DefaultTreeCellRenderer
{

    public RootDirectoryTreeCellRenderer()
    {
    }

    public Component getTreeCellRendererComponent(JTree p1, Object p2, boolean p3, boolean p4, boolean p5, int p6, boolean p7)
    {
        super.getTreeCellRendererComponent(p1, p2, p3, p4, p5, p6, p7);
        if(p2 instanceof TNamed)
        {
            TNamed named = (TNamed)p2;
            setText(named.getTitle() + " (" + named.getName() + ")");
        }
        if(p2 instanceof TBranchObject)
            setIcon(branchObIcon);
        else
        if(p2 instanceof TBranchClones)
            setIcon(branchClIcon);
        else
        if(p2 instanceof TBranch)
            setIcon(branchIcon);
        else
        if(p2 instanceof TKey)
            try
            {
                RootClass rc = ((TKey)p2).getObjectClass();
                if(rc.instanceOf("TTree"))
                    setIcon(treeIcon);
                else
                if(rc.instanceOf("TH2"))
                    setIcon(h2Icon);
                else
                if(rc.instanceOf("TH3"))
                    setIcon(h3Icon);
                else
                if(rc.instanceOf("TH1"))
                    setIcon(h1Icon);
                else
                if(rc.instanceOf("TFile"))
                    setIcon(rootdbIcon);
            }
            catch(IOException ioexception) { }
        return this;
    }

    static Class _mthclass$(String x0)
    {
        try
        {
            return Class.forName(x0);
        }
        catch(ClassNotFoundException x1)
        {
            throw new NoClassDefFoundError(x1.getMessage());
        }
    }

    private static final Icon h1Icon;
    private static final Icon h2Icon;
    private static final Icon h3Icon;
    private static final Icon rootdbIcon;
    private static final Icon treeIcon;
    private static final Icon branchIcon;
    private static final Icon branchObIcon;
    private static final Icon branchClIcon;

    static 
    {
        h1Icon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/h1_t.gif"));
        h2Icon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/h2_t.gif"));
        h3Icon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/h3_t.gif"));
        rootdbIcon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/rootdb_t.gif"));
        treeIcon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/tree_t.gif"));
        branchIcon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/branch_t.gif"));
        branchObIcon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/branch-ob_t.gif"));
        branchClIcon = new ImageIcon((hep.rootio.util.RootDirectoryTreeCellRenderer.class).getResource("images/branch-cl_t.gif"));
    }
}

 

Ads help maintain this website.