123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961 |
- (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 <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. 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: <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. 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;
- })();
|