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#HTMLOptGroupElement} class.</p>
028  * <p>This class represents an option group 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;optgroup&gt;</tt> tag which allows HTML authors to group choices logically.</p> 
031  * <p>The HTML <tt>&lt;optgroup&gt;</tt> tag is particularly helpful when the user must 
032  * choose from a long list of options; groups of related choices are easier to grasp and 
033  * remember than a single long list of options. In HTML 4, all OPTGROUP elements must be 
034  * specified directly within a SELECT element, that is, groups may not be nested.</p> 
035  *
036  * @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>
037  * @see JsHTMLOptionElement
038  * @see JsHTMLSelectElement
039  *
040  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
041  * generated into the target codes. Re-compilers must exit with error on the operations of
042  * accessing that kind of class objects.
043  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
044  * and <tt>instanceof</tt> to it always <tt>true</tt>.
045  */
046 public class JsHTMLOptGroupElement extends JsClient.HTMLOptGroupElement.Prototype
047 {
048     /**
049      * <p>An <b>internal</b> class containing membership data for its enclosing
050      * opaque class.</p>
051      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
052      * class members.</p>
053      *
054      * @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>
055      * 
056      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
057      */
058     protected static abstract class Members extends JsClient.HTMLOptGroupElement.Prototype.Members
059     {
060         /**
061          * <p>An <b>internal</b> static field defining a member ID of the field name and
062          * used internally to define a member of the same name.</p>
063          * @since 1.0
064          * @see JsHTMLOptGroupElement#disabled
065          * @see JsHTMLOptGroupElement.Member#disabled
066          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
067          */
068         public final static Mid disabled = id("disabled");
069         /**
070          * <p>An <b>internal</b> static field defining a member ID of the field name and
071          * used internally to define a member of the same name.</p>
072          * @since 1.0
073          * @see JsHTMLOptGroupElement#label
074          * @see JsHTMLOptGroupElement.Member#label
075          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
076          */
077         public final static Mid label    = id("label"   );
078     }
079     /**
080      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
081      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
082      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
083      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
084      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
085      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
086      * either circumstance, the field names must be exactly same as the member names, as 
087      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
088      * based on the field names.</p>
089      *
090      * @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>
091      * 
092      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
093      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
094      * of class objects.
095      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
096      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
097      * <pre>q.m</pre>
098      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
099      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
100      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
101      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
102      * <pre>m</pre>
103      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
104      * error on the access to <b>opaque</b> fields declared by this class under any other 
105      * circumstances.
106      */
107     public static class Member extends JsClient.HTMLOptGroupElement.Prototype.Member
108     {
109         /**
110          * <p>Internally constructs a member based on a qualifying member.</p>
111          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
112          * or <b>internal</b> classes or class members.</p>
113          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
114          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
115          * declared in the declaring class of this constructor itself or its subclasses. 
116          * Under this circumstance, the field names must be exactly same as the member 
117          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
118          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
119          * to their names appending to the name resolved from the specified qualifying 
120          * member with a dot in between.</p>
121          * @param q A qualifying member
122          * @param mid The ID of the member to construct
123          * @since 1.0
124          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
125          */
126         public Member(JsObject.Member q, Mid mid) {
127             super(q, mid);
128         }
129         /**
130          * <p>Internally constructs a member without a qualifying member.</p>
131          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
132          * or <b>internal</b> classes or class members.</p>
133          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
134          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
135          * declared in <b>opaque</b> types other than the declaring class of this constructor 
136          * itself and its subclasses. Under this circumstance, the field names must be
137          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
138          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
139          * @param mid The ID of the member to construct
140          * @since 1.0
141          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
142          */
143         public Member(Mid mid) {
144             super(mid);
145         }
146         @Override
147         /**
148          * <p>Evaluates the property, represented by the current member instance, of the
149          * argument object.</p>
150          * @param o The argument object
151          * @return The value of the current member based on the object argument.
152          * @since 1.0
153          * @javascript Re-compilers must convert the instance invocation of this method into
154          * the JavaScript expression: 
155          * <pre>o.m</pre>
156          * where <tt>m</tt> is the identifier name resolved from the current member
157          * instance of the invocation.
158          */
159         public JsHTMLOptGroupElement with(ObjectLike o) {
160             return new JsHTMLOptGroupElement(super.with(o));
161         }
162 
163         /**
164          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
165          * name of this field, qualified by the current member instance of the field, and 
166          * to access the property of the name on an object.</p>
167          * <p>The property, identified by this member, of a {@link JsHTMLOptGroupElement} 
168          * object refers to a boolean value that specifies whether the element is 
169          * disabled and is unavailable for user input.</p> 
170          * @since 1.0
171          * @javascript Re-compilers must resolve the member of this instance field to the
172          * identifier of the field name appending to the identifier resolved from its 
173          * qualifying member with a dot in between.
174          */
175         public final Value.Boolean.Member disabled = new Value.Boolean.Member(this, Members.disabled);
176         /**
177          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
178          * name of this field, qualified by the current member instance of the field, and 
179          * to access the property of the name on an object.</p>
180          * <p>The property, identified by this member, of a {@link JsHTMLOptGroupElement} 
181          * object refers to a string value that assigns a label to the option group.</p> 
182          * @since 1.0
183          * @javascript Re-compilers must resolve the member of this instance field to the
184          * identifier of the field name appending to the identifier resolved from its 
185          * qualifying member with a dot in between.
186          */
187         public final Value.String.Member label = new Value.String.Member(this, Members.label);
188     }
189 
190     /**
191      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
192      * with the wrapping constructor.</p>
193      * @param var The argument of an <b>opaque</b> object.
194      * @since 1.0
195      * @javascript Re-compilers must ignore the construction operation of this constructor,
196      * that is, replacing it with its only argument.
197      */
198     public JsHTMLOptGroupElement(JsObject var) {
199         super(var);
200     }
201 
202     /**
203      * <p>An <b>opaque</b> static field defining a member that is named by the field name
204      * without a qualifying member and to access the property of the name on an object.</p>
205      * <p>The property, identified by this member, of a {@link JsHTMLOptGroupElement} 
206      * object refers to a boolean value that specifies whether the element is 
207      * disabled and is unavailable for user input.</p> 
208      * @since 1.0
209      * @javascript Re-compilers must resolve the member of this static field to the
210      * identifier of the field name.
211      */
212     public static final Value.Boolean.Member disabled = new Value.Boolean.Member(Members.disabled);
213     /**
214      * <p>An <b>opaque</b> static field defining a member that is named by the field name
215      * without a qualifying member and to access the property of the name on an object.</p>
216      * <p>The property, identified by this member, of a {@link JsHTMLOptGroupElement} 
217      * object refers to a string value that assigns a label to the option group.</p> 
218      * @since 1.0
219      * @javascript Re-compilers must resolve the member of this static field to the
220      * identifier of the field name.
221      */
222     public static final Value.String.Member label = new Value.String.Member(Members.label);
223 
224     @Override
225     /**
226      * <p>Returns the primitive value associated with the current instance, if there is one.
227      * This invocation simply returns the instance itself for the current instance is an 
228      * object and there is no primitive value for it.</p>
229      * @return The current object itself.
230      * @since 1.0
231      * @javascript Re-compilers must convert the instance invocation of this method directly
232      * into a JavaScript invocation on its current object instance without changing the 
233      * method name, but expanding variable arguments, if any, into comma-separated values. 
234      */
235     public final JsHTMLOptGroupElement valueOf() {
236         return new JsHTMLOptGroupElement((JsObject)var().valueOf());
237     }
238 }