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