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