]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/tree/model.js.uncompressed.js
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){
97 // Creates a new item. See `dojo.data.api.Write` for details on args.
98 // args: dojo.dnd.Item
105 pasteItem: function(childItem, oldParentItem, newParentItem, bCopy){
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.
112 // oldParentItem: Item
113 // newParentItem: Item
119 // =======================================================================
122 onChange: function(item){
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
133 onChildrenChange: function(parent, newChildrenList){
135 // Callback to do notifications about new, updated, or deleted items.
136 // parent: dojo.data.Item
137 // newChildrenList: dojo.data.Item[]