com.groiss.gui.table
Class TableAdapter

java.lang.Object
  extended by com.groiss.gui.table.TableAdapter
All Implemented Interfaces:
Table

public class TableAdapter
extends java.lang.Object
implements Table

Adapter class for the table interface. It is recommended to make subclasses of this class or use is directly instead of implementing the table interface with another class.
The class has several protected fields that can be set by subclasses for defining the behaviour of the table.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.groiss.gui.table.Table
Table.ToolbarShape
 
Field Summary
protected  boolean asc
           
protected  java.util.List<ColumnDescription> columns
           
protected  java.lang.String defaultAction
           
protected  java.lang.String editTarget
           
protected  java.lang.String editTargetProps
           
protected  java.lang.String editUrl
           
protected  java.lang.String fieldname
           
protected  java.lang.String id
           
protected  javax.swing.table.TableModel model
           
protected  boolean oidOnly
           
protected  javax.servlet.http.HttpServletRequest request
          The HTTP request is set in the init method
protected  Resource resource
           
protected  java.util.List<java.lang.String> selected
           
protected  int selection
           
protected  boolean showCounter
           
protected  boolean sortable
           
protected  int sortColumn
           
protected  java.lang.String tableTarget
           
protected  java.lang.String title
           
protected  java.lang.String toolbarActions
           
protected  boolean toolbarIcons
           
protected  Table.ToolbarShape toolbarShape
           
protected  java.lang.String toolbarTarget
           
protected  boolean useColumnPicker
           
protected  boolean useFilter
           
protected  boolean usePaging
           
protected  boolean verticalToolbar
           
 
Fields inherited from interface com.groiss.gui.table.Table
SELECTION_HIDDEN, SELECTION_LINK, SELECTION_MULTIPLE, SELECTION_NONE, SELECTION_ROW_MULTIPLE, SELECTION_ROW_SINGLE, SELECTION_SINGLE
 
Constructor Summary
TableAdapter()
           
TableAdapter(javax.swing.table.TableModel m, java.lang.String id)
           
 
Method Summary
 java.util.List<ColumnDescription> getColumns()
          Return a list of column descriptions.
 java.lang.String getDefaultAction()
          Returns the action that is executed on doubleclick on a row.
 java.lang.String getEditTarget()
          The default target for toolbar functions
 java.lang.String getEditTargetProps()
          Return the window properties for the edit target
 java.lang.String getEditUrl()
          Returns an url used as link for toolbar functions
 java.lang.String getFieldName()
          Return the name of the checkbox or radio buttons
 java.lang.String getFilterId()
          Returns the id that is used when column filters are stored.
 java.lang.String getId()
          Returns the id of this table
 Page getPage()
          Define the page the table uses.
 int getPagesize()
          The default implementation reads the table.pagesize property as default and the user property avw.table.pagesize.
 java.util.List<java.lang.String> getSelectedItems()
           
 int getSelectionMode()
          Return the mode for selection.
 int getSortColumn()
          Return the sort column.
 java.lang.String getTableFrameName()
          Returns the name of the frame where the table resides.
 javax.swing.table.TableModel getTableModel()
          Builds the final tablemodel containing all data displayed in the table.
 int getTableSize()
          Determines the tablesize of the tablemodel without reading all the objects.
 java.lang.Object getTitle()
          Return a string or Component for table title
 java.lang.String getToolbarActions()
          Return a comma separated list of action ids for the toolbar.
 java.lang.String getToolbarFrameName()
          Returns the name of the frame where the toolbar resides.
 Table.ToolbarShape getToolbarShape()
          Returns the desired mode of the toolbar.
 boolean hasVerticalToolbar()
          Returns true if the toolbar is vertical, false for horizontal.
 void init(javax.servlet.http.HttpServletRequest req)
          Init the tablemodel (determine data to be displayed).
 boolean isSortable()
          Is the table sortable.
 java.lang.String lineStyle(int i, java.lang.String style)
          Use this method for defining a row specific css-class.
 boolean oidOnly()
          If true the value of the checkbox or radio button contains only the oid, otherwise it contains classname:oid
 TableAdapter setColumns(java.util.List<ColumnDescription> cols, boolean useFilter, boolean useColumnPicker)
          Set the column properties.
 TableAdapter setDefaultAction(java.lang.String action)
          Set the default action.
 TableAdapter setEditProps(java.lang.String editUrl, java.lang.String editTarget, java.lang.String winProps, java.lang.String toolbarActions, java.lang.String toolbarTarget)
          Set the edit properties.
 TableAdapter setSelection(int selection, java.lang.String fieldname, boolean oidOnly, java.util.List<java.lang.String> selected)
          Set the selection properties.
 TableAdapter setSortable(boolean isSortable, int col, boolean asc)
          Set the sort properties.
 TableAdapter setTitle(java.lang.String title)
          Set the title of the table.
 void setToolbarShape(java.lang.String s)
           
 boolean showCounter()
          Returns true if a counter is shown below the table.
 TableAdapter showCounter(boolean show)
          Define whether a counter should be shown.
 boolean showToolbarIcons()
          Returns true if the toolbar shows the icons, false for text toolbar.
 boolean sortAscending()
          Is the table sorted ascending.
 boolean useColumnPicker()
          Returns true if column picker should be shown.
 boolean useFilter()
          Returns true if column filters are enabled.
 boolean usePaging()
          Returns true if paging is enabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected javax.servlet.http.HttpServletRequest request
The HTTP request is set in the init method


model

protected javax.swing.table.TableModel model

id

protected java.lang.String id

title

protected java.lang.String title

resource

protected Resource resource

sortable

protected boolean sortable

sortColumn

protected int sortColumn

asc

protected boolean asc

selection

protected int selection

selected

protected java.util.List<java.lang.String> selected

fieldname

protected java.lang.String fieldname

oidOnly

protected boolean oidOnly

editUrl

protected java.lang.String editUrl

editTarget

protected java.lang.String editTarget

editTargetProps

protected java.lang.String editTargetProps

toolbarActions

protected java.lang.String toolbarActions

toolbarTarget

protected java.lang.String toolbarTarget

tableTarget

protected java.lang.String tableTarget

verticalToolbar

protected boolean verticalToolbar

toolbarIcons

protected boolean toolbarIcons

toolbarShape

protected Table.ToolbarShape toolbarShape

defaultAction

protected java.lang.String defaultAction

showCounter

protected boolean showCounter

columns

protected java.util.List<ColumnDescription> columns

useFilter

protected boolean useFilter

useColumnPicker

protected boolean useColumnPicker

usePaging

protected boolean usePaging
Constructor Detail

TableAdapter

public TableAdapter()

TableAdapter

public TableAdapter(javax.swing.table.TableModel m,
                    java.lang.String id)
Method Detail

init

public void init(javax.servlet.http.HttpServletRequest req)
Init the tablemodel (determine data to be displayed).

Specified by:
init in interface Table

getTableSize

public int getTableSize()
Determines the tablesize of the tablemodel without reading all the objects.

Specified by:
getTableSize in interface Table
Returns:
int representing the actual tablesize

getTableModel

public javax.swing.table.TableModel getTableModel()
Builds the final tablemodel containing all data displayed in the table.

Specified by:
getTableModel in interface Table
Returns:
TableModel containing all the data

getTitle

public java.lang.Object getTitle()
Return a string or Component for table title

Specified by:
getTitle in interface Table

getId

public java.lang.String getId()
Returns the id of this table

Specified by:
getId in interface Table

getPage

public Page getPage()
Define the page the table uses. Has to return a new, empty page on each call.

Specified by:
getPage in interface Table

lineStyle

public java.lang.String lineStyle(int i,
                                  java.lang.String style)
Use this method for defining a row specific css-class.

Specified by:
lineStyle in interface Table
Parameters:
i - the row index
style - the css class that is set by the table renderer
Returns:
a css class

isSortable

public boolean isSortable()
Is the table sortable.

Specified by:
isSortable in interface Table

sortAscending

public boolean sortAscending()
Is the table sorted ascending.

Specified by:
sortAscending in interface Table

getSortColumn

public int getSortColumn()
Return the sort column.

Specified by:
getSortColumn in interface Table

getSelectionMode

public int getSelectionMode()
Return the mode for selection.

Specified by:
getSelectionMode in interface Table
Returns:
one of SELECTION_NONE, SELECTION_LINK, SELECTION_SINGLE, SELECTION_MULTIPLE, SELECTION_ROW_SINGLE, SELECTION_ROW_MULTIPLE

getFieldName

public java.lang.String getFieldName()
Return the name of the checkbox or radio buttons

Specified by:
getFieldName in interface Table

oidOnly

public boolean oidOnly()
If true the value of the checkbox or radio button contains only the oid, otherwise it contains classname:oid

Specified by:
oidOnly in interface Table

getEditUrl

public java.lang.String getEditUrl()
Returns an url used as link for toolbar functions

Specified by:
getEditUrl in interface Table

getEditTarget

public java.lang.String getEditTarget()
The default target for toolbar functions

Specified by:
getEditTarget in interface Table

getEditTargetProps

public java.lang.String getEditTargetProps()
Return the window properties for the edit target

Specified by:
getEditTargetProps in interface Table

getToolbarActions

public java.lang.String getToolbarActions()
Return a comma separated list of action ids for the toolbar.

Specified by:
getToolbarActions in interface Table

getTableFrameName

public java.lang.String getTableFrameName()
Returns the name of the frame where the table resides.

Specified by:
getTableFrameName in interface Table

getToolbarFrameName

public java.lang.String getToolbarFrameName()
Returns the name of the frame where the toolbar resides.

Specified by:
getToolbarFrameName in interface Table

hasVerticalToolbar

public boolean hasVerticalToolbar()
Returns true if the toolbar is vertical, false for horizontal.

Specified by:
hasVerticalToolbar in interface Table

showToolbarIcons

public boolean showToolbarIcons()
Returns true if the toolbar shows the icons, false for text toolbar.

Specified by:
showToolbarIcons in interface Table

getToolbarShape

public Table.ToolbarShape getToolbarShape()
Description copied from interface: Table
Returns the desired mode of the toolbar.

Specified by:
getToolbarShape in interface Table

setToolbarShape

public void setToolbarShape(java.lang.String s)

getDefaultAction

public java.lang.String getDefaultAction()
Returns the action that is executed on doubleclick on a row. See Table.getToolbarActions() for a description of allowed values

Specified by:
getDefaultAction in interface Table

useFilter

public boolean useFilter()
Returns true if column filters are enabled.

Specified by:
useFilter in interface Table

useColumnPicker

public boolean useColumnPicker()
Returns true if column picker should be shown.

Specified by:
useColumnPicker in interface Table

usePaging

public boolean usePaging()
Returns true if paging is enabled.

Specified by:
usePaging in interface Table

showCounter

public boolean showCounter()
Returns true if a counter is shown below the table.

Specified by:
showCounter in interface Table

getColumns

public java.util.List<ColumnDescription> getColumns()
Return a list of column descriptions.

Specified by:
getColumns in interface Table

getFilterId

public java.lang.String getFilterId()
Description copied from interface: Table
Returns the id that is used when column filters are stored. Normally this will be the id of the table, but if it is desired to use filters for several tables, another id can be defined.

Specified by:
getFilterId in interface Table

setSortable

public TableAdapter setSortable(boolean isSortable,
                                int col,
                                boolean asc)
Set the sort properties.

Parameters:
isSortable - true if sortable.
col - the sort column
asc - the sort order (true = ascending)
Returns:
the TableAdapter

setSelection

public TableAdapter setSelection(int selection,
                                 java.lang.String fieldname,
                                 boolean oidOnly,
                                 java.util.List<java.lang.String> selected)
Set the selection properties.

Parameters:
selection - see Table.getSelectionMode() for values
fieldname - see Table.getFieldName()()
oidOnly - see Table.oidOnly()
selected - a list of already selected values
Returns:
the TableAdapter

setEditProps

public TableAdapter setEditProps(java.lang.String editUrl,
                                 java.lang.String editTarget,
                                 java.lang.String winProps,
                                 java.lang.String toolbarActions,
                                 java.lang.String toolbarTarget)
Set the edit properties.

Parameters:
editUrl -
editTarget -
winProps -
toolbarActions -
toolbarTarget -
Returns:
the TableAdapter

showCounter

public TableAdapter showCounter(boolean show)
Define whether a counter should be shown.

Parameters:
show - true if a counter is wanted.

setTitle

public TableAdapter setTitle(java.lang.String title)
Set the title of the table.


setColumns

public TableAdapter setColumns(java.util.List<ColumnDescription> cols,
                               boolean useFilter,
                               boolean useColumnPicker)
Set the column properties.

Parameters:
cols -
useFilter -
useColumnPicker -

setDefaultAction

public TableAdapter setDefaultAction(java.lang.String action)
Set the default action.


getSelectedItems

public java.util.List<java.lang.String> getSelectedItems()
Specified by:
getSelectedItems in interface Table

getPagesize

public int getPagesize()
The default implementation reads the table.pagesize property as default and the user property avw.table.pagesize.

Specified by:
getPagesize in interface Table


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.