wheel.components
Class Table

java.lang.Object
  extended by wheel.components.Component
      extended by wheel.components.RenderableComponent
          extended by wheel.components.Table
All Implemented Interfaces:
IContainer

public class Table
extends RenderableComponent
implements IContainer

An XHTML-table that uses thead, tbody and tfoot. Supports all table-features like colgroups, caption, headers and footers. An example:

 table().attribute("border", "2").
      caption().label("Table caption").up(2).

      thead().
          tr().
              th().label("column1").up(2).
              th().label("column2").up(2).
              th().label("column3").up(4).
      tbody().
          tr().
              td().p("Column1 content").up(2).
              td().p("Column2 content").up(2).
              td().p("Column3 content").up(4).
      tfoot().
          tr().
              td().label("footer text");

 
Note that you can insert any component you like (as long as following xhtml rules) at any point. Here's a brief example of creating a traditional (and not so recommended) border table layout:
 table().
      tbody().
          tr().
              td().placeholder("north").up(3).
          tr().
              td().placeholder("west").up(2).
              td().placeholder("center").up(2).
              td().placeholder("east").up(3).
          tr().
              td().placeholder("south");
 
To access the layout you can do this:
get("center")
Its also easy to store the placeholder in a variable and pass it around or make it inheritable.

Author:
Henri Frilund

Method Summary
 void _clear()
          Inteded for internal use.
 Component caption()
           
 TableBlock colgroup()
          Adds a colgroup-element to a surrounding Table-component.
 java.lang.String defaultTagName()
          Subclasses must implement this.
 Table id(java.lang.String componentId)
          Changes the componentId.
 void renderComponent(org.xmlpull.v1.XmlSerializer serializer)
          Default implementation that will render all renderable child components that this component has.
 Table renderHint(java.lang.CharSequence renderHint)
          Adds a rendering hint to this component.
 TableBlock tbody()
          Adds a tbody-element to a surrounding Table-component.
 TableBlock tfoot()
          Adds a tfoot-element to a surrounding Table-component.
 TableBlock thead()
          Adds a thead-element to a surrounding Table-component.
 
Methods inherited from class wheel.components.RenderableComponent
_classReferenceFromHints, _getRenderAfterMe, _getRenderBeforeMe, _render, _renderActions, _renderClassReferenceFromHints, _renderTagStart, _renderXhtmlAttributes, addRenderAfter, addRenderBefore, config, defaultDomEvent, getTagName, toString
 
Methods inherited from class wheel.components.Component
_applyFormat, _getAction, _getActions, _getChildren, _getForm, _getRenderableChildren, _getRenderHints, _getTopLevelComponent, _getVisibleForm, _getXhtmlAttributes, _isGeneratedId, _setComponentId, _setGeneratedId, _wrapComponentId, a, a, abbr, abbr, acronym, acronym, action, actionBinding, actionBinding, add, addFirst, address, address, afterAdd, area, attribute, attributes, b, b, base, bdo, big, big, blockquote, br, button, checkbox, checkboxGroup, cite, cite, clasS, col, create, dateInput, dd, dd, del, del, dfn, dfn, div, dl, dt, dt, el, em, em, encode, entity, equals, eval, fieldset, fileInput, fileInput, find, findAll, form, form, frame, frameset, get, getComponentId, getComponentName, getComponents, getEngine, getPage, getParent, h1, h1, h2, h2, h3, h3, h4, h4, h5, h5, h6, h6, hashCode, head, hidden, hr, htmlText, i, i, iframe, img, ins, ins, kbd, kdb, label, label, legend, legend, li, li, link, link, map, message, message, meta, multiSelect, nbsp, noframes, noscript, numberInput, numberInput, object, ol, p, p, param, placeholder, pre, pre, q, q, radio, radioGroup, rawText, remove, remove, requestFocus, s, s, samp, samp, script, select, selectModel, small, small, span, span, strike, strike, strong, strong, style, sub, sub, submit, sup, sup, table, td, text, textarea, textInput, th, title, tr, u, u, ul, up, up, var, var, wBlock, wrapSelf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

thead

public TableBlock thead()
Description copied from class: Component
Adds a thead-element to a surrounding Table-component. If the surrounding element is not a Table, thorws an exception.

Overrides:
thead in class Component
Returns:

tfoot

public TableBlock tfoot()
Description copied from class: Component
Adds a tfoot-element to a surrounding Table-component. If the surrounding element is not a Table, thorws an exception.

Overrides:
tfoot in class Component
Returns:

tbody

public TableBlock tbody()
Description copied from class: Component
Adds a tbody-element to a surrounding Table-component. If the surrounding element is not a Table, thorws an exception.

Overrides:
tbody in class Component
Returns:

caption

public Component caption()
Overrides:
caption in class Component

colgroup

public TableBlock colgroup()
Description copied from class: Component
Adds a colgroup-element to a surrounding Table-component. If the surrounding element is not a Table, thorws an exception.

Overrides:
colgroup in class Component
Returns:

defaultTagName

public java.lang.String defaultTagName()
Description copied from class: RenderableComponent
Subclasses must implement this. If no xhtml tagname can be resolved from rendering hints, will default to value returned by this method.

Specified by:
defaultTagName in class RenderableComponent
Returns:

renderComponent

public void renderComponent(org.xmlpull.v1.XmlSerializer serializer)
                     throws java.io.IOException
Description copied from class: RenderableComponent
Default implementation that will render all renderable child components that this component has. Subclasses should override this method if necessary.

Overrides:
renderComponent in class RenderableComponent
Throws:
java.io.IOException

id

public Table id(java.lang.String componentId)
Description copied from class: Component
Changes the componentId.

Overrides:
id in class Component
Parameters:
componentId - New component id.
Returns:

renderHint

public Table renderHint(java.lang.CharSequence renderHint)
Description copied from class: Component
Adds a rendering hint to this component. A rendering hint can be either a css class reference or a xhtml specification tag name. Many rendering hints can be given in one input string. Example: "h1 error" will cause the component to render as <h1 class="error">. Note that the html tag name doesn't have to be first.

Overrides:
renderHint in class Component
Returns:
Will return the component itself to enable method chaining.

_clear

public void _clear()
Description copied from class: Component
Inteded for internal use. Clears all attributes and child components.

Overrides:
_clear in class RenderableComponent


Copyright © 2007-2008. All Rights Reserved.