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#HTMLLabelElement} class.</p>
028  * <p>This class represents a label for a form control that does not have an implicit label 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * tag <tt>&lt;label&gt;</tt>.</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 JsHTMLLabelElement extends JsClient.HTMLLabelElement.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.HTMLLabelElement.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 JsHTMLLabelElement#form
059          * @see JsHTMLLabelElement.Member#form
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid form      = id("form"     );
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 JsHTMLLabelElement#accessKey
068          * @see JsHTMLLabelElement.Member#accessKey
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid accessKey = id("accessKey");
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 JsHTMLLabelElement#htmlFor
077          * @see JsHTMLLabelElement.Member#htmlFor
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid htmlFor   = id("htmlFor"  );
081     }
082     /**
083      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
084      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
085      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
086      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
087      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
088      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
089      * either circumstance, the field names must be exactly same as the member names, as 
090      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
091      * based on the field names.</p>
092      *
093      * @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>
094      * 
095      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
096      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
097      * of class objects.
098      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
099      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
100      * <pre>q.m</pre>
101      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
102      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
103      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
104      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
105      * <pre>m</pre>
106      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
107      * error on the access to <b>opaque</b> fields declared by this class under any other 
108      * circumstances.
109      */
110     public static class Member extends JsClient.HTMLLabelElement.Prototype.Member
111     {
112         /**
113          * <p>Internally constructs a member based on a qualifying member.</p>
114          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
115          * or <b>internal</b> classes or class members.</p>
116          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
117          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
118          * declared in the declaring class of this constructor itself or its subclasses. 
119          * Under this circumstance, the field names must be exactly same as the member 
120          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
121          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
122          * to their names appending to the name resolved from the specified qualifying 
123          * member with a dot in between.</p>
124          * @param q A qualifying member
125          * @param mid The ID of the member to construct
126          * @since 1.0
127          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
128          */
129         public Member(JsObject.Member q, Mid mid) {
130             super(q, mid);
131         }
132         /**
133          * <p>Internally constructs a member without a qualifying member.</p>
134          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
135          * or <b>internal</b> classes or class members.</p>
136          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
137          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
138          * declared in <b>opaque</b> types other than the declaring class of this constructor 
139          * itself and its subclasses. Under this circumstance, the field names must be
140          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
141          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
142          * @param mid The ID of the member to construct
143          * @since 1.0
144          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
145          */
146         public Member(Mid mid) {
147             super(mid);
148         }
149         @Override
150         /**
151          * <p>Evaluates the property, represented by the current member instance, of the
152          * argument object.</p>
153          * @param o The argument object
154          * @return The value of the current member based on the object argument.
155          * @since 1.0
156          * @javascript Re-compilers must convert the instance invocation of this method into
157          * the JavaScript expression: 
158          * <pre>o.m</pre>
159          * where <tt>m</tt> is the identifier name resolved from the current member
160          * instance of the invocation.
161          */
162         public JsHTMLLabelElement with(ObjectLike o) {
163             return new JsHTMLLabelElement(super.with(o));
164         }
165 
166         /**
167          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
168          * name of this field, qualified by the current member instance of the field, and 
169          * to access the property of the name on an object.</p>
170          * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
171          * object is a read-only reference to the {@link JsHTMLFormElement} object 
172          * containing the control. It is <tt>null</tt> if the control is not within the 
173          * context of a form.</p>
174          * @since 1.0
175          * @javascript Re-compilers must resolve the member of this instance field to the
176          * identifier of the field name appending to the identifier resolved from its 
177          * qualifying member with a dot in between.
178          */
179         public final JsHTMLFormElement.Member form = new JsHTMLFormElement.Member(this, Members.form);
180         /**
181          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
182          * name of this field, qualified by the current member instance of the field, and 
183          * to access the property of the name on an object.</p>
184          * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
185          * object refers to a string specifying single character access key to the 
186          * element. An access key is a single character from the document character set. 
187          * Pressing an access key assigned to an element gives focus to the element. 
188          * The action that occurs when an element receives focus depends on the element.</p> 
189          * @since 1.0
190          * @javascript Re-compilers must resolve the member of this instance field to the
191          * identifier of the field name appending to the identifier resolved from its 
192          * qualifying member with a dot in between.
193          */
194         public final Value.String.Member accessKey = new Value.String.Member(this, Members.accessKey);
195         /**
196          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
197          * name of this field, qualified by the current member instance of the field, and 
198          * to access the property of the name on an object.</p>
199          * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
200          * object refers to a string that mirrors the <tt>for</tt> attribute for the 
201          * <tt>&lt;label&gt;</tt> tag and links the label with another form control by 
202          * <tt>id</tt> attribute.</p> 
203          * @since 1.0
204          * @javascript Re-compilers must resolve the member of this instance field to the
205          * identifier of the field name appending to the identifier resolved from its 
206          * qualifying member with a dot in between.
207          */
208         public final Value.String.Member htmlFor   = new Value.String.Member(this, Members.htmlFor  );
209     }
210 
211     /**
212      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
213      * with the wrapping constructor.</p>
214      * @param var The argument of an <b>opaque</b> object.
215      * @since 1.0
216      * @javascript Re-compilers must ignore the construction operation of this constructor,
217      * that is, replacing it with its only argument.
218      */
219     public JsHTMLLabelElement(JsObject var) {
220         super(var);
221     }
222 
223     /**
224      * <p>An <b>opaque</b> static field defining a member that is named by the field name
225      * without a qualifying member and to access the property of the name on an object.</p>
226      * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
227      * object is a read-only reference to the {@link JsHTMLFormElement} object 
228      * containing the control. It is <tt>null</tt> if the control is not within the 
229      * context of a form.</p>
230      * @since 1.0
231      * @javascript Re-compilers must resolve the member of this static field to the
232      * identifier of the field name.
233      */
234     public static final JsHTMLFormElement.Member form = new JsHTMLFormElement.Member(Members.form);
235     /**
236      * <p>An <b>opaque</b> static field defining a member that is named by the field name
237      * without a qualifying member and to access the property of the name on an object.</p>
238      * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
239      * object refers to a string specifying single character access key to the 
240      * element. An access key is a single character from the document character set. 
241      * Pressing an access key assigned to an element gives focus to the element. 
242      * The action that occurs when an element receives focus depends on the element.</p> 
243      * @since 1.0
244      * @javascript Re-compilers must resolve the member of this static field to the
245      * identifier of the field name.
246      */
247     public static final Value.String.Member accessKey = new Value.String.Member(Members.accessKey);
248     /**
249      * <p>An <b>opaque</b> static field defining a member that is named by the field name
250      * without a qualifying member and to access the property of the name on an object.</p>
251      * <p>The property, identified by this member, of a {@link JsHTMLLabelElement} 
252      * object refers to a string that mirrors the <tt>for</tt> attribute for the 
253      * <tt>&lt;label&gt;</tt> tag and links the label with another form control by 
254      * <tt>id</tt> attribute.</p> 
255      * @since 1.0
256      * @javascript Re-compilers must resolve the member of this static field to the
257      * identifier of the field name.
258      */
259     public static final Value.String.Member htmlFor   = new Value.String.Member(Members.htmlFor  );
260 
261     @Override
262     /**
263      * <p>Returns the primitive value associated with the current instance, if there is one.
264      * This invocation simply returns the instance itself for the current instance is an 
265      * object and there is no primitive value for it.</p>
266      * @return The current object itself.
267      * @since 1.0
268      * @javascript Re-compilers must convert the instance invocation of this method directly
269      * into a JavaScript invocation on its current object instance without changing the 
270      * method name, but expanding variable arguments, if any, into comma-separated values. 
271      */
272     public final JsHTMLLabelElement valueOf() {
273         return new JsHTMLLabelElement((JsObject)var().valueOf());
274     }
275 }