7 // Contract for any data provider object for the tree. Tree
8 // passes in values to the constructor to specify the callbacks.
9 // "item" is typically a dojo.data.Item but it's just a black box so
10 // it could be anything.
12 // This (like dojo.data.api.Read) is just documentation, and not meant to be used.
15 // summary: destroys this object, releasing connections to the store
18 // =======================================================================
19 // Methods for traversing hierarchy
21 getRoot: function(onItem){
23 // Calls onItem with the root item for the tree, possibly a fabricated item.
24 // Throws exception on error.
27 mayHaveChildren: function(/*dojo.data.Item*/ item){
29 // Tells if an item has or may have children. Implementing logic here
30 // avoids showing +/- expando icon for nodes that we know don't have children.
31 // (For efficiency reasons we may not want to check if an element actually
32 // has children until user clicks the expando node)
35 getChildren: function(/*dojo.data.Item*/ parentItem, /*function(items)*/ onComplete){
37 // Calls onComplete() with array of child items of given parent item, all loaded.
38 // Throws exception on error.
41 // =======================================================================
44 getIdentity: function(/* item */ item){
45 // summary: returns identity for an item
48 getLabel: function(/*dojo.data.Item*/ item){
49 // summary: get the label for an item
52 // =======================================================================
55 newItem: function(/* Object? */ args, /*Item?*/ parent){
57 // Creates a new item. See dojo.data.api.Write for details on args.
60 pasteItem: function(/*Item*/ childItem, /*Item*/ oldParentItem, /*Item*/ newParentItem, /*Boolean*/ bCopy){
62 // Move or copy an item from one parent item to another.
63 // Used in drag & drop.
64 // If oldParentItem is specified and bCopy is false, childItem is removed from oldParentItem.
65 // If newParentItem is specified, childItem is attached to newParentItem.
68 // =======================================================================
71 onChange: function(/*dojo.data.Item*/ item){
73 // Callback whenever an item has changed, so that Tree
74 // can update the label, icon, etc. Note that changes
75 // to an item's children or parent(s) will trigger an
76 // onChildrenChange() so you can ignore those changes here.
79 onChildrenChange: function(/*dojo.data.Item*/ parent, /*dojo.data.Item[]*/ newChildrenList){
81 // Callback to do notifications about new, updated, or deleted items.