opengrok-tooltip.js revision 1363
1363N/A * Copyright 2012 Yahoo! Inc. All rights reserved. 1363N/A * Licensed under the BSD License. 1363N/A * Portions Copyright 2012 Jens Elkner. 1363N/A// The tooltip in the YUI gallery makes nice effects but is not flexible enough. 1363N/A// So we use a slightly modified version of the YUI examples. 1363N/A * Required NAME static field, used to identify the Widget class and used 1363N/A * as an event prefix, to generate class names etc. (set to the class name 1363N/A /* Default Tooltip Attributes */ 1363N/A * The tooltip content. This can either be a String, Node, or a simple 1363N/A * map of id-to-values, designed to be used when a single tooltip is 1363N/A * mapped to multiple trigger elements. 1363N/A * The set of nodes to bind to the tooltip instance. Can be a string, 1363N/A * The delegate node to which event listeners should be attached. This 1363N/A * node should be an ancestor of all trigger nodes bound to the 1363N/A * instance. By default the document is used. 1363N/A * The time to wait, after the mouse enters the trigger node, to display 1363N/A * The time to wait, after the mouse leaves the trigger node, to hide 1363N/A * The time to wait, after the tooltip is first displayed for a trigger 1363N/A * node, to hide it, if the mouse has not left the trigger node 1363N/A * Override the default visibility set by the widget base class 1363N/A * Override the default XY value set by the widget base class, to 1363N/A * position the tooltip offscreen 1363N/A /* Extend the base Widget class */ 1363N/A * Initialization Code: Sets up privately used state properties, and 1363N/A * publishes the events Tooltip introduces 1363N/A // Currently bound trigger node information 1363N/A // Event handles - mouse over is set on the delegate element, 1363N/A // mousemove and mouseout are set on the trigger node 1363N/A // Publish events introduced by Tooltip. Note the triggerEnter event 1363N/A // is preventable, with the default behavior defined in the 1363N/A // _defTriggerEnterFn method 1363N/A // we assume, horizontal scrollbar has ~ same height as vert. and 1363N/A * Destruction Code: Clears event handles, timers, and current trigger 1363N/A * bindUI is used to bind attribute change and dom event listeners 1363N/A * syncUI is used to update the rendered DOM, based on the current 1363N/A * Helper method to extract the content for the tooltip of the given 1363N/A * node, based on (in order of precedence): 1363N/A * a). The given node's 'content' attribute value, if set: 1363N/A * 0) If its value denotes a function, the result of executing as 1363N/A * function(node, this), whereby this is the Tooltip instance 1363N/A * 1) If the value is a map, the maps value for the key equal to 1363N/A * 2) If the value is a String or Node, the value itself. 1363N/A * 3) otherwise, fallback to b) 1363N/A * b) The value of the node's 'title' attribute. 1363N/A * @return either an innerHTML acceptable String or a Node 1363N/A * Public method, which can be used by triggerEvent event listeners to 1363N/A * set the content of the tooltip for the current trigger node. This 1363N/A * implementation uses {#getTooltipContent} to extract the content to 1363N/A * Gets the closest ancestor of the given node, which is a tooltip 1363N/A * Default attribute change listener for the triggerNodes attribute 1363N/A * Default attribute change listener for the delegate attribute 1363N/A * Updates the rendered DOM to reflect the set of trigger nodes passed in 1363N/A * Attaches the default mouseover DOM listener to the current delegate node 1363N/A * Default mouse over DOM event listener. 1363N/A * Delegates to the _enterTrigger method, if the mouseover enters a 1363N/A * Default mouse out DOM event listener 1363N/A * Delegates to _leaveTrigger if the mouseout leaves the current trigger 1363N/A * Default mouse move DOM event listener 1363N/A * Default handler invoked when the mouse enters a trigger node. Set the 1363N/A * content of the tooltip box and fires the triggerEnter event, which 1363N/A * inturn notifies all listeners. Listeners may prevent the tooltip 1363N/A * Default handler for the triggerEvent event, which will setup the 1363N/A * timer to display the tooltip, if the default handler has not been 1363N/A * Default handler invoked when the mouse leaves the current trigger 1363N/A * node. Fires the triggerLeave event and sets up the hide timer 1363N/A * Default handler invoked for mousemove events on the trigger node. 1363N/A * Stores the current mouse x, y positions 1363N/A * Shows the tooltip, after moving it to the current mouse position. 1363N/A * Hides the tooltip, after clearing existing timers. 1363N/A * Set the currently bound trigger node information, clearing out the 1363N/A * Clear out the current trigger state, restoring the title attribute 1363N/A * on the trigger node, if it was originally set. 1363N/A * Detach any stored event handles 1363N/A // dynamic:false = Modify the existing Tooltip class 1363N/A},
'1.0', {
requires: [
'widget',
'widget-position',
'widget-stack']});
1363N/A// vim: set filetype=javascript ts=4