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#HTMLParamElement} class.</p>
028  * <p>This class represents a parameter fed to the {@link JsHTMLObjectElement} element 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;param&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 JsHTMLParamElement extends JsClient.HTMLParamElement.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.HTMLParamElement.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 JsHTMLParamElement#name
059          * @see JsHTMLParamElement.Member#name
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid name      = id("name"     );
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 JsHTMLParamElement#type
068          * @see JsHTMLParamElement.Member#type
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid type      = id("type"     );
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 JsHTMLParamElement#value
077          * @see JsHTMLParamElement.Member#value
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid value     = id("value"    );
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 JsHTMLParamElement#valueType
086          * @see JsHTMLParamElement.Member#valueType
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid valueType = id("valueType");
090     }
091     /**
092      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
093      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
094      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
095      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
096      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
097      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
098      * either circumstance, the field names must be exactly same as the member names, as 
099      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
100      * based on the field names.</p>
101      *
102      * @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>
103      * 
104      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
105      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
106      * of class objects.
107      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
108      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
109      * <pre>q.m</pre>
110      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
111      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
112      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
113      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
114      * <pre>m</pre>
115      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
116      * error on the access to <b>opaque</b> fields declared by this class under any other 
117      * circumstances.
118      */
119     public static class Member extends JsClient.HTMLParamElement.Prototype.Member
120     {
121         /**
122          * <p>Internally constructs a member based on a qualifying member.</p>
123          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
124          * or <b>internal</b> classes or class members.</p>
125          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
126          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
127          * declared in the declaring class of this constructor itself or its subclasses. 
128          * Under this circumstance, the field names must be exactly same as the member 
129          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
130          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
131          * to their names appending to the name resolved from the specified qualifying 
132          * member with a dot in between.</p>
133          * @param q A qualifying member
134          * @param mid The ID of the member to construct
135          * @since 1.0
136          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
137          */
138         public Member(JsObject.Member q, Mid mid) {
139             super(q, mid);
140         }
141         /**
142          * <p>Internally constructs a member without a qualifying member.</p>
143          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
144          * or <b>internal</b> classes or class members.</p>
145          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
146          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
147          * declared in <b>opaque</b> types other than the declaring class of this constructor 
148          * itself and its subclasses. Under this circumstance, the field names must be
149          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
150          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
151          * @param mid The ID of the member to construct
152          * @since 1.0
153          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
154          */
155         public Member(Mid mid) {
156             super(mid);
157         }
158         @Override
159         /**
160          * <p>Evaluates the property, represented by the current member instance, of the
161          * argument object.</p>
162          * @param o The argument object
163          * @return The value of the current member based on the object argument.
164          * @since 1.0
165          * @javascript Re-compilers must convert the instance invocation of this method into
166          * the JavaScript expression: 
167          * <pre>o.m</pre>
168          * where <tt>m</tt> is the identifier name resolved from the current member
169          * instance of the invocation.
170          */
171         public JsHTMLParamElement with(ObjectLike o) {
172             return new JsHTMLParamElement(super.with(o));
173         }
174 
175         /**
176          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
177          * name of this field, qualified by the current member instance of the field, and 
178          * to access the property of the name on an object.</p>
179          * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
180          * object refers to a string specifying the name of the run-time parameter, 
181          * assumed to be known by the inserted object. Whether the property name is 
182          * case-sensitive depends on the specific object implementation.</p> 
183          * @since 1.0
184          * @javascript Re-compilers must resolve the member of this instance field to the
185          * identifier of the field name appending to the identifier resolved from its 
186          * qualifying member with a dot in between.
187          */
188         public final Value.String.Member name      = new Value.String.Member(this, Members.name     );
189         /**
190          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
191          * name of this field, qualified by the current member instance of the field, and 
192          * to access the property of the name on an object.</p>
193          * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
194          * object refers to a string specifying the content type of the resource designated 
195          * by the {@link #value} attribute only in the case where {@link #valueType} is 
196          * set to "ref". This attribute thus specifies for the browser, the type of 
197          * values that will be found at the URI designated by {@link #value}.</p> 
198          * @since 1.0
199          * @javascript Re-compilers must resolve the member of this instance field to the
200          * identifier of the field name appending to the identifier resolved from its 
201          * qualifying member with a dot in between.
202          */
203         public final Value.String.Member type      = new Value.String.Member(this, Members.type     );
204         /**
205          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
206          * name of this field, qualified by the current member instance of the field, and 
207          * to access the property of the name on an object.</p>
208          * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
209          * object refers to a string specifying the value of the run-time parameter 
210          * specified by {@link #name}. Property values have no meaning to HTML; their 
211          * meaning is determined by the object in question.</p> 
212          * @since 1.0
213          * @javascript Re-compilers must resolve the member of this instance field to the
214          * identifier of the field name appending to the identifier resolved from its 
215          * qualifying member with a dot in between.
216          */
217         public final Value.String.Member value     = new Value.String.Member(this, Members.value    );
218         /**
219          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
220          * name of this field, qualified by the current member instance of the field, and 
221          * to access the property of the name on an object.</p>
222          * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
223          * object refers to a string specifying the type information about the meaning of 
224          * the {@link #value} attribute value. Possible values are: 
225          * <ul>
226          * <li><tt>"data"</tt>: This is default value for the attribute. It means that 
227          * the value specified by {@link #value} will be evaluated and passed to the 
228          * object's implementation as a string.</li>
229          * <li><tt>"ref"</tt>: The value specified by {@link #value} is a URI that 
230          * designates a resource where run-time values are stored. This allows support 
231          * tools to identify URIs given as parameters. The URI must be passed to the 
232          * object AS IS, that is, unresolved.</li>
233          * <li><tt>"object"</tt>: The value specified by {@link #value} is an identifier 
234          * that refers to an <tt>&lt;object&gt;</tt> declaration in the same document. 
235          * The identifier must be the value of the <tt>id</tt> attribute set for the 
236          * declared <tt>&lt;object&gt;</tt> element.</li>
237          * </ul></p>
238          * @since 1.0
239          * @javascript Re-compilers must resolve the member of this instance field to the
240          * identifier of the field name appending to the identifier resolved from its 
241          * qualifying member with a dot in between.
242          */
243         public final Value.String.Member valueType = new Value.String.Member(this, Members.valueType);
244     }
245 
246     /**
247      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
248      * with the wrapping constructor.</p>
249      * @param var The argument of an <b>opaque</b> object.
250      * @since 1.0
251      * @javascript Re-compilers must ignore the construction operation of this constructor,
252      * that is, replacing it with its only argument.
253      */
254     public JsHTMLParamElement(JsObject var) {
255         super(var);
256     }
257 
258     /**
259      * <p>An <b>opaque</b> static field defining a member that is named by the field name
260      * without a qualifying member and to access the property of the name on an object.</p>
261      * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
262      * object refers to a string specifying the name of the run-time parameter, 
263      * assumed to be known by the inserted object. Whether the property name is 
264      * case-sensitive depends on the specific object implementation.</p> 
265      * @since 1.0
266      * @javascript Re-compilers must resolve the member of this static field to the
267      * identifier of the field name.
268      */
269     public static final Value.String.Member name      = new Value.String.Member(Members.name     );
270     /**
271      * <p>An <b>opaque</b> static field defining a member that is named by the field name
272      * without a qualifying member and to access the property of the name on an object.</p>
273      * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
274      * object refers to a string specifying the content type of the resource designated 
275      * by the {@link #value} attribute only in the case where {@link #valueType} is 
276      * set to "ref". This attribute thus specifies for the browser, the type of 
277      * values that will be found at the URI designated by {@link #value}.</p> 
278      * @since 1.0
279      * @javascript Re-compilers must resolve the member of this static field to the
280      * identifier of the field name.
281      */
282     public static final Value.String.Member type      = new Value.String.Member(Members.type     );
283     /**
284      * <p>An <b>opaque</b> static field defining a member that is named by the field name
285      * without a qualifying member and to access the property of the name on an object.</p>
286      * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
287      * object refers to a string specifying the value of the run-time parameter 
288      * specified by {@link #name}. Property values have no meaning to HTML; their 
289      * meaning is determined by the object in question.</p> 
290      * @since 1.0
291      * @javascript Re-compilers must resolve the member of this static field to the
292      * identifier of the field name.
293      */
294     public static final Value.String.Member value     = new Value.String.Member(Members.value    );
295     /**
296      * <p>An <b>opaque</b> static field defining a member that is named by the field name
297      * without a qualifying member and to access the property of the name on an object.</p>
298      * <p>The property, identified by this member, of a {@link JsHTMLParagraphElement} 
299      * object refers to a string specifying the type information about the meaning of 
300      * the {@link #value} attribute value. Possible values are: 
301      * <ul>
302      * <li><tt>"data"</tt>: This is default value for the attribute. It means that 
303      * the value specified by {@link #value} will be evaluated and passed to the 
304      * object's implementation as a string.</li>
305      * <li><tt>"ref"</tt>: The value specified by {@link #value} is a URI that 
306      * designates a resource where run-time values are stored. This allows support 
307      * tools to identify URIs given as parameters. The URI must be passed to the 
308      * object AS IS, that is, unresolved.</li>
309      * <li><tt>"object"</tt>: The value specified by {@link #value} is an identifier 
310      * that refers to an <tt>&lt;object&gt;</tt> declaration in the same document. 
311      * The identifier must be the value of the <tt>id</tt> attribute set for the 
312      * declared <tt>&lt;object&gt;</tt> element.</li>
313      * </ul></p>
314      * @since 1.0
315      * @javascript Re-compilers must resolve the member of this static field to the
316      * identifier of the field name.
317      */
318     public static final Value.String.Member valueType = new Value.String.Member(Members.valueType);
319 
320     @Override
321     /**
322      * <p>Returns the primitive value associated with the current instance, if there is one.
323      * This invocation simply returns the instance itself for the current instance is an 
324      * object and there is no primitive value for it.</p>
325      * @return The current object itself.
326      * @since 1.0
327      * @javascript Re-compilers must convert the instance invocation of this method directly
328      * into a JavaScript invocation on its current object instance without changing the 
329      * method name, but expanding variable arguments, if any, into comma-separated values. 
330      */
331     public final JsHTMLParamElement valueOf() {
332         return new JsHTMLParamElement((JsObject)var().valueOf());
333     }
334 }