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