⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 treestructuremodel.java

📁 jsp + xml实现treeview
💻 JAVA
字号:
/*
 * ====================================================================
 * The JSP Tree Software License, Version 1.1
 *
 * (this license is derived and fully compatible with the Apache Software
 * License - see http://www.apache.org/LICENSE.txt)
 *
 * Copyright (c) 2002-2005 jsptree.sourceforge.net . All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution,
 *    if any, must include the following acknowledgment:
 *       "This product includes software developed by
 *        jsptree.sourceforge.net (http://jsptree.sourceforge.net/)."
 *    Alternately, this acknowledgment may appear in the software itself,
 *    if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The name "JSP Tree" must not be used to endorse or promote
 *    products derived from this software without prior written permission.
 *    For written permission, please contact modano@users.sourceforge.net .
 *
 * 5. Products derived from this software may not be called "JSP Tree",
 *    nor may "JSP Tree" appear in their name, without prior written
 *    permission of jsptree.sourceforge.net.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 */
package net.sf.jsptree.tree;

/**
 * @author Vladislav Kamensky
 */
public interface TreeStructureModel extends Cloneable {

    /**
     * Return name of the tree.
     *
     * @return tree's name
     */
    String getName();

    /**
     * Sets tree's name.
     *
     * @param p_name tree's name to be set
     */
    void setName(String p_name);

    /**
     * Returns the root of the tree.  Returns <code>null</code>
     * only if the tree has no nodes.
     *
     * @return the root of the tree
     */
    TreeNode getRootNode();

    /**
     * Creates root node and sets specified data
     * as root node data.
     *
     * @param root The data to be set as root node's data.
     */
    void setRoot(Object root);

    /**
     * Creates node with specified data and adds it to root node
     *
     * @param child
     * @return <code>true</code> if node has been successfully added;
     *         <code>false</code> otherwise.
     */
    boolean addChildToRoot(Object child);

    /**
     * Creates node with specified data and adds it to specified parent node .
     *
     * @param child
     * @return <code>true</code> if node has been successfully added;
     *         <code>false</code> otherwise.
     */
    boolean addChildToParent(Object parent, Object child);

    /**
     * Removes node, which data equals to given one.
     *
     * @param node The data of node, which should be deleted.
     * @return <code>true</code> if node has been successfully deleted;
     *         <code>false</code> otherwise.
     */
    boolean removeNode(Object node);

    /**
     * Returns <code>true</code> if <code>node</code> is a leaf.
     * Tests whether specified node has children.
     *
     * @param node a node in the tree
     * @return true if <code>node</code> is a leaf
     */
    boolean isLeaf(Object node);

    /**
     * Returns the number of children of <code>parent</code>.
     * Returns 0 if the node has no children or there is no node
     * in the tree coresponding to input data.
     *
     * @param parent a node in the tree
     * @return the number of children of the node <code>parent</code>
     */
    int getChildCount(Object parent);

    /**
     * Returns the number of children of <code>root</code> node
     * from all of tree's branches.
     * Returns 0 if the root node has no children or there is no
     * root node.
     *
     * @return the maximum depth of the tree.
     */
    int getMaxDepth();

    /**
     * Creates and returns a copy of this object.
     *
     * @throws CloneNotSupportedException
     */
    Object clone() throws CloneNotSupportedException;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -