001    /*
002     * This file is part of the Echo Point Project.  This project is a
003     * collection of Components that have extended the Echo Web Application
004     * Framework Version 3.
005     *
006     * Version: MPL 1.1
007     *
008     * The contents of this file are subject to the Mozilla Public License Version
009     * 1.1 (the "License"); you may not use this file except in compliance with
010     * the License. You may obtain a copy of the License at
011     * http://www.mozilla.org/MPL/
012     *
013     * Software distributed under the License is distributed on an "AS IS" basis,
014     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015     * for the specific language governing rights and limitations under the
016     * License.
017     */
018    
019    package echopoint.tree;
020    
021    import java.io.Serializable;
022    import java.util.Enumeration;
023    
024    /**
025     * The design paradigm and class name used within have been taken directly
026     * from the {@link javax.swing} package has been retro-fitted to work with the
027     * NextApp Echo web framework.
028     *
029     * <p>This file was made part of the EchoPoint project on the 25/07/2002.</p>
030     *
031     * @author Brad Baker, Rakesh 2009-05-29
032     * @version $Id: TreeNode.java 213 2009-06-03 16:34:13Z sptrakesh $
033     * @since 3.0.0b3
034     */
035    public interface TreeNode extends Serializable
036    {
037      /** @return The children of the reciever as a enumeration. */
038      Enumeration<TreeNode> children();
039    
040      /** @return The action command string associated with this node */
041      String getActionCommand();
042    
043      /** @return {@code true} if the receiver allows children. */
044      boolean getAllowsChildren();
045    
046      /**
047       * Returns the child {@code TreeNode} at index {@code childIndex}.
048       *
049       * @param childIndex The index into the children at which the child exists.
050       * @return The child tree node.
051       */
052      TreeNode getChildAt( final int childIndex );
053    
054      /**
055       * @return The number of children {@code TreeNode}s the receiver contains.
056       */
057      int getChildCount();
058    
059      /**
060       * Returns the index of {@code node} in the receivers children. If the
061       * receiver does not contain {@code node}, -1 will be returned.
062       *
063       * @param node The node whose index is to be returned.
064       * @return The index in the children collection for the node.
065       */
066      int getIndex( final TreeNode node );
067    
068      /** @return The parent {@code TreeNode} of the receiver. */
069      TreeNode getParent();
070    
071      /** @return {@code true} if the receiver is a leaf. */
072      boolean isLeaf();
073    }