www.element4solution.com

e4s.html
Class TABLE

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.E4HtmlObject
          extended by e4s.html.E4HtmlElementGeneral
              extended by e4s.html.E4HtmlElement
                  extended by e4s.html.E4HtmlElementPersistant
                      extended by e4s.html.TABLE
All Implemented Interfaces:
E4HtmlElement_Intf
Direct Known Subclasses:
E4ModuleEditingHandling02.buttonLine, E4SortedList

public class TABLE
extends E4HtmlElementPersistant
implements E4HtmlElement_Intf

<TABLE>-tag representation. The TABLE element is intended to display data layouted in HTML tables. It has nothing to do with a database table. Each table consists of rows (<TR;gt;) and each row consists of cells (<TD;gt;).

Example_Table.java

Since:
JDK 1.4
See Also:
TR, TD, E4TableColGroup, Align

Nested Class Summary
static class TABLE.E4TableElement
          Abstract class for TFOOT, THEAD or TBODY
static class TABLE.TBODY
          Table Body
static class TABLE.TFOOT
          Table Foot
static class TABLE.THEAD
          Table Header
 
Field Summary
static STYLE_Name DEFAULTSTYLE
           
static java.lang.String HTML_TAG
           
 
Fields inherited from class e4s.html.E4HtmlElementGeneral
m_elements, m_needed_scripts
 
Fields inherited from class e4s.html.E4HtmlObject
m_parent_e4sID
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
TABLE()
           
TABLE(E4ID parent_id)
           
TABLE(E4ID parent_id, STYLE_Name parent_style)
           
TABLE(E4ID parent_id, TABLE template)
          Create a TABLE object using the parameters from the given table object template.
TABLE(STYLE_Name parent_style)
           
TABLE(TABLE template)
          Create a TABLE object using the parameters from the given table object template.
 
Method Summary
static java.lang.String _getSVNVersionString()
          Get version info string from subversion.
 void addElement(E4HtmlElement_Intf element)
          Adds an element to the internal Vector.
static TABLE E4S_DEFAULT_TABLE()
          Get a default table layout which contains a small gray border and font ARIAL.
 E4Color getBgColor()
           
 IMG getBgImage()
           
 boolean getBorder()
           
 E4Color getBorderColor()
           
 E4Color getCellBgColor()
          Get the background color for the cell (not the table).
 FONT getFONT()
           
 void Header(E4Label_Intf[] header)
          Make a header row containing the specified labels, using E4Color.LIGHT_GRAY for the background color.
 void Header(E4Label_Intf[] header, CLASS_Name classname)
          Make a header row containing the specified labels.
 void Header(E4Label_Intf[] header, E4Color bgcolor)
          Make a header row containing the specified labels.
 void Header(E4Label_Intf[] header, E4Color bgcolor, CLASS_Name classname)
          Make a header row containing the specified labels untranslated.
 void Header(E4LabelsVec header)
          Make a header row containing the specified labels, using E4Color.LIGHT_GREY for the background color.
 void Header(E4LabelsVec header, CLASS_Name classname)
          Make a header row containing the specified labels.
 void Header(E4LabelsVec header, E4Color bgcolor)
          Make a header row containing the specified labels.
 void Header(E4LabelsVec header, E4Color bgcolor, CLASS_Name classname)
          Make a header row containing the specified labels untranslated.
 void Header(java.lang.String[] header)
          Make a header row containing the specified labels untranslated.
 void Header(java.lang.String[] header, CLASS_Name classname)
          Make a header row containing the specified labels untranslated.
 void Header(java.lang.String[] header, E4Color bgcolor)
          Make a header row containing the specified labels untranslated.
 void Header(java.lang.String[] header, E4Color bgcolor, CLASS_Name classname)
          Make a header row containing the specified labels untranslated.
 void Header(java.util.Vector vHeader, CLASS_Name classname)
          Make a header row containing the specified labels untranslated.
 void insertRow(TR tr, int n)
          Insert the TR element within the elements vector at the specified position, works only in the TBODY section.
 void removeElements()
          Remove all elements.
 void removeElements(java.lang.Class clazz)
          Remove all elements after and including a specified class.
 void reorderColumns(int[] idx)
           
 void setBgColor(E4Color color)
           
 void setBgImage(IMG image)
           
 void setBorder()
           
 void setBorderColor(E4Color color)
           
 void setBorderColor(int red, int green, int blue)
          Set the color for the border.
 void setCellBgColor(E4Color color)
          Set the background color for the cell (not the table).
 void setCellpadding(int cellpadding)
           
 void setCellspacing(int cellspacing)
           
 void setCellspacing(int cellspacing, int cellpadding)
           
 void setColGroup(E4TableColGroup[] colgroup)
           
 void setFONT(FONT font)
           
 void setHeight(float height)
          Set the table height in pixel.
 void setHeight(int height)
          Set the table height in pixel.
 void setHeightMax()
           
 void setHeightMaximum()
          Deprecated.  
 void setHeightPercentage(int percentage)
          Deprecated.  
 void setHeightPixel(int pixels)
          Deprecated.  
 void setId(java.lang.String id)
          Define an ID for the table tag.
 void setSTYLE(CLASS_Name class_name)
           
 void setWidth(float width)
          Set the table width in pixel.
 void setWidth(int width)
          Set the table width in pixel.
 void setWidthMax()
           
 void setWidthMaximum()
          Deprecated.  
 void setWidthPercentage(int percentage)
          Deprecated.  
 void setWidthPixel(int pixels)
          Deprecated.  
 void swapColumns(int a, int b)
          Changes two elements within all TR in this table.
 TABLE.TBODY TBODY()
           
 TD[] TD(int cols)
          Add a TR and add a 1-dimensional array of TD elements.
 TD[][] TD(int rows, int cols)
          Create a 2-dimensional array of TD elements.
 TABLE.TFOOT TFOOT()
           
 TABLE.THEAD THEAD()
           
 void toHtml(E4StringBufferHtml buf, E4ServletImplementation_Intf servlet)
          Create the HTML output for this element.
 TR TR()
          Adds a TR element to the TBODY-section of that table.
 void twoColumns(E4Label_Intf c1, int c2)
          Create a TD including two columns.
 void twoColumns(E4Label_Intf c1, java.lang.String c2)
          Create a TD including two columns.
 void twoColumns(java.lang.String c1, int c2)
          Create a TD including two columns.
 void twoColumns(java.lang.String c1, java.lang.String c2)
          Create a TD including two columns.
 
Methods inherited from class e4s.html.E4HtmlElementPersistant
preventFromRemoving, preventFromRemoving, removeAll
 
Methods inherited from class e4s.html.E4HtmlElement
addElement, addElement, copyElements, print
 
Methods inherited from class e4s.html.E4HtmlElementGeneral
addScript, addScript, addScript, addStyleForEditing, addTranslationForEditing, buildStyleAttribute, buildStyleClassReference, collectScripts, collectStylesForEditing, collectStylesForEditing, collectStylesForEditing, collectTranslationsForEditing, collectTranslationsForEditing, createScript, createScript, debugToString, findElement, findElement, findElement, findElement, getElements, getElementsVec, getField, getId, getLastElement, getStringContent, getStyle, getSTYLE, getStyle, hasScripts, hasSTYLE, isContentClass, isE4InputField_Intf, openTag, removeElementById, removeStyle, setId, setReadOnly, setStyle, setStyle, setSTYLE, setValue, Style, Style, toHtml_hidden, validate
 
Methods inherited from class e4s.html.E4HtmlObject
E4ID, E4ID, set_e4sID
 
Methods inherited from class e4s.util.E4Object
Calendar, CName, CName, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelApp, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelNone, E4LabelSys, E4LabelSys, e4sCopyright, e4sVersion, encode, encode, encode, encodeHtml, encodeHtml, encodeHtml, encodeURL, encodeURL, encodeURL, finalize, getLINE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTRACE, getTraceMemory, HtmlEncode, HtmlEncode, HtmlEncode, isdecimal, isdigit, isnotok, isnotok, isnumeric, isok, isok, isok, isok, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingFunction, lastCallingStack, mkdirs, null2nbsp, null2nbsp, null2nbsp, ok, ok, ok, ok, outPrintln, setLogFile4Trace, setTraceMemory, STACKTRACE, toDebug, toDouble, toFloat, toFloat, toString, TRACE_CALLS, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, TRACE, wait
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface e4s.html.E4HtmlElement_Intf
addScript, addScript, addScript, collectScripts, collectStylesForEditing, collectTranslationsForEditing, debugToString, findElement, findElement, getElements, getElementsVec, getField, getId, getStringContent, isContentClass, removeAll, removeElementById, set_e4sID, setId, setReadOnly, setValue, toHtml_hidden, validate
 

Field Detail

HTML_TAG

public static final java.lang.String HTML_TAG
See Also:
Constant Field Values

DEFAULTSTYLE

public static final STYLE_Name DEFAULTSTYLE
Constructor Detail

TABLE

public TABLE(E4ID parent_id,
             STYLE_Name parent_style)

TABLE

public TABLE(STYLE_Name parent_style)

TABLE

public TABLE(E4ID parent_id)

TABLE

public TABLE()

TABLE

public TABLE(E4ID parent_id,
             TABLE template)
Create a TABLE object using the parameters from the given table object template.

Parameters:
parent_id - the ID of the parent object.
template - a defined TABLE object, it might be empty or not. Any data will not be copied to the new created instance of TABLE, except definition parameters.

TABLE

public TABLE(TABLE template)
Create a TABLE object using the parameters from the given table object template.

Parameters:
template - a defined TABLE object, it might be empty or not. Any data will not be copied to the new created instance of TABLE, except definition parameters.
Method Detail

removeElements

public void removeElements(java.lang.Class clazz)
Description copied from class: E4HtmlElementGeneral
Remove all elements after and including a specified class. Example: if your DOM looks like <TABLE><TR><TD><TR><TD> then a call to removeElements(TD.class) would remove both <TD> entries.

Specified by:
removeElements in interface E4HtmlElement_Intf
Overrides:
removeElements in class E4HtmlElementGeneral
Parameters:
clazz - the class to be removed
See Also:
E4HtmlElementGeneral.removeElements()

removeElements

public void removeElements()
Description copied from class: E4HtmlElementGeneral
Remove all elements.

Overrides:
removeElements in class E4HtmlElementGeneral

setSTYLE

public void setSTYLE(CLASS_Name class_name)

setFONT

public void setFONT(FONT font)

getFONT

public FONT getFONT()

setBgImage

public void setBgImage(IMG image)

getBgImage

public IMG getBgImage()

setBorder

public void setBorder()

getBorder

public boolean getBorder()

setCellspacing

public void setCellspacing(int cellspacing,
                           int cellpadding)

setCellspacing

public void setCellspacing(int cellspacing)

setCellpadding

public void setCellpadding(int cellpadding)

setBgColor

public void setBgColor(E4Color color)

getBgColor

public E4Color getBgColor()

setCellBgColor

public void setCellBgColor(E4Color color)
Set the background color for the cell (not the table).

See Also:
TR.setBgColor(e4s.html.E4Color), getCellBgColor(), setBgColor(e4s.html.E4Color), setBorderColor(e4s.html.E4Color)

getCellBgColor

public E4Color getCellBgColor()
Get the background color for the cell (not the table).

See Also:
TR.getBgColor(), setCellBgColor(e4s.html.E4Color), getBgColor(), getBorderColor()

setBorderColor

public void setBorderColor(E4Color color)

getBorderColor

public E4Color getBorderColor()

setWidthPercentage

public void setWidthPercentage(int percentage)
Deprecated. 

See Also:
setWidth(float)

setWidthMax

public void setWidthMax()

setWidthMaximum

public void setWidthMaximum()
Deprecated. 

See Also:
setWidthMax()

setWidthPixel

public void setWidthPixel(int pixels)
Deprecated. 

See Also:
setWidth(int)

setWidth

public void setWidth(int width)
Set the table width in pixel.

Parameters:
width - a value for the width in pixel
See Also:
setWidthMax(), setWidth(float), setHeight(int)

setWidth

public void setWidth(float width)
Set the table width in pixel.

Parameters:
width - a value for the width in percent, between 0.0f and 1.0f
See Also:
setWidthMax(), setWidth(float)

setHeightPercentage

public void setHeightPercentage(int percentage)
Deprecated. 


setHeightMaximum

public void setHeightMaximum()
Deprecated. 

See Also:
setHeightMax()

setHeightMax

public void setHeightMax()

setHeight

public void setHeight(int height)
Set the table height in pixel.

Parameters:
height - a value for the height in pixel
See Also:
setWidthMax(), setHeight(float), setWidth(int)

setHeight

public void setHeight(float height)
Set the table height in pixel.

Parameters:
height - a value for the height in percent, between 0.0f and 1.0f
See Also:
setWidthMax(), setHeight(float)

setHeightPixel

public void setHeightPixel(int pixels)
Deprecated. 


setBorderColor

public void setBorderColor(int red,
                           int green,
                           int blue)
Set the color for the border.

Parameters:
red - 0 <= red <= 0xFF
green - 0 <= green <= 0xFF
blue - 0 <= blue <= 0xFF

setColGroup

public void setColGroup(E4TableColGroup[] colgroup)

TR

public TR TR()
Adds a TR element to the TBODY-section of that table. To force other sections, you might use THEAD() or TFOOT().

Returns:
the new created and added TR element

addElement

public void addElement(E4HtmlElement_Intf element)
Description copied from class: E4HtmlElement
Adds an element to the internal Vector.

Overrides:
addElement in class E4HtmlElement
Parameters:
element - the element to be added

toHtml

public void toHtml(E4StringBufferHtml buf,
                   E4ServletImplementation_Intf servlet)
            throws java.lang.Exception
Description copied from interface: E4HtmlElement_Intf
Create the HTML output for this element. Also run throught all child elements, and call their E4HtmlElement_Intf.toHtml(e4s.util.E4StringBufferHtml, e4s.servlet.E4ServletImplementation_Intf) function to generate output of those objects which becomes appended. Normally, there is no need to call this function anyway, and this also might result in side effects of too-early relasing of objects in some cases. This function is called by E4ServletImplementation_Intf.write(e4s.html.E4HtmlElement) on the top level HTML element (common this is a HTML or BODY element) and branches down to all child elements.

Specified by:
toHtml in interface E4HtmlElement_Intf
Overrides:
toHtml in class E4HtmlElementGeneral
servlet - the servlet environment currently running in
Throws:
java.lang.Exception

twoColumns

public void twoColumns(java.lang.String c1,
                       java.lang.String c2)
Create a TD including two columns. This function is useful for common table outputs that require a label on the left side and a value for the right side.

Parameters:
c1 - is printed into the first column
c2 - is printed into the second column

twoColumns

public void twoColumns(E4Label_Intf c1,
                       java.lang.String c2)
Create a TD including two columns. This function is useful for common table outputs that require a label on the left side and a value for the right side.

Parameters:
c1 - is printed into the first column
c2 - is printed into the second column

twoColumns

public void twoColumns(java.lang.String c1,
                       int c2)
Create a TD including two columns. This function is useful for common table outputs that require a label on the left side and a value for the right side.

Parameters:
c1 - is printed into the first column
c2 - is printed into the second column

twoColumns

public void twoColumns(E4Label_Intf c1,
                       int c2)
Create a TD including two columns. This function is useful for common table outputs that require a label on the left side and a value for the right side.

Parameters:
c1 - is printed into the first column
c2 - is printed into the second column

E4S_DEFAULT_TABLE

public static TABLE E4S_DEFAULT_TABLE()
Get a default table layout which contains a small gray border and font ARIAL. Usage: e.g. BODY.TABLE(E2S_DEFAULT_TABLE());

Returns:
the table element

Header

public void Header(java.lang.String[] header,
                   CLASS_Name classname)
Make a header row containing the specified labels untranslated.

Parameters:
header - an array of header labels
classname - a E4CSS class for the header (might be null)
See Also:
Header(java.lang.String[], e4s.html.style.CLASS_Name)

Header

public void Header(java.lang.String[] header,
                   E4Color bgcolor)
Make a header row containing the specified labels untranslated.

Parameters:
header - an array of header labels
bgcolor - a color for the header (might be null)
See Also:
Header(java.lang.String[], e4s.html.style.CLASS_Name)

Header

public void Header(java.lang.String[] header)
Make a header row containing the specified labels untranslated. Uses E4Color.LIGHT_GREY as color and no css-style.

Parameters:
header - an array of header labels
See Also:
Header(java.lang.String[], e4s.html.style.CLASS_Name)

Header

public void Header(java.lang.String[] header,
                   E4Color bgcolor,
                   CLASS_Name classname)
Make a header row containing the specified labels untranslated.

Parameters:
header - an array of header labels
bgcolor - a color for the header (might be null)
classname - a E4CSS class for the header (might be null)
See Also:
Header(java.lang.String[], e4s.html.style.CLASS_Name)

Header

public void Header(java.util.Vector vHeader,
                   CLASS_Name classname)
Make a header row containing the specified labels untranslated.

Parameters:
vHeader - a vector of header labels (objects of type String, E4Label_Intf or E4String)
classname - a E4CSS class for the header (might be null)

Header

public void Header(E4Label_Intf[] header,
                   CLASS_Name classname)
Make a header row containing the specified labels.

Parameters:
header - an array of header labels
classname - a E4CSS class for the header (might be null)
See Also:
Header( e4s.translate.E4LabelsVec, e4s.html.style.CLASS_Name )

Header

public void Header(E4LabelsVec header,
                   CLASS_Name classname)
Make a header row containing the specified labels.

Parameters:
header - a vector of header labels
classname - a E4CSS class for the header (might be null)
See Also:
Header( e4s.translate.E4Label_Intf[], e4s.html.style.CLASS_Name )

Header

public void Header(E4Label_Intf[] header,
                   E4Color bgcolor)
Make a header row containing the specified labels.

Parameters:
header - an array of header labels
bgcolor - a color for the header (might be null)
See Also:
Header( e4s.translate.E4LabelsVec, e4s.html.E4Color )

Header

public void Header(E4LabelsVec header,
                   E4Color bgcolor)
Make a header row containing the specified labels.

Parameters:
header - an array of header labels
bgcolor - a color for the header (might be null)
See Also:
Header( e4s.translate.E4Label_Intf[], e4s.html.E4Color )

Header

public void Header(E4LabelsVec header)
Make a header row containing the specified labels, using E4Color.LIGHT_GREY for the background color.

Parameters:
header - a vector of header labels
See Also:
Header( e4s.translate.E4Label_Intf[] )

Header

public void Header(E4Label_Intf[] header)
Make a header row containing the specified labels, using E4Color.LIGHT_GRAY for the background color.

Parameters:
header - an array of header labels
See Also:
Header( e4s.translate.E4LabelsVec )

Header

public void Header(E4Label_Intf[] header,
                   E4Color bgcolor,
                   CLASS_Name classname)
Make a header row containing the specified labels untranslated.

Parameters:
header - an array of header labels
bgcolor - a color for the header (might be null)
classname - a E4CSS class for the header (might be null)

Header

public void Header(E4LabelsVec header,
                   E4Color bgcolor,
                   CLASS_Name classname)
Make a header row containing the specified labels untranslated.

Parameters:
header - a vector of header labels
bgcolor - a color for the header (might be null)
classname - a E4CSS class for the header (might be null)

TD

public TD[][] TD(int rows,
                 int cols)
Create a 2-dimensional array of TD elements. To access an element, use row for first index, cols for second.

Parameters:
rows - the number of rows
cols - the number of columns
Returns:
the TD array.
See Also:
TR(), TR.TD()

TD

public TD[] TD(int cols)
Add a TR and add a 1-dimensional array of TD elements. To access an element, use index for the column.

Parameters:
cols - the number of columns
Returns:
the TD array.
See Also:
TD(int,int), TR(), TR.TD(int)

insertRow

public void insertRow(TR tr,
                      int n)
Insert the TR element within the elements vector at the specified position, works only in the TBODY section.

Parameters:
tr - the TR element to be inserted
n - the index (starting at 0)
See Also:
E4ElementsVec.insertElementAt(e4s.html.E4HtmlElement_Intf, int)

setId

public void setId(java.lang.String id)
Define an ID for the table tag.


THEAD

public TABLE.THEAD THEAD()

TFOOT

public TABLE.TFOOT TFOOT()

TBODY

public TABLE.TBODY TBODY()

reorderColumns

public void reorderColumns(int[] idx)

swapColumns

public void swapColumns(int a,
                        int b)
Changes two elements within all TR in this table.

Parameters:
a - index of the fist element
b - index of the second element
See Also:
TR.swapColumns(int,int)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()
Get version info string from subversion.

Returns:
the version info string.
See Also:
E4Util.getRevisionCodeFromSVN(Class)

www.element4solution.com