Class idx.widget.NavTreeModel


Extends dijit.tree/ForestStoreModel.
Provides an expanded ForestStoreModel to support the additional features of idx.widget.NavTree.
Defined in: <idx\widget\NavTreeModel.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.
 
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 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 selectability for items of that type (true or false).

Method Summary

Method Attributes Method Name and Description
 
getBadge(item)
Gets the badge for the specified item or returns null if no badge is associated with the specified item.
 
Returns the type of the item.
 
Function to determine if a node is selectable.
 
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.
 
Call this method when the badgeLabelAttr, badgeIconTypeAttr, or badgeMap is changed.
 
Call this method when the selectabilityMap or typeSelectbailityMap is changed.

Constructor Detail

idx.widget.NavTreeModel()

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".

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.

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.
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"}

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

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

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

typeAttr

The attribute used to classify the tree nodes into different types to lookup different default behaviors for nodes of that type.

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

Method Detail

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.
Parameters:
item

getItemType(item)

Returns the type of the item.
Parameters:
item

isSelectable(item)

Function to determine if a node is selectable.
Parameters:
item

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.
Parameters:
item
The item to be normalized.

onBadgesChanged()

Call this method when the badgeLabelAttr, badgeIconTypeAttr, or badgeMap is changed.

onSelectabilityChanged()

Call this method when the selectabilityMap or typeSelectbailityMap is changed.