]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/tree/model.js.uncompressed.js
1 define("dijit/tree/model", ["dojo/_base/declare"], function(declare
){
8 // Contract for any data provider object for the tree.
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.
14 // This (like `dojo/data/api/Read`) is just documentation, and not meant to be used.
18 // Destroys this object, releasing connections to the store
23 // =======================================================================
24 // Methods for traversing hierarchy
26 getRoot: function(onItem
){
28 // Calls onItem with the root item for the tree, possibly a fabricated item.
29 // Throws exception on error.
34 mayHaveChildren: function(item
){
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
45 getChildren: function(parentItem
, onComplete
){
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)
55 // =======================================================================
58 isItem: function(something
){
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.
67 fetchItemByIdentity: function(keywordArgs
){
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.
78 getIdentity: function(item
){
80 // Returns identity for an item
85 getLabel: function(item
){
87 // Get the label for an item
92 // =======================================================================
95 newItem: function(args
, parent
, insertIndex
, before
){
97 // Creates a new item. See `dojo/data/api/Write` for details on args.
98 // args: dijit/tree/dndSource.__Item
101 // Allows to insert the new item as the n'th child of `parent`.
103 // Insert the new item as the previous sibling of this item. `before` must be a child of `parent`.
108 pasteItem: function(childItem
, oldParentItem
, newParentItem
, bCopy
, insertIndex
, before
){
110 // Move or copy an item from one parent item to another.
111 // Used in drag & drop.
112 // If oldParentItem is specified and bCopy is false, childItem is removed from oldParentItem.
113 // If newParentItem is specified, childItem is attached to newParentItem.
115 // oldParentItem: Item
116 // newParentItem: Item
119 // Allows to insert the new item as the n'th child of `parent`.
121 // Insert the new item as the previous sibling of this item. `before` must be a child of `parent`.
126 // =======================================================================
129 onChange: function(item
){
131 // Callback whenever an item has changed, so that Tree
132 // can update the label, icon, etc. Note that changes
133 // to an item's children or parent(s) will trigger an
134 // onChildrenChange() so you can ignore those changes here.
135 // item: dojo/data/Item
140 onChildrenChange: function(parent
, newChildrenList
){
142 // Callback to do notifications about new, updated, or deleted items.
143 // parent: dojo/data/Item
144 // newChildrenList: dojo/data/Item[]