BEA Systems, Inc.

WebLogic Server 5.1.0 API Reference

weblogic.html
Class TableDataElement

java.lang.Object
  |
  +--weblogic.html.HtmlElement
        |
        +--weblogic.html.ElementWithAttributes
              |
              +--weblogic.html.SinglePartElement
                    |
                    +--weblogic.html.TableDataElement
Direct Known Subclasses:
TableHeadingElement

public class TableDataElement
extends SinglePartElement

A TableDataElement object is used to display a single cell of an htmlKona TableElement. A TableRowElement can be built by adding TableDataElements to it. For example, this shows how to created a nested table by adding TableDataElements to TableRowElements:

  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.

This class also supports browser extensions for setting BGCOLOR and BACKGROUND (image) attributes, and other attributes for alignment. Attributes such as id, class, lang, and dir are available with methods from a superclass.

Author:
Copyright (c) 1995-97 by WebLogic, Inc. All Rights Reserved.
Copyright © 2000 BEA Systems, Inc. All Rights Reserved.
See Also:
TableElement

Field Summary
protected  StringElement contents
           
protected  HtmlElement val
           
 
Fields inherited from class weblogic.html.HtmlElement
codeset, useObsolete
 
Constructor Summary
TableDataElement()
          Constructs a TableDataElement object.
TableDataElement(HtmlElement elem)
          Constructs a TableDataElement object with the specified HtmlElement object.
TableDataElement(java.lang.String data)
          Constructs a TableDataElement object with the specified String.
 
Method Summary
 StringElement getContents()
          Gets the contents of a TableDataElement as a StringElement.
protected  java.lang.String getHtmlCode()
           
 HtmlElement getHtmlElement()
          Gets the underlying HtmlElement used to create the contents of the TableDataElement.
protected  boolean printCR()
           
 TableDataElement setAlign(AlignType val)
          Sets the alignment of a TableDataElement.
 TableDataElement setBackground(java.lang.String url)
          Sets a background image for a table data cell.
 TableDataElement setBgColor(java.awt.Color color)
          Sets the background color to the specified java.awt.Color object.
 TableDataElement setBgColor(java.lang.String color)
          Sets the background color for a table data cell.
 TableDataElement setColSpan(int val)
          Sets the number of columns spanned by a TableDataElement.
 TableDataElement setHeight(int height)
          Sets the height of a TableDataElement in pixels.
 TableDataElement setNoWrap(boolean val)
          Determines whether the text in the TableDataElement wraps.
 TableDataElement setRowSpan(int val)
          Sets the number of rows spanned by a TableDataElement.
 TableDataElement setVAlign(AlignType val)
          Sets the vertical alignment of a TableDataElement.
 TableDataElement setWidth(java.lang.String width)
          Sets the width of a TableDataElement in pixels or a percent of the width of the browser.
 
Methods inherited from class weblogic.html.SinglePartElement
getElement, printBody, printBody, printBody, setElement, setElement, 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

contents

protected StringElement contents

val

protected HtmlElement val
Constructor Detail

TableDataElement

public TableDataElement()
Constructs a TableDataElement object.

TableDataElement

public TableDataElement(HtmlElement elem)
Constructs a TableDataElement object with the specified HtmlElement object.

Parameters:
elem - HtmlElement

TableDataElement

public TableDataElement(java.lang.String data)
Constructs a TableDataElement object with the specified String.

Parameters:
data - String
Method Detail

getHtmlCode

protected java.lang.String getHtmlCode()

Overrides:
getHtmlCode in class ElementWithAttributes

printCR

protected boolean printCR()

Overrides:
printCR in class ElementWithAttributes

getContents

public StringElement getContents()
Gets the contents of a TableDataElement as a StringElement.

Returns:
StringElement

getHtmlElement

public HtmlElement getHtmlElement()
Gets the underlying HtmlElement used to create the contents of the TableDataElement. Use this method to get at the contents of a FormElement that have been added to a TableElement.

Returns:
HtmlElement

setWidth

public TableDataElement setWidth(java.lang.String width)
Sets the width of a TableDataElement in pixels or a percent of the width of the browser.

Parameters:
width - Width as an int
Returns:
TableDataElement object

setHeight

public TableDataElement setHeight(int height)
Sets the height of a TableDataElement in pixels.

Parameters:
height - Height as an int
Returns:
TableDataElement

setAlign

public TableDataElement setAlign(AlignType val)
Sets the alignment of a TableDataElement. Valid types are left, right, center.

Parameters:
val - AlignType object
Returns:
TableDataElement object

setVAlign

public TableDataElement setVAlign(AlignType val)
Sets the vertical alignment of a TableDataElement. Valid types are top, middle, bottom, baseline.

Parameters:
val - Vertical alignment as an AlignType object
Returns:
TableDataElement object

setNoWrap

public TableDataElement setNoWrap(boolean val)
Determines whether the text in the TableDataElement wraps. If you set the NOWRAP attribute, you must use a BreakElement to specify line breaks, or the entire cell will show up as a single line.

Parameters:
val - True if the text should not wrap
Returns:
TableDataElement object

setColSpan

public TableDataElement setColSpan(int val)
Sets the number of columns spanned by a TableDataElement.

Parameters:
val - Number of columns as an int
Returns:
TableDataElement object

setRowSpan

public TableDataElement setRowSpan(int val)
Sets the number of rows spanned by a TableDataElement.

Parameters:
val - Number of rows as an int
Returns:
TableDataElement object

setBgColor

public TableDataElement setBgColor(java.lang.String color)
Sets the background color for a table data cell. Use the constants in FontElement for color names or use the hex value of an RGB color.

Parameters:
color - Constant from FontElement or RGB (hex) color
See Also:
FontElement

setBgColor

public TableDataElement setBgColor(java.awt.Color color)
Sets the background color to the specified java.awt.Color object.

Parameters:
color - Color object
Returns:
TableDataElement

setBackground

public TableDataElement setBackground(java.lang.String url)
Sets a background image for a table data cell.

Parameters:
img - URL for image

Documentation is available at
http://www.weblogic.com/docs51