12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022 |
- (function() {
- // During the rave-navigation.js build, this file is added to the top.
- // Create an inner self-executing function that will be run with the global scope
- // On browsers, this is 'window'. Everywhere else should use 'this' if available.
- // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :)
- var _window = (1, eval)('this');
- (function (global, factory) {
- // dynamically determine how 'rave' variable should be loaded depeneding on loader type
- var _rave;
- if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") {
- // CommonJS/node.js
- var rave = require("rave");
- var navigation = factory(global,rave);
- module.exports = rave;
- } else if (typeof define === "function" && define.amd) {
- // AMD
- define(['rave'], function(rave) {
- return factory(global,rave);
- });
- } else {
- // probably loading via script tag. run as is, setting stuff on rave
- factory(global,global['rave']);
- }
- }(_window, function (_global, _rave) {// $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 global = typeof _global !== "undefined" ? _global : (1, eval)('this');
- var rave = typeof _rave !== "undefined" ? _rave : global['rave'];
- var 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_context_RaveContextManager = rave["internal"]["RaveContextManager"],
- 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. 2017
- **
- ** 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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. <code>true</true> to search forward, <code>false</false> to search backwards.
- * @return (com.ibm.rave.core.scene.SceneNode) The node with the specified index, or <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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 <code>null</code> 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. 2017
- **
- ** 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: <code> NavigationSelector navSelector = (NavigationSelector) Rave.select("id").extension(Navigation.SELECTOR_ID); </code>
- */
- /** @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. 2017
- **
- ** 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. 2017
- **
- ** 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, nextFocusableNodeFromStart, previousFocusableNodeFromEnd, nextLevelFocusableNode, previousLevelFocusableNode, 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(10, this.nextLevel).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. 2017
- **
- ** 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() {},
- /**
- * Create the extension to the selector.
- * @param (com.ibm.rave.core.selector.Selector) s The core selector.
- * @return (com.ibm.rave.core.selector.Selector) The extended selector.
- */
- /** @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$0(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$0(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. 2017
- **
- ** 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 navigation keys and for keyboard modifiers: Shift, Control, Alt and Meta
- */
- var com_ibm_rave_navigation_keys_Keys = com_ibm_rave_core_nativeImpl_Declare({
- /** @expose */
- ENTER : 10,
- /** @expose */
- RETURN : 13,
- /** @expose */
- ESC : 27,
- /** @expose */
- TAB : 9,
- /** @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. 2017
- **
- ** 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/context/RaveContextManager (static) // RaveContextManager
- //@import com/ibm/rave/core/selector/Selector (static) // extension
- //@import com/ibm/rave/navigation/selector/NavigationSelector (runtime) // new
- //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare
- //@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();
- };
- com_ibm_rave_navigation_Navigation.getRegistrationStatus = function() {
- var registrationStatus = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("NAVIGATION_EXTENSION_REGISTRATION_STATUS_KEY");
- if (!registrationStatus) {
- registrationStatus = new com_ibm_rave_navigation_Navigation.RegistrationStatus();
- com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("NAVIGATION_EXTENSION_REGISTRATION_STATUS_KEY", registrationStatus);
- }
- return registrationStatus;
- };
- /**
- * Initialize the Navigation feature. This needs to be called before using any navigation features.
- */
- /** @expose */
- com_ibm_rave_navigation_Navigation.init = function() {
- var registrationStatus = com_ibm_rave_navigation_Navigation.getRegistrationStatus();
- if (!registrationStatus.registered) {
- registrationStatus.registered = com_ibm_rave_core_selector_Selector.extension(com_ibm_rave_navigation_Navigation.SELECTOR_ID, function() {
- return new com_ibm_rave_navigation_selector_NavigationSelector();
- });
- }
- };
- com_ibm_rave_navigation_Navigation.RegistrationStatus = com_ibm_rave_core_nativeImpl_Declare({
- registered : false
- });
- //com_ibm_rave_navigation_Navigation.EXTENSION_REGISTRATION_STATUS_KEY = "NAVIGATION_EXTENSION_REGISTRATION_STATUS_KEY";
- /**
- * @see (com.ibm.rave.navigation.keys.Keys) Keys
- */
- /** @expose */
- com_ibm_rave_navigation_Navigation.keys = com_ibm_rave_navigation_keys_Keys.INSTANCE;
- /**
- * @see this.NavigationConstants#com_ibm_rave_navigation_NavigationConstants.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;
- // This is the end of the factory method defined in the header. Added only during a full compiled JS build.
- return rave;
- }));})();
|