Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-routing-foss4g/web/ext/src/widgets/tips/QuickTips.js @ 77

Revision 76, 6.4 KB checked in by djay, 13 years ago (diff)

Ajout du répertoire web

  • Property svn:executable set to *
Line 
1/*!
2 * Ext JS Library 3.4.0
3 * Copyright(c) 2006-2011 Sencha Inc.
4 * licensing@sencha.com
5 * http://www.sencha.com/license
6 */
7/**
8 * @class Ext.QuickTips
9 * <p>Provides attractive and customizable tooltips for any element. The QuickTips
10 * singleton is used to configure and manage tooltips globally for multiple elements
11 * in a generic manner.  To create individual tooltips with maximum customizability,
12 * you should consider either {@link Ext.Tip} or {@link Ext.ToolTip}.</p>
13 * <p>Quicktips can be configured via tag attributes directly in markup, or by
14 * registering quick tips programmatically via the {@link #register} method.</p>
15 * <p>The singleton's instance of {@link Ext.QuickTip} is available via
16 * {@link #getQuickTip}, and supports all the methods, and all the all the
17 * configuration properties of Ext.QuickTip. These settings will apply to all
18 * tooltips shown by the singleton.</p>
19 * <p>Below is the summary of the configuration properties which can be used.
20 * For detailed descriptions see the config options for the {@link Ext.QuickTip QuickTip} class</p>
21 * <p><b>QuickTips singleton configs (all are optional)</b></p>
22 * <div class="mdetail-params"><ul><li>dismissDelay</li>
23 * <li>hideDelay</li>
24 * <li>maxWidth</li>
25 * <li>minWidth</li>
26 * <li>showDelay</li>
27 * <li>trackMouse</li></ul></div>
28 * <p><b>Target element configs (optional unless otherwise noted)</b></p>
29 * <div class="mdetail-params"><ul><li>autoHide</li>
30 * <li>cls</li>
31 * <li>dismissDelay (overrides singleton value)</li>
32 * <li>target (required)</li>
33 * <li>text (required)</li>
34 * <li>title</li>
35 * <li>width</li></ul></div>
36 * <p>Here is an example showing how some of these config options could be used:</p>
37 * <pre><code>
38// Init the singleton.  Any tag-based quick tips will start working.
39Ext.QuickTips.init();
40
41// Apply a set of config properties to the singleton
42Ext.apply(Ext.QuickTips.getQuickTip(), {
43    maxWidth: 200,
44    minWidth: 100,
45    showDelay: 50,      // Show 50ms after entering target
46    trackMouse: true
47});
48
49// Manually register a quick tip for a specific element
50Ext.QuickTips.register({
51    target: 'my-div',
52    title: 'My Tooltip',
53    text: 'This tooltip was added in code',
54    width: 100,
55    dismissDelay: 10000 // Hide after 10 seconds hover
56});
57</code></pre>
58 * <p>To register a quick tip in markup, you simply add one or more of the valid QuickTip attributes prefixed with
59 * the <b>ext:</b> namespace.  The HTML element itself is automatically set as the quick tip target. Here is the summary
60 * of supported attributes (optional unless otherwise noted):</p>
61 * <ul><li><b>hide</b>: Specifying "user" is equivalent to setting autoHide = false.  Any other value will be the
62 * same as autoHide = true.</li>
63 * <li><b>qclass</b>: A CSS class to be applied to the quick tip (equivalent to the 'cls' target element config).</li>
64 * <li><b>qtip (required)</b>: The quick tip text (equivalent to the 'text' target element config).</li>
65 * <li><b>qtitle</b>: The quick tip title (equivalent to the 'title' target element config).</li>
66 * <li><b>qwidth</b>: The quick tip width (equivalent to the 'width' target element config).</li></ul>
67 * <p>Here is an example of configuring an HTML element to display a tooltip from markup:</p>
68 * <pre><code>
69// Add a quick tip to an HTML button
70&lt;input type="button" value="OK" ext:qtitle="OK Button" ext:qwidth="100"
71     ext:qtip="This is a quick tip from markup!">&lt;/input>
72</code></pre>
73 * @singleton
74 */
75Ext.QuickTips = function(){
76    var tip,
77        disabled = false;
78       
79    return {
80        /**
81         * Initialize the global QuickTips instance and prepare any quick tips.
82         * @param {Boolean} autoRender True to render the QuickTips container immediately to preload images. (Defaults to true)
83         */
84        init : function(autoRender){
85            if(!tip){
86                if(!Ext.isReady){
87                    Ext.onReady(function(){
88                        Ext.QuickTips.init(autoRender);
89                    });
90                    return;
91                }
92                tip = new Ext.QuickTip({
93                    elements:'header,body', 
94                    disabled: disabled
95                });
96                if(autoRender !== false){
97                    tip.render(Ext.getBody());
98                }
99            }
100        },
101       
102        // Protected method called by the dd classes
103        ddDisable : function(){
104            // don't disable it if we don't need to
105            if(tip && !disabled){
106                tip.disable();
107            }   
108        },
109       
110        // Protected method called by the dd classes
111        ddEnable : function(){
112            // only enable it if it hasn't been disabled
113            if(tip && !disabled){
114                tip.enable();
115            }
116        },
117
118        /**
119         * Enable quick tips globally.
120         */
121        enable : function(){
122            if(tip){
123                tip.enable();
124            }
125            disabled = false;
126        },
127
128        /**
129         * Disable quick tips globally.
130         */
131        disable : function(){
132            if(tip){
133                tip.disable();
134            }
135            disabled = true;
136        },
137
138        /**
139         * Returns true if quick tips are enabled, else false.
140         * @return {Boolean}
141         */
142        isEnabled : function(){
143            return tip !== undefined && !tip.disabled;
144        },
145
146        /**
147         * Gets the single {@link Ext.QuickTip QuickTip} instance used to show tips from all registered elements.
148         * @return {Ext.QuickTip}
149         */
150        getQuickTip : function(){
151            return tip;
152        },
153
154        /**
155         * Configures a new quick tip instance and assigns it to a target element.  See
156         * {@link Ext.QuickTip#register} for details.
157         * @param {Object} config The config object
158         */
159        register : function(){
160            tip.register.apply(tip, arguments);
161        },
162
163        /**
164         * Removes any registered quick tip from the target element and destroys it.
165         * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.
166         */
167        unregister : function(){
168            tip.unregister.apply(tip, arguments);
169        },
170
171        /**
172         * Alias of {@link #register}.
173         * @param {Object} config The config object
174         */
175        tips : function(){
176            tip.register.apply(tip, arguments);
177        }
178    };
179}();
Note: See TracBrowser for help on using the repository browser.