www.element4solution.com

e4s.html.ajax
Class E4AjaxTable

java.lang.Object
  extended by e4s.util.E4Object
      extended by e4s.html.ajax.E4AjaxData
          extended by e4s.html.ajax.E4AjaxTable
All Implemented Interfaces:
E4AjaxData_Intf

public abstract class E4AjaxTable
extends E4AjaxData
implements E4AjaxData_Intf

Provide an ajax based table that provides paging, change columns and sorting. Requires an implementing instance or an above class around. $LastChangedDate: 2009-04-20 14:28:18 +0200 (Mo, 20 Apr 2009) $ $LastChangedRevision: 4244 $ $LastChangedBy: robert $

Example_E4AjaxTable.java


Nested Class Summary
static class E4AjaxTable.E4AjaxTableColumn
           
 
Field Summary
 
Fields inherited from class e4s.util.E4Object
CRLF, E4S_CORE_SYSTEM_LANGUAGE, NBSP, NULLSTR, URL_ENCODING_CHARSET
 
Constructor Summary
E4AjaxTable(java.lang.String id)
           
 
Method Summary
static java.lang.String _getSVNVersionString()
           
 void changeSort(int column, boolean ascending)
          Do not call this function.
 void collectScripts(E4ScriptsVec vec, E4ServletImplementation_Intf servlet)
          This is an empty implementation.
 void collectStylesForEditing(E4StylesHash h, E4ServletImplementation_Intf servlet)
          This is an empty implementation.
 void collectTranslationsForEditing(E4TranslationsVec vec, E4ServletImplementation_Intf servlet)
          This is an empty implementation.
 void defineColumn(E4AjaxTable.E4AjaxTableColumn col)
          Add a column (header) to the column layout structure.
 E4AjaxTable.E4AjaxTableColumn defineColumn(E4Label_Intf caption)
          Add a column (header) to the column layout structure.
 E4AjaxTable.E4AjaxTableColumn defineColumn(E4Label_Intf caption, Align align)
          Add a column (header) to the column layout structure.
 void drawCaption(TD td)
           
 int getActualPage()
          Get the actual page
abstract  void getData(TD td, int row, int col, E4ServletImplementation_Intf servlet)
           
 java.lang.String getDivId()
          This is the ID assoziated with the DIV element that holds the E4Ajax content and which is used as key within the E4AjaxDataRepository.
 E4JavaScript getJsForceReload(E4ServletImplementation_Intf servlet)
          Provides a script that fordes the table to reload (resets table content for new rendering and calls Ajax request).
 E4JavaScript getJsPage(E4ServletImplementation_Intf servlet)
          Provide a JavaScript that enables switsching to a particular page
abstract  int getNumRows()
          This method must be implemented in the above implementation to define the number of data rows.
 int getPageSize()
           
 boolean isSortingEnabled()
          Check, if sorting is enabled
 void setCaption(E4Label_Intf caption)
          Define a caption that is drawn on top of the table
 void setCellpadding(int cellpadding)
          Set the cellpadding attribute for the main table (default = 1).
 void setCellspacing(int cellspacing)
          Set the cellspacing attribute for the main table (default = 0).
 void setEnableChangeColumnOrder(boolean change_column_order)
           
 void setEnableSorting(boolean sorting)
          Define, if sorting is enabled.
 void setPageSize(int pagesize)
          Set the size for one display page
 void setSTYLE(CLASS_Name style)
           
 void setStyleCaption(CLASS_Name classname)
          Define a CSS class for the caption.
 void toHtml(E4StringBufferHtml buf, E4CgiParams params, E4ServletImplementation_Intf servlet, boolean initialLoad)
          Use provided classes e.g.
 
Methods inherited from class e4s.html.ajax.E4AjaxData
finalize, getSendReqScript, getSendReqScriptGeneric, getTrace, removeRemarksInHtml, runWithoutLogin, setAjaxElement, validate
 
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, 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.ajax.E4AjaxData_Intf
getTrace, removeRemarksInHtml, runWithoutLogin, setAjaxElement, validate
 

Constructor Detail

E4AjaxTable

public E4AjaxTable(java.lang.String id)
Method Detail

setStyleCaption

public void setStyleCaption(CLASS_Name classname)
Define a CSS class for the caption.

Parameters:
classname - the CSS class
See Also:
setCaption(E4Label_Intf)

setCaption

public void setCaption(E4Label_Intf caption)
Define a caption that is drawn on top of the table

Parameters:
caption - the caption, or null if any caption shall be removed
See Also:
setStyleCaption(CLASS_Name)

setEnableChangeColumnOrder

public void setEnableChangeColumnOrder(boolean change_column_order)

setEnableSorting

public void setEnableSorting(boolean sorting)
Define, if sorting is enabled.

Parameters:
sorting - true enables sorting. If so, function changeSort(int, boolean) must be overridden.
See Also:
changeSort(int, boolean), isSortingEnabled(), setEnableChangeColumnOrder(boolean)

isSortingEnabled

public boolean isSortingEnabled()
Check, if sorting is enabled

Returns:
true, if sorting is enabled

setPageSize

public void setPageSize(int pagesize)
Set the size for one display page

Parameters:
pagesize - size of the page

getActualPage

public int getActualPage()
Get the actual page


setCellspacing

public void setCellspacing(int cellspacing)
Set the cellspacing attribute for the main table (default = 0).

See Also:
setCellpadding(int)

setCellpadding

public void setCellpadding(int cellpadding)
Set the cellpadding attribute for the main table (default = 1).

See Also:
setCellspacing(int)

setSTYLE

public void setSTYLE(CLASS_Name style)

getPageSize

public int getPageSize()

getDivId

public java.lang.String getDivId()
Description copied from interface: E4AjaxData_Intf
This is the ID assoziated with the DIV element that holds the E4Ajax content and which is used as key within the E4AjaxDataRepository. This key must be unique within one user session. You also can use getClass().getName() as ID if each data class is unique and will represent a value unique within the session.

Specified by:
getDivId in interface E4AjaxData_Intf
Returns:
the ID

toHtml

public void toHtml(E4StringBufferHtml buf,
                   E4CgiParams params,
                   E4ServletImplementation_Intf servlet,
                   boolean initialLoad)
            throws java.lang.Exception
Description copied from interface: E4AjaxData_Intf
Use provided classes e.g. e4s.html.ajax.aTABLE for building the HTML output. E4Ajax output is more tricky rather than normal HTML output as the browser's DOM (document object model) is involved directly. This is the reason, why the "normal" classes like TABLE shall not be used here.

Specified by:
toHtml in interface E4AjaxData_Intf
Parameters:
buf - the buffer collecting all the output stuff (rendering results).
params - the parameters filled into the form, if applicable, or null.
servlet - the servlet's context, useful for e.g. determining the user or application object in the need of database requests.
Throws:
java.lang.Exception
See Also:
e4s.html.ajax.aTABLE#toHtml, e4s.html.ajax.aA#toHtml, e4s.html.ajax.aB#toHtml, e4s.html.ajax.aI#toHtml, e4s.html.ajax.aFONT#toHtml

drawCaption

public void drawCaption(TD td)

getJsPage

public E4JavaScript getJsPage(E4ServletImplementation_Intf servlet)
Provide a JavaScript that enables switsching to a particular page

Returns:
the script
See Also:
getActualPage(), getJsForceReload(e4s.servlet.E4ServletImplementation_Intf)

getJsForceReload

public E4JavaScript getJsForceReload(E4ServletImplementation_Intf servlet)
Provides a script that fordes the table to reload (resets table content for new rendering and calls Ajax request).

Parameters:
servlet - a valid servlet context
Returns:
the script for reloading

defineColumn

public E4AjaxTable.E4AjaxTableColumn defineColumn(E4Label_Intf caption,
                                                  Align align)
Add a column (header) to the column layout structure. This function must be called after instanciating the class.

Parameters:
caption - a label for the caption
align - define an alignment for the column
See Also:
defineColumn(e4s.translate.E4Label_Intf, e4s.html.Align), defineColumn(E4AjaxTableColumn)

defineColumn

public E4AjaxTable.E4AjaxTableColumn defineColumn(E4Label_Intf caption)
Add a column (header) to the column layout structure. This function must be called after instanciating the class.

Parameters:
caption - a label for the caption
See Also:
defineColumn(e4s.translate.E4Label_Intf, e4s.html.Align), defineColumn(E4AjaxTableColumn)

defineColumn

public void defineColumn(E4AjaxTable.E4AjaxTableColumn col)
Add a column (header) to the column layout structure. This function must be called after instanciating the class.

Parameters:
col - the column definition
See Also:
defineColumn(e4s.translate.E4Label_Intf, e4s.html.Align), defineColumn(e4s.translate.E4Label_Intf)

collectScripts

public void collectScripts(E4ScriptsVec vec,
                           E4ServletImplementation_Intf servlet)
Description copied from class: E4AjaxData
This is an empty implementation.

Specified by:
collectScripts in interface E4AjaxData_Intf
Overrides:
collectScripts in class E4AjaxData
Parameters:
vec - the script vector
servlet - the servlet's context

collectTranslationsForEditing

public void collectTranslationsForEditing(E4TranslationsVec vec,
                                          E4ServletImplementation_Intf servlet)
Description copied from class: E4AjaxData
This is an empty implementation.

Specified by:
collectTranslationsForEditing in interface E4AjaxData_Intf
Overrides:
collectTranslationsForEditing in class E4AjaxData
Parameters:
vec - the translations vector
servlet - the servlet's context

collectStylesForEditing

public void collectStylesForEditing(E4StylesHash h,
                                    E4ServletImplementation_Intf servlet)
Description copied from class: E4AjaxData
This is an empty implementation.

Specified by:
collectStylesForEditing in interface E4AjaxData_Intf
Overrides:
collectStylesForEditing in class E4AjaxData
Parameters:
h - the styles collection
servlet - the servlet's context

getNumRows

public abstract int getNumRows()
This method must be implemented in the above implementation to define the number of data rows.

Returns:
the numer of rows.

getData

public abstract void getData(TD td,
                             int row,
                             int col,
                             E4ServletImplementation_Intf servlet)

changeSort

public void changeSort(int column,
                       boolean ascending)
Do not call this function. It must be overridden by the above implementing class. It will only be called, when the user clicks on one of the sort buttons, which requires sorting beeing enabled.

Parameters:
column - the actual column
ascending - sort ascending if true
See Also:
setEnableSorting(boolean)

_getSVNVersionString

public static java.lang.String _getSVNVersionString()

www.element4solution.com