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#HTMLTableSectionElement} class.</p>
028  * <p>This class represents a table row 
029  * in an HTML page, or a {@link JsHTMLElement} object created with the HTML 
030  * <tt>&lt;thead&gt;</tt>, <tt>&lt;tbody&gt;</tt> or <tt>&lt;tfoot&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 JsHTMLTableSectionElement extends JsClient.HTMLTableSectionElement.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.HTMLTableSectionElement.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 JsHTMLTableSectionElement#rows
059          * @see JsHTMLTableSectionElement.Member#rows
060          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
061          */
062         public final static Mid rows   = id("rows"  );
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 JsHTMLTableSectionElement#align
068          * @see JsHTMLTableSectionElement.Member#align
069          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
070          */
071         public final static Mid align  = id("align" );
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 JsHTMLTableSectionElement#ch
077          * @see JsHTMLTableSectionElement.Member#ch
078          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
079          */
080         public final static Mid ch     = id("ch"    );
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 JsHTMLTableSectionElement#chOff
086          * @see JsHTMLTableSectionElement.Member#chOff
087          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
088          */
089         public final static Mid chOff  = id("chOff" );
090         /**
091          * <p>An <b>internal</b> static field defining a member ID of the field name and
092          * used internally to define a member of the same name.</p>
093          * @since 1.0
094          * @see JsHTMLTableSectionElement#vAlign
095          * @see JsHTMLTableSectionElement.Member#vAlign
096          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
097          */
098         public final static Mid vAlign = id("vAlign");
099     }
100 
101     /**
102      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
103      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
104      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
105      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
106      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
107      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
108      * either circumstance, the field names must be exactly same as the member names, as 
109      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
110      * based on the field names.</p>
111      *
112      * @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>
113      * 
114      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
115      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
116      * of class objects.
117      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
118      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
119      * <pre>q.m</pre>
120      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
121      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
122      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
123      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
124      * <pre>m</pre>
125      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
126      * error on the access to <b>opaque</b> fields declared by this class under any other 
127      * circumstances.
128      */
129     public static class Member extends JsClient.HTMLTableSectionElement.Prototype.Member
130     {
131         /**
132          * <p>Internally constructs a member based on a qualifying member.</p>
133          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
134          * or <b>internal</b> classes or class members.</p>
135          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
136          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
137          * declared in the declaring class of this constructor itself or its subclasses. 
138          * Under this circumstance, the field names must be exactly same as the member 
139          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
140          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
141          * to their names appending to the name resolved from the specified qualifying 
142          * member with a dot in between.</p>
143          * @param q A qualifying member
144          * @param mid The ID of the member to construct
145          * @since 1.0
146          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
147          */
148         public Member(JsObject.Member q, Mid mid) {
149             super(q, mid);
150         }
151         /**
152          * <p>Internally constructs a member without a qualifying member.</p>
153          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
154          * or <b>internal</b> classes or class members.</p>
155          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
156          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
157          * declared in <b>opaque</b> types other than the declaring class of this constructor 
158          * itself and its subclasses. Under this circumstance, the field names must be
159          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
160          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
161          * @param mid The ID of the member to construct
162          * @since 1.0
163          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
164          */
165         public Member(Mid mid) {
166             super(mid);
167         }
168         @Override
169         /**
170          * <p>Evaluates the property, represented by the current member instance, of the
171          * argument object.</p>
172          * @param o The argument object
173          * @return The value of the current member based on the object argument.
174          * @since 1.0
175          * @javascript Re-compilers must convert the instance invocation of this method into
176          * the JavaScript expression: 
177          * <pre>o.m</pre>
178          * where <tt>m</tt> is the identifier name resolved from the current member
179          * instance of the invocation.
180          */
181         public JsHTMLTableSectionElement with(ObjectLike o) {
182             return new JsHTMLTableSectionElement(super.with(o));
183         }
184 
185         /**
186          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
187          * name of this field, qualified by the current member instance of the field, and 
188          * to access the property of the name on an object.</p>
189          * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
190          * object is a read-only reference to a collection of {@link JsHTMLTableRowElement} 
191          * elements of the current table section.</p>
192          * @since 1.0
193          * @javascript Re-compilers must resolve the member of this instance field to the
194          * identifier of the field name appending to the identifier resolved from its 
195          * qualifying member with a dot in between.
196          */
197         public final JsHTMLCollection.Member<JsHTMLTableRowElement> rows = new JsHTMLCollection.Member<JsHTMLTableRowElement>(this, Members.rows);
198         /**
199          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
200          * name of this field, qualified by the current member instance of the field, and 
201          * to access the property of the name on an object.</p>
202          * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
203          * object refers to a string specifying the horizontal alignment of the elements 
204          * of the table section with respect to the surrounding context. Possible values 
205          * are:
206          * <ul>
207          * <li><tt>"left"</tt>: text lines are rendered flush left.</li>
208          * <li><tt>"center"</tt>: text lines are centered.</li>
209          * <li><tt>"right"</tt>: text lines are rendered flush right.</li>
210          * <li><tt>"justify"</tt>: text lines are justified to both margins.</li>
211          * </ul>
212          * The default value of this attribute depends on the base text direction. 
213          * For left to right text, the default is "left", while for right to left text, 
214          * it is "right".</p>
215          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
216          * @since 1.0
217          * @javascript Re-compilers must resolve the member of this instance field to the
218          * identifier of the field name appending to the identifier resolved from its 
219          * qualifying member with a dot in between.
220          */
221         public final Value.String.Member align  = new Value.String.Member(this, Members.align );
222         /**
223          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
224          * name of this field, qualified by the current member instance of the field, and 
225          * to access the property of the name on an object.</p>
226          * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
227          * object refers to a string specifying a single character within a text fragment 
228          * to act as an axis for alignment. The default value for this attribute is the 
229          * decimal point character for the current language as set by the {@link JsHTMLElement#lang} 
230          * attribute, e.g., the period (".") in English and the comma (",") in French. 
231          * Browsers are not required to support this attribute by HTML 4.01.</p>
232          * @since 1.0
233          * @javascript Re-compilers must resolve the member of this instance field to the
234          * identifier of the field name appending to the identifier resolved from its 
235          * qualifying member with a dot in between.
236          */
237         public final Value.String.Member ch     = new Value.String.Member(this, Members.ch    );
238         /**
239          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
240          * name of this field, qualified by the current member instance of the field, and 
241          * to access the property of the name on an object.</p>
242          * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
243          * object refers to a string specifying, if specified, the offset to the first 
244          * occurrence of the alignment character on each line. If a line doesn't include 
245          * the alignment character, it should be horizontally shifted to end at the 
246          * alignment position.</p>
247          * @since 1.0
248          * @javascript Re-compilers must resolve the member of this instance field to the
249          * identifier of the field name appending to the identifier resolved from its 
250          * qualifying member with a dot in between.
251          */
252         public final Value.String.Member chOff  = new Value.String.Member(this, Members.chOff );
253         /**
254          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
255          * name of this field, qualified by the current member instance of the field, and 
256          * to access the property of the name on an object.</p>
257          * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
258          * object refers to a string specifying the vertical position of data within a 
259          * table section. Possible values are:
260          * <ul>
261          * <li><tt>"top"</tt>: Cell data is flush with the top of the cell.</li>
262          * <li><tt>"middle"</tt>: Cell data is centered vertically within the cell. This is the default value.</li>
263          * <li><tt>"bottom"</tt>: Cell data is flush with the bottom of the cell.</li>
264          * <li><tt>"baseline"</tt>: All cells in the same row as a cell whose {@link #vAlign} 
265          * attribute has this value should have their textual data positioned so that 
266          * the first text line occurs on a baseline common to all cells in the row. 
267          * This constraint does not apply to subsequent text lines in these cells.</li>
268          * </ul></p>
269          * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
270          * @since 1.0
271          * @javascript Re-compilers must resolve the member of this instance field to the
272          * identifier of the field name appending to the identifier resolved from its 
273          * qualifying member with a dot in between.
274          */
275         public final Value.String.Member vAlign = new Value.String.Member(this, Members.vAlign);
276     }
277 
278     /**
279      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
280      * with the wrapping constructor.</p>
281      * @param var The argument of an <b>opaque</b> object.
282      * @since 1.0
283      * @javascript Re-compilers must ignore the construction operation of this constructor,
284      * that is, replacing it with its only argument.
285      */
286     public JsHTMLTableSectionElement(JsObject var) {
287         super(var);
288     }
289 
290     /**
291      * <p>An <b>opaque</b> static field defining a member that is named by the field name
292      * without a qualifying member and to access the property of the name on an object.</p>
293      * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
294      * object is a read-only reference to a collection of {@link JsHTMLTableRowElement} 
295      * elements of the current table section.</p>
296      * @since 1.0
297      * @javascript Re-compilers must resolve the member of this static field to the
298      * identifier of the field name.
299      */
300     public static final JsHTMLCollection.Member<JsHTMLTableRowElement> rows = new JsHTMLCollection.Member<JsHTMLTableRowElement>(Members.rows);
301     /**
302      * <p>An <b>opaque</b> static field defining a member that is named by the field name
303      * without a qualifying member and to access the property of the name on an object.</p>
304      * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
305      * object refers to a string specifying the horizontal alignment of the elements 
306      * of the table section with respect to the surrounding context. Possible values 
307      * are:
308      * <ul>
309      * <li><tt>"left"</tt>: text lines are rendered flush left.</li>
310      * <li><tt>"center"</tt>: text lines are centered.</li>
311      * <li><tt>"right"</tt>: text lines are rendered flush right.</li>
312      * <li><tt>"justify"</tt>: text lines are justified to both margins.</li>
313      * </ul>
314      * The default value of this attribute depends on the base text direction. 
315      * For left to right text, the default is "left", while for right to left text, 
316      * it is "right".</p>
317      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
318      * @since 1.0
319      * @javascript Re-compilers must resolve the member of this static field to the
320      * identifier of the field name.
321      */
322     public static final Value.String.Member align  = new Value.String.Member(Members.align );
323     /**
324      * <p>An <b>opaque</b> static field defining a member that is named by the field name
325      * without a qualifying member and to access the property of the name on an object.</p>
326      * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
327      * object refers to a string specifying a single character within a text fragment 
328      * to act as an axis for alignment. The default value for this attribute is the 
329      * decimal point character for the current language as set by the {@link JsHTMLElement#lang} 
330      * attribute, e.g., the period (".") in English and the comma (",") in French. 
331      * Browsers are not required to support this attribute by HTML 4.01.</p>
332      * @since 1.0
333      * @javascript Re-compilers must resolve the member of this static field to the
334      * identifier of the field name.
335      */
336     public static final Value.String.Member ch     = new Value.String.Member(Members.ch    );
337     /**
338      * <p>An <b>opaque</b> static field defining a member that is named by the field name
339      * without a qualifying member and to access the property of the name on an object.</p>
340      * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
341      * object refers to a string specifying, if specified, the offset to the first 
342      * occurrence of the alignment character on each line. If a line doesn't include 
343      * the alignment character, it should be horizontally shifted to end at the 
344      * alignment position.</p>
345      * @since 1.0
346      * @javascript Re-compilers must resolve the member of this static field to the
347      * identifier of the field name.
348      */
349     public static final Value.String.Member chOff  = new Value.String.Member(Members.chOff );
350     /**
351      * <p>An <b>opaque</b> static field defining a member that is named by the field name
352      * without a qualifying member and to access the property of the name on an object.</p>
353      * <p>The property, identified by this member, of a {@link JsHTMLTableSectionElement} 
354      * object refers to a string specifying the vertical position of data within a 
355      * table section. Possible values are:
356      * <ul>
357      * <li><tt>"top"</tt>: Cell data is flush with the top of the cell.</li>
358      * <li><tt>"middle"</tt>: Cell data is centered vertically within the cell. This is the default value.</li>
359      * <li><tt>"bottom"</tt>: Cell data is flush with the bottom of the cell.</li>
360      * <li><tt>"baseline"</tt>: All cells in the same row as a cell whose {@link #vAlign} 
361      * attribute has this value should have their textual data positioned so that 
362      * the first text line occurs on a baseline common to all cells in the row. 
363      * This constraint does not apply to subsequent text lines in these cells.</li>
364      * </ul></p>
365      * <p>This attribute is deprecated by HTML 4.01 and should be handled by style sheets.</p> 
366      * @since 1.0
367      * @javascript Re-compilers must resolve the member of this static field to the
368      * identifier of the field name.
369      */
370     public static final Value.String.Member vAlign = new Value.String.Member(Members.vAlign);
371 
372     @Override
373     /**
374      * <p>Returns the primitive value associated with the current instance, if there is one.
375      * This invocation simply returns the instance itself for the current instance is an 
376      * object and there is no primitive value for it.</p>
377      * @return The current object itself.
378      * @since 1.0
379      * @javascript Re-compilers must convert the instance invocation of this method directly
380      * into a JavaScript invocation on its current object instance without changing the 
381      * method name, but expanding variable arguments, if any, into comma-separated values. 
382      */
383     public JsHTMLTableSectionElement valueOf() {
384         return new JsHTMLTableSectionElement((JsObject)var().valueOf());
385     }
386     /**
387      * <p>Deletes the specified row from the current table section.</p>
388      * @param index The index of the row to be deleted, or -1 to delete the last row. 
389      * This index starts from 0 and is relative only to the rows contained inside this 
390      * section, not all the rows in the table.
391      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
392      * the {@link JsDOMException#code} property of the value {@link JsDOMException#INDEX_SIZE_ERR} 
393      * if the specified <tt>index</tt> is greater than or equal to the number of cells 
394      * or if the <tt>index</tt> is a negative number other than -1. See {@link Js#err(Object)} for 
395      * JS Simulation.
396      * @since 1.0
397      * @see #deleteRow(NumberLike)
398      * @javascript Re-compilers must convert the instance invocation of this method directly
399      * into a JavaScript invocation on its current object instance without changing the 
400      * method name, but expanding variable arguments, if any, into comma-separated values. 
401      */
402     public final void deleteRow(Number index) {
403         call(deleteRow, index);
404     }
405     /**
406      * <p>Deletes the specified row from the current table section.</p>
407      * @param index The index of the row to be deleted, or -1 to delete the last row. 
408      * This index starts from 0 and is relative only to the rows contained inside this 
409      * section, not all the rows in the table.
410      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
411      * the {@link JsDOMException#code} property of the value {@link JsDOMException#INDEX_SIZE_ERR} 
412      * if the specified <tt>index</tt> is greater than or equal to the number of cells 
413      * or if the <tt>index</tt> is a negative number other than -1. See {@link Js#err(Object)} for 
414      * JS Simulation.
415      * @since 1.0
416      * @see #deleteRow(Number)
417      * @javascript Re-compilers must convert the instance invocation of this method directly
418      * into a JavaScript invocation on its current object instance without changing the 
419      * method name, but expanding variable arguments, if any, into comma-separated values. 
420      */
421     public final void deleteRow(NumberLike<?> index) {
422         call(deleteRow, index);
423     }
424     /**
425      * <p>Insert a new row into the current table section.</p>
426      * <p>The new row is inserted immediately before the current <tt>index</tt>th row 
427      * in this table section. If <tt>index</tt> is -1 or equal to the number of rows 
428      * in the section, the new row is appended.</p>
429      * @param index The row number where to insert a new row. This index starts from 0 
430      * and is relative only to the rows contained inside this section, not all the rows 
431      * in the table.
432      * @return The newly created row.
433      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
434      * the {@link JsDOMException#code} property of the value {@link JsDOMException#INDEX_SIZE_ERR} 
435      * if the specified <tt>index</tt> is greater than or equal to the number of cells 
436      * or if the <tt>index</tt> is a negative number other than -1. See {@link Js#err(Object)} for 
437      * JS Simulation.
438      * @since 1.0
439      * @see #insertRow(NumberLike)
440      * @javascript Re-compilers must convert the instance invocation of this method directly
441      * into a JavaScript invocation on its current object instance without changing the 
442      * method name, but expanding variable arguments, if any, into comma-separated values. 
443      */
444     public final JsHTMLTableRowElement insertRow(Number index) {
445         return new JsHTMLTableRowElement(call(insertRow, index));
446     }
447     /**
448      * <p>Insert a new row into the current table section.</p>
449      * <p>The new row is inserted immediately before the current <tt>index</tt>th row 
450      * in this table section. If <tt>index</tt> is -1 or equal to the number of rows 
451      * in the section, the new row is appended.</p>
452      * @param index The row number where to insert a new row. This index starts from 0 
453      * and is relative only to the rows contained inside this section, not all the rows 
454      * in the table.
455      * @return The newly created row.
456      * @throws RuntimeException JavaScript throws a {@link JsDOMException} object with 
457      * the {@link JsDOMException#code} property of the value {@link JsDOMException#INDEX_SIZE_ERR} 
458      * if the specified <tt>index</tt> is greater than or equal to the number of cells 
459      * or if the <tt>index</tt> is a negative number other than -1. See {@link Js#err(Object)} for 
460      * JS Simulation.
461      * @since 1.0
462      * @see #insertRow(Number)
463      * @javascript Re-compilers must convert the instance invocation of this method directly
464      * into a JavaScript invocation on its current object instance without changing the 
465      * method name, but expanding variable arguments, if any, into comma-separated values. 
466      */
467     public final JsHTMLTableRowElement insertRow(NumberLike<?> index) {
468         return new JsHTMLTableRowElement(call(insertRow, index));
469     }
470 }