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 Node} listener interface.
016: */
017: public interface NodeListener {
018:
019: /**
020: * Fires when a new child node is appended.
021: *
022: * @param tree the owner tree
023: * @param self this 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 self, Node node, int index);
028:
029: /**
030: * Fires before a new child is appended, return false to cancel the append.
031: *
032: * @param tree the owner tree
033: * @param self this node
034: * @param node the child node to be appended
035: * @return false to cancel the append
036: */
037: boolean doBeforeAppend(Tree tree, Node self, Node node);
038:
039: /**
040: * Fires before a new child is inserted, return false to cancel the insert.
041: *
042: * @param tree the owner tree
043: * @param self this 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 self, Node node, Node refNode);
049:
050: /**
051: * Fires before this node is moved to a new location in the tree. Return false to cancel the move.
052: *
053: * @param tree the owner tree
054: * @param self this node
055: * @param oldParent the parent of this node
056: * @param newParent the new parent this node is moving to
057: * @param index the index it is being moved to
058: * @return false to cancel the move
059: */
060: boolean doBeforeMove(Tree tree, Node self, Node oldParent,
061: Node newParent, int index);
062:
063: /**
064: * Fires before a child is removed, return false to cancel the remove.
065: *
066: * @param tree the owner tree
067: * @param self this node
068: * @param node the child node to be removed
069: * @return false to cancel the remove
070: */
071: boolean doBeforeRemove(Tree tree, Node self, Node node);
072:
073: /**
074: * Fires when a new child node is inserted.
075: *
076: * @param tree the owner tree
077: * @param self this node
078: * @param node the child node inserted
079: * @param refNode the child node the node was inserted before
080: */
081: void onInsert(Tree tree, Node self, Node node, Node refNode);
082:
083: /**
084: * Fires when this node is moved to a new location in the tree.
085: *
086: * @param tree the owner tree
087: * @param self this node
088: * @param oldParent the old parent of this node
089: * @param newParent the new parent of this node
090: * @param index the index it was moved to
091: */
092: void onMove(Tree tree, Node self, Node oldParent, Node newParent,
093: int index);
094:
095: /**
096: * Fires before a child is removed, return false to cancel the remove.
097: *
098: * @param tree the owner tree
099: * @param self this node
100: * @param node the child node to be removed
101: */
102: void onRemove(Tree tree, Node self, Node node);
103: }
|