All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ca.odell.glazedlists.swing.TreeNodeData Maven / Gradle / Ivy

/* Glazed Lists                                                 (c) 2003-2006 */
/* http://publicobject.com/glazedlists/                      publicobject.com,*/
/*                                                     O'Dell Engineering Ltd.*/
package ca.odell.glazedlists.swing;

/**
 * Instances of this class should only be constructed by Glazed Lists.
 * It describes information to related to the tree node that is about to be
 * rendered or edited. Special renderers and editors,
 * {@link TreeTableNodeDataEditor} and {@link TreeTableNodeDataRenderer}, will
 * receive instances of this class. Renderers and editors that require
 * hierarchical information about tree nodes to produce the correct component
 * should implement one of those editors in order to receive one of these
 * objects detailing the node's information.
 */
public final class TreeNodeData {

    private int depth;
    private boolean isExpanded;
    private boolean hasChildren;
    private boolean allowsChildren;

    /**
     * Returns the depth of the tree node in the hierarchy.
     */
    public int getDepth() { return depth; }
    public void setDepth(int depth) { this.depth = depth; }

    /**
     * Returns true if the node is expanded and its children are thus
     * visible; false if it is collapsed and its children are thus
     * hidden. This argument only has meaning when {@link #hasChildren()}
     * returns true; otherwise it should be ignored.
     */
    public boolean isExpanded() { return isExpanded; }
    public void setExpanded(boolean expanded) { isExpanded = expanded; }

    /**
     * Returns true if the tree node has child nodes; false
     * otherwise.
     */
    public boolean hasChildren() { return hasChildren; }
    public void setHasChildren(boolean hasChildren) { this.hasChildren = hasChildren; }

    /**
     * Returns true if the node is of the type that can have child
     * elements; false otherwise.
     */
    public boolean allowsChildren() { return allowsChildren; }
    public void setAllowsChildren(boolean allowsChildren) { this.allowsChildren = allowsChildren; }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy