Package com.groiss.gui.table
Class TableAdapter
java.lang.Object
com.groiss.gui.table.TableAdapter
- All Implemented Interfaces:
Table
- Direct Known Subclasses:
ConfiguredTable
Adapter class for the table interface. It is recommended to make subclasses of
this class or use it 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 behavior of the table.
The class has several protected fields that can be set by subclasses for defining the behavior of the table.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.groiss.gui.table.Table
Table.ToolbarShape
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected List<ColumnDescription>
protected String
protected String
protected String
protected String
protected String
protected String
protected String
protected TableModel
protected boolean
protected Page
protected String
protected HttpServletRequest
The HTTP request is set in the init methodprotected Resource
protected String
protected int
protected boolean
protected boolean
protected int
protected String
protected String
protected String
protected boolean
protected Table.ToolbarShape
protected Integer
protected String
protected boolean
protected boolean
protected boolean
protected boolean
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
-
Method Summary
Modifier and TypeMethodDescriptionReturn a list of column descriptions.Returns the action that is executed on doubleclick on a row.The default target for toolbar functionsReturn the window properties for the edit targetReturns an url used as link for toolbar functionsReturn the name of the checkbox or radio buttonsReturns the id that is used when column filters are stored.Returns the context for online-helpgetId()
Returns the id of this tablegetPage()
Define the page the table uses.int
The default implementation reads the table.pagesize property as default and the user property avw.table.pagesize.int
Return the mode for selection.int
Return the sort column.Returns the name of the frame where the table resides.Builds the final tablemodel containing all data displayed in the table.int
Determines the tablesize of the tablemodel without reading all the objects.getTitle()
Return a string or Component for table titleReturn a comma separated list of action ids for the toolbar.Returns the name of the frame where the toolbar resides.Returns the desired mode of the toolbar.boolean
Returns true if the toolbar is vertical, false for horizontal.void
init
(HttpServletRequest req) Init the tablemodel (determine data to be displayed).boolean
Is the table sortable.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:oidvoid
parseSelection
(String select, int defaultValue) setColumns
(List<ColumnDescription> cols, boolean useFilter, boolean useColumnPicker) Set the column properties.setDefaultAction
(String action) Set the default action.setEditProps
(String editUrl, String editTarget, String winProps, String toolbarActions, String toolbarTarget) Set the edit properties.setHelpContext
(String ctx) Set the help context for online help.void
void
void
setSearchString
(String searchString) Sets the search string for that table which may be used for filtering the table contentsetSelection
(int selection, String fieldname, boolean oidOnly, List<String> selected) Set the selection properties.setSortable
(boolean isSortable, int col, boolean asc) Set the sort properties.Set the title of the table.void
void
setToolbarSize
(int toolbarSize) boolean
Returns true if a counter is shown below the table.showCounter
(boolean show) Define whether a counter should be shown.boolean
Deprecated.boolean
Is the table sorted ascending.boolean
Returns true if column picker should be shown.boolean
Returns true if column filters are enabled.boolean
Returns true if paging is enabled.
-
Field Details
-
request
The HTTP request is set in the init method -
model
-
id
-
title
-
resource
-
sortable
protected boolean sortable -
sortColumn
protected int sortColumn -
asc
protected boolean asc -
selection
protected int selection -
selected
-
fieldname
-
oidOnly
protected boolean oidOnly -
editUrl
-
editTarget
-
editTargetProps
-
toolbarActions
-
toolbarTarget
-
tableTarget
-
verticalToolbar
protected boolean verticalToolbar -
toolbarIcons
protected boolean toolbarIcons -
toolbarShape
-
toolbarSize
-
defaultAction
-
showCounter
protected boolean showCounter -
columns
-
useFilter
protected boolean useFilter -
useColumnPicker
protected boolean useColumnPicker -
usePaging
protected boolean usePaging -
searchString
-
pageString
-
page
-
helpctx
-
-
Constructor Details
-
TableAdapter
public TableAdapter() -
TableAdapter
-
-
Method Details
-
init
Init the tablemodel (determine data to be displayed). -
setSearchString
Sets the search string for that table which may be used for filtering the table content- Specified by:
setSearchString
in interfaceTable
- Parameters:
searchString
- a string for filtering or null if no search string is defined
-
getTableSize
public int getTableSize()Determines the tablesize of the tablemodel without reading all the objects.- Specified by:
getTableSize
in interfaceTable
- Returns:
- int representing the actual tablesize
-
getTableModel
Builds the final tablemodel containing all data displayed in the table.- Specified by:
getTableModel
in interfaceTable
- Returns:
- TableModel containing all the data
-
getTitle
Return a string or Component for table title -
getId
Returns the id of this table -
getPage
Define the page the table uses. Has to return a new, empty page on each call. -
setPage
-
setPage
-
lineStyle
Use this method for defining a row specific css-class. -
isSortable
public boolean isSortable()Is the table sortable.- Specified by:
isSortable
in interfaceTable
-
sortAscending
public boolean sortAscending()Is the table sorted ascending.- Specified by:
sortAscending
in interfaceTable
-
getSortColumn
public int getSortColumn()Return the sort column.- Specified by:
getSortColumn
in interfaceTable
-
getSelectionMode
public int getSelectionMode()Return the mode for selection.- Specified by:
getSelectionMode
in interfaceTable
- Returns:
- one of SELECTION_NONE, SELECTION_LINK, SELECTION_SINGLE, SELECTION_MULTIPLE, SELECTION_ROW_SINGLE, SELECTION_ROW_MULTIPLE
-
getFieldName
Return the name of the checkbox or radio buttons- Specified by:
getFieldName
in interfaceTable
-
oidOnly
public boolean oidOnly()If true the value of the checkbox or radio button contains only the oid, otherwise it contains classname:oid -
getEditUrl
Returns an url used as link for toolbar functions- Specified by:
getEditUrl
in interfaceTable
-
getEditTarget
The default target for toolbar functions- Specified by:
getEditTarget
in interfaceTable
-
getEditTargetProps
Return the window properties for the edit target- Specified by:
getEditTargetProps
in interfaceTable
-
getToolbarActions
Return a comma separated list of action ids for the toolbar.- Specified by:
getToolbarActions
in interfaceTable
-
getTableFrameName
Returns the name of the frame where the table resides.- Specified by:
getTableFrameName
in interfaceTable
-
getToolbarFrameName
Returns the name of the frame where the toolbar resides.- Specified by:
getToolbarFrameName
in interfaceTable
-
hasVerticalToolbar
public boolean hasVerticalToolbar()Returns true if the toolbar is vertical, false for horizontal.- Specified by:
hasVerticalToolbar
in interfaceTable
-
showToolbarIcons
Deprecated.Returns true if the toolbar shows the icons, false for text toolbar.- Specified by:
showToolbarIcons
in interfaceTable
-
getToolbarShape
Description copied from interface:Table
Returns the desired mode of the toolbar.- Specified by:
getToolbarShape
in interfaceTable
-
setToolbarSize
public void setToolbarSize(int toolbarSize) - Parameters:
toolbarSize
- the toolbarSize to set
-
getToolbarSize
- Specified by:
getToolbarSize
in interfaceTable
-
setToolbarShape
-
getDefaultAction
Returns the action that is executed on doubleclick on a row. SeeTable.getToolbarActions()
for a description of allowed values- Specified by:
getDefaultAction
in interfaceTable
-
useFilter
public boolean useFilter()Returns true if column filters are enabled. -
useColumnPicker
public boolean useColumnPicker()Returns true if column picker should be shown.- Specified by:
useColumnPicker
in interfaceTable
-
usePaging
public boolean usePaging()Returns true if paging is enabled. -
showCounter
public boolean showCounter()Returns true if a counter is shown below the table.- Specified by:
showCounter
in interfaceTable
-
getColumns
Return a list of column descriptions.- Specified by:
getColumns
in interfaceTable
-
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 interfaceTable
-
setSortable
Set the sort properties.- Parameters:
isSortable
- true if sortable.col
- the sort columnasc
- the sort order (true = ascending)- Returns:
- the TableAdapter
-
setSelection
public TableAdapter setSelection(int selection, String fieldname, boolean oidOnly, List<String> selected) Set the selection properties.- Parameters:
selection
- seeTable.getSelectionMode()
for valuesfieldname
- seeTable.getFieldName()
oidOnly
- seeTable.oidOnly()
selected
- a list of already selected values- Returns:
- the TableAdapter
-
setEditProps
public TableAdapter setEditProps(String editUrl, String editTarget, String winProps, String toolbarActions, String toolbarTarget) Set the edit properties.- Parameters:
editUrl
-editTarget
-winProps
-toolbarActions
-toolbarTarget
-- Returns:
- the TableAdapter
-
setHelpContext
Set the help context for online help.- Parameters:
ctx
-- Returns:
- the TableAdapter
-
showCounter
Define whether a counter should be shown.- Parameters:
show
- true if a counter is wanted.
-
setTitle
Set the title of the table. -
setColumns
public TableAdapter setColumns(List<ColumnDescription> cols, boolean useFilter, boolean useColumnPicker) Set the column properties.- Parameters:
cols
-useFilter
-useColumnPicker
-
-
setDefaultAction
Set the default action. -
getSelectedItems
- Specified by:
getSelectedItems
in interfaceTable
-
getHelpContext
Returns the context for online-help- Specified by:
getHelpContext
in interfaceTable
-
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 interfaceTable
-
parseSelection
-