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#HTMLMenuElement} class.</p>
028  * <p>This class represents a menu list 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;menu&gt;</tt> tag which is deprecated by HTML 4.01.</p>
031  * <p>The <tt>&lt;dir&gt;</tt> element was designed to be used for creating multi-column 
032  * directory lists. The <tt>&lt;menu&gt;</tt> element was designed to be used for single 
033  * column menu lists. Both elements have the same structure as <tt>&lt;ul&gt;</tt>, just 
034  * different rendering. In practice, a web browser will render a <tt>&lt;dir&gt;</tt> or 
035  * <tt>&lt;menu&gt;</tt> list exactly as a <tt>&lt;ul&gt;</tt> list. Using <tt>&lt;ul&gt;</tt> 
036  * instead is strongly recommended by HTML 4.01.</p>
037  *
038  * @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>
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 JsHTMLMenuElement extends JsClient.HTMLMenuElement.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.HTMLMenuElement.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 JsHTMLMenuElement#compact
065          * @see JsHTMLMenuElement.Member#compact
066          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
067          */
068         public final static Mid compact = id("compact");
069     }
070     /**
071      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
072      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
073      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
074      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
075      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
076      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
077      * either circumstance, the field names must be exactly same as the member names, as 
078      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
079      * based on the field names.</p>
080      *
081      * @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>
082      * 
083      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
084      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
085      * of class objects.
086      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
087      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
088      * <pre>q.m</pre>
089      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
090      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
091      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
092      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
093      * <pre>m</pre>
094      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
095      * error on the access to <b>opaque</b> fields declared by this class under any other 
096      * circumstances.
097      */
098     public static class Member extends JsClient.HTMLMenuElement.Prototype.Member
099     {
100         /**
101          * <p>Internally constructs a member based on a qualifying member.</p>
102          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
103          * or <b>internal</b> classes or class members.</p>
104          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
105          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
106          * declared in the declaring class of this constructor itself or its subclasses. 
107          * Under this circumstance, the field names must be exactly same as the member 
108          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
109          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
110          * to their names appending to the name resolved from the specified qualifying 
111          * member with a dot in between.</p>
112          * @param q A qualifying member
113          * @param mid The ID of the member to construct
114          * @since 1.0
115          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
116          */
117         public Member(JsObject.Member q, Mid mid) {
118             super(q, mid);
119         }
120         /**
121          * <p>Internally constructs a member without a qualifying member.</p>
122          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
123          * or <b>internal</b> classes or class members.</p>
124          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
125          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
126          * declared in <b>opaque</b> types other than the declaring class of this constructor 
127          * itself and its subclasses. Under this circumstance, the field names must be
128          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
129          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
130          * @param mid The ID of the member to construct
131          * @since 1.0
132          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
133          */
134         public Member(Mid mid) {
135             super(mid);
136         }
137         @Override
138         /**
139          * <p>Evaluates the property, represented by the current member instance, of the
140          * argument object.</p>
141          * @param o The argument object
142          * @return The value of the current member based on the object argument.
143          * @since 1.0
144          * @javascript Re-compilers must convert the instance invocation of this method into
145          * the JavaScript expression: 
146          * <pre>o.m</pre>
147          * where <tt>m</tt> is the identifier name resolved from the current member
148          * instance of the invocation.
149          */
150         public JsHTMLMenuElement with(ObjectLike o) {
151             return new JsHTMLMenuElement(super.with(o));
152         }
153 
154         /**
155          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
156          * name of this field, qualified by the current member instance of the field, and 
157          * to access the property of the name on an object.</p>
158          * <p>The property, identified by this member, of a {@link JsHTMLMenuElement} 
159          * object refers to a boolean value specifying whether to reduce interitem spacing, 
160          * giving a hint to visual browsers to render the list in a more compact way.</p>
161          * <p>This attribute is deprecated by HTML 4.01 along with the <tt>&lt;menu&gt;</tt> tag.</p> 
162          * @since 1.0
163          * @javascript Re-compilers must resolve the member of this instance field to the
164          * identifier of the field name appending to the identifier resolved from its 
165          * qualifying member with a dot in between.
166          */
167         public final Value.Boolean.Member compact = new Value.Boolean.Member(this, Members.compact);
168     }
169 
170     /**
171      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
172      * with the wrapping constructor.</p>
173      * @param var The argument of an <b>opaque</b> object.
174      * @since 1.0
175      * @javascript Re-compilers must ignore the construction operation of this constructor,
176      * that is, replacing it with its only argument.
177      */
178     public JsHTMLMenuElement(JsObject var) {
179         super(var);
180     }
181 
182     /**
183      * <p>An <b>opaque</b> static field defining a member that is named by the field name
184      * without a qualifying member and to access the property of the name on an object.</p>
185      * <p>The property, identified by this member, of a {@link JsHTMLMenuElement} 
186      * object refers to a boolean value specifying whether to reduce interitem spacing, 
187      * giving a hint to visual browsers to render the list in a more compact way.</p>
188      * <p>This attribute is deprecated by HTML 4.01 along with the <tt>&lt;menu&gt;</tt> tag.</p> 
189      * @since 1.0
190      * @javascript Re-compilers must resolve the member of this static field to the
191      * identifier of the field name.
192      */
193     public static final Value.Boolean.Member compact = new Value.Boolean.Member(Members.compact);
194 
195     @Override
196     /**
197      * <p>Returns the primitive value associated with the current instance, if there is one.
198      * This invocation simply returns the instance itself for the current instance is an 
199      * object and there is no primitive value for it.</p>
200      * @return The current object itself.
201      * @since 1.0
202      * @javascript Re-compilers must convert the instance invocation of this method directly
203      * into a JavaScript invocation on its current object instance without changing the 
204      * method name, but expanding variable arguments, if any, into comma-separated values. 
205      */
206     public final JsHTMLMenuElement valueOf() {
207         return new JsHTMLMenuElement((JsObject)var().valueOf());
208     }
209 }