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#HTMLDivElement} class.</p>
028  * <p>This class represents a generic block container 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;div&gt;</tt> tag which, in conjunction with the <tt>id</tt> and <tt>class</tt> 
031  * attributes, offers a generic mechanism for adding structure to documents. These 
032  * elements define content to be block-level but impose no other presentational idioms 
033  * on the content. Thus, HTML authors may use these elements in conjunction with style 
034  * sheets, the <tt>lang</tt> attribute, etc., to tailor HTML to their own needs and 
035  * tastes.</p> 
036  *
037  * @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>
038  *
039  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
040  * generated into the target codes. Re-compilers must exit with error on the operations of
041  * accessing that kind of class objects.
042  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
043  * and <tt>instanceof</tt> to it always <tt>true</tt>.
044  */
045 public class JsHTMLDivElement extends JsClient.HTMLDivElement.Prototype
046 {
047     /**
048      * <p>An <b>internal</b> class containing membership data for its enclosing
049      * opaque class.</p>
050      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
051      * class members.</p>
052      *
053      * @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>
054      * 
055      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
056      */
057     protected static abstract class Members extends JsClient.HTMLDivElement.Prototype.Members
058     {
059         /**
060          * <p>An <b>internal</b> static field defining a member ID of the field name and
061          * used internally to define a member of the same name.</p>
062          * @since 1.0
063          * @see JsHTMLDivElement#align
064          * @see JsHTMLDivElement.Member#align
065          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
066          */
067         public final static Mid align = id("align");
068     }
069     /**
070      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
071      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
072      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
073      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
074      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
075      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
076      * either circumstance, the field names must be exactly same as the member names, as 
077      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
078      * based on the field names.</p>
079      *
080      * @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>
081      * 
082      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
083      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
084      * of class objects.
085      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
086      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
087      * <pre>q.m</pre>
088      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
089      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
090      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
091      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
092      * <pre>m</pre>
093      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
094      * error on the access to <b>opaque</b> fields declared by this class under any other 
095      * circumstances.
096      */
097     public static class Member extends JsClient.HTMLDivElement.Prototype.Member
098     {
099         /**
100          * <p>Internally constructs a member based on a qualifying member.</p>
101          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
102          * or <b>internal</b> classes or class members.</p>
103          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
104          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
105          * declared in the declaring class of this constructor itself or its subclasses. 
106          * Under this circumstance, the field names must be exactly same as the member 
107          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
108          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
109          * to their names appending to the name resolved from the specified qualifying 
110          * member with a dot in between.</p>
111          * @param q A qualifying member
112          * @param mid The ID of the member to construct
113          * @since 1.0
114          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
115          */
116         public Member(JsObject.Member q, Mid mid) {
117             super(q, mid);
118         }
119         /**
120          * <p>Internally constructs a member without a qualifying member.</p>
121          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
122          * or <b>internal</b> classes or class members.</p>
123          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
124          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
125          * declared in <b>opaque</b> types other than the declaring class of this constructor 
126          * itself and its subclasses. Under this circumstance, the field names must be
127          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
128          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
129          * @param mid The ID of the member to construct
130          * @since 1.0
131          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
132          */
133         public Member(Mid mid) {
134             super(mid);
135         }
136         @Override
137         /**
138          * <p>Evaluates the property, represented by the current member instance, of the
139          * argument object.</p>
140          * @param o The argument object
141          * @return The value of the current member based on the object argument.
142          * @since 1.0
143          * @javascript Re-compilers must convert the instance invocation of this method into
144          * the JavaScript expression: 
145          * <pre>o.m</pre>
146          * where <tt>m</tt> is the identifier name resolved from the current member
147          * instance of the invocation.
148          */
149         public JsHTMLDivElement with(ObjectLike o) {
150             return new JsHTMLDivElement(super.with(o));
151         }
152 
153         /**
154          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
155          * name of this field, qualified by the current member instance of the field, and 
156          * to access the property of the name on an object.</p>
157          * <p>The property, identified by this member, of a {@link JsHTMLDivElement} 
158          * object refers to a string specifying the horizontal alignment of the element 
159          * with respect to the surrounding context. Possible values are:
160          * <ul>
161          * <li><tt>"left"</tt>: text lines are rendered flush left.</li>
162          * <li><tt>"center"</tt>: text lines are centered.</li>
163          * <li><tt>"right"</tt>: text lines are rendered flush right.</li>
164          * <li><tt>"justify"</tt>: text lines are justified to both margins.</li>
165          * </ul>
166          * The default value of this attribute depends on the base text direction. 
167          * For left to right text, the default is "left", while for right to left text, 
168          * it is "right".</p>
169          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</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.String.Member align = new Value.String.Member(this, Members.align);
176     }
177 
178     /**
179      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
180      * with the wrapping constructor.</p>
181      * @param var The argument of an <b>opaque</b> object.
182      * @since 1.0
183      * @javascript Re-compilers must ignore the construction operation of this constructor,
184      * that is, replacing it with its only argument.
185      */
186     public JsHTMLDivElement(JsObject var) {
187         super(var);
188     }
189 
190     /**
191      * <p>An <b>opaque</b> static field defining a member that is named by the field name
192      * without a qualifying member and to access the property of the name on an object.</p>
193      * <p>The property, identified by this member, of a {@link JsHTMLDivElement} 
194      * object refers to a string specifying the horizontal alignment of the element 
195      * with respect to the surrounding context. Possible values are:</p>
196      * <ul>
197      * <li><tt>"left"</tt>: text lines are rendered flush left.</li>
198      * <li><tt>"center"</tt>: text lines are centered.</li>
199      * <li><tt>"right"</tt>: text lines are rendered flush right.</li>
200      * <li><tt>"justify"</tt>: text lines are justified to both margins.</li>
201      * </ul>
202      * The default value of this attribute depends on the base text direction. 
203      * For left to right text, the default is "left", while for right to left text, 
204      * it is "right".</p>
205      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
206      * @since 1.0
207      * @javascript Re-compilers must resolve the member of this static field to the
208      * identifier of the field name.
209      */
210     public static final Value.String.Member align = new Value.String.Member(Members.align);
211 
212     @Override
213     /**
214      * <p>Returns the primitive value associated with the current instance, if there is one.
215      * This invocation simply returns the instance itself for the current instance is an 
216      * object and there is no primitive value for it.</p>
217      * @return The current object itself.
218      * @since 1.0
219      * @javascript Re-compilers must convert the instance invocation of this method directly
220      * into a JavaScript invocation on its current object instance without changing the 
221      * method name, but expanding variable arguments, if any, into comma-separated values. 
222      */
223     public final JsHTMLDivElement valueOf() {
224         return new JsHTMLDivElement((JsObject)var().valueOf());
225     }
226 }