Example usage for javax.swing JTree getShowsRootHandles

List of usage examples for javax.swing JTree getShowsRootHandles

Introduction

In this page you can find the example usage for javax.swing JTree getShowsRootHandles.

Prototype

public boolean getShowsRootHandles() 

Source Link

Document

Returns the value of the showsRootHandles property.

Usage

From source file:org.kepler.gui.AnnotatedPTree.java

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {
    if (isDebugging) {
        log.debug(/*w  ww . java  2s.  c o  m*/
                "getTreeCellRendererComponent(" + tree.getClass().getName() + ", " + value.getClass().getName()
                        + ", " + selected + ", " + expanded + ", " + leaf + ", " + row + ", " + hasFocus + ")");
        log.debug(tree.getShowsRootHandles());
    }

    if (value instanceof ptolemy.moml.EntityLibrary) {
        EntityLibrary el = (EntityLibrary) value;
        if (isDebugging) {
            log.debug(el.getName() + " " + el.getClass().getName());
        }

        if (el instanceof KAREntityLibrary) {
            setOpenIcon(_packIconOpen);
            setClosedIcon(_packIconClosed);
        } else if (el instanceof FolderEntityLibrary) {
            setOpenIcon(_folderIconOpen);
            setClosedIcon(_folderIconClosed);
        } else if (el instanceof OntologyEntityLibrary) {
            setOpenIcon(_ontIconOpen);
            setClosedIcon(_ontIconClosed);
        } else if (el instanceof SearchEntityLibrary) {
            setOpenIcon(_searchIcon);
            setClosedIcon(_searchIcon);
        } else if (el instanceof KARErrorEntityLibrary || el instanceof RemoteKARErrorEntityLibrary) {
            setOpenIcon(_packIconError);
            setClosedIcon(_packIconError);
        } else if (el instanceof DownloadableKAREntityLibrary) {
            // Icons for the KAR files - trash cans?
            setOpenIcon(_packIconOpen);
            setClosedIcon(_packIconClosed);
        } else if (el instanceof RemoteRepositoryEntityLibrary) {
            // Icons for the Remote repositories - computers
            setOpenIcon(_remoteIcon);
            setClosedIcon(_remoteIcon);
            // TODO: Also make sure that the top-level "Remote Components" is a globe
        } else {
            setOpenIcon(_generalIcon);
            setClosedIcon(_generalIcon);
        }
    } else {
        if (isDebugging)
            log.debug("set general icon");
        setOpenIcon(_generalIcon);
        setClosedIcon(_generalIcon);
    }
    Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

    // if the object is a NamedObj, use display name for the label
    // since the display name is used on the canvas. the component returned
    // by super.getTreeCellRenderer() uses the display name for settables.
    if (!(value instanceof Settable) && (value instanceof NamedObj) && (c instanceof DefaultTreeCellRenderer)) {
        ((DefaultTreeCellRenderer) c).setText(((NamedObj) value).getDisplayName());
    }

    if (isDebugging)
        log.debug("Component: " + c.getClass().getName());
    return c;
}