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 /**
103  * This class is typically only instantiated by Content Studio.
104  * @class
105  * Represents a <code>"list"</code> user interface created with
106  * {@link PanelControl}.
107  */
108 function MapListModel() {
109 
110   /**
111    * Gets a row of the list UI.
112    * @param {String} id The identifier of the row to get.
113    * @return {Object} A map representing the row.
114    */
115   this.get = function (id) {
116     return null;
117   };
118 
119   /**
120    * Adds a row to the list UI.
121    *
122    * @param {String} id The identifier of the row to add.
123    * @param {Object} object A map representing the row to add. You must use the map keys
124    * that were defined when the user interface model was created
125    * with the {@link PanelControl#show()} object. For example:
126    * 
127    * <pre>
128    *   object = {
129    *     "from": "someone",
130    *     "when": "Today",
131    *     "summary" : "This is a great story"
132    *   }
133    * </pre>
134    * @param {int} [index=size of the list] The position at which the row is to be inserted.
135    */
136   this.add = function (id, object, index) {
137   };
138 
139   /**
140    * Removes a row from the list UI.
141    *
142    * @param {String} id The identifier of the row to remove.
143    */
144   this.remove = function (id) {
145   };
146 
147   /**
148    * Removes all the rows from the list UI.
149    */
150   this.clear = function () {
151   };
152 }
153 
154 /**
155  * This class is typically only instantiated by Content Studio.
156  * @class
157  * Represents a <code>"browser"</code> user interface created with 
158  * {@link PanelControl}.
159  */
160 function BrowserModel() {
161 
162   /**
163    * The URI of an HTML page to display in the browser user interface.
164    * @type String
165    */
166   this.uri = "";
167 
168   /**
169    * Some HTML content to display in the browser user interface.
170    * @type String
171    */
172   this.content = "";
173 }
174 
175 /**
176  * This class is typically only instantiated by Content Studio.
177  * @class
178  * An executor for executing Javascript scripts in <code>"browser"</code> user interfaces
179  * created by {@link PanelControl}.
180  */
181 function ScriptExecutor() {
182 
183   /**
184    * Executes a script in the swing event dispatch thread. This function does
185    * not wait for the script to finish executing and returns immediately.
186    *
187    * @param {String} script The script to execute.
188    */
189   this.executeScript = function (script) {
190   };
191 
192   /**
193    * Executes a script in the swing event dispatch thread and returns the
194    * result of the script. This function waits for the script to finish
195    * executing.
196    *
197    * @param {String} script The script to execute.
198    * @return {Object} The result of the script.
199    */
200   this.executeScriptWithResult = function (script) {
201     return null;
202   };
203 }
204 
205 /**
206  * This class is typically only instantiated by Content Studio.
207  * @class
208  * Identifies a drop, and provides control for current drop object.
209  * Instances of this class are passed as arguments to the
210  * <code>drop</code> events from <code>content-studio</code>.
211  * It allows extensions to identify the current drop, and get the
212  * drop as <code>String<code> data type.
213  */
214 function DropControl() {
215   /**
216    * Checks whether or this DropControl supports a specified <code>mimeType</code>.
217    * 
218    * @param {string} mimeType The MIME type to check for.
219    * @return <code>true</code> if the specified <code>mimeType</code> is supported
220    *  by this DropControl, <code>false</code> otherwise.
221    */
222   this.supports = function(mimeType) {
223   }
224 
225   /**
226    * Returns the dropped content for a specified <code>mimeType</code>. The
227    * content is returned as a <code>string</code>.
228    *
229    * @param {string} mimeType The MIME type of the content to be retrieved.
230    * @return The dropped content as a <code>string<code>.
231    * @throws ScriptException
232    *           if the specified <code>mimeType</code> is not supported or the
233    *           dropped content cannot be read.
234    */
235   this.getData = function(mimeType) {
236   }
237 
238 }
239 
240 
241   /**
242    * Instantiates a new XMLHttpRequest instance.
243    * @constructor
244    * @class A standard implementation of the XMLHttpRequest
245    * interface as defined by w3c.
246    * This class does not strive to be binary compatible with
247    * any specific browser implementation, so using a wrapper
248    * library might not work well.
249    * <p>
250    * Notable things about the XHR implementation inside
251    * Content Studio include:
252    * <ul>
253    * <li>The requests will use the same HTTP proxy as Content Studio
254    * itself.
255    * <li>Any requests to the web service using the same base URI,
256    * host name and port are pre-authenticated as the user logged in
257    * to Content Studio.  No need to provide credentials in order to
258    * perform operations on behalf of the user
259    * <li>The base URI for relative URIs is the root of the web
260    * service itself, i.e. <code>/webservice/</code>.  This means that
261    * well known starting points in the web service can be accessed
262    * using relative URIs, if needed.
263    * <li>XML responses are decoded and made availabe as E4X elements
264    * <li>JSON responses are decoded and made available as JavaScript objects.
265    * </ul>
266    */
267   function XMLHttpRequest() {
268 
269     /**
270      * Sets a request header.
271      */
272     this.setRequestHeader = function( name, value ) {
273     }
274 
275 
276     /**
277      * Prepares the XHR to connect to a specific server.
278      */
279     this.open = function( Method, URL, Asynchronous, UserName, Password ) {
280     }
281 
282     /**
283      * An event listener which is invoked every time the readyState changes.
284      */
285     this.onreadystatechange = function() {}
286 
287   }
288 
289