001: /*
002: * GWT-Ext Widget Library
003: * Copyright(c) 2007-2008, GWT-Ext.
004: * licensing@gwt-ext.com
005: *
006: * http://www.gwt-ext.com/license
007: */
008:
009: package com.gwtext.client.data.event;
010:
011: import com.gwtext.client.data.Node;
012: import com.gwtext.client.data.Tree;
013:
014: /**
015: * {@link Tree} listener interface.
016: */
017: public interface TreeListener {
018:
019: /**
020: * Fires when a new child node is appended to a node in this tree.
021: *
022: * @param tree the owner tree
023: * @param parent the parent node
024: * @param node the newly appended node
025: * @param index the index of the newly appended node
026: */
027: void onAppend(Tree tree, Node parent, Node node, int index);
028:
029: /**
030: * Fires before a new child is appended to a node in this tree, return false to cancel the append.
031: *
032: * @param tree the owner tree
033: * @param parent the parent node
034: * @param node the child node to be appended
035: * @return false to cancel the append
036: */
037: boolean doBeforeAppend(Tree tree, Node parent, Node node);
038:
039: /**
040: * Fires before a new child is inserted in a node in this tree, return false to cancel the insert.
041: *
042: * @param tree the owner tree
043: * @param parent the parent node
044: * @param node the child node to be inserted
045: * @param refNode the child node the node is being inserted before
046: * @return false to cancel the insert
047: */
048: boolean doBeforeInsert(Tree tree, Node parent, Node node,
049: Node refNode);
050:
051: /**
052: * Fires before a node is moved to a new location in the tree. Return false to cancel the move.
053: *
054: * @param tree the owner tree
055: * @param node the node being moved
056: * @param oldParent the parent of the node
057: * @param newParent the new parent the node is moving to
058: * @param index the index it is being moved to
059: * @return false to cancel the move
060: */
061: boolean doBeforeMove(Tree tree, Node node, Node oldParent,
062: Node newParent, int index);
063:
064: /**
065: * Fires before a child is removed from a node in this tree, return false to cancel the remove.
066: *
067: * @param tree the owner tree
068: * @param parent the parent node
069: * @param node the child node to be removed
070: * @return false to cancel the remove
071: */
072: boolean doBeforeRemove(Tree tree, Node parent, Node node);
073:
074: /**
075: * Fires when a new child node is inserted in a node in this tree.
076: *
077: * @param tree the owner tree
078: * @param parent the parent node
079: * @param node the child node inserted
080: * @param refNode the child node the node was inserted before
081: */
082: void onInsert(Tree tree, Node parent, Node node, Node refNode);
083:
084: /**
085: * Fires when a node is moved to a new location in the tree.
086: *
087: * @param tree the owner tree
088: * @param node the node moved
089: * @param oldParent the old parent of this node
090: * @param newParent the new parent of this node
091: * @param index the index it was moved to
092: */
093: void onMove(Tree tree, Node node, Node oldParent, Node newParent,
094: int index);
095:
096: /**
097: * Fires when a child node is removed from a node in this tree.
098: *
099: * @param tree the owner tree
100: * @param parent the parent node
101: * @param node the child node removed
102: */
103: void onRemove(Tree tree, Node parent, Node node);
104: }
|