Class idx.widget.NavTreeObjectModel


Extends dijit/tree/ObjectStoreModel.
Provides an expanded version of dijit/tree/ObjectStoreModel to support the additional features of idx.widget.NavTree.
Defined in: <idx\widget\ForestObjectStoreModel.js>.

Constructor Summary

Constructor Attributes Constructor Name and Description
 

Field Summary

Field Attributes Field Name and Description
 
The attribute to check per-item to see if a badge icon should be displayed.
 
The attribute to check per-item to see if a badge label should be displayed.
 
How to interpret the text of the badge label.
 
The associative array/map of item IDs to their badge values.
 
The attribute used to help determine if an item can potentially have children according to the "mayHaveChildren()" function.
 
Used to determine whether or not an item may have children in conjunction with the branchingAttr.
 
The associative array/map of item IDs to their branching status (true or false).
 
Used to determine the default selectability of nodes if the item is not found in the selectability map or the item or this model does not have a defined "selectableAttr" or its type is not in the type selectabliltiy map.
 
query 
Specifies the set of children of the root item so that more than one item can be returned by the query (unlike ObjectStoreModel).
 
rootId 
ID of fabricated root item to simulate ForestStoreModel behavior.
 
Label of fabricated root item to simulate ForestStoreModel behavior.
 
The associative array/map of item IDs to their selectability (true or false).
 
The attribute to check per-item to see if it is selectable.
 
The attribute used to classify the tree nodes into different types to lookup different default behaviors for nodes of that type.
 
The associative array/map of item types (obtained via the optional "typeAttr") to the branching status for items of that type (true or false).
 
The associative array/map of item types (obtained via the optional "typeAttr") to the selectability for items of that type (true or false).

Method Summary

Method Attributes Method Name and Description
 
constructor(params)
Constructor that internally creates the fabricated root item.
 
fetchItemByIdentity(keywordArgs)
Overridden to specially handle the fabricated root node.
 
getBadge(item)
Gets the badge for the specified item or returns null if no badge is associated with the specified item.
 
getChildren(parentItem, onComplete, onError)
Overridden to specially handle the root item with the default query.
 
Overridden to specially handle the fabricated root node.
 
Returns the type of the item.
 
getLabel(item)
Overridden to specially handle the fabricated root node.
 
Function to determine if a node is selectable.
 
Overriden to always return true for the fabricated root node and to otherwise return true or false depending on the branching settings for this model.
 
newItem(args, parent, insertIndex, before)
Overridden to handle special case of parent being fabricated root node.
 
Returns a snapshot object that contains all the attributes and values of the specified item so that it is simplified from the data store interface.
 
Called when item added to root of tree; user must override this method to modify the item so that it matches the query for top level items.
 
Call this method when the badgeLabelAttr, badgeIconTypeAttr, or badgeMap is changed.
 
Callback method for when branchingMap, typeBranchingMap, branchingAttr or branchingAttrMode is changed.
 
Called when item removed from root of tree; user must override this method to modify the item so it doesn't match the query for top level items.
 
Attach to or override this function to force the parameters for a child of the root node to match the query for children of the root node.
 
Call this method when the selectabilityMap or typeSelectbailityMap is changed.
 
pasteItem(childItem, oldParentItem, newParentItem, bCopy, insertIndex, before)
Overridden to handle cases where the old or new parent is the fabricated root node.

Constructor Detail

idx.widget.NavTreeObjectModel()

Field Detail

badgeIconTypeAttr

The attribute to check per-item to see if a badge icon should be displayed. The value of the attribute is used by the NavTree to lookup an "icon class" in its "badgeIconMap".
Defined in: <idx\widget\NavTreeObjectModel.js>.

badgeLabelAttr

The attribute to check per-item to see if a badge label should be displayed. The value of the attribute may be a number or a string that is parseable to cause it to be directly displayed. If the string is not parseable as a number the NavTree may either display it literally or use it as a basis for a resource lookup key to obtain the text to display.
Defined in: <idx\widget\NavTreeObjectModel.js>.

badgeLabelType

How to interpret the text of the badge label. By default this assumes "html", but it can be set to "text" to force a text interpretation. The default for this differs from "labelType" which is added to TreeStoreModel from idx/trees module. This is becuase badges historically assumed HTML and it was later discovered that tree labels forced plain text. Now both are configurable for NavTree, but have different default values for historical reasons.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Default Value:
"html"

badgeMap

The associative array/map of item IDs to their badge values. The badge values may take one of the following forms: -- an integer numeric value (used as a badge label without resource lookup) -- a string representing an integer value (used as a badge label without resource lookup) -- an alpha-numeric string (either display literally or used as a resource lookup key) -- an object of the form: {label: *badgeLabel*, iconType: *iconType*} Where *badgeLabel* is either an integer, numeric string or alpha-numeric string (as above) and *iconType* is a string indicating a key for the NavTree to lookup in its badgeIconMap. Items not in this map have their badge value determined by the "badgeLabelAttr" and/or "badgeIconTypeAttr" (per item). Example: { "item1": 10, "item2": "warning", "item3": "info"}
Defined in: <idx\widget\NavTreeObjectModel.js>.

branchingAttr

The attribute used to help determine if an item can potentially have children according to the "mayHaveChildren()" function. The presence of the attribute is interpreted according to the branchingMode assigned to the model. Order of precedence is: - Value from branchingMap (when present) - Value of typeBranchingMap (when present) - Value from branchingAttr as interpreted by branchingAttrMode
Defined in: <idx\widget\NavTreeObjectModel.js>.
Default Value:
"branch"

branchingAttrMode

Used to determine whether or not an item may have children in conjunction with the branchingAttr. If the item is not found in the branchingMap or the item or its type is not in the typeBranchingMap then this attribute is used to interpret the value of associated with the branchingAttr value. The possible modes are: "always" - Regardless of value, all items are considered to be possible parents. "never" - Regardless of value, no items (except root) are considered to be possible parents. "present" - The mere presence of the branchingAttr in the child indicates possible children. "absent" - The absence of the branchingAttr in the child indicates possible children. "length" - A value that is a non-empty array or non-empty string indicates possible children. "branch" - A value that is not zero, false, null or undefined indicates possible children. "leaf" - A value that is not zero, false, null or undefined indicates NO possible children "function" - The branchingAttr is a function that should be called.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Default Value:
"present"

branchingMap

The associative array/map of item IDs to their branching status (true or false). Items not in this map have their branching status determined by the "brancingAttr" (per item) or the "defaultBranching" attribute for the model. Example: { "item1": true, "item2": false} Order of precedence is: - Value from branchingMap (when present) - Value of typeBranchingMap (when present) - Value from branchingAttr as interpreted by branchingAttrMode
Defined in: <idx\widget\NavTreeObjectModel.js>.

defaultSelectability

Used to determine the default selectability of nodes if the item is not found in the selectability map or the item or this model does not have a defined "selectableAttr" or its type is not in the type selectabliltiy map. The possible values are: "all" - All node are selectable by default. "none" - No nodes are selectable default (per-node exceptions required) "leaves" - Only nodes for which "mayHaveChildren()" is false are selectable
Defined in: <idx\widget\NavTreeObjectModel.js>.

query

Specifies the set of children of the root item so that more than one item can be returned by the query (unlike ObjectStoreModel).

rootId

ID of fabricated root item to simulate ForestStoreModel behavior.
Default Value:
"|_-_-$root$-_-_|"

rootLabel

Label of fabricated root item to simulate ForestStoreModel behavior.

selectabilityMap

The associative array/map of item IDs to their selectability (true or false). Items not in this map have their selectability determined by the "selectableAttr" (per item) or the "defaultSelectability" attribute for the model. Example: { "item1": true, "item2": false} Order of precedence is: - Value from selectabilityMap (when present) - Value of selectableAttr for item (when available) - Value of typeSelectabilityMap (when present) - defaultSelectability
Defined in: <idx\widget\NavTreeObjectModel.js>.

selectableAttr

The attribute to check per-item to see if it is selectable. Order of precedence is: - Value from selectabilityMap (when present) - Value of selectableAttr for item (when available) - Value of typeSelectabilityMap (when present) - defaultSelectability
Defined in: <idx\widget\NavTreeObjectModel.js>.

typeAttr

The attribute used to classify the tree nodes into different types to lookup different default behaviors for nodes of that type.
Defined in: <idx\widget\NavTreeObjectModel.js>.

typeBranchingMap

The associative array/map of item types (obtained via the optional "typeAttr") to the branching status for items of that type (true or false). For items of types not found in this map have their branching status determined by the "defaultBranching" attribute for the model. Example: { "typeA": true, "typeB": false} Order of precedence is: - Value from branchingMap (when present) - Value of typeBranchingMap (when present) - Value from branchingAttr as interpreted by branchingAttrMode
Defined in: <idx\widget\NavTreeObjectModel.js>.

typeSelectabilityMap

The associative array/map of item types (obtained via the optional "typeAttr") to the selectability for items of that type (true or false). For items of types not found in this map have their selectability determined by the "defaultSelectability" attribute for the model. Example: { "typeA": true, "typeB": false} Order of precedence is: - Value from selectabilityMap (when present) - Value of selectableAttr for item (when available) - Value of typeSelectabilityMap (when present) - defaultSelectability
Defined in: <idx\widget\NavTreeObjectModel.js>.

Method Detail

constructor(params)

Constructor that internally creates the fabricated root item.
Parameters:
params

fetchItemByIdentity(keywordArgs)

Overridden to specially handle the fabricated root node.
Parameters:
keywordArgs

getBadge(item)

Gets the badge for the specified item or returns null if no badge is associated with the specified item. If the return value is not null it takes the form of: { label: *badgeLabel*, iconType: *badgeIconType* } Where *badgeLabel* and *badgeIconType* are as follows: *badgeLabel*: Either an integer/numeric value indicating a literal badge value or a string that the NavTree may use to create a resource lookup key to obtain the displayable text or may be null to indicate no label. *badgeIconType*: Either null to indicate no icon or a string to be used as a key in the badgeIconMap of the NavTree to lookup an iconClass to associate with the type.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Parameters:
item

getChildren(parentItem, onComplete, onError)

Overridden to specially handle the root item with the default query.
Parameters:
parentItem
onComplete
onError

getIdentity(item)

Overridden to specially handle the fabricated root node.
Parameters:
item

getItemType(item)

Returns the type of the item.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Parameters:
item

getLabel(item)

Overridden to specially handle the fabricated root node.
Parameters:
item

isSelectable(item)

Function to determine if a node is selectable.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Parameters:
item

mayHaveChildren(item)

Overriden to always return true for the fabricated root node and to otherwise return true or false depending on the branching settings for this model. Order of precedence is: - Value from branchingMap (when present) - Value of typeBranchingMap (when present) - Value from branchingAttr as interpreted by branchingAttrMode
Defined in: <idx\widget\NavTreeObjectModel.js>.
Parameters:
item

newItem(args, parent, insertIndex, before)

Overridden to handle special case of parent being fabricated root node. Keep in mind that if the specified parent is the fabricated root element that the element should match the "query" specified for this model in order to become a true child upon refresh. If it does not match the specified query then the "child" will be created, but will not show. This method triggers a call to "onNewRootItem" which may be overridden to change the parameters of the new item to force it to match the query (e.g.: it may set "root=true").
Parameters:
args
parent
insertIndex
before

normalizeItem(item)

Returns a snapshot object that contains all the attributes and values of the specified item so that it is simplified from the data store interface.
Defined in: <idx\widget\NavTreeObjectModel.js>.
Parameters:
item
The item to be normalized.

onAddToRoot(item)

Called when item added to root of tree; user must override this method to modify the item so that it matches the query for top level items. Unlike ForestStoreModel, ForestObjectStoreModel calls this function to modify the object before the parent is actually changed in the store so that a single "put" can be used to save both changes.
Parameters:
item

onBadgesChanged()

Call this method when the badgeLabelAttr, badgeIconTypeAttr, or badgeMap is changed.
Defined in: <idx\widget\NavTreeObjectModel.js>.

onBranchingChanged()

Callback method for when branchingMap, typeBranchingMap, branchingAttr or branchingAttrMode is changed.
Defined in: <idx\widget\NavTreeObjectModel.js>.

onLeaveRoot(item)

Called when item removed from root of tree; user must override this method to modify the item so it doesn't match the query for top level items. This method is called before the "put" operation that saves the change of parent so that the change to the attributes and parent can be done in the same "put" operation.
Parameters:
item

onNewRootItem()

Attach to or override this function to force the parameters for a child of the root node to match the query for children of the root node. This can be implemented by doing something as simple as adding a flag that as "root=true".

onSelectabilityChanged()

Call this method when the selectabilityMap or typeSelectbailityMap is changed.
Defined in: <idx\widget\NavTreeObjectModel.js>.

pasteItem(childItem, oldParentItem, newParentItem, bCopy, insertIndex, before)

Overridden to handle cases where the old or new parent is the fabricated root node. This will trigger calls to either "onLeaveRoot" or "onAddToRoot" which are responsible for modifying existing items to match the query specified for this instance's root children.
Parameters:
childItem
oldParentItem
newParentItem
bCopy
insertIndex
before