1 /* This file is purely for documentation purposes, in order to
  2    get documentation in jsdoc form.  Therefore it's a function
  3    that itself does nothing. */
  4 
  5 
  6 /**
  7  * This class is typically only instantiated by Content Studio.
  8  * @class
  9  * Identifies an editor.  Instances of this class are passed as
 10  * arguments to the <code>editor-active</code> and related events.
 11  * Its sole function is to identify editors and to provide them with
 12  * human-readable names.
 13  */
 14 
 15 function EditorControl() {
 16   /**
 17    * The (full) URI of the editor in question.
 18    * @type  String
 19    */
 20   this.uri = "";
 21 
 22   /**
 23    * The display name of the editor in question
 24    * @type  String
 25    */
 26   this.displayName = "";
 27 }
 28 
 29 
 30 /**
 31  * This class is typically only instantiated by Content Studio.
 32  * @class
 33  * Identifies a panel, and provides a UI construction facility.
 34  *  Instances of this class are passed as arguments to the
 35  * <code>panel-*</code> events from <code>content-studio</code>.
 36  * It allows extensions to identify panel events, and to
 37  * initialize a UI inside a particular panel.
 38  */
 39 function PanelControl() {
 40   /**
 41    * The (full) URI of the panel in question.  Used to distinguish
 42    * panel events from one another, and for cooperating extensions
 43    * that share panels.
 44    * @type String
 45    */
 46   this.uri = "";
 47 
 48    /**
 49     * Initialize the panel with the specified type of UI and with the options provided
 50     * in <code>options</code>.
 51     *
 52     * @param {String} ui The type of user interface to be shown. Currently
 53     * <code>"list"</code> and <code>"browser"</code> are supported.
 54     * @param {Object} options A map containing configuration options for the UI.
 55     * For a <code>"list"</code> user interface, the following <code>options</code> are supported:
 56     * <ul>
 57     *   <li>columns</li>
 58     *   <li>span</li>
 59     * </ul>
 60     * The following example illustrates the correct structure of an options map:
 61     * <pre>
 62     *   var options = {
 63     *     'columns': [
 64     *       {
 65     *         'title' : 'From',
 66     *         'property' : 'from'
 67     *       },
 68     *       {
 69     *         'title' : 'When',
 70     *         'property' : 'when'
 71     *       }
 72     *     ],
 73     *     'span' : {
 74     *       'rows' : 3,
 75     *       'property' : 'summary'
 76     *     }
 77     *   };
 78     * </pre>
 79     * <p>
 80     * The <code>columns</code> option is an array of column definitions. Each column definition
 81     * consists of two values: <code>title</code> (the column title) and <code>property</code> 
 82     * (the column's identifier, used when adding values to the list). The <code>span</code>
 83     * option can be used to add a larger list entry that spans all the columns in the list. It 
 84     * consists of two values: <code>rows</code> (the maximum number of rows spanned entries
 85     * can occupy) and <code>property</code> (the column's identifier, used when adding values
 86     * to the list).
 87     * </p>
 88     * <p>
 89     * For a <code>"browser"</code> user interface, no <code>options</code> are required.
 90     * </p>
 91     * @return An object representing the specified user interface:
 92     * <ul>
 93     *   <li>A {@link MapListModel} object for <code>"list"</code> user interfaces.</li>
 94     *   <li>A {@link BrowserModel} object for <code>"browser"</code> user interfaces.</li>
 95     * </ul>
 96     */
 97    this.show = function(ui, options) {
 98      return null;
 99    };
100 
101   /**
102    * Notifies the panel to request user's attention. The alert icon is set for the panel.
103    */
104    this.alert = function () {
105    };
106 }
107 
108 /**
109  * This class is typically only instantiated by Content Studio.
110  * @class
111  * Represents a <code>"list"</code> user interface created with
112  * {@link PanelControl}.
113  */
114 function MapListModel() {
115 
116   /**
117    * Gets a row of the list UI.
118    * @param {String} id The identifier of the row to get.
119    * @return {Object} A map representing the row.
120    */
121   this.get = function (id) {
122     return null;
123   };
124 
125   /**
126    * Adds a row to the list UI.
127    *
128    * @param {String} id The identifier of the row to add.
129    * @param {Object} object A map representing the row to add. You must use the map keys
130    * that were defined when the user interface model was created
131    * with the {@link PanelControl#show()} object. For example:
132    * 
133    * <pre>
134    *   object = {
135    *     "from": "someone",
136    *     "when": "Today",
137    *     "summary" : "This is a great story"
138    *   }
139    * </pre>
140    * @param {int} [index=size of the list] The position at which the row is to be inserted.
141    */
142   this.add = function (id, object, index) {
143   };
144 
145   /**
146    * Removes a row from the list UI.
147    *
148    * @param {String} id The identifier of the row to remove.
149    */
150   this.remove = function (id) {
151   };
152 
153   /**
154    * Removes all the rows from the list UI.
155    */
156   this.clear = function () {
157   };
158 }
159 
160 /**
161  * This class is typically only instantiated by Content Studio.
162  * @class
163  * Represents a <code>"browser"</code> user interface created with 
164  * {@link PanelControl}.
165  */
166 function BrowserModel() {
167 
168   /**
169    * The URI of an HTML page to display in the browser user interface.
170    * @type String
171    */
172   this.uri = "";
173 
174   /**
175    * Some HTML content to display in the browser user interface.
176    * @type String
177    */
178   this.content = "";
179 }
180 
181 /**
182  * This class is typically only instantiated by Content Studio.
183  * @class
184  * Identifies a pinned tab. Instances of this class are passed as arguments to
185  * the <code>tab-*</code> events from <code>content-studio</code>.
186  * It allows extensions to identify panel events, and to
187  * show and remove the tab.
188  */
189 function TabControl() {
190 
191   /**
192    * The (full) URI of the pinned tab in question. Used to distinguish
193    * tab events from one another, and for cooperating extensions
194    * that share tabs.
195    * @type String
196    */
197   this.uri = "";
198 
199   /**
200    * Shows the pinned tab.
201    */
202   this.show = function () {
203   };
204 
205   /**
206    * Removes the pinned tab.
207    */
208   this.remove = function () {
209   };
210 }
211 
212 /**
213  * This class is typically only instantiated by Content Studio.
214  * @class
215  * An executor for executing Javascript scripts in <code>"browser"</code> user interfaces
216  * created by {@link PanelControl}.
217  */
218 function ScriptExecutor() {
219 
220   /**
221    * Executes a script in the swing event dispatch thread. This function does
222    * not wait for the script to finish executing and returns immediately.
223    *
224    * @param {String} script The script to execute.
225    */
226   this.executeScript = function (script) {
227   };
228 
229   /**
230    * Executes a script in the swing event dispatch thread and returns the
231    * result of the script. This function waits for the script to finish
232    * executing.
233    *
234    * @param {String} script The script to execute.
235    * @return {Object} The result of the script.
236    */
237   this.executeScriptWithResult = function (script) {
238     return null;
239   };
240 }
241 
242 /**
243  * This class is typically only instantiated by Content Studio.
244  * @class
245  * Identifies a drop, and provides control for current drop object.
246  * Instances of this class are passed as arguments to the
247  * <code>drop</code> events from <code>content-studio</code>.
248  * It allows extensions to identify the current drop, and get the
249  * drop as <code>String<code> data type.
250  */
251 function DropControl() {
252   /**
253    * Checks whether or this DropControl supports a specified <code>mimeType</code>.
254    * 
255    * @param {string} mimeType The MIME type to check for.
256    * @return {boolean} <code>true</code> if the specified <code>mimeType</code> is supported
257    *  by this DropControl, <code>false</code> otherwise.
258    */
259   this.supports = function(mimeType) {
260   };
261 
262   /**
263    * Returns the dropped content for a specified <code>mimeType</code>. The
264    * content is returned as a <code>string</code>.
265    *
266    * @param {string} mimeType The MIME type of the content to be retrieved.
267    * @return The dropped content as a <code>string<code>.
268    * @throws ScriptException
269    *           if the specified <code>mimeType</code> is not supported or the
270    *           dropped content cannot be read.
271    */
272   this.getData = function(mimeType) {
273   };
274 
275 }
276 
277 
278   /**
279    * Instantiates a new XMLHttpRequest instance.
280    * @constructor
281    * @class A standard implementation of the XMLHttpRequest
282    * interface as defined by w3c.
283    * This class does not strive to be binary compatible with
284    * any specific browser implementation, so using a wrapper
285    * library might not work well.
286    * <p>
287    * Notable things about the XHR implementation inside
288    * Content Studio include:
289    * <ul>
290    * <li>The requests will use the same HTTP proxy as Content Studio
291    * itself.
292    * <li>Any requests to the web service using the same base URI,
293    * host name and port are pre-authenticated as the user logged in
294    * to Content Studio.  No need to provide credentials in order to
295    * perform operations on behalf of the user
296    * <li>The base URI for relative URIs is the root of the web
297    * service itself, i.e. <code>/webservice/</code>.  This means that
298    * well known starting points in the web service can be accessed
299    * using relative URIs, if needed.
300    * <li>XML responses are decoded and made availabe as E4X elements
301    * <li>JSON responses are decoded and made available as JavaScript objects.
302    * </ul>
303    */
304   function XMLHttpRequest() {
305 
306     /**
307      * Sets a request header.
308      */
309     this.setRequestHeader = function( name, value ) {
310     };
311 
312 
313     /**
314      * Prepares the XHR to connect to a specific server.
315      */
316     this.open = function( Method, URL, Asynchronous, UserName, Password ) {
317     };
318 
319     /**
320      * An event listener which is invoked every time the readyState changes.
321      */
322     this.onreadystatechange = function() {};
323 
324   }
325 
326