Package org.opencms.workplace.list
Class CmsHtmlList
java.lang.Object
org.opencms.workplace.list.CmsHtmlList
The main class of the html list widget.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringStandard list button location.static final StringStandard list button location.static final StringConstant for item separator char used for coding/encoding multiselection.protected intCurrent displayed page number.protected CmsListOrderEnumCurrent sort order.protected List<CmsListItem> Filtered list of items ornullif no filter is set and not sorted.protected final StringDhtml id.protected booleanIf this flag is set the list will be surrounded by a box.protected intMaximum number of items per page.protected CmsListMetadataMetadata for building the list.protected org.opencms.i18n.CmsMessageContainerDisplay Name of the list.protected List<CmsListItem> Really content of the list.protected booleanprintable flag.protected StringSearch filter text.protected booleanShow the title of the list.protected intThe filtered content size, only used if data self managed.protected StringColumn name to be sorted.protected intThe total size, only used is data self managed.protected List<CmsListItem> Items currently displayed.protected A_CmsListDialogThe related workplace dialog object.static final StringConstant name for error message if no item has been selected.static final StringConstant name for error message if number of selected items does not match. -
Constructor Summary
ConstructorsConstructorDescriptionCmsHtmlList(String id, org.opencms.i18n.CmsMessageContainer name, CmsListMetadata metadata) Default Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()This method resets the content of the list (no the metadata).protected intReturns the number (from 1) of the first displayed item.protected intReturns the number (from 1) of the last displayed item.Returns all list items in the list, may be not visible and sorted.Returns the filtered list of list items.intreturns the number of the current page.Returns all items of the current page.Returns the current used sort order.getId()Returns the id.This method returns the item identified by the parameter id.intReturns the maximum number of items per page.Returns the metadata.org.opencms.i18n.CmsMessageContainergetName()Returns the name of the list.intReturns the filtered number of pages.Returns the search filter.intgetSize()Return the filtered number of items.Returns the sorted column's name.getState()Returns a filled list state.intReturns the total number of pages.intReturn the total number of items.getWp()Returns the workplace dialog object.protected StringGenerates the initial html code.protected StringhtmlEnd()Generates the need html code for ending a list.static StringhtmlPageSelector(int nrPages, int itemsPage, int nrItems, int curPage, Locale locale) Generates the list of html option elements for a html select control to select a page of a list.protected StringGenerates the needed html code for the paging bar.protected StringReturns the html for the title of the list.protected StringReturns the html code for the toolbar (search bar + multiactions bar).booleanisBoxed()Returns the isBoxed flag.booleanReturns the printable flag.booleanReturns if the list title is shown.listCsv()Generates the csv output for the list.listHtml()Generates the html code for the list.listJs()Generate the need js code for the list.Returns a new list item for this list.Returns html code for printing the list.removeItem(String id) Removes an item from the list.voidsetBoxed(boolean isBoxed) Sets the isBoxed flag.voidsetContent(Collection<CmsListItem> listItems) Sets the list item to display in the list.voidsetCurrentPage(int currentPage) Sets the current page.voidsetMaxItemsPerPage(int maxItemsPerPage) Sets the maximum number of items per page.protected voidsetMetadata(CmsListMetadata metadata) Sets the metadata for this list.voidsetName(org.opencms.i18n.CmsMessageContainer name) Sets the name of the list.voidsetSearchFilter(String searchFilter) Sets the search filter.voidsetShowTitle(boolean showTitle) Sets if the list title is shown.voidsetSize(int size) Sets the current filtered size, only used if data self managed.voidsetSortedColumn(String sortedColumn) Sets the sorted column.voidsetState(CmsListState listState) Sets the list state.voidsetTotalSize(int totalSize) Sets the total Size, only used if data self managed.voidsetWp(A_CmsListDialog wp) Sets the workplace dialog object.
-
Field Details
-
ICON_LEFT
Standard list button location.- See Also:
-
ICON_RIGHT
Standard list button location.- See Also:
-
ITEM_SEPARATOR
Constant for item separator char used for coding/encoding multiselection.- See Also:
-
NO_SELECTION_HELP_VAR
Constant name for error message if no item has been selected.- See Also:
-
NO_SELECTION_MATCH_HELP_VAR
Constant name for error message if number of selected items does not match.- See Also:
-
m_currentPage
Current displayed page number. -
m_currentSortOrder
Current sort order. -
m_filteredItems
Filtered list of items ornullif no filter is set and not sorted. -
m_id
Dhtml id. -
m_isBoxed
If this flag is set the list will be surrounded by a box. -
m_maxItemsPerPage
Maximum number of items per page. -
m_metadata
Metadata for building the list. -
m_name
Display Name of the list. -
m_originalItems
Really content of the list. -
m_printable
printable flag. -
m_searchFilter
Search filter text. -
m_showTitle
Show the title of the list. -
m_size
The filtered content size, only used if data self managed. -
m_sortedColumn
Column name to be sorted. -
m_totalSize
The total size, only used is data self managed. -
m_visibleItems
Items currently displayed. -
m_wp
The related workplace dialog object.
-
-
Constructor Details
-
CmsHtmlList
Default Constructor.- Parameters:
id- unique id of the list, is used as name for controls and js functions and varsname- the display namemetadata- the list's metadata
-
-
Method Details
-
htmlPageSelector
public static String htmlPageSelector(int nrPages, int itemsPage, int nrItems, int curPage, Locale locale) Generates the list of html option elements for a html select control to select a page of a list.- Parameters:
nrPages- the total number of pagesitemsPage- the maximum number of items per pagenrItems- the total number of itemscurPage- the current pagelocale- the locale- Returns:
- html code
-
clear
This method resets the content of the list (no the metadata). -
getAllContent
Returns all list items in the list, may be not visible and sorted.- Returns:
- all list items
-
getContent
Returns the filtered list of list items.Equals to
if no filter is set.getAllContent()- Returns:
- the filtered list of list items
-
getCurrentPage
returns the number of the current page.- Returns:
- the number of the current page
-
getCurrentPageItems
Returns all items of the current page.- Returns:
- all items of the current page, a list of
CmsListItemobjects
-
getCurrentSortOrder
Returns the current used sort order.- Returns:
- the current used sort order
-
getId
Returns the id.- Returns:
- the id
-
getItem
This method returns the item identified by the parameter id.Only current visible item can be retrieved using this method.
- Parameters:
id- the id of the item to look for- Returns:
- the requested item or
nullif not found
-
getMaxItemsPerPage
Returns the maximum number of items per page.- Returns:
- the maximum number of items per page
-
getMetadata
Returns the metadata.- Returns:
- the metadata
-
getName
Returns the name of the list.- Returns:
- the list's name
-
getNumberOfPages
Returns the filtered number of pages.Equals to
if no filter is set.getTotalNumberOfPages()- Returns:
- the filtered of pages
-
getSearchFilter
Returns the search filter.- Returns:
- the search filter
-
getSize
Return the filtered number of items.Equals to
if no filter is set.getTotalSize()- Returns:
- the filtered number of items
-
getSortedColumn
Returns the sorted column's name.- Returns:
- the sorted column's name
-
getState
Returns a filled list state.- Returns:
- the state of the list
-
getTotalNumberOfPages
Returns the total number of pages.- Returns:
- the total number of pages
-
getTotalSize
Return the total number of items.- Returns:
- the total number of items
-
getWp
Returns the workplace dialog object.- Returns:
- the workplace dialog object
-
isBoxed
Returns the isBoxed flag.If this flag is set the list will be surrounded by a box.
- Returns:
- the isBoxed flag
-
isPrintable
Returns the printable flag.- Returns:
- the printable flag
-
isShowTitle
Returns if the list title is shown.- Returns:
- true if the list title is shown, otherwise false
-
listCsv
Generates the csv output for the list.- Returns:
- csv output
-
listHtml
Generates the html code for the list.- Returns:
- html code
-
listJs
Generate the need js code for the list.- Returns:
- js code
-
newItem
Returns a new list item for this list.- Parameters:
id- the id of the item has to be unique- Returns:
- a new list item
-
printableHtml
Returns html code for printing the list.- Returns:
- html code
-
removeItem
Removes an item from the list.Keeping care of all the state like sorted column, sorting order, displayed page and search filter.
Try to use it instead of
.A_CmsListDialog.refreshList()- Parameters:
id- the id of the item to remove- Returns:
- the removed list item
-
setBoxed
Sets the isBoxed flag.If this flag is set, the list will be surrounded by a box.
- Parameters:
isBoxed- the isBoxed flag to set
-
setContent
Sets the list item to display in the list.- Parameters:
listItems- a collection ofCmsListItemobjects
-
setCurrentPage
Sets the current page.- Parameters:
currentPage- the current page to set- Throws:
org.opencms.main.CmsIllegalArgumentException- if the argument is invalid
-
setMaxItemsPerPage
Sets the maximum number of items per page.- Parameters:
maxItemsPerPage- the maximum number of items per page to set
-
setName
Sets the name of the list.- Parameters:
name- the name of the list
-
setSearchFilter
Sets the search filter.- Parameters:
searchFilter- the search filter to set
-
setShowTitle
Sets if the list title is shown.- Parameters:
showTitle- true if the list title is shown, otherwise false
-
setSize
Sets the current filtered size, only used if data self managed.- Parameters:
size- the size to set
-
setSortedColumn
public void setSortedColumn(String sortedColumn) throws org.opencms.main.CmsIllegalArgumentException Sets the sorted column.- Parameters:
sortedColumn- the sorted column to set- Throws:
org.opencms.main.CmsIllegalArgumentException- if thesortedColumnargument is invalid
-
setState
Sets the list state.This may involve sorting, filtering and paging.
- Parameters:
listState- the state to be set
-
setTotalSize
Sets the total Size, only used if data self managed.- Parameters:
totalSize- the total Size to set
-
setWp
Sets the workplace dialog object.- Parameters:
wp- the workplace dialog object to set
-
displayedFrom
Returns the number (from 1) of the first displayed item.- Returns:
- the number (from 1) of the first displayed item, or zero if the list is empty
-
displayedTo
Returns the number (from 1) of the last displayed item.- Returns:
- the number (from 1) of the last displayed item, or zero if the list is empty
-
htmlBegin
Generates the initial html code.- Returns:
- html code
-
htmlEnd
Generates the need html code for ending a list.- Returns:
- html code
-
htmlPagingBar
Generates the needed html code for the paging bar.- Returns:
- html code
-
htmlTitle
Returns the html for the title of the list.- Returns:
- html code
-
htmlToolBar
Returns the html code for the toolbar (search bar + multiactions bar).- Returns:
- html code
-
setMetadata
Sets the metadata for this list.Should only be used by the
class for temporally removing the metadata object while the list is saved in theA_CmsListDialog.CmsWorkplaceSettings- Parameters:
metadata- the list metadata
-