001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.user;
021 
022 import js.*;
023 import js.core.*;
024 
025 /**
026  * <p>An <b>opaque</b> class representing JavaScript client-side objects of the global 
027  * {@link JsClient#HTMLAreaElement} class.</p>
028  * <p>This class represents an image map area 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;area&gt;</tt> tag.</p>
031  *
032  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
033  *
034  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
035  * generated into the target codes. Re-compilers must exit with error on the operations of
036  * accessing that kind of class objects.
037  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
038  * and <tt>instanceof</tt> to it always <tt>true</tt>.
039  */
040 public class JsHTMLAreaElement extends JsClient.HTMLAreaElement.Prototype
041 {
042     /**
043      * <p>An <b>internal</b> class containing membership data for its enclosing
044      * opaque class.</p>
045      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
046      * class members.</p>
047      *
048      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
049      * 
050      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
051      */
052     protected static abstract class Members extends JsClient.HTMLAreaElement.Prototype.Members
053     {
054         /**
055          * <p>An <b>internal</b> static field defining a member ID of the field name and
056          * used internally to define a member of the same name.</p>
057          * @since 1.0
058          * @see JsHTMLAreaElement#accessKey
059          * @see JsHTMLAreaElement.Member#accessKey
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid accessKey = id("accessKey");
063         /**
064          * <p>An <b>internal</b> static field defining a member ID of the field name and
065          * used internally to define a member of the same name.</p>
066          * @since 1.0
067          * @see JsHTMLAreaElement#alt
068          * @see JsHTMLAreaElement.Member#alt
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid alt       = id("alt"      );
072         /**
073          * <p>An <b>internal</b> static field defining a member ID of the field name and
074          * used internally to define a member of the same name.</p>
075          * @since 1.0
076          * @see JsHTMLAreaElement#coords
077          * @see JsHTMLAreaElement.Member#coords
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid coords    = id("coords"   );
081         /**
082          * <p>An <b>internal</b> static field defining a member ID of the field name and
083          * used internally to define a member of the same name.</p>
084          * @since 1.0
085          * @see JsHTMLAreaElement#href
086          * @see JsHTMLAreaElement.Member#href
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid href      = id("href"     );
090         /**
091          * <p>An <b>internal</b> static field defining a member ID of the field name and
092          * used internally to define a member of the same name.</p>
093          * @since 1.0
094          * @see JsHTMLAreaElement#noHref
095          * @see JsHTMLAreaElement.Member#noHref
096          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
097          */
098         public final static Mid noHref    = id("noHref"   );
099         /**
100          * <p>An <b>internal</b> static field defining a member ID of the field name and
101          * used internally to define a member of the same name.</p>
102          * @since 1.0
103          * @see JsHTMLAreaElement#shape
104          * @see JsHTMLAreaElement.Member#shape
105          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
106          */
107         public final static Mid shape     = id("shape"    );
108         /**
109          * <p>An <b>internal</b> static field defining a member ID of the field name and
110          * used internally to define a member of the same name.</p>
111          * @since 1.0
112          * @see JsHTMLAreaElement#tabIndex
113          * @see JsHTMLAreaElement.Member#tabIndex
114          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
115          */
116         public final static Mid tabIndex  = id("tabIndex" );
117         /**
118          * <p>An <b>internal</b> static field defining a member ID of the field name and
119          * used internally to define a member of the same name.</p>
120          * @since 1.0
121          * @see JsHTMLAreaElement#target
122          * @see JsHTMLAreaElement.Member#target
123          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
124          */
125         public final static Mid target    = id("target"   );
126     }
127     /**
128      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
129      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
130      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
131      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
132      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
133      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
134      * either circumstance, the field names must be exactly same as the member names, as 
135      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
136      * based on the field names.</p>
137      *
138      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
139      * 
140      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
141      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
142      * of class objects.
143      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
144      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
145      * <pre>q.m</pre>
146      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
147      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
148      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
149      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
150      * <pre>m</pre>
151      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
152      * error on the access to <b>opaque</b> fields declared by this class under any other 
153      * circumstances.
154      */
155     public static class Member extends JsClient.HTMLAreaElement.Prototype.Member
156     {
157         /**
158          * <p>Internally constructs a member based on a qualifying member.</p>
159          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
160          * or <b>internal</b> classes or class members.</p>
161          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
162          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
163          * declared in the declaring class of this constructor itself or its subclasses. 
164          * Under this circumstance, the field names must be exactly same as the member 
165          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
166          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
167          * to their names appending to the name resolved from the specified qualifying 
168          * member with a dot in between.</p>
169          * @param q A qualifying member
170          * @param mid The ID of the member to construct
171          * @since 1.0
172          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
173          */
174         public Member(JsObject.Member q, Mid mid) {
175             super(q, mid);
176         }
177         /**
178          * <p>Internally constructs a member without a qualifying member.</p>
179          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
180          * or <b>internal</b> classes or class members.</p>
181          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
182          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
183          * declared in <b>opaque</b> types other than the declaring class of this constructor 
184          * itself and its subclasses. Under this circumstance, the field names must be
185          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
186          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
187          * @param mid The ID of the member to construct
188          * @since 1.0
189          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
190          */
191         public Member(Mid mid) {
192             super(mid);
193         }
194         @Override
195         /**
196          * <p>Evaluates the property, represented by the current member instance, of the
197          * argument object.</p>
198          * @param o The argument object
199          * @return The value of the current member based on the object argument.
200          * @since 1.0
201          * @javascript Re-compilers must convert the instance invocation of this method into
202          * the JavaScript expression: 
203          * <pre>o.m</pre>
204          * where <tt>m</tt> is the identifier name resolved from the current member
205          * instance of the invocation.
206          */
207         public JsHTMLAreaElement with(ObjectLike o) {
208             return new JsHTMLAreaElement(super.with(o));
209         }
210 
211         /**
212          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
213          * name of this field, qualified by the current member instance of the field, and 
214          * to access the property of the name on an object.</p>
215          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
216          * object refers to a string specifying single character access key to the 
217          * element. An access key is a single character from the document character set. 
218          * Pressing an access key assigned to an element gives focus to the element. 
219          * The action that occurs when an element receives focus depends on the element.</p> 
220          * @since 1.0
221          * @javascript Re-compilers must resolve the member of this instance field to the
222          * identifier of the field name appending to the identifier resolved from its 
223          * qualifying member with a dot in between.
224          */
225         public final Value.String.Member accessKey = new Value.String.Member(this, Members.accessKey);
226         /**
227          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
228          * name of this field, qualified by the current member instance of the field, and 
229          * to access the property of the name on an object.</p>
230          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
231          * object refers to a string specifying an alternate text for web browsers not 
232          * rendering the normal content of this element.</p>
233          * @since 1.0
234          * @javascript Re-compilers must resolve the member of this instance field to the
235          * identifier of the field name appending to the identifier resolved from its 
236          * qualifying member with a dot in between.
237          */
238         public final Value.String.Member alt       = new Value.String.Member(this, Members.alt      );
239         /**
240          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
241          * name of this field, qualified by the current member instance of the field, and 
242          * to access the property of the name on an object.</p>
243          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
244          * object refers to a comma-separated list of lengths, defining an active region 
245          * geometry. The lengths specify the position and shape on the screen. The number 
246          * and order of values depends on the {@link #shape} being defined. Possible 
247          * combinations are: 
248          * <ul>
249          * <li><tt>left-x, top-y, right-x, bottom-y</tt> when {@link #shape} is <tt>"rect"</tt>.</li>
250          * <li><tt>center-x, center-y, radius</tt> when {@link #shape} is <tt>"circle"</tt>. When the 
251          * radius value is a percentage value, web browsers should calculate the final 
252          * radius value based on the associated object's width and height. The radius 
253          * should be the smaller value of the two.</li>
254          * <li><tt>x1, y1, x2, y2, ..., xN, yN</tt> when {@link #shape} is <tt>"poly"</tt>. The first x 
255          * and y coordinate pair and the last should be the same to close the polygon. 
256          * When these coordinate values are not the same, web browsers should infer an 
257          * additional coordinate pair to close the polygon.</li>
258          * </ul></p> 
259          * @since 1.0
260          * @see #shape
261          * @javascript Re-compilers must resolve the member of this instance field to the
262          * identifier of the field name appending to the identifier resolved from its 
263          * qualifying member with a dot in between.
264          */
265         public final Value.String.Member coords    = new Value.String.Member(this, Members.coords   );
266         /**
267          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
268          * name of this field, qualified by the current member instance of the field, and 
269          * to access the property of the name on an object.</p>
270          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
271          * object refers to the absolute URI of the linked resource.</p> 
272          * @since 1.0
273          * @javascript Re-compilers must resolve the member of this instance field to the
274          * identifier of the field name appending to the identifier resolved from its 
275          * qualifying member with a dot in between.
276          */
277         public final Value.String.Member href      = new Value.String.Member(this, Members.href     );
278         /**
279          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
280          * name of this field, qualified by the current member instance of the field, and 
281          * to access the property of the name on an object.</p>
282          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
283          * object refers to a string naming the shape of the active area. The coordinates 
284          * are given by {@link #coords}. Possible values of the property are: 
285          * <ul>
286          * <li><tt>"default"</tt>: Specifies the entire region.</li>
287          * <li><tt>"rect"</tt>: Defines a rectangular region.</li>
288          * <li><tt>"circle"</tt>: Defines a circular region.</li>
289          * <li><tt>"poly"</tt>: Defines a polygonal region.</li>
290          * </ul></p>
291          * @since 1.0
292          * @see #coords
293          * @javascript Re-compilers must resolve the member of this instance field to the
294          * identifier of the field name appending to the identifier resolved from its 
295          * qualifying member with a dot in between.
296          */
297         public final Value.String.Member shape     = new Value.String.Member(this, Members.shape    );
298         /**
299          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
300          * name of this field, qualified by the current member instance of the field, and 
301          * to access the property of the name on an object.</p>
302          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
303          * object refers to an index number representing the element's position in the 
304          * tabbing order.</p>
305          * @since 1.0
306          * @javascript Re-compilers must resolve the member of this instance field to the
307          * identifier of the field name appending to the identifier resolved from its 
308          * qualifying member with a dot in between.
309          */
310         public final Value.Number.Member tabIndex  = new Value.Number.Member(this, Members.tabIndex );
311         /**
312          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
313          * name of this field, qualified by the current member instance of the field, and 
314          * to access the property of the name on an object.</p>
315          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
316          * object refers to string specifying the {@link JsHTMLFrameElement#name} of a 
317          * target frame to render the resource in.</p>
318          * @since 1.0
319          * @javascript Re-compilers must resolve the member of this instance field to the
320          * identifier of the field name appending to the identifier resolved from its 
321          * qualifying member with a dot in between.
322          */
323         public final Value.String.Member target    = new Value.String.Member(this, Members.target   );
324         /**
325          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
326          * name of this field, qualified by the current member instance of the field, and 
327          * to access the property of the name on an object.</p>
328          * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
329          * object refers to boolean value specifying whether this area is inactive, that is, 
330          * has no associated action.</p>
331          * @since 1.0
332          * @javascript Re-compilers must resolve the member of this instance field to the
333          * identifier of the field name appending to the identifier resolved from its 
334          * qualifying member with a dot in between.
335          */
336         public final Value.Boolean.Member noHref = new Value.Boolean.Member(this, Members.noHref);
337     }
338 
339     /**
340      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
341      * with the wrapping constructor.</p>
342      * @param var The argument of an <b>opaque</b> object.
343      * @since 1.0
344      * @javascript Re-compilers must ignore the construction operation of this constructor,
345      * that is, replacing it with its only argument.
346      */
347     public JsHTMLAreaElement(JsObject var) {
348         super(var);
349     }
350 
351     /**
352      * <p>An <b>opaque</b> static field defining a member that is named by the field name
353      * without a qualifying member and to access the property of the name on an object.</p>
354      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
355      * object refers to a string specifying single character access key to the 
356      * element. An access key is a single character from the document character set. 
357      * Pressing an access key assigned to an element gives focus to the element. 
358      * The action that occurs when an element receives focus depends on the element.</p> 
359      * @since 1.0
360      * @javascript Re-compilers must resolve the member of this static field to the
361      * identifier of the field name.
362      */
363     public static final Value.String.Member accessKey = new Value.String.Member(Members.accessKey);
364     /**
365      * <p>An <b>opaque</b> static field defining a member that is named by the field name
366      * without a qualifying member and to access the property of the name on an object.</p>
367      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
368      * object refers to a string specifying an alternate text for web browsers not 
369      * rendering the normal content of this element.</p>
370      * @since 1.0
371      * @javascript Re-compilers must resolve the member of this static field to the
372      * identifier of the field name.
373      */
374     public static final Value.String.Member alt       = new Value.String.Member(Members.alt      );
375     /**
376      * <p>An <b>opaque</b> static field defining a member that is named by the field name
377      * without a qualifying member and to access the property of the name on an object.</p>
378      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
379      * object refers to a comma-separated list of lengths, defining an active region 
380      * geometry. The lengths specify the position and shape on the screen. The number 
381      * and order of values depends on the {@link #shape} being defined. Possible 
382      * combinations are: 
383      * <ul>
384      * <li><tt>left-x, top-y, right-x, bottom-y</tt> when {@link #shape} is <tt>"rect"</tt>.</li>
385      * <li><tt>center-x, center-y, radius</tt> when {@link #shape} is <tt>"circle"</tt>. When the 
386      * radius value is a percentage value, web browsers should calculate the final 
387      * radius value based on the associated object's width and height. The radius 
388      * should be the smaller value of the two.</li>
389      * <li><tt>x1, y1, x2, y2, ..., xN, yN</tt> when {@link #shape} is <tt>"poly"</tt>. The first x 
390      * and y coordinate pair and the last should be the same to close the polygon. 
391      * When these coordinate values are not the same, web browsers should infer an 
392      * additional coordinate pair to close the polygon.</li>
393      * </ul></p> 
394      * @since 1.0
395      * @see #shape
396      * @javascript Re-compilers must resolve the member of this static field to the
397      * identifier of the field name.
398      */
399     public static final Value.String.Member coords    = new Value.String.Member(Members.coords   );
400     /**
401      * <p>An <b>opaque</b> static field defining a member that is named by the field name
402      * without a qualifying member and to access the property of the name on an object.</p>
403      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
404      * object refers to the absolute URI of the linked resource.</p> 
405      * @since 1.0
406      * @javascript Re-compilers must resolve the member of this static field to the
407      * identifier of the field name.
408      */
409     public static final Value.String.Member href      = new Value.String.Member(Members.href     );
410     /**
411      * <p>An <b>opaque</b> static field defining a member that is named by the field name
412      * without a qualifying member and to access the property of the name on an object.</p>
413      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
414      * object refers to a string naming the shape of the active area. The coordinates 
415      * are given by {@link #coords}. Possible values of the property are: 
416      * <ul>
417      * <li><tt>"default"</tt>: Specifies the entire region.</li>
418      * <li><tt>"rect"</tt>: Defines a rectangular region.</li>
419      * <li><tt>"circle"</tt>: Defines a circular region.</li>
420      * <li><tt>"poly"</tt>: Defines a polygonal region.</li>
421      * </ul></p>
422      * @since 1.0
423      * @see #coords
424      * @javascript Re-compilers must resolve the member of this static field to the
425      * identifier of the field name.
426      */
427     public static final Value.String.Member shape     = new Value.String.Member(Members.shape    );
428     /**
429      * <p>An <b>opaque</b> static field defining a member that is named by the field name
430      * without a qualifying member and to access the property of the name on an object.</p>
431      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
432      * object refers to an index number representing the element's position in the 
433      * tabbing order.</p>
434      * @since 1.0
435      * @javascript Re-compilers must resolve the member of this static field to the
436      * identifier of the field name.
437      */
438     public static final Value.Number.Member tabIndex  = new Value.Number.Member(Members.tabIndex );
439     /**
440      * <p>An <b>opaque</b> static field defining a member that is named by the field name
441      * without a qualifying member and to access the property of the name on an object.</p>
442      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
443      * object refers to string specifying the {@link JsHTMLFrameElement#name} of a 
444      * target frame to render the resource in.</p>
445      * @since 1.0
446      * @javascript Re-compilers must resolve the member of this static field to the
447      * identifier of the field name.
448      */
449     public static final Value.String.Member target    = new Value.String.Member(Members.target   );
450     /**
451      * <p>An <b>opaque</b> static field defining a member that is named by the field name
452      * without a qualifying member and to access the property of the name on an object.</p>
453      * <p>The property, identified by this member, of a {@link JsHTMLAreaElement} 
454      * object refers to boolean value specifying whether this area is inactive, that is, 
455      * has no associated action.</p>
456      * @since 1.0
457      * @javascript Re-compilers must resolve the member of this static field to the
458      * identifier of the field name.
459      */
460     public static final Value.Boolean.Member noHref = new Value.Boolean.Member(Members.noHref);
461 
462     @Override
463     /**
464      * <p>Returns the primitive value associated with the current instance, if there is one.
465      * This invocation simply returns the instance itself for the current instance is an 
466      * object and there is no primitive value for it.</p>
467      * @return The current object itself.
468      * @since 1.0
469      * @javascript Re-compilers must convert the instance invocation of this method directly
470      * into a JavaScript invocation on its current object instance without changing the 
471      * method name, but expanding variable arguments, if any, into comma-separated values. 
472      */
473     public final JsHTMLAreaElement valueOf() {
474         return new JsHTMLAreaElement((JsObject)var().valueOf());
475     }
476 }