Package org.opencms.ui.components
Class CmsFileTable
java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.CustomComponent
org.opencms.ui.components.CmsResourceTable
org.opencms.ui.components.CmsFileTable
- All Implemented Interfaces:
com.vaadin.event.ContextClickEvent.ContextClickNotifier,com.vaadin.event.MethodEventSource,com.vaadin.server.ClientConnector,com.vaadin.server.Sizeable,com.vaadin.shared.Connector,com.vaadin.ui.Component,com.vaadin.ui.HasComponents,Serializable,Iterable<com.vaadin.ui.Component>
- Direct Known Subclasses:
CmsLinkValidationInternalTable,CmsResultTable
Table for displaying resources.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassFile edit handler.classField factory to enable inline editing of individual file properties.static classExtends the default sorting to differentiate between files and folder when sorting by name.static interfaceHandles folder selects in the file table.Nested classes/interfaces inherited from class org.opencms.ui.components.CmsResourceTable
CmsResourceTable.CategoryComparator, CmsResourceTable.CategoryLabel, CmsResourceTable.ColumnBuilder, CmsResourceTable.ColumnEntry, CmsResourceTable.ColumnSettingChangeHandler, CmsResourceTable.DefaultItemDescriptionGenerator, CmsResourceTable.I_ResourcePropertyProvider, CmsResourceTable.ItemContainerNested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListenerNested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.ListenerNested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListenerNested classes/interfaces inherited from interface com.vaadin.server.Sizeable
com.vaadin.server.Sizeable.Unit -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<CmsResourceTableProperty, Integer> The default file table columns.protected List<CmsResource> The selected resources.Fields inherited from class org.opencms.ui.components.CmsResourceTable
COLLAPSED, INVISIBLE, m_container, m_fileTable, m_propertyProvidersFields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXTFields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS -
Constructor Summary
ConstructorsConstructorDescriptionCmsFileTable(I_CmsContextProvider contextProvider) Default constructor.CmsFileTable(I_CmsContextProvider contextProvider, Map<CmsResourceTableProperty, Integer> tableColumns) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalStyleGenerator(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator) Adds an additional cell style generator.voidApplies settings generally used within workplace app file lists.voidClears all container filters.booleancontainsId(CmsUUID structureId) Checks if the file table has a row for the resource with the given structure id.voidfilterTable(String search) Filters the displayed resources.byte[]Generates UTF-8 encoded CSV for currently active table columns (standard columns only).Returns the dialog context provider.intReturns the index of the first visible item.Gets the selected structure ids.Gets the list of selected resources.static StringgetStateStyle(com.vaadin.v7.data.Item resourceItem) Returns the resource state specific style name.Returns the current table state.voidhandleSelection(String itemId) Handles the item selection.booleanReturns if a file property is being edited.booleanisEditProperty(CmsResourceTableProperty propertyId) Returns if the given property is being edited.voidopenContextMenu(com.vaadin.v7.event.ItemClickEvent event) Opens the context menu.voidremoveAdditionalStyleGenerator(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator) Removes the given cell style generator.voidRestores container filters to the ones previously saved via saveFilters().voidSaves currently active filters.voidsetActionColumnProperty(CmsResourceTableProperty actionColumnProperty) Sets the default action column property.voidsetContextProvider(I_CmsContextProvider provider) Sets the dialog context provider.voidsetFirstVisibleItemIndex(int i) Sets the first visible item index.voidsetFolderSelectHandler(CmsFileTable.I_FolderSelectHandler folderSelectHandler) Sets the folder select handler.voidsetMenuBuilder(I_CmsContextMenuBuilder builder) Sets the menu builder.voidSets the table state.voidstartEdit(CmsUUID itemId, CmsResourceTableProperty propertyId, I_CmsFilePropertyEditHandler editHandler) Starts inline editing of the given file property.voidstopEdit()Stops the current edit process to save the changed property value.voidupdate(Collection<CmsUUID> ids, boolean remove) Updates all items with ids from the given list.voidupdateColumnWidths(int estimatedSpace) Updates the column widths.voidUpdates the file table sorting.Methods inherited from class org.opencms.ui.components.CmsResourceTable
addPropertyProvider, clearSelection, fillItem, fillItemDefault, fillTable, fillTable, fillTable, fillTable, getAllIds, getItemCount, getStateStyle, getUUIDFromItemID, internalSetColumnCollapsed, isColumnVisible, itemIdsToUUIDs, removePropertyProvider, selectAll, setCollapsedColumns, setColumnSettingChangeHandler, setDragMode, setDropHandler, setValueMethods inherited from class com.vaadin.ui.CustomComponent
getComponentCount, getCompositionRoot, getState, getState, iterator, setCompositionRootMethods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, readDesign, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined, writeDesignMethods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlerMethods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesignMethods inherited from interface com.vaadin.shared.Connector
getConnectorIdMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
-
Field Details
-
DEFAULT_TABLE_PROPERTIES
The default file table columns. -
m_currentResources
The selected resources.
-
-
Constructor Details
-
CmsFileTable
Default constructor.- Parameters:
contextProvider- the dialog context provider
-
CmsFileTable
public CmsFileTable(I_CmsContextProvider contextProvider, Map<CmsResourceTableProperty, Integer> tableColumns) Default constructor.- Parameters:
contextProvider- the dialog context providertableColumns- the table columns to show
-
-
Method Details
-
getStateStyle
Returns the resource state specific style name.- Parameters:
resourceItem- the resource item- Returns:
- the style name
-
addAdditionalStyleGenerator
Adds an additional cell style generator.- Parameters:
styleGenerator- the cell style generator
-
applyWorkplaceAppSettings
Applies settings generally used within workplace app file lists. -
clearFilters
Clears all container filters. -
containsId
Checks if the file table has a row for the resource with the given structure id.- Parameters:
structureId- a structure id- Returns:
- true if the file table has a row for the resource with the given id
-
filterTable
Filters the displayed resources.Only resources where either the resource name, the title or the nav-text contains the given substring are shown.
- Parameters:
search- the search term
-
generateCsv
Generates UTF-8 encoded CSV for currently active table columns (standard columns only).Note: the generated CSV takes the active filters into account.
- Returns:
- the generated CSV data
-
getContextProvider
Returns the dialog context provider.- Returns:
- the dialog context provider
-
getFirstVisibleItemIndex
Returns the index of the first visible item.- Returns:
- the first visible item
-
getSelectedIds
Gets the selected structure ids.- Returns:
- the set of selected structure ids
-
getSelectedResources
Gets the list of selected resources.- Returns:
- the list of selected resources
-
getTableSettings
Returns the current table state.- Returns:
- the table state
-
handleSelection
Handles the item selection.- Parameters:
itemId- the selected item id
-
isEditing
Returns if a file property is being edited.- Returns:
trueif a file property is being edited
-
isEditProperty
Returns if the given property is being edited.- Parameters:
propertyId- the property id- Returns:
trueif the given property is being edited
-
openContextMenu
Opens the context menu.- Parameters:
event- the click event
-
removeAdditionalStyleGenerator
public void removeAdditionalStyleGenerator(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator) Removes the given cell style generator.- Parameters:
styleGenerator- the cell style generator to remove
-
restoreFilters
Restores container filters to the ones previously saved via saveFilters(). -
saveFilters
Saves currently active filters. -
setActionColumnProperty
Sets the default action column property.- Parameters:
actionColumnProperty- the default action column property
-
setContextProvider
Sets the dialog context provider.- Parameters:
provider- the dialog context provider
-
setFirstVisibleItemIndex
Sets the first visible item index.- Parameters:
i- the item index
-
setFolderSelectHandler
Sets the folder select handler.- Parameters:
folderSelectHandler- the folder select handler
-
setTableState
Sets the table state.- Parameters:
state- the table state
-
startEdit
public void startEdit(CmsUUID itemId, CmsResourceTableProperty propertyId, I_CmsFilePropertyEditHandler editHandler) Starts inline editing of the given file property.- Parameters:
itemId- the item resource structure idpropertyId- the property to editeditHandler- the edit handler
-
stopEdit
Stops the current edit process to save the changed property value. -
update
Updates all items with ids from the given list.- Parameters:
ids- the resource structure ids to updateremove- true if the item should be removed only
-
updateColumnWidths
Updates the column widths.The reason this is needed is that the Vaadin table does not support minimum widths for columns, so expanding columns get squished when most of the horizontal space is used by other columns. So we try to determine whether the expanded columns would have enough space, and if not, give them a fixed width.
- Parameters:
estimatedSpace- the estimated horizontal space available for the table.
-
updateSorting
Updates the file table sorting.
-