Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / docs / source / Provider2.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js"><span id='Ext-direct-Provider'>/**
19 </span> * @class Ext.direct.Provider
20  * &lt;p&gt;Ext.direct.Provider is an abstract class meant to be extended.&lt;/p&gt;
21  * 
22  * &lt;p&gt;For example ExtJs implements the following subclasses:&lt;/p&gt;
23  * &lt;pre&gt;&lt;code&gt;
24 Provider
25 |
26 +---{@link Ext.direct.JsonProvider JsonProvider} 
27     |
28     +---{@link Ext.direct.PollingProvider PollingProvider}   
29     |
30     +---{@link Ext.direct.RemotingProvider RemotingProvider}   
31  * &lt;/code&gt;&lt;/pre&gt;
32  * @abstract
33  */
34 Ext.define('Ext.direct.Provider', {
35     
36     /* Begin Definitions */
37    
38    alias: 'direct.provider',
39    
40     mixins: {
41         observable: 'Ext.util.Observable'   
42     },
43    
44     /* End Definitions */
45    
46 <span id='Ext-direct-Provider-cfg-id'>   /**
47 </span>     * @cfg {String} id
48      * The unique id of the provider (defaults to an {@link Ext#id auto-assigned id}).
49      * You should assign an id if you need to be able to access the provider later and you do
50      * not have an object reference available, for example:
51      * &lt;pre&gt;&lt;code&gt;
52 Ext.direct.Manager.addProvider({
53     type: 'polling',
54     url:  'php/poll.php',
55     id:   'poll-provider'
56 });     
57 var p = {@link Ext.direct.Manager}.{@link Ext.direct.Manager#getProvider getProvider}('poll-provider');
58 p.disconnect();
59      * &lt;/code&gt;&lt;/pre&gt;
60      */
61     
62     constructor : function(config){
63         var me = this;
64         
65         Ext.apply(me, config);
66         me.addEvents(
67 <span id='Ext-direct-Provider-event-connect'>            /**
68 </span>             * @event connect
69              * Fires when the Provider connects to the server-side
70              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
71              */            
72             'connect',
73 <span id='Ext-direct-Provider-event-disconnect'>            /**
74 </span>             * @event disconnect
75              * Fires when the Provider disconnects from the server-side
76              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
77              */            
78             'disconnect',
79 <span id='Ext-direct-Provider-event-data'>            /**
80 </span>             * @event data
81              * Fires when the Provider receives data from the server-side
82              * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.
83              * @param {event} e The Ext.Direct.Event type that occurred.
84              */            
85             'data',
86 <span id='Ext-direct-Provider-event-exception'>            /**
87 </span>             * @event exception
88              * Fires when the Provider receives an exception from the server-side
89              */                        
90             'exception'
91         );
92         me.mixins.observable.constructor.call(me, config);
93     },
94     
95 <span id='Ext-direct-Provider-method-isConnected'>    /**
96 </span>     * Returns whether or not the server-side is currently connected.
97      * Abstract method for subclasses to implement.
98      */
99     isConnected: function(){
100         return false;
101     },
102
103 <span id='Ext-direct-Provider-method-connect'>    /**
104 </span>     * Abstract methods for subclasses to implement.
105      * @method
106      */
107     connect: Ext.emptyFn,
108     
109 <span id='Ext-direct-Provider-method-disconnect'>    /**
110 </span>     * Abstract methods for subclasses to implement.
111      * @method
112      */
113     disconnect: Ext.emptyFn
114 });
115 </pre>
116 </body>
117 </html>