Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

WebLogic Server 5.1.0sp9 API Reference

## weblogic.html
Class TableElement

    java.lang.Object
      |
      +--weblogic.html.HtmlElement
            |
            +--weblogic.html.ElementWithAttributes
                  |
                  +--weblogic.html.MultiPartElement
                        |
                        +--weblogic.html.TableElement

public class TableElement
extends MultiPartElement

A TableElement is analogous to an HTML table. It is built by adding TableRowElements (which contain TableDataElements) to it. The TableElement class is also used to set general characteristics for constructing tables on an htmlKona page.

Use the addElement() method in this class to add TableRowElements to a TableElement. For example, this shows how to created a nested table by adding TableRowElements to a TableElement tab:

      TableElement tab = new TableElement()
              .setBorder(1)
              .setCellPadding(5)
              .setWidth(50%)
              .setCaption(new StrongElement("Fall Registration Schedule").asItalicElement());
       tab.addElement(new TableRowElement()
                      .addElement(new TableHeadingElement(new AnchorElement(AnchorType.name,
                                                                     "topic",
                                                                     "Topic")))
                      .addElement(new TableHeadingElement("Value").setBgColor(HtmlColor.navy)));
       tab.addElement(new TableRowElement()
                      .addElement(new TableDataElement(reg.getID()).setVAlign(AlignType.top))
                      .addElement(new TableDataElement(new TableElement(reg.getMain())
                                                       .setCaption(new BoldElement("N1"))
                                                       .setBorder(1))
                                  .setVAlign(AlignType.top)));
       page.getBody().addElement(new CenteredElement(tab));

and so forth.

When you construct a TableElement with a dbKona DataSet, the Schema of the DataSet is used to construct an HTML table and each Record in the DataSet is automatically displayed as a row in the HTML table. Use a constructor with the boolean "withHeading" set to true to show column names at the top of the table.

Constructors in this class also support table generation with Dictionary and WebLogic ParamSet objects.

This class has variables for the HTML attributes border, caption, cellpadding, cellspacing, width, background image, and background color. Use AlignType objects to set the ALIGN and VALIGN elements. This class also support several browser extensions, including BORDERSTYLE, BACKGROUND, and BGCOLOR.

In compliance with HTML 4.0, TableElement supports the attributes align, bgcolor, width, cols, border, frame, rules, cellspacing, and cellpadding. Other attributes, including id, class, lang, title, etc., are available with methods from its superclass.

Author:
  Copyright (c) 1995-97 by WebLogic, Inc. All Rights Reserved.
  Copyright © 2001 BEA Systems, Inc. All Rights Reserved.
See Also:
  `TableCaptionElement`, `ColGroupElement`, `TableDataElement`, `TableHeadingElement`, `TableRowElement`, `DataSet`, `Schema`, `ParamSet`

Field Summary
`static int` | `default_border` Default border is unset.
`static TableCaptionElement` | `default_caption` Default caption is unset.
`static int` | `default_cellpadding` Default cellpadding is unset.
`static int` | `default_cellspacing` Default cellspacing is unset.
`static java.lang.String` | `default_width` Default width is unset.

Fields inherited from class weblogic.html.HtmlElement
`codeset, useObsolete`

Constructor Summary
`TableElement()` Constructs a TableElement object.
`TableElement(DataSet ds)` Constructs a TableElement object with a dbKona DataSet as its contents.
`TableElement(DataSet ds, boolean withHeading)` Constructs a TableElement object with a dbKona DataSet as its contents.
`TableElement(java.util.Dictionary dictionary)` Constructs a TableElement with a java.util.Dictionary as its contents, sorted by key, with the column headings "Key" and "Value."
`TableElement(java.util.Dictionary dictionary, boolean withHeading)` Constructs a TableElement with a java.util.Dictionary as its contents, sorted by key.
`TableElement(java.util.Dictionary dictionary, boolean withHeading, boolean sortByKey)` Constructs a TableElement with a java.util.Dictionary as its contents.
`TableElement(ParamSet ps)` Constructs a TableElement with a weblogic.common.ParamSet as its contents.
`TableElement(ParamSet ps, boolean withHeading)` Constructs a TableElement with a weblogic.common.ParamSet as its contents.
`TableElement(ParamSet ps, boolean withHeading, boolean sortByName)` Constructs a TableElement with a weblogic.common.ParamSet as its contents.
`TableElement(ParamSet ps, boolean withHeading, boolean sortByName, java.lang.String fontFace)` Constructs a TableElement with a weblogic.common.ParamSet as its contents.

Method Summary
`TableElement` | `addElement(ColGroupElement cge)` Adds a ColGroupElement to a TableElement.
`TableElement` | `addElement(TableRowElement val)` Adds a TableRowElement to a TableElement.
`TableElement` | `addElement(TBodyElement tbe)` Adds a TBodyElement to a TableElement.
`TableElement` | `addElement(TFootElement tfe)` Adds a TFootElement to a TableElement.
`TableElement` | `addElement(THeadElement the)` Adds a THeadElement to a TableElement.
`TableElement` | `addRow(int numcols)` Adds a row with the specified number of columns to the TableElement.
`TableCaptionElement` | `getCaption()` Gets the caption of a TableElement.
`TableDataElement` | `getCellAt(int row, int col)` Gets the cell at the specified row and column.
`HtmlContainer` | `getColGroup()` Gets the colgroup set of a TableElement.
`TableRowElement` | `getElementAt(int pos)` Gets the TableRowElement at the specified index position.
`protected java.lang.String` | `getHtmlCode()`
`int` | `getNumRows()` Gets the number of rows in a TableElement.
`TableRowElement` | `getRowAt(int pos)` Gets the TableRowElement at the specified index position.
`TBodyElement` | `getTBody()` Returns the TBody section of a TableElement.
`TFootElement` | `getTFoot()` Returns the TFoot section of a TableElement.
`THeadElement` | `getTHead()` Returns the THead section of a TableElement.
`protected void` | `printBody(java.io.OutputStream out)` This is an odd bird because of the ordering Caption has to go under the <TABLE> tag.
`protected void` | `printBody(java.io.OutputStream out, java.lang.String codeset)`
`protected boolean` | `printCR()`
`TableElement` | `resetColGroup()` Returns a new ColGroupElement for a TableElement.
`TableElement` | `resetTBody()` Returns a new TBodyElement that is the table body portion of a TableElement.
`TableElement` | `resetTFoot()` Returns a new TBodyElement that is the table body portion of a TableElement.
`TableElement` | `resetTHead()` Returns a new THeadElement that is the table head portion of a TableElement.
`TableElement` | `setAlign(AlignType align)` Sets the alignment for the table on the page.
`TableElement` | `setBackground(java.lang.String url)` Sets a background image for a table.
`TableElement` | `setBgColor(java.awt.Color color)` Sets the BGCOLOR attribute.
`TableElement` | `setBgColor(java.lang.String color)` Sets the BGCOLOR attribute.
`TableElement` | `setBorder(int val)` Sets the border width to the specified number of pixels.
`TableElement` | `setBorderstyle(BorderstyleType style)` Sets the borderstyle attribute (extension supported by some browsers).
`TableElement` | `setCaption(HtmlElement he)` Sets the caption to the specified HtmlElement.
`TableElement` | `setCaption(java.lang.String str)` Sets the caption to the specified String.
`TableElement` | `setCaption(TableCaptionElement cap)` Sets the caption to the specified TableCaptionElement.
`TableElement` | `setCellAt(int row, int col, HtmlElement val)` Sets the cell at the specified row and column to the specified HtmlElement value.
`TableElement` | `setCellAt(int row, int col, java.lang.String val)` Sets the cell at the specified row and column to the specified String value.
`TableElement` | `setCellPadding(int val)` Sets the cellpadding to the specified number of pixels.
`TableElement` | `setCellSpacing(int val)` Sets the cellspacing to the specified number of pixels.
`TableElement` | `setFramework(FrameType frame, RulesType rules)` Sets the FRAME and RULES attributes.
`TableElement` | `setWidth(int val)` Sets the width to the specified number of pixels.
`TableElement` | `setWidth(java.lang.String val)` Sets the width to the specified number of pixels.

Methods inherited from class weblogic.html.MultiPartElement
`addHeadMultiElement, addMultiElement, getMultiElementAt, getNumElements, printBody, removeElement, removeElementAt, replaceElementAt, replaceMultiElementAt, widthAsLiteral`

Methods inherited from class weblogic.html.ElementWithAttributes
`addAttribute, addAttribute, escapeQuotes, getBooleanAttribute, getElementAttribute, getLocalVar, getQuotedAttribute, output, output, output, printBody, printEndingTag, setBooleanAttribute, setBooleanAttribute, setClass, setDirection, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setElementAttribute, setId, setLang, setLocalVar, setQuotedAttribute, setStyle`

Methods inherited from class weblogic.html.HtmlElement
`asAnchorElement, asBigElement, asBlockquoteElement, asBoldElement, asCenteredElement, asCiteElement, asCodeElement, asCommentElement, asDefineTermElement, asEmphasisElement, asFontElement, asFontElement, asFontElement, asHtmlContainer, asItalicElement, asKeyboardElement, asLiteralElement, asParagraphElement, asSampleElement, asSmallElement, asStrikeElement, asStrongElement, asSubscriptElement, asSuperscriptElement, asTeletypeElement, asUnderlineElement, asVariableElement, getVersion, setAnchorMode, setCodeset, toString, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### default_border

    public static int default_border

  Default border is unset. The BORDER attribute will only be added if you set the variable or if you use the setBorder() method.

### default_cellspacing

    public static int default_cellspacing

  Default cellspacing is unset. The CELLSPACING attribute will only be added if you set the variable or if you use the setCellspacing() method.

### default_cellpadding

    public static int default_cellpadding

  Default cellpadding is unset. The CELLPADDING attribute will only be added if you set the variable or use the setCellpadding() method.

### default_width

    public static java.lang.String default_width

  Default width is unset. The WIDTH attribute will only be added if you set the variable or use the setWidth() method.

### default_caption

    public static TableCaptionElement default_caption

  Default caption is unset. The CAPTION element will only be added if you set the variable or use the setCaption() method.

Constructor Detail

### TableElement

    public TableElement()

  Constructs a TableElement object.

### TableElement

    public TableElement(DataSet ds)
                 throws DataSetException,
                        java.sql.SQLException

  Constructs a TableElement object with a dbKona DataSet as its contents.

  Parameters:
    `ds` - DataSet object
  Throws:
    DataSetException - if there is an error with the DataSet
    java.sql.SQLException - if there is a SQL error

### TableElement

    public TableElement(DataSet ds,
                        boolean withHeading)
                 throws DataSetException,
                        java.sql.SQLException

  Constructs a TableElement object with a dbKona DataSet as its contents.

  Parameters:
    `ds` - DataSet object
    `withHeading` - True if headings should be used
  Throws:
    DataSetException - if there is an error with the DataSet
    java.sql.SQLException - if there is a SQL error

### TableElement

    public TableElement(ParamSet ps)

  Constructs a TableElement with a weblogic.common.ParamSet as its contents. This creates a two-column table with the headings "Name" and "Value," sorted on the Name column.

  Parameters:
    `ps` - ParamSet object
  See Also:
    `ParamSet`

### TableElement

    public TableElement(ParamSet ps,
                        boolean withHeading)

  Constructs a TableElement with a weblogic.common.ParamSet as its contents. Set the argument `withHeading` to `true` to add "Name" and "Value" as column headings. The contents of the table are sorted on the Name column.

  Parameters:
    `ps` - ParamSet object
    `withHeading` - true to add "Name" and "Value" column headings

### TableElement

    public TableElement(ParamSet ps,
                        boolean withHeading,
                        boolean sortByName)

  Constructs a TableElement with a weblogic.common.ParamSet as its contents. Set the argument `withHeading` to `true` to add "Name" and "Value" as italic column headings. Set the argument `sortByName` to `true` to sort the contents of the table on the Name column.

  Parameters:
    `ps` - ParamSet object
    `withHeading` - true to add "Name" and "Value" column headings
    `sortByName` - true to sort on the Name column

### TableElement

    public TableElement(ParamSet ps,
                        boolean withHeading,
                        boolean sortByName,
                        java.lang.String fontFace)

  Constructs a TableElement with a weblogic.common.ParamSet as its contents. Sets the argument `withHeading` to `true` to add "Name" and "Value" as column headings. Set the argument `sortByName` to `true` to sort the contents of the table on the Name column. The contents of the table are sorted on the Name column.

  Also sets the name of the font as specified, since at the time of this writing, browsers consistently ignore page-level font face settings and require a font face attribute for each table cell.

  Parameters:
    `ps` - ParamSet object
    `withHeading` - true to add "Name" and "Value" column headings
    `sortByName` - true to sort on the Name column
    `fontFace` - String name of font

### TableElement

    public TableElement(java.util.Dictionary dictionary)

  Constructs a TableElement with a java.util.Dictionary as its contents, sorted by key, with the column headings "Key" and "Value."

  Parameters:
    `dictionary` - Dictionary object

### TableElement

    public TableElement(java.util.Dictionary dictionary,
                        boolean withHeading)

  Constructs a TableElement with a java.util.Dictionary as its contents, sorted by key. Set the argument `withHeading` to true to add the column headings "Key" and "Value."

  Parameters:
    `dictionary` - Dictionary object
    `withHeading` - true to add "Key" and "Value" column headings

### TableElement

    public TableElement(java.util.Dictionary dictionary,
                        boolean withHeading,
                        boolean sortByKey)

  Constructs a TableElement with a java.util.Dictionary as its contents. Set the argument `withHeading` to true to add the column headings "Key" and "Value." Set the argument `sortByKey` to true to sort on its Key column.

  Parameters:
    `dictionary` - Dictionary object
    `withHeading` - true to add "Key" and "Value" column headings
    `sortByKey` - true to sort on the Key column

Method Detail

### getHtmlCode

    protected java.lang.String getHtmlCode()

  Overrides:
    getHtmlCode in class ElementWithAttributes

### printCR

    protected boolean printCR()

  Overrides:
    printCR in class ElementWithAttributes

### getTHead

    public THeadElement getTHead()

  Returns the THead section of a TableElement. Add TableRowElements (probably made up of TableHeadingElements in this case) to a TableElement after calling this method.

  Returns:
    THeadElement

### resetTHead

    public TableElement resetTHead()

  Returns a new THeadElement that is the table head portion of a TableElement.

### getTBody

    public TBodyElement getTBody()

  Returns the TBody section of a TableElement. Add TableRowElements to a TableElement after calling this method.

  Returns:
    HtmlContainer

### resetTBody

    public TableElement resetTBody()

  Returns a new TBodyElement that is the table body portion of a TableElement.

### getTFoot

    public TFootElement getTFoot()

  Returns the TFoot section of a TableElement. Add TableRowElements to a TableElement after calling this method.

  Returns:
    TFootElement

### resetTFoot

    public TableElement resetTFoot()

  Returns a new TBodyElement that is the table body portion of a TableElement.

### addElement

    public TableElement addElement(TableRowElement val)

  Adds a TableRowElement to a TableElement.

  Parameters:
    `val` - TableRowElement
  Returns:
    TableElement object

### addElement

    public TableElement addElement(ColGroupElement cge)

  Adds a ColGroupElement to a TableElement.

### addElement

    public TableElement addElement(THeadElement the)

  Adds a THeadElement to a TableElement.

### addElement

    public TableElement addElement(TBodyElement tbe)

  Adds a TBodyElement to a TableElement.

### addElement

    public TableElement addElement(TFootElement tfe)

  Adds a TFootElement to a TableElement.

### addRow

    public TableElement addRow(int numcols)

  Adds a row with the specified number of columns to the TableElement.

  Parameters:
    `numcols` - Number of columns
  Returns:
    TableElement object

### getNumRows

    public int getNumRows()

  Gets the number of rows in a TableElement.

  Returns:
    Number of rows

### getRowAt

    public TableRowElement getRowAt(int pos)

  Gets the TableRowElement at the specified index position.

  Parameters:
    `pos` - Index position
  Returns:
    TableRowElement object

### getElementAt

    public TableRowElement getElementAt(int pos)

  Gets the TableRowElement at the specified index position.

  Parameters:
    `pos` - Index position
  Returns:
    TableRowElement object

### setAlign

    public TableElement setAlign(AlignType align)

  Sets the alignment for the table on the page.

  Parameters:
    `align` - AlignType object
  Returns:
    TableElement

### setCellAt

    public TableElement setCellAt(int row,
                                  int col,
                                  HtmlElement val)

  Sets the cell at the specified row and column to the specified HtmlElement value. Use this method to replace the contents of cells after the table is constructed.

  Parameters:
    `row` - Row number
    `col` - Column number
    `val` - HtmlElement
  Returns:
    TableElement object

### setCellAt

    public TableElement setCellAt(int row,
                                  int col,
                                  java.lang.String val)

  Sets the cell at the specified row and column to the specified String value. Use this method to replace the contents of cells after the table is constructed.

  Parameters:
    `row` - Row number
    `col` - Column number
    `val` - String
  Returns:
    TableElement object

### getCellAt

    public TableDataElement getCellAt(int row,
                                      int col)

  Gets the cell at the specified row and column.

  Parameters:
    `row` - Row number
    `col` - Column number
  Returns:
    TableDataElement object

### setBorder

    public TableElement setBorder(int val)

  Sets the border width to the specified number of pixels. The default border is 0.

  Parameters:
    `val` - Border width
  Returns:
    TableElement object

### setBorderstyle

    public TableElement setBorderstyle(BorderstyleType style)

  Sets the borderstyle attribute (extension supported by some browsers). BorderstyleType encapsulates possible values for this attribute. Valid values depend upon the browser.

  Parameters:
    `style` - BorderstyleType constant
  Returns:
    TableElement

### setFramework

    public TableElement setFramework(FrameType frame,
                                     RulesType rules)

  Sets the FRAME and RULES attributes. This is an HTML 4.0 attribute that is not yet supported in all browsers (notably, not in Netscape). It will supercede the BORDER attribute.

  Parameters:
    `frame` - FrameType constant
    `rules` - RulesType constant
  Returns:
    TableElement

### setBgColor

    public TableElement setBgColor(java.lang.String color)

  Sets the BGCOLOR attribute. This is an HTML 4.0 attribute that is not yet supported in all browsers.

  Parameters:
    `color` - HtmlColor constant or RGB (hex) value
  Returns:
    TableElement

### setBgColor

    public TableElement setBgColor(java.awt.Color color)

  Sets the BGCOLOR attribute. This is an HTML 4.0 attribute that is not yet supported in all browsers. #param color java.awt.Color object

  Returns:
    TableElement

### setBackground

    public TableElement setBackground(java.lang.String url)

  Sets a background image for a table. Not supported in all browsers.

  Parameters:
    `img` - URL for image

### setCellSpacing

    public TableElement setCellSpacing(int val)

  Sets the cellspacing to the specified number of pixels.

  Parameters:
    `val` - Spacing in pixels
  Returns:
    TableElement object

### setCellPadding

    public TableElement setCellPadding(int val)

  Sets the cellpadding to the specified number of pixels.

  Parameters:
    `val` - Padding in pixels
  Returns:
    TableElement object

### setWidth

    public TableElement setWidth(java.lang.String val)

  Sets the width to the specified number of pixels. The default width is none. This value can be a percentage, for example "100%".

  Parameters:
    `val` - Width
  Returns:
    TableElement object

### setWidth

    public TableElement setWidth(int val)

  Sets the width to the specified number of pixels. The default width is none.

  Parameters:
    `val` - Width
  Returns:
    TableElement object

### setCaption

    public TableElement setCaption(java.lang.String str)

  Sets the caption to the specified String.

  Parameters:
    `str` - Caption
  Returns:
    TableElement object

### setCaption

    public TableElement setCaption(HtmlElement he)

  Sets the caption to the specified HtmlElement. The default caption is none.

  Parameters:
    `he` - HtmlElement
  Returns:
    TableElement object

### setCaption

    public TableElement setCaption(TableCaptionElement cap)

  Sets the caption to the specified TableCaptionElement. The default caption is none.

  Parameters:
    `he` - TableCaptionElement
  Returns:
    TableElement object

### getCaption

    public TableCaptionElement getCaption()

  Gets the caption of a TableElement.

  Returns:
    TableCaptionElement object

### getColGroup

    public HtmlContainer getColGroup()

  Gets the colgroup set of a TableElement.

  Returns:
    HtmlContainer

### resetColGroup

    public TableElement resetColGroup()

  Returns a new ColGroupElement for a TableElement.

  Returns:
    New ColGroupElement

### printBody

    protected void printBody(java.io.OutputStream out)
                      throws java.io.IOException

  This is an odd bird because of the ordering Caption has to go under the <TABLE> tag. The Colgroup lines have to follow, then the rows. THead, TFoot, and TBody can be in any order.

  Overrides:
    printBody in class MultiPartElement

### printBody

    protected void printBody(java.io.OutputStream out,
                             java.lang.String codeset)
                      throws java.io.IOException

  Overrides:
    printBody in class MultiPartElement

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at http://www.weblogic.com/docs51
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD