Android Open Source - Gui2Go Tree State Manager






From Project

Back to project page Gui2Go.

License

The source code is released under:

MIT License

If you think the Android project Gui2Go listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ami.gui2go.tree;
//ww w  .  jav  a 2s  .c om
import java.util.List;

import android.database.DataSetObserver;

/**
 * Manages information about state of the tree. It only keeps information about
 * tree elements, not the elements themselves.
 * 
 * @param <T>
 *            type of the identifier for nodes in the tree
 */
public interface TreeStateManager<T> {

    /**
     * Returns array of integers showing the location of the node in hierarchy.
     * It corresponds to heading numbering. {0,0,0} in 3 level node is the first
     * node {0,0,1} is second leaf (assuming that there are two leaves in first
     * subnode of the first node).
     * 
     * @param id
     *            id of the node
     * @return textual description of the hierarchy in tree for the node.
     */
    Integer[] getHierarchyDescription(T id);

    /**
     * Returns level of the node.
     * 
     * @param id
     *            id of the node
     * @return level in the tree
     */
    int getLevel(T id);

    /**
     * Returns information about the node.
     * 
     * @param id
     *            node id
     * @return node info
     */
    TreeNodeInfo<T> getNodeInfo(T id);

    /**
     * Returns children of the node.
     * 
     * @param id
     *            id of the node or null if asking for top nodes
     * @return children of the node
     */
    List<T> getChildren(T id);

    /**
     * Returns parent of the node.
     * 
     * @param id
     *            id of the node
     * @return parent id or null if no parent
     */
    T getParent(T id);

    /**
     * Adds the node before child or at the beginning.
     * 
     * @param parent
     *            id of the parent node. If null - adds at the top level
     * @param newChild
     *            new child to add if null - adds at the beginning.
     * @param beforeChild
     *            child before which to add the new child
     */
    void addBeforeChild(T parent, T newChild, T beforeChild);

    /**
     * Adds the node after child or at the end.
     * 
     * @param parent
     *            id of the parent node. If null - adds at the top level.
     * @param newChild
     *            new child to add. If null - adds at the end.
     * @param afterChild
     *            child after which to add the new child
     */
    void addAfterChild(T parent, T newChild, T afterChild);

    /**
     * Removes the node and all children from the tree.
     * 
     * @param id
     *            id of the node to remove or null if all nodes are to be
     *            removed.
     */
    void removeNodeRecursively(T id);

    /**
     * Expands all children of the node.
     * 
     * @param id
     *            node which children should be expanded. cannot be null (top
     *            nodes are always expanded!).
     */
    void expandDirectChildren(T id);

    /**
     * Expands everything below the node specified. Might be null - then expands
     * all.
     * 
     * @param id
     *            node which children should be expanded or null if all nodes
     *            are to be expanded.
     */
    void expandEverythingBelow(T id);

    /**
     * Collapse children.
     * 
     * @param id
     *            id collapses everything below node specified. If null,
     *            collapses everything but top-level nodes.
     */
    void collapseChildren(T id);

    /**
     * Returns next sibling of the node (or null if no further sibling).
     * 
     * @param id
     *            node id
     * @return the sibling (or null if no next)
     */
    T getNextSibling(T id);

    /**
     * Returns previous sibling of the node (or null if no previous sibling).
     * 
     * @param id
     *            node id
     * @return the sibling (or null if no previous)
     */
    T getPreviousSibling(T id);

    /**
     * Checks if given node is already in tree.
     * 
     * @param id
     *            id of the node
     * @return true if node is already in tree.
     */
    boolean isInTree(T id);

    /**
     * Count visible elements.
     * 
     * @return number of currently visible elements.
     */
    int getVisibleCount();

    /**
     * Returns visible node list.
     * 
     * @return return the list of all visible nodes in the right sequence
     */
    List<T> getVisibleList();

    /**
     * Registers observers with the manager.
     * 
     * @param observer
     *            observer
     */
    void registerDataSetObserver(final DataSetObserver observer);

    /**
     * Unregisters observers with the manager.
     * 
     * @param observer
     *            observer
     */
    void unregisterDataSetObserver(final DataSetObserver observer);

    /**
     * Cleans tree stored in manager. After this operation the tree is empty.
     * 
     */
    void clear();

    /**
     * Refreshes views connected to the manager.
     */
    void refresh();
}




Java Source Code List

com.ami.gui2go.ActivityManager.java
com.ami.gui2go.EditorActivity.java
com.ami.gui2go.FileDialogFragment.java
com.ami.gui2go.GridViewItemClickListener.java
com.ami.gui2go.HomeActivity.java
com.ami.gui2go.LongClickListener.java
com.ami.gui2go.ProjectManagerActivity.java
com.ami.gui2go.ResourceManagerActivity.java
com.ami.gui2go.UserGuideActivity.java
com.ami.gui2go.models.ActivityInfo.java
com.ami.gui2go.models.ProjectInfo.java
com.ami.gui2go.models.WidgetAttribute.java
com.ami.gui2go.models.WidgetTypes.java
com.ami.gui2go.models.WidgetWrapper.java
com.ami.gui2go.models.Widget.java
com.ami.gui2go.tree.AbstractTreeViewAdapter.java
com.ami.gui2go.tree.InMemoryTreeNode.java
com.ami.gui2go.tree.InMemoryTreeStateManager.java
com.ami.gui2go.tree.NodeAlreadyInTreeException.java
com.ami.gui2go.tree.NodeNotInTreeException.java
com.ami.gui2go.tree.SimpleStandardAdapter.java
com.ami.gui2go.tree.TreeBuilder.java
com.ami.gui2go.tree.TreeConfigurationException.java
com.ami.gui2go.tree.TreeNodeInfo.java
com.ami.gui2go.tree.TreeStateManager.java
com.ami.gui2go.tree.TreeViewList.java
com.ami.gui2go.utils.FileHelper.java
com.ami.gui2go.utils.LayoutXMLCreator.java
com.ami.gui2go.utils.ProjectXMLParser.java
com.ami.gui2go.utils.TextValidator.java
com.ami.gui2go.views.ColorPickerDialog.java