LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.view.web.struts
Class LyStrutsTable

java.lang.Object
  extended by leon.view.graphic.LyGraphicalObject
      extended by leon.view.web.LyWebObject
          extended by leon.view.web.struts.LyStrutsFieldItem
              extended by leon.view.web.struts.LyStrutsPanel
                  extended by leon.view.web.struts.LyStrutsTable
All Implemented Interfaces:
LyGraphicalComponent, LyGraphicalFieldItem, LyGraphicalPanel, LyGraphicalTable, LyViewComponent, LyFreeInterface, LySetEnabledInterface, LySetIdleInterface, LySetLabelInterface, LySetPopupMenuInterface, LySetTableInterface, LySetVisibleInterface, LyWebComponent

public class LyStrutsTable
extends LyStrutsPanel
implements LyGraphicalTable, LySetVisibleInterface, LySetTableInterface, LySetIdleInterface

This class implements the Table object (as described in the dtd) for web viewer.

TABLE: Table
A table allows displaying a set of rows and columns containing a set of cells. It can contain a header providing information about the content of the cells of the list. It is possible to define its selection modes (simple, extended, multiple or none) and finally to indicate if horizontal and/or vertical separation lines should be drawn.


Field Summary
static java.lang.String __VERSION
           
static boolean DISABLE_TEXT_SELECTION
          Indicates whether text selection must be disabled.
static java.lang.String EXTEND_SORT
          The extend_sort String value.
static java.lang.String EXTEND_SORT_IMAGE
          The extend_sort_image String value.
static java.lang.String SELECT_ALL
          The select_all String value.
 
Fields inherited from class leon.view.web.LyWebObject
WEB_COMPONENT_ID, WEB_CONTROLLER_ID, WEB_SESSION_ID
 
Constructor Summary
LyStrutsTable(LyTable table)
          Constructor.
 
Method Summary
 boolean addLastCell(LyWebPageWriter pw)
          Indicates if an empty cell must be added at the end of each row.
 void addRow(LyRow row)
          Adds the given row at the end of the current table.
 void addRow(LyRow row, int idx)
          Adds the given row at the given position in the current table.
 boolean allowExtendedSort()
          Computes if we can have an extended sort (more than one header with sort enable).
 boolean drawImages()
          Indicates if images must be drawn.
 void freezeColumn(int idx)
          Freezes the column at the given index in the view.
 boolean generateExternalBorder(LyWebPageWriter pw)
          Indicates whether an external border must be generated for this table.
 java.lang.String getAdditionalStyle()
          Computes an additional style for the table.
 java.lang.String getDefaultAction(LyWebPageWriter pw)
          (non-Javadoc).
 java.lang.String getExpandRowAction(LyWebPageWriter pw)
          Gets the expand row action and writes associated javascript function for this table.
 java.lang.String getHRefAction(LyWebPageWriter pw)
          Gets the href action and writes associated javascript function for this table.
static java.lang.String getHtmlHAligment(LyHeader.Align alignCode)
          Gets the HTML horizontal alignment string corresponding to the LyHeader alignment.
 LyRow getRow(int i)
          Gets the row at the specified position.
 int getScrollHeightForSplitter(LyWebPageWriter pw)
          Indicates whether this component needs scrollbars when inserted in a splitter.
 java.lang.String getSelectionAction(LyWebPageWriter pw)
          Gets the selection action javascript function name for this table.
 java.lang.String getSortAction(LyWebPageWriter pw)
          Gets the sort action and writes associated javascript function for this table.
 java.lang.String getSortActionFunction()
          Gets the sort action and writes associated javascript function for this table.
 java.lang.String getStatusAction(LyWebPageWriter pw)
          (non-Javadoc).
 java.lang.String getTableRootUrl()
          This method is overriden to redirect the SORT, HREF and EXPAND actions to the Leonardi struts 'graphical event handler'.
 java.lang.String getUpdateRowsColorsScript()
          Returns the Javascript code to be used to update table colors.
 void hideRow(int idx, boolean hide)
          Hides or show the row at the given index.
 void initialize()
          Initialization method.
 void refresh()
          Performs a refresh of the table.
 void removeRow(int idx)
          Removes the row at the given index from the current table.
 void removeRow(LyRow row)
          Removes the given row from the current table.
 void selectAll(boolean select, boolean updateView)
          Selects or unselects all objects of the table.
 void selectRow(int idx, boolean select)
          Selects or unselects the row at the given index of the table.
 void selectRow(LyRow row, boolean select)
          Selects or unselects the specified row in the table.
 void setEnabled(boolean status)
          Updates attribute enabled to the given value.
 void setFooters(LyFooters footers)
          Sets sub-component footers.
 void setHeaders(LyHeaders headers)
          Sets sub-component headers.
 void setIdle(boolean status)
          Sets or unset the idle mode on the component/node.
 void setNRows(int nRows)
          Updates attribute nRows to the given value.
 void setVisible(boolean status)
          Sets the visibility status of this component.
 void showRow(int idx)
          Scrolls to make visible to the user the row at the given index .
 boolean sortOnStatus()
          Indicates there is header for sorting status.
 void swapRows(int idx1, int idx2)
          Swaps the rows at the specified indexes.
 void updateRow(LyRow row)
          Updates the given row.
 void writeHtml(LyWebPageWriter pw)
          Write HTML description corresponding to this component.
 
Methods inherited from class leon.view.web.struts.LyStrutsPanel
getPopupMenuView, setPopupMenu
 
Methods inherited from class leon.view.web.struts.LyStrutsFieldItem
canDisabled, getCaption, getController, getFieldItem, getForm, getFormField, getFormName, getHtmlForm, getId, isEditable, isNetscape, isOptional, needCheck, setLabel
 
Methods inherited from class leon.view.web.LyWebObject
addFileScript, decodeUrl, displayUpPage, encodeUrl, encodeUrlXhtml, expandUrl, free, getDisabledImageUrl, getFontSize, getFontString, getFontString, getFontString, getHexColor, getHexColor, getHtmlEntitiesString, getHtmlString, getImageSize, getImageSize, getImageUrl, getJavascriptString, getLastFrameName, getLyFont, getMessage, getRootUrl, getRootURL, getUrl, getWebViewManager, replaceUrl, replaceUrl, setUpdating, updateRefreshInfo, writeJson
 
Methods inherited from class leon.view.graphic.LyGraphicalObject
expand, getBounds, getChildrenBounds, getEnv, getEnvironment, getIdCode, getIntResource, getMessage, getResource, getString, getString, getString, getViewComponent, getViewManager, isFreed, isFreeing, isImageAnimated, processDemand, processDemand, testResource, translate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface leon.view.graphic.LyGraphicalComponent
free, getViewComponent
 

Field Detail

__VERSION

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

EXTEND_SORT

public static final java.lang.String EXTEND_SORT
The extend_sort String value.


EXTEND_SORT_IMAGE

public static final java.lang.String EXTEND_SORT_IMAGE
The extend_sort_image String value.


SELECT_ALL

public static final java.lang.String SELECT_ALL
The select_all String value.


DISABLE_TEXT_SELECTION

public static boolean DISABLE_TEXT_SELECTION
Indicates whether text selection must be disabled.

Constructor Detail

LyStrutsTable

public LyStrutsTable(LyTable table)
Constructor.

Parameters:
table - the table component.
Method Detail

getHtmlHAligment

public static java.lang.String getHtmlHAligment(LyHeader.Align alignCode)
Gets the HTML horizontal alignment string corresponding to the LyHeader alignment.

Parameters:
alignCode - the LyHeader halign code. Possible values are LyHeader#Align.CENTER, LyHeader#Align.LEFT and LyHeader#Align.RIGHT.
Returns:
the html horizontal alignment string.

selectAll

public void selectAll(boolean select,
                      boolean updateView)
Description copied from interface: LySetTableInterface
Selects or unselects all objects of the table.

Specified by:
selectAll in interface LySetTableInterface
Parameters:
select - true if all objects have to be selected, false otherwise
updateView - indicates if the view must be updated or not.

selectRow

public void selectRow(int idx,
                      boolean select)
Description copied from interface: LySetTableInterface
Selects or unselects the row at the given index of the table.

Specified by:
selectRow in interface LySetTableInterface
Parameters:
idx - index of the row to select or unselect
select - true if the row has to be selected, false otherwise

getDefaultAction

public java.lang.String getDefaultAction(LyWebPageWriter pw)
(non-Javadoc).

See Also:
getDefaultAction(leon.view.web.LyWebPageWriter)

getHRefAction

public java.lang.String getHRefAction(LyWebPageWriter pw)
Gets the href action and writes associated javascript function for this table.

Parameters:
pw - the page writer
Returns:
the href action

getStatusAction

public java.lang.String getStatusAction(LyWebPageWriter pw)
(non-Javadoc).

See Also:
getStatusAction(leon.view.web.LyWebPageWriter)

getSortAction

public java.lang.String getSortAction(LyWebPageWriter pw)
Gets the sort action and writes associated javascript function for this table.

Parameters:
pw - the page writer
Returns:
the sort action javascript tag

getTableRootUrl

public java.lang.String getTableRootUrl()
This method is overriden to redirect the SORT, HREF and EXPAND actions to the Leonardi struts 'graphical event handler'.

Returns:
The absolute URL of the target action.

setHeaders

public void setHeaders(LyHeaders headers)
Description copied from interface: LyGraphicalTable
Sets sub-component headers.

Specified by:
setHeaders in interface LyGraphicalTable
Parameters:
headers - New value of headers
See Also:
leon.view.setinterface.LySetTableInterface#setHeaders(LyHeaders)

setFooters

public void setFooters(LyFooters footers)
Description copied from interface: LyGraphicalTable
Sets sub-component footers.

Specified by:
setFooters in interface LyGraphicalTable
Parameters:
footers - New value of footers
See Also:
leon.view.setinterface.LySetTableInterface#setFooters(LyFooters)

addRow

public void addRow(LyRow row)
Description copied from interface: LySetTableInterface
Adds the given row at the end of the current table.

Specified by:
addRow in interface LySetTableInterface
Parameters:
row - the row to add

addRow

public void addRow(LyRow row,
                   int idx)
Description copied from interface: LySetTableInterface
Adds the given row at the given position in the current table.

Specified by:
addRow in interface LySetTableInterface
Parameters:
row - the row to add
idx - the position where the row has to be added

removeRow

public void removeRow(LyRow row)
Description copied from interface: LySetTableInterface
Removes the given row from the current table.

Specified by:
removeRow in interface LySetTableInterface
Parameters:
row - the row to remove

removeRow

public void removeRow(int idx)
Description copied from interface: LySetTableInterface
Removes the row at the given index from the current table.

Specified by:
removeRow in interface LySetTableInterface
Parameters:
idx - the index of the row to remove

refresh

public void refresh()
Performs a refresh of the table.

Overrides:
refresh in class LyWebObject

getUpdateRowsColorsScript

public java.lang.String getUpdateRowsColorsScript()
Returns the Javascript code to be used to update table colors.

Returns:
the Javascript code to be used to update table colors.

getScrollHeightForSplitter

public int getScrollHeightForSplitter(LyWebPageWriter pw)
Description copied from class: LyWebObject
Indicates whether this component needs scrollbars when inserted in a splitter.

Overrides:
getScrollHeightForSplitter in class LyWebObject
Parameters:
pw - current page writer
Returns:
a positive value if this component needs scrollbars, a negative or null value otherwise.

initialize

public void initialize()
Initialization method.
Sets actions and the root URL to null.
Sets the body font and row even and odd colors with properties defined in resources files.
Sets the JavaSript Id with the default value.


addLastCell

public boolean addLastCell(LyWebPageWriter pw)
Indicates if an empty cell must be added at the end of each row.

Returns:
true if an empty cell must be added, false otherwise

writeHtml

public void writeHtml(LyWebPageWriter pw)
Description copied from interface: LyWebComponent
Write HTML description corresponding to this component.

Specified by:
writeHtml in interface LyWebComponent
Parameters:
pw - the page writer

generateExternalBorder

public final boolean generateExternalBorder(LyWebPageWriter pw)
Indicates whether an external border must be generated for this table.


setVisible

public void setVisible(boolean status)
Description copied from interface: LySetVisibleInterface
Sets the visibility status of this component.

Specified by:
setVisible in interface LySetVisibleInterface
Parameters:
status - new visibility status, if true the component will be shown, if false it will be hiden

drawImages

public boolean drawImages()
Indicates if images must be drawn.

Returns:
true if at least one row of the table has an image to draw, false othewise

sortOnStatus

public boolean sortOnStatus()
Indicates there is header for sorting status.

Returns:
true if there is at least one header for the sorting status, false otherwise

swapRows

public void swapRows(int idx1,
                     int idx2)
Description copied from interface: LySetTableInterface
Swaps the rows at the specified indexes.

Specified by:
swapRows in interface LySetTableInterface
Parameters:
idx1 - the position of the first row to swap
idx2 - the position of the second row to swap

selectRow

public void selectRow(LyRow row,
                      boolean select)
Description copied from interface: LySetTableInterface
Selects or unselects the specified row in the table.

Specified by:
selectRow in interface LySetTableInterface
Parameters:
row - the row to select or unselect
select - true if the row has to be selected, false otherwise

hideRow

public void hideRow(int idx,
                    boolean hide)
Description copied from interface: LySetTableInterface
Hides or show the row at the given index.

Specified by:
hideRow in interface LySetTableInterface
Parameters:
idx - the index of the row to show or hide
hide - indicates if the row has to be shown or hided

updateRow

public void updateRow(LyRow row)
Description copied from interface: LySetTableInterface
Updates the given row.

Specified by:
updateRow in interface LySetTableInterface
Parameters:
row - the row to update

freezeColumn

public void freezeColumn(int idx)
Description copied from interface: LySetTableInterface
Freezes the column at the given index in the view.

Specified by:
freezeColumn in interface LySetTableInterface
Parameters:
idx - the index of the column to freeze

allowExtendedSort

public boolean allowExtendedSort()
Computes if we can have an extended sort (more than one header with sort enable).

Returns:
true if at least one header of the table is sortable, false otherwise

getSortActionFunction

public java.lang.String getSortActionFunction()
Gets the sort action and writes associated javascript function for this table.

Parameters:
pw - the page writer
Returns:
the sort action javascript tag

getExpandRowAction

public java.lang.String getExpandRowAction(LyWebPageWriter pw)
Gets the expand row action and writes associated javascript function for this table.

Parameters:
pw - the page writer
Returns:
the expand row action javascript tag

getSelectionAction

public java.lang.String getSelectionAction(LyWebPageWriter pw)
Gets the selection action javascript function name for this table.

Parameters:
pw - the page writer
Returns:
the selection action

showRow

public void showRow(int idx)
Description copied from interface: LySetTableInterface
Scrolls to make visible to the user the row at the given index .

Specified by:
showRow in interface LySetTableInterface
Parameters:
idx - the index of the row to show

setIdle

public void setIdle(boolean status)
Description copied from interface: LySetIdleInterface
Sets or unset the idle mode on the component/node.

Specified by:
setIdle in interface LySetIdleInterface
Parameters:
status - new idle status (LySetIdleInterface interface)

setEnabled

public void setEnabled(boolean status)
Description copied from interface: LyGraphicalTable
Updates attribute enabled to the given value.

Specified by:
setEnabled in interface LyGraphicalTable
Specified by:
setEnabled in interface LySetEnabledInterface
Parameters:
status - Boolean indicating if attribute enabled is set or unset.
See Also:
LySetEnabledInterface.setEnabled(boolean)

setNRows

public void setNRows(int nRows)
Description copied from interface: LyGraphicalTable
Updates attribute nRows to the given value.

Specified by:
setNRows in interface LyGraphicalTable
Parameters:
nRows - New value of nRows.
See Also:
LyGraphicalTable.setNRows(int)

getRow

public LyRow getRow(int i)
Gets the row at the specified position.

Parameters:
i - the row position
Returns:
the LySwingRow at position i

getAdditionalStyle

public java.lang.String getAdditionalStyle()
Computes an additional style for the table.

Returns:
a string containing the CSS additional style

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com