(function() {
// $source: com/ibm/rave/navigation/internal/nativeImpl/ModuleHeader
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2014, 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// setup
var rave = window["rave"], rave_externs = {},
com_ibm_rave_core_Rave = rave,
com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"],
com_ibm_rave_core_selector_Selector = rave["internal"]["Selector"],
com_ibm_rave_core_selector_SelectorDelegate = rave["internal"]["SelectorDelegate"];
// $source: com/ibm/rave/navigation/focus/FocusController
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/navigation/NavigationConstants (runtime) // NavigationConstants
/**
* Controller that determines focus order based on navigation index rules. Order is determined in the same way as 'tabIndex'.
*/
var com_ibm_rave_navigation_focus_FocusController = rave_externs["FocusController"] = {
};
/**
* Return the focusable node on the previous level.
* @param (com.ibm.rave.core.scene.SceneNode) node The node with focus.
* @return (com.ibm.rave.core.scene.SceneNode) The node on the previous level that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.previousLevelFocusableNode = function(node) {
var focused = node, parent;
while ((parent = focused.rave_getParentNode())) {
if (com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(parent) >= 0) {
break;
}
focused = parent;
}
return parent;
};
/**
* Return the focusable node on the next level.
* @param (com.ibm.rave.core.scene.SceneNode) node The node with focus.
* @return (com.ibm.rave.core.scene.SceneNode) The node on the next level that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.nextLevelFocusableNode = function(node) {
var firstChild = com_ibm_rave_navigation_focus_FocusController.firstChild(node);
var focused = com_ibm_rave_navigation_focus_FocusController.nextFocusableNodeFromStart(firstChild);
if (!focused) {
for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length;
__i_enFor0 < __len_enFor0; ++__i_enFor0) {
var child = __exp_enFor0[__i_enFor0];
focused = com_ibm_rave_navigation_focus_FocusController.nextLevelFocusableNode(child);
if (focused) {
break;
}
}
}
return focused;
};
/**
* Return the previous node that should receive focus, starting from the end of the current scope. The end is determined by using the last child of the current scope.
* @param (com.ibm.rave.core.scene.SceneNode) node The node to use as the current scope.
* @return (com.ibm.rave.core.scene.SceneNode) The previous node that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.previousFocusableNodeFromEnd = function(node) {
return com_ibm_rave_navigation_focus_FocusController._previousFocusableNode(node, null);
};
/**
* Return the previous node that should receive focus.
* @param (com.ibm.rave.core.scene.SceneNode) node The node with focus.
* @return (com.ibm.rave.core.scene.SceneNode) The previous node that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.previousFocusableNode = function(node) {
return com_ibm_rave_navigation_focus_FocusController._previousFocusableNode(node, node);
};
/**
* Find the previous node that should receive focus. A start node can be given to indicate the starting point of the search. If none is given, the scope is used to get the last child as the starting point.
* @param (com.ibm.rave.core.scene.SceneNode) scope A node to indicate the scope of the search.
* @param (com.ibm.rave.core.scene.SceneNode) start The starting point of the search.
* @return (com.ibm.rave.core.scene.SceneNode) The previous node that should receive focus, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController._previousFocusableNode = function(scope, start) {
var last = com_ibm_rave_navigation_focus_FocusController.lastChild(scope ? scope.rave_getParentNode() : null);
var startingIndex;
var startingNode;
if (start) {
startingIndex = com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(start);
startingNode = start.rave_getPreviousSibling();
} else {
startingIndex = 0;
startingNode = last;
}
if (startingIndex < 0) {
for (var target = startingNode; target; target = target.rave_getPreviousSibling()) {
if (com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(target) >= 0) {
return target;
}
}
} else {
var sameIndex = com_ibm_rave_navigation_focus_FocusController.findNodeWithIndex(startingNode, startingIndex, false);
if (sameIndex) {
return sameIndex;
}
}
startingIndex = start && startingIndex != 0 ? startingIndex : 2147483647;
return com_ibm_rave_navigation_focus_FocusController.findPreviousNodeWithLowerIndex(last, startingIndex);
};
/**
* Return the next node that should receive focus, from the start of the current scope. The start is determined by using the first child of the current scope.
* @param (com.ibm.rave.core.scene.SceneNode) node The node to use as the current scope.
* @return (com.ibm.rave.core.scene.SceneNode) The next node that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.nextFocusableNodeFromStart = function(node) {
return com_ibm_rave_navigation_focus_FocusController._nextFocusableNode(node, null);
};
/**
* Return the next node that should receive focus.
* @param (com.ibm.rave.core.scene.SceneNode) node The node with focus.
* @return (com.ibm.rave.core.scene.SceneNode) The next node that should receive focus, or null
if none is found.
*/
/** @expose */
com_ibm_rave_navigation_focus_FocusController.nextFocusableNode = function(node) {
return com_ibm_rave_navigation_focus_FocusController._nextFocusableNode(node, node);
};
/**
* Find the next node that should receive focus. A start node can be given to indicate the starting point of the search. If none is given, the scope is used to get the first child as the starting point.
* @param (com.ibm.rave.core.scene.SceneNode) scope A node to indicate the scope of the search.
* @param (com.ibm.rave.core.scene.SceneNode) start The starting point of the search.
* @return (com.ibm.rave.core.scene.SceneNode) The next node that should receive focus, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController._nextFocusableNode = function(scope, start) {
if (start) {
var index = com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(start);
if (index < 0) {
for (var target = start.rave_getNextSibling(); target; target = target.rave_getNextSibling()) {
if (com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(target) >= 0) {
return target;
}
}
} else {
var sameIndex = com_ibm_rave_navigation_focus_FocusController.findNodeWithIndex(start.rave_getNextSibling(), index, true);
if (sameIndex) {
return sameIndex;
}
}
if (index == 0) {
return null;
}
}
var first = com_ibm_rave_navigation_focus_FocusController.firstChild(scope ? scope.rave_getParentNode() : null);
var next = com_ibm_rave_navigation_focus_FocusController.findNextNodeWithGreaterIndex(first, start ? com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(start) : 0);
if (next) {
return next;
}
return com_ibm_rave_navigation_focus_FocusController.findNodeWithIndex(first, 0, true);
};
/**
* Get the navigation index property on the given node.
* @param (com.ibm.rave.core.scene.SceneNode) node The node.
* @return (int) The value of the navigation index, or 0 if none was found.
*/
com_ibm_rave_navigation_focus_FocusController.getNavigationIndex = function(node) {
var index = node.rave_getProperty(com_ibm_rave_navigation_NavigationConstants.NAVIGATION_INDEX_KEY);
return index != null ? ~~ (index) : 0;
};
/**
* Find a node with the specified index.
* @param (com.ibm.rave.core.scene.SceneNode) node The node to use as the starting point of the search. This node is included in the search.
* @param (int) index The index to match.
* @param (boolean) forward The direction of the search. true to search forward, false to search backwards.
* @return (com.ibm.rave.core.scene.SceneNode) The node with the specified index, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController.findNodeWithIndex = function(node, index, forward) {
for (var target = node; target; target = forward ? target.rave_getNextSibling() : target.rave_getPreviousSibling()) {
if (com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(target) == index) {
return target;
}
}
return null;
};
/**
* Find the next node with an index greater than the one specified.
* @param (com.ibm.rave.core.scene.SceneNode) node The node to use as the starting point of the search. This node is included in the search.
* @param (int) index The index.
* @return (com.ibm.rave.core.scene.SceneNode) The node with an index greater than the one specified, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController.findNextNodeWithGreaterIndex = function(node, index) {
var greater;
var maxIndex = 2147483647;
for (var target = node; target; target = target.rave_getNextSibling()) {
var currentIndex = com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(target);
if (currentIndex > index && currentIndex < maxIndex) {
maxIndex = currentIndex;
greater = target;
}
}
return greater;
};
/**
* Find the previous node with an index less than the one specified.
* @param (com.ibm.rave.core.scene.SceneNode) node The node to use as the starting point of the search. This node is included in the search.
* @param (int) index The index.
* @return (com.ibm.rave.core.scene.SceneNode) The node with an index lower than the one specified, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController.findPreviousNodeWithLowerIndex = function(node, index) {
var lower;
var minIndex = 0;
for (var target = node; target; target = target.rave_getPreviousSibling()) {
var currentIndex = com_ibm_rave_navigation_focus_FocusController.getNavigationIndex(target);
if (currentIndex < index && currentIndex > minIndex) {
minIndex = currentIndex;
lower = target;
}
}
return lower;
};
/**
* Get the first child of the provided node.
* @param (com.ibm.rave.core.scene.SceneNode) node The parent node.
* @return (com.ibm.rave.core.scene.SceneNode) The first child of the provided node, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController.firstChild = function(node) {
var firstChild;
if (node && node.rave_hasChildNodes()) {
firstChild = node.rave_getChildNodes()[0];
}
return firstChild;
};
/**
* Get the last child of the provided node.
* @param (com.ibm.rave.core.scene.SceneNode) node The parent node.
* @return (com.ibm.rave.core.scene.SceneNode) The last child of the provided node, or null
if none is found.
*/
com_ibm_rave_navigation_focus_FocusController.lastChild = function(node) {
var lastChild;
if (node && node.rave_hasChildNodes()) {
var children = node.rave_getChildNodes();
lastChild = children[children.length - 1];
}
return lastChild;
};
// $source: com/ibm/rave/navigation/NavigationConstants
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
var com_ibm_rave_navigation_NavigationConstants = rave_externs["NavigationConstants"] = {
};
/**
* Key for the navigation selector. To access navigation methods on a selector, get the navigation selector from the core selector this way: NavigationSelector navSelector = (NavigationSelector) Rave.select("id").extension(Navigation.SELECTOR_ID);
*/
/** @expose */
com_ibm_rave_navigation_NavigationConstants.SELECTOR_ID = "raveNavigation";
/**
* Property key for navigation index.
*/
/** @expose */
com_ibm_rave_navigation_NavigationConstants.NAVIGATION_INDEX_KEY = "__raveNavigationIndex__";
// $source: com/ibm/rave/navigation/keyboard/KeyBinding
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
var com_ibm_rave_navigation_keyboard_KeyBinding = rave_externs["KeyBinding"] = com_ibm_rave_core_nativeImpl_Declare({
//keyDownMap : null,
//keyPressMap : null,
/**
* Define the keydown listener. It will act on the keydown event by calling the function mapped to the key code(s) in the provided mappings.
*/
//keyDownListener : null,
/**
* Define the keypress listener. It will act on the keypress event by calling the function mapped to the key character code(s) in the provided mappings.
*/
//keyPressListener : null,
_$functionClassMethod : function() {
var _$self = /**
* @see _$self.KeyBinding#_$self.keybinding(com_ibm_rave_core_selector_Selector)
*/
function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
_$self.keybinding(args[0]);
return null;
}
};
return _$self;
},
constructor : function() {
this.keyDownMap = {};
this.keyPressMap = {};
{
var self = this;
this.keyDownListener = function(data, index, groupIndex, event) {
var callback = com_ibm_rave_navigation_keyboard_KeyBinding.getCallback(self.keyDownMap);
if (callback) {
callback.call(event.target, event);
}
};
this.keyPressListener = function(data, index, groupIndex, event) {
var callback = com_ibm_rave_navigation_keyboard_KeyBinding.getCallback(self.keyPressMap);
if (callback) {
callback.call(event.target, event);
}
};
}
},
/**
* Attach the keydown listener to the keydown event on the provided node. Attach the keypress listener to the keypress event on the provided node.
* @param (com.ibm.rave.core.selector.Selector) g the selector context.
*/
/** @expose */
keybinding : function(g) {
g.on("keydown", this.keyDownListener);
g.on("keypress", this.keyPressListener);
},
/**
* Associates a key code to a callback. The key code will trigger the callback on the keydown event.
* @param (int) keyCode The key code.
* @param (com.ibm.rave.core.selector.RunFunction) callback The callback for the key code.
* @return (com.ibm.rave.navigation.keyboard.KeyBinding) This KeyBinding object.
*/
on$0 : function(keyCode, callback) {
com_ibm_rave_navigation_keyboard_KeyBinding.addKeyCallback(keyCode, callback, 0, this.keyDownMap);
return this;
},
/**
* Get the callback associated with the provided key.
* @param (int) keyCode The key code.
* @return (com.ibm.rave.core.selector.RunFunction) The callback associated with the key, or null if none found.
*/
get$0 : function(keyCode) {
return com_ibm_rave_navigation_keyboard_KeyBinding.getKeyCallback(keyCode, 0, this.keyDownMap);
},
/**
* Associates a key code combination to a callback. The key code combination will trigger the callback on the keydown event.
* @param (int) keyCode The key code.
* @param (com.ibm.rave.core.selector.RunFunction) callback The callback for the key combination.
* @param (int) modifiers bitwise OR value of modifiers from @see Keys
* @return (com.ibm.rave.navigation.keyboard.KeyBinding) This KeyBinding object.
*/
on$1 : function(keyCode, callback, modifiers) {
com_ibm_rave_navigation_keyboard_KeyBinding.addKeyCallback(keyCode, callback, modifiers, this.keyDownMap);
return this;
},
/**
* Get the callback associated with the provided key combination.
* @param (int) keyCode The key code.
* @return (com.ibm.rave.core.selector.RunFunction) The callback associated with the key, or null if none found.
*/
get$1 : function(keyCode, modifiers) {
return com_ibm_rave_navigation_keyboard_KeyBinding.getKeyCallback(keyCode, modifiers, this.keyDownMap);
},
/**
* Associates a key to a callback. The key will trigger the callback on the keypress event.
* @param (String) key The key.
* @param (com.ibm.rave.core.selector.RunFunction) callback The callback for the key.
* @return (com.ibm.rave.navigation.keyboard.KeyBinding) This KeyBinding object.
*/
on$2 : function(key, callback) {
if (key != null && key.length > 0) {
com_ibm_rave_navigation_keyboard_KeyBinding.addKeyCallback(key.charCodeAt(0), callback, 0, this.keyPressMap);
}
return this;
},
/**
* Get the callback associated with the provided key.
* @param (String) key The key.
* @return (com.ibm.rave.core.selector.RunFunction) The callback associated with the key, or null if none found.
*/
get$2 : function(key) {
if (key != null && key.length > 0) {
return com_ibm_rave_navigation_keyboard_KeyBinding.getKeyCallback(key.charCodeAt(0), 0, this.keyPressMap);
}
return null;
},
/**
* Associates a key combination to a callback. If the SHIFT modifier is present, the key combination will trigger the callback on the keypress event. Otherwise, the key combination will trigger the callback on the keydown event.
* @param (String) key The key.
* @param (com.ibm.rave.core.selector.RunFunction) callback The callback for the key combination.
* @param (int) modifiers bitwise OR value of modifiers from @see Keys
* @return (com.ibm.rave.navigation.keyboard.KeyBinding) This KeyBinding object.
*/
on$3 : function(key, callback, modifiers) {
if (key != null && key.length > 0) {
com_ibm_rave_navigation_keyboard_KeyBinding.addKeyCallback(key.charCodeAt(0), callback, modifiers, modifiers == 8 || modifiers == 0 ? this.keyPressMap : this.keyDownMap);
}
return this;
},
/**
* Get the callback associated with the provided key combination.
* @param (String) key The key.
* @return (com.ibm.rave.core.selector.RunFunction) The callback associated with the key, or null if none found.
*/
get$3 : function(key, modifiers) {
if (key != null && key.length > 0) {
return com_ibm_rave_navigation_keyboard_KeyBinding.getKeyCallback(key.charCodeAt(0), modifiers, modifiers == 8 || modifiers == 0 ? this.keyPressMap : this.keyDownMap);
}
return null;
},
/** @expose */
on : function(a0, a1, a2) {
var args = arguments;
if (args.length == 2 && (a0 == null || typeof a0 === "string")) {
return this.on$2(a0, a1);
}
if (args.length == 2) {
return this.on$0(a0, a1);
}
if (args.length == 3 && (a0 == null || typeof a0 === "string") && (a2 == null || typeof a2 === "number")) {
return this.on$3(a0, a1, a2);
}
return this.on$1(a0, a1, a2);
},
/** @expose */
get : function(a0, a1) {
var args = arguments;
if (args.length == 1 && (a0 == null || typeof a0 === "string")) {
return this.get$2(a0);
}
if (args.length == 1) {
return this.get$0(a0);
}
if (args.length == 2 && (a0 == null || typeof a0 === "string") && (a1 == null || typeof a1 === "number")) {
return this.get$3(a0, a1);
}
return this.get$1(a0, a1);
}
});
/**
* Add the key combination and callback to the map.
* @param (int) keyCode The key code.
* @param (com.ibm.rave.core.selector.RunFunction) callback The callback for the key combination.
* @param (int) modifiers Bitwise ORed key modifiers.
* @param (Object) map The map to insert into.
*/
com_ibm_rave_navigation_keyboard_KeyBinding.addKeyCallback = function(keyCode, callback, modifiers, map) {
var key = com_ibm_rave_navigation_keyboard_KeyBinding.generateMapKey(keyCode, modifiers);
map[key] = callback;
};
/**
* Return the callback associated to the key combination in the map.
* @param (int) keyCode The key code.
* @param (int) modifiers Bitwise ORed key modifiers.
* @param (Object) map The lookup map.
* @return (com.ibm.rave.core.selector.RunFunction) The callback for the key combination, or null if none found.
*/
com_ibm_rave_navigation_keyboard_KeyBinding.getKeyCallback = function(keyCode, modifiers, map) {
var key = com_ibm_rave_navigation_keyboard_KeyBinding.generateMapKey(keyCode, modifiers);
return map[key];
};
/**
* Generate a key from the key code and modifiers.
* @param (int) keyCode The key code.
* @param (int) modifiers Bitwise ORed key modifiers.
* @return (String) A string representation of the generated key.
*/
com_ibm_rave_navigation_keyboard_KeyBinding.generateMapKey = function(keyCode, modifiers) {
return keyCode + ":" + modifiers;
};
/**
* Get the callback for the key on the keyboard event.
* @param (Object) map The target map.
* @return (com.ibm.rave.core.selector.RunFunction) The callback function.
*/
com_ibm_rave_navigation_keyboard_KeyBinding.getCallback = function(map) {
return map[com_ibm_rave_navigation_keyboard_KeyBinding.getKeyFromEvent(rave.event)];
};
/**
* Get the key code from the keyboard event.
* @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event The KeyBoard event.
* @return (String) The key code.
*/
com_ibm_rave_navigation_keyboard_KeyBinding.getKeyFromEvent = function(event) {
var modifiers = 0;
if (event.shiftKey) {
modifiers |= 8;
}
if (event.ctrlKey) {
modifiers |= 4;
}
if (event.altKey) {
modifiers |= 2;
}
if (event.metaKey) {
modifiers |= 1;
}
var keyCode = event.keyCode == 0 ? event.which : event.keyCode;
return com_ibm_rave_navigation_keyboard_KeyBinding.generateMapKey(keyCode, modifiers);
};
// $source: com/ibm/rave/navigation/keyboard/DefaultKeyboard
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
//@import com/ibm/rave/navigation/keyboard/KeyBinding (runtime) // new
//@import com/ibm/rave/core/Rave (runtime) // select, Rave
//@import com/ibm/rave/navigation/focus/FocusController (runtime) // nextFocusableNode, nextLevelFocusableNode, previousFocusableNodeFromEnd, previousLevelFocusableNode, nextFocusableNodeFromStart, previousFocusableNode
var com_ibm_rave_navigation_keyboard_DefaultKeyboard = rave_externs["DefaultKeyboard"] = com_ibm_rave_core_nativeImpl_Declare({
//kb : null,
//eventHandler : null,
/** @expose */
next : null,
/** @expose */
previous : null,
/** @expose */
nextLevel : null,
/** @expose */
previousLevel : null,
_$functionClassMethod : function() {
var _$self = function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
_$self.bind(args[0]);
return null;
}
};
return _$self;
},
constructor : function() {
this.kb = new com_ibm_rave_navigation_keyboard_KeyBinding();
this.eventHandler = com_ibm_rave_core_Rave.behavior.focusEventHandler();
{
var self = this;
this.next = function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
var focused = self.eventHandler.focusedNode;
if (focused && !(com_ibm_rave_navigation_keyboard_DefaultKeyboard.isNavigationRoot(focused))) {
var nextSibling = com_ibm_rave_navigation_focus_FocusController.nextFocusableNode(focused);
if (!nextSibling) {
nextSibling = com_ibm_rave_navigation_focus_FocusController.nextFocusableNodeFromStart(focused);
}
if (nextSibling) {
self.eventHandler.fireFocus(nextSibling);
}
rave.event.preventDefault();
}
return null;
}
};
this.previous = function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
var focused = self.eventHandler.focusedNode;
if (focused && !(com_ibm_rave_navigation_keyboard_DefaultKeyboard.isNavigationRoot(focused))) {
var previousSibling = com_ibm_rave_navigation_focus_FocusController.previousFocusableNode(focused);
if (!previousSibling) {
previousSibling = com_ibm_rave_navigation_focus_FocusController.previousFocusableNodeFromEnd(focused);
}
if (previousSibling) {
self.eventHandler.fireFocus(previousSibling);
}
rave.event.preventDefault();
}
return null;
}
};
this.nextLevel = function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
var focused = self.eventHandler.focusedNode;
if (focused) {
focused = com_ibm_rave_navigation_focus_FocusController.nextLevelFocusableNode(focused);
if (focused) {
self.eventHandler.fireFocus(focused);
}
}
rave.event.preventDefault();
return null;
}
};
this.previousLevel = function(args) {
if (args !== null || arguments.length > 1){
args = Array.prototype.slice.call(arguments, 0);
}
{
var focused = self.eventHandler.focusedNode;
if (focused) {
var parent = com_ibm_rave_navigation_focus_FocusController.previousLevelFocusableNode(focused);
if (com_ibm_rave_navigation_keyboard_DefaultKeyboard.isNavigationRoot(parent)) {
self.eventHandler.fireBlur(focused);
self.eventHandler.focusedNode = parent;
} else if (!(com_ibm_rave_navigation_keyboard_DefaultKeyboard.isNavigationRoot(focused))) {
self.eventHandler.fireFocus(parent);
}
rave.event.preventDefault();
}
return null;
}
};
}
{
this.kb.on(13, this.nextLevel).on(27, this.previousLevel).on(9, this.next).on(9, this.previous, 8);
}
},
/** @expose */
bind : function(g) {
var self = this;
g.each(function(data, index, groupIndex) {
var s = com_ibm_rave_core_Rave.select(this);
com_ibm_rave_core_Rave.select(this.rave_getOwner()).call(self.kb);
s.property(com_ibm_rave_navigation_keyboard_DefaultKeyboard.NATIVATION_ROOT, true);
self.eventHandler.focusedNode = this;
});
},
/** @expose */
keyBinding : function() {
return this.kb;
},
focusEventHandler$0 : function() {
return this.eventHandler;
},
focusEventHandler$1 : function(handler) {
this.eventHandler = handler;
return this;
},
/** @expose */
focusEventHandler : function(a0) {
var args = arguments;
if (args.length == 0) {
return this.focusEventHandler$0();
}
return this.focusEventHandler$1(a0);
}
});
com_ibm_rave_navigation_keyboard_DefaultKeyboard.isNavigationRoot = function(item) {
return item.rave_getProperty(com_ibm_rave_navigation_keyboard_DefaultKeyboard.NATIVATION_ROOT) != null;
};
com_ibm_rave_navigation_keyboard_DefaultKeyboard.NATIVATION_ROOT = "__rave-kbnav-root__";
// $source: com/ibm/rave/navigation/selector/NavigationSelector
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
//@import com/ibm/rave/core/selector/SelectorDelegate (loadtime) // superclass
//@import com/ibm/rave/navigation/NavigationConstants (runtime) // NavigationConstants
/**
* Navigation extension to {@link (com.ibm.rave.core.selector.SelectorDelegate) SelectorDelegate} . Adds the ability to perform navigation related functions to a selector.
*/
var com_ibm_rave_navigation_selector_NavigationSelector = rave_externs["NavigationSelector"] = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_selector_SelectorDelegate, {
/**
* Constructor
*/
/** @expose */
constructor : function() {},
/**
* @see {@link this.SelectorDelegate#this.create}
*/
/** @expose */
create : function(s) {
var ns = new com_ibm_rave_navigation_selector_NavigationSelector();
return ns.setDelegate(s);
},
/**
* Get the navigation index for the first SceneNode in this Selector.
* @return (Object) the navigation index of the first SceneNode in this Selector
*/
navigationIndex$0 : function() {
var node = this.node();
return !node ? null : node.rave_getProperty(com_ibm_rave_navigation_NavigationConstants.NAVIGATION_INDEX_KEY);
},
/**
* Set the navigation index for each SceneNode in this Selector.
* @param (int) index the navigation index
* @return (com.ibm.rave.navigation.selector.NavigationSelector) this {@link (com.ibm.rave.navigation.selector.NavigationSelector) NavigationSelector}
*/
navigationIndex$1 : function(index) {
this.each(function(data, idx, groupIndex) {
this.rave_setProperty(com_ibm_rave_navigation_NavigationConstants.NAVIGATION_INDEX_KEY, index);
});
return this;
},
/**
* Set the navigation index for each SceneNode in this Selector.
* @param (com.ibm.rave.core.selector.ValueFunction) valueFunction a function which returns a navigation index
* @return (com.ibm.rave.navigation.selector.NavigationSelector) this {@link (com.ibm.rave.navigation.selector.NavigationSelector) NavigationSelector}
*/
navigationIndex$2 : function(valueFunction) {
this.each(function(data, index, groupIndex) {
this.rave_setProperty(com_ibm_rave_navigation_NavigationConstants.NAVIGATION_INDEX_KEY, valueFunction.call(this, data, index, groupIndex));
});
return this;
},
/** @expose */
navigationIndex : function(a0) {
var args = arguments;
if (args.length == 0) {
return this.navigationIndex$0();
}
if (args.length == 1 && typeof a0 === "function") {
return this.navigationIndex$2(a0);
}
return this.navigationIndex$1(a0);
}
});
// $source: com/ibm/rave/navigation/keys/Keys
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
/**
* Key mappings for keyboard modifiers: Shift, Control, Alt and Meta
*/
var com_ibm_rave_navigation_keys_Keys = com_ibm_rave_core_nativeImpl_Declare({
/** @expose */
SHIFT : 0x08,
/** @expose */
CTRL : 0x04,
/** @expose */
ALT : 0x02,
/** @expose */
META : 0x01
//constructor : function() {}
});
/** @expose */
com_ibm_rave_navigation_keys_Keys.INSTANCE = new com_ibm_rave_navigation_keys_Keys();
// $source: com/ibm/rave/navigation/Navigation
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/navigation/keyboard/KeyBinding (static) // new
//@import com/ibm/rave/navigation/keyboard/DefaultKeyboard (static) // new
//@import com/ibm/rave/core/selector/Selector (static) // extension
//@import com/ibm/rave/navigation/selector/NavigationSelector (runtime) // new
//@import com/ibm/rave/navigation/keys/Keys (static) // Keys
//@import com/ibm/rave/navigation/NavigationConstants (static) // NavigationConstants
/**
* Entry point for navigation capabilities.
*/
var com_ibm_rave_navigation_Navigation = rave_externs["Navigation"] = {
/**
* Singleton
*/
//constructor : function() {}
};
/**
* Creates a new instance of {@link (com.ibm.rave.navigation.keyboard.KeyBinding) KeyBinding} .
* @return (com.ibm.rave.navigation.keyboard.KeyBinding) new instance of {@link (com.ibm.rave.navigation.keyboard.KeyBinding) KeyBinding}
*/
/** @expose */
com_ibm_rave_navigation_Navigation.keybinding = function() {
return new com_ibm_rave_navigation_keyboard_KeyBinding();
};
/**
* Creates a new instance of {@link (com.ibm.rave.navigation.keyboard.DefaultKeyboard) DefaultKeyboard} .
* @return (com.ibm.rave.navigation.keyboard.DefaultKeyboard) new instance of {@link (com.ibm.rave.navigation.keyboard.DefaultKeyboard) DefaultKeyboard}
*/
/** @expose */
com_ibm_rave_navigation_Navigation.keyboard = function() {
return new com_ibm_rave_navigation_keyboard_DefaultKeyboard();
};
/**
* Initialize the Navigation feature. This needs to be called before using any navigation features.
*/
/** @expose */
com_ibm_rave_navigation_Navigation.init = function() {
com_ibm_rave_core_selector_Selector.extension(com_ibm_rave_navigation_Navigation.SELECTOR_ID, function() {
return new com_ibm_rave_navigation_selector_NavigationSelector();
});
};
/**
* @see (com.ibm.rave.navigation.keys.Keys) Keys
*/
/** @expose */
com_ibm_rave_navigation_Navigation.keys = com_ibm_rave_navigation_keys_Keys.INSTANCE;
/**
* @see this.AccessibilityConstants#this.SELECTOR_ID
*/
/** @expose */
com_ibm_rave_navigation_Navigation.SELECTOR_ID = com_ibm_rave_navigation_NavigationConstants.SELECTOR_ID;
// $source: com/ibm/rave/navigation/internal/nativeImpl/Module
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2014, 2015
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// @OnDemandLoad("rave-navigation")
// Must be the first import
// @import ./ModuleHeader
// Other module dependencies
// @import com/ibm/rave/core/internal/nativeImpl/Module
// @import com/ibm/rave/navigation/Navigation
com_ibm_rave_navigation_Navigation.init();
// expose navigation to the global variable rave
rave["navigation"] = com_ibm_rave_navigation_Navigation;
rave["navigation"]["internal"] = rave_externs;
})();