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