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#HTMLBodyElement} class.</p>
028  * <p>This class represents the HTML document body 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;body&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 JsHTMLBodyElement extends JsClient.HTMLBodyElement.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.HTMLBodyElement.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 JsHTMLBodyElement#aLink
059          * @see JsHTMLBodyElement.Member#aLink
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid aLink      = id("aLink"     );
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 JsHTMLBodyElement#background
068          * @see JsHTMLBodyElement.Member#background
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid background = id("background");
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 JsHTMLBodyElement#bgColor
077          * @see JsHTMLBodyElement.Member#bgColor
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid bgColor    = id("bgColor"   );
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 JsHTMLBodyElement#link
086          * @see JsHTMLBodyElement.Member#link
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid link       = id("link"      );
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 JsHTMLBodyElement#text
095          * @see JsHTMLBodyElement.Member#text
096          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
097          */
098         public final static Mid text       = id("text"      );
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 JsHTMLBodyElement#vLink
104          * @see JsHTMLBodyElement.Member#vLink
105          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
106          */
107         public final static Mid vLink      = id("vLink"     );
108     }
109     /**
110      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
111      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
112      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
113      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
114      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
115      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
116      * either circumstance, the field names must be exactly same as the member names, as 
117      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
118      * based on the field names.</p>
119      *
120      * @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>
121      * 
122      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
123      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
124      * of class objects.
125      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
126      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
127      * <pre>q.m</pre>
128      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
129      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
130      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
131      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
132      * <pre>m</pre>
133      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
134      * error on the access to <b>opaque</b> fields declared by this class under any other 
135      * circumstances.
136      */
137     public static class Member extends JsClient.HTMLBodyElement.Prototype.Member
138     {
139         /**
140          * <p>Internally constructs a member based on a qualifying member.</p>
141          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
142          * or <b>internal</b> classes or class members.</p>
143          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
144          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
145          * declared in the declaring class of this constructor itself or its subclasses. 
146          * Under this circumstance, the field names must be exactly same as the member 
147          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
148          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
149          * to their names appending to the name resolved from the specified qualifying 
150          * member with a dot in between.</p>
151          * @param q A qualifying member
152          * @param mid The ID of the member to construct
153          * @since 1.0
154          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
155          */
156         public Member(JsObject.Member q, Mid mid) {
157             super(q, mid);
158         }
159         /**
160          * <p>Internally constructs a member without a qualifying member.</p>
161          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
162          * or <b>internal</b> classes or class members.</p>
163          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
164          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
165          * declared in <b>opaque</b> types other than the declaring class of this constructor 
166          * itself and its subclasses. Under this circumstance, the field names must be
167          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
168          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
169          * @param mid The ID of the member to construct
170          * @since 1.0
171          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
172          */
173         public Member(Mid mid) {
174             super(mid);
175         }
176         @Override
177         /**
178          * <p>Evaluates the property, represented by the current member instance, of the
179          * argument object.</p>
180          * @param o The argument object
181          * @return The value of the current member based on the object argument.
182          * @since 1.0
183          * @javascript Re-compilers must convert the instance invocation of this method into
184          * the JavaScript expression: 
185          * <pre>o.m</pre>
186          * where <tt>m</tt> is the identifier name resolved from the current member
187          * instance of the invocation.
188          */
189         public JsHTMLBodyElement with(ObjectLike o) {
190             return new JsHTMLBodyElement(super.with(o));
191         }
192 
193         /**
194          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
195          * name of this field, qualified by the current member instance of the field, and 
196          * to access the property of the name on an object.</p>
197          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
198          * object refers to a string specifying the color of active links, after 
199          * mouse-button down, but before mouse-button up.</p>
200          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
201          * @since 1.0
202          * @javascript Re-compilers must resolve the member of this instance field to the
203          * identifier of the field name appending to the identifier resolved from its 
204          * qualifying member with a dot in between.
205          */
206         public final Value.String.Member aLink      = new Value.String.Member(this, Members.aLink     );
207         /**
208          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
209          * name of this field, qualified by the current member instance of the field, and 
210          * to access the property of the name on an object.</p>
211          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
212          * object refers to a string specifying a URI that designates an image resource. 
213          * The image generally tiles the background for visual browsers.</p>
214          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
215          * @since 1.0
216          * @javascript Re-compilers must resolve the member of this instance field to the
217          * identifier of the field name appending to the identifier resolved from its 
218          * qualifying member with a dot in between.
219          */
220         public final Value.String.Member background = new Value.String.Member(this, Members.background);
221         /**
222          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
223          * name of this field, qualified by the current member instance of the field, and 
224          * to access the property of the name on an object.</p>
225          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
226          * object refers to a string specifying the background color for the document 
227          * body.</p>
228          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
229          * @since 1.0
230          * @javascript Re-compilers must resolve the member of this instance field to the
231          * identifier of the field name appending to the identifier resolved from its 
232          * qualifying member with a dot in between.
233          */
234         public final Value.String.Member bgColor    = new Value.String.Member(this, Members.bgColor   );
235         /**
236          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
237          * name of this field, qualified by the current member instance of the field, and 
238          * to access the property of the name on an object.</p>
239          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
240          * object refers to a string specifying the color of text marking unvisited 
241          * hypertext links for visual browsers.</p>
242          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
243          * @since 1.0
244          * @javascript Re-compilers must resolve the member of this instance field to the
245          * identifier of the field name appending to the identifier resolved from its 
246          * qualifying member with a dot in between.
247          */
248         public final Value.String.Member link       = new Value.String.Member(this, Members.link      );
249         /**
250          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
251          * name of this field, qualified by the current member instance of the field, and 
252          * to access the property of the name on an object.</p>
253          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
254          * object refers to a string specifying the foreground color for text for 
255          * visual browsers.</p>
256          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
257          * @since 1.0
258          * @javascript Re-compilers must resolve the member of this instance field to the
259          * identifier of the field name appending to the identifier resolved from its 
260          * qualifying member with a dot in between.
261          */
262         public final Value.String.Member text       = new Value.String.Member(this, Members.text      );
263         /**
264          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
265          * name of this field, qualified by the current member instance of the field, and 
266          * to access the property of the name on an object.</p>
267          * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
268          * object refers to a string specifying the color of text marking visited 
269          * hypertext links for visual browsers.</p>
270          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
271          * @since 1.0
272          * @javascript Re-compilers must resolve the member of this instance field to the
273          * identifier of the field name appending to the identifier resolved from its 
274          * qualifying member with a dot in between.
275          */
276         public final Value.String.Member vLink      = new Value.String.Member(this, Members.vLink     );
277     }
278 
279     /**
280      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
281      * with the wrapping constructor.</p>
282      * @param var The argument of an <b>opaque</b> object.
283      * @since 1.0
284      * @javascript Re-compilers must ignore the construction operation of this constructor,
285      * that is, replacing it with its only argument.
286      */
287     public JsHTMLBodyElement(JsObject var) {
288         super(var);
289     }
290 
291     /**
292      * <p>An <b>opaque</b> static field defining a member that is named by the field name
293      * without a qualifying member and to access the property of the name on an object.</p>
294      * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
295      * object refers to a string specifying the color of active links, after 
296      * mouse-button down, but before mouse-button up.</p>
297      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
298      * @since 1.0
299      * @javascript Re-compilers must resolve the member of this static field to the
300      * identifier of the field name.
301      */
302     public static final Value.String.Member aLink      = new Value.String.Member(Members.aLink     );
303     /**
304      * <p>An <b>opaque</b> static field defining a member that is named by the field name
305      * without a qualifying member and to access the property of the name on an object.</p>
306      * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
307      * object refers to a string specifying a URI that designates an image resource. 
308      * The image generally tiles the background for visual browsers.</p>
309      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
310      * @since 1.0
311      * @javascript Re-compilers must resolve the member of this static field to the
312      * identifier of the field name.
313      */
314     public static final Value.String.Member background = new Value.String.Member(Members.background);
315     /**
316      * <p>An <b>opaque</b> static field defining a member that is named by the field name
317      * without a qualifying member and to access the property of the name on an object.</p>
318      * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
319      * object refers to a string specifying the background color for the document 
320      * body.</p>
321      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
322      * @since 1.0
323      * @javascript Re-compilers must resolve the member of this static field to the
324      * identifier of the field name.
325      */
326     public static final Value.String.Member bgColor    = new Value.String.Member(Members.bgColor   );
327     /**
328      * <p>An <b>opaque</b> static field defining a member that is named by the field name
329      * without a qualifying member and to access the property of the name on an object.</p>
330      * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
331      * object refers to a string specifying the color of text marking unvisited 
332      * hypertext links for visual browsers.</p>
333      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
334      * @since 1.0
335      * @javascript Re-compilers must resolve the member of this static field to the
336      * identifier of the field name.
337      */
338     public static final Value.String.Member link       = new Value.String.Member(Members.link      );
339     /**
340      * <p>An <b>opaque</b> static field defining a member that is named by the field name
341      * without a qualifying member and to access the property of the name on an object.</p>
342      * <p>The property, identified by this member, of a {@link JsHTMLBodyElement} 
343      * object refers to a string specifying the foreground color for text for 
344      * visual browsers.</p>
345      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
346      * @since 1.0
347      * @javascript Re-compilers must resolve the member of this static field to the
348      * identifier of the field name.
349      */
350     public static final Value.String.Member text       = new Value.String.Member(Members.text      );
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 JsHTMLBodyElement} 
355      * object refers to a string specifying the color of text marking visited 
356      * hypertext links for visual browsers.</p>
357      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
358      * @since 1.0
359      * @javascript Re-compilers must resolve the member of this static field to the
360      * identifier of the field name.
361      */
362     public static final Value.String.Member vLink      = new Value.String.Member(Members.vLink     );
363 
364     @Override
365     /**
366      * <p>Returns the primitive value associated with the current instance, if there is one.
367      * This invocation simply returns the instance itself for the current instance is an 
368      * object and there is no primitive value for it.</p>
369      * @return The current object itself.
370      * @since 1.0
371      * @javascript Re-compilers must convert the instance invocation of this method directly
372      * into a JavaScript invocation on its current object instance without changing the 
373      * method name, but expanding variable arguments, if any, into comma-separated values. 
374      */
375     public final JsHTMLBodyElement valueOf() {
376         return new JsHTMLBodyElement((JsObject)var().valueOf());
377     }
378 }