Debian Codegraph @

dijit/tree/model.js

raw symbols SCIP
1 define(["dojo/_base/declare"], function(declare){
2
3 return declare("dijit.tree.model", null, {
4 // summary:
5 // Contract for any data provider object for the tree.
6 // description:
7 // Tree passes in values to the constructor to specify the callbacks.
8 // "item" is typically a dojo/data/Item but it's just a black box so
9 // it could be anything.
10 //
11 // This (like `dojo/data/api/Read`) is just documentation, and not meant to be used.
12
13 destroy: function(){
14 // summary:
15 // Destroys this object, releasing connections to the store
16 // tags:
17 // extension
18 },
19
20 // =======================================================================
21 // Methods for traversing hierarchy
22
23 getRoot: function(onItem){
24 // summary:
25 // Calls onItem with the root item for the tree, possibly a fabricated item.
26 // Throws exception on error.
27 // tags:
28 // extension
29 },
30
31 mayHaveChildren: function(item){
32 // summary:
33 // Tells if an item has or may have children. Implementing logic here
34 // avoids showing +/- expando icon for nodes that we know don't have children.
35 // (For efficiency reasons we may not want to check if an element actually
36 // has children until user clicks the expando node)
37 // item: dojo/data/Item
38 // tags:
39 // extension
40 },
41
42 getChildren: function(parentItem, onComplete){
43 // summary:
44 // Calls onComplete() with array of child items of given parent item, all loaded.
45 // Throws exception on error.
46 // parentItem: dojo/data/Item
47 // onComplete: function(items)
48 // tags:
49 // extension
50 },
51
52 // =======================================================================
53 // Inspecting items
54
55 isItem: function(something){
56 // summary:
57 // Returns true if *something* is an item and came from this model instance.
58 // Returns false if *something* is a literal, an item from another model instance,
59 // or is any object other than an item.
60 // tags:
61 // extension
62 },
63
64 getIdentity: function(item){
65 // summary:
66 // Returns identity for an item
67 // tags:
68 // extension
69 },
70
71 getLabel: function(item){
72 // summary:
73 // Get the label for an item
74 // tags:
75 // extension
76 },
77
78 // =======================================================================
79 // Write interface
80
81 newItem: function(args, parent, insertIndex, before){
82 // summary:
83 // Creates a new item. See `dojo/data/api/Write` for details on args.
84 // args: dijit/tree/dndSource.__Item
85 // parent: Item
86 // insertIndex: int?
87 // Allows to insert the new item as the n'th child of `parent`.
88 // before: Item?
89 // Insert the new item as the previous sibling of this item. `before` must be a child of `parent`.
90 // tags:
91 // extension
92 },
93
94 pasteItem: function(childItem, oldParentItem, newParentItem, bCopy, insertIndex, before){
95 // summary:
96 // Move or copy an item from one parent item to another.
97 // Used in drag & drop.
98 // If oldParentItem is specified and bCopy is false, childItem is removed from oldParentItem.
99 // If newParentItem is specified, childItem is attached to newParentItem.
100 // childItem: Item
101 // oldParentItem: Item
102 // newParentItem: Item
103 // bCopy: Boolean
104 // insertIndex: int?
105 // Allows to insert the new item as the n'th child of `parent`.
106 // before: Item?
107 // Insert the new item as the previous sibling of this item. `before` must be a child of `parent`.
108 // tags:
109 // extension
110 },
111
112 // =======================================================================
113 // Callbacks
114
115 onChange: function(item){
116 // summary:
117 // Callback whenever an item has changed, so that Tree
118 // can update the label, icon, etc. Note that changes
119 // to an item's children or parent(s) will trigger an
120 // onChildrenChange() so you can ignore those changes here.
121 // item: dojo/data/Item
122 // tags:
123 // callback
124 },
125
126 onChildrenChange: function(parent, newChildrenList){
127 // summary:
128 // Callback to do notifications about new, updated, or deleted items.
129 // parent: dojo/data/Item
130 // newChildrenList: dojo/data/Item[]
131 // tags:
132 // callback
133 }
134 });
135 });