Class 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, java.io.Serializable, java.lang.Iterable<com.vaadin.ui.Component>
    Direct Known Subclasses:
    CmsLinkValidationInternalTable, CmsResultTable

    public class CmsFileTable
    extends CmsResourceTable
    Table for displaying resources.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  CmsFileTable.FileEditHandler
      File edit handler.
      class  CmsFileTable.FileFieldFactory
      Field factory to enable inline editing of individual file properties.
      static class  CmsFileTable.FileSorter
      Extends the default sorting to differentiate between files and folder when sorting by name.
      static interface  CmsFileTable.I_FolderSelectHandler
      Handles folder selects in the file table.
      • Nested 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.DetachListener
      • Nested 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.Listener
      • Nested 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.ComponentDetachListener
      • Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable

        com.vaadin.server.Sizeable.Unit
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAdditionalStyleGenerator​(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator)
      Adds an additional cell style generator.
      void applyWorkplaceAppSettings()
      Applies settings generally used within workplace app file lists.
      void clearFilters()
      Clears all container filters.
      boolean containsId​(CmsUUID structureId)
      Checks if the file table has a row for the resource with the given structure id.
      void filterTable​(java.lang.String search)
      Filters the displayed resources.
      byte[] generateCsv()
      Generates UTF-8 encoded CSV for currently active table columns (standard columns only).
      I_CmsContextProvider getContextProvider()
      Returns the dialog context provider.
      int getFirstVisibleItemIndex()
      Returns the index of the first visible item.
      java.util.Collection<CmsUUID> getSelectedIds()
      Gets the selected structure ids.
      java.util.List<CmsResource> getSelectedResources()
      Gets the list of selected resources.
      static java.lang.String getStateStyle​(com.vaadin.v7.data.Item resourceItem)
      Returns the resource state specific style name.
      CmsFileExplorerSettings getTableSettings()
      Returns the current table state.
      void handleSelection​(java.lang.String itemId)
      Handles the item selection.
      boolean isEditing()
      Returns if a file property is being edited.
      boolean isEditProperty​(CmsResourceTableProperty propertyId)
      Returns if the given property is being edited.
      void openContextMenu​(com.vaadin.v7.event.ItemClickEvent event)
      Opens the context menu.
      void removeAdditionalStyleGenerator​(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator)
      Removes the given cell style generator.
      void restoreFilters()
      Restores container filters to the ones previously saved via saveFilters().
      void saveFilters()
      Saves currently active filters.
      void setActionColumnProperty​(CmsResourceTableProperty actionColumnProperty)
      Sets the default action column property.
      void setContextProvider​(I_CmsContextProvider provider)
      Sets the dialog context provider.
      void setFirstVisibleItemIndex​(int i)
      Sets the first visible item index.
      void setFolderSelectHandler​(CmsFileTable.I_FolderSelectHandler folderSelectHandler)
      Sets the folder select handler.
      void setMenuBuilder​(I_CmsContextMenuBuilder builder)
      Sets the menu builder.
      void setTableState​(CmsFileExplorerSettings state)
      Sets the table state.
      void startEdit​(CmsUUID itemId, CmsResourceTableProperty propertyId, I_CmsFilePropertyEditHandler editHandler)
      Starts inline editing of the given file property.
      void stopEdit()
      Stops the current edit process to save the changed property value.
      void update​(java.util.Collection<CmsUUID> ids, boolean remove)
      Updates all items with ids from the given list.
      void updateColumnWidths​(int estimatedSpace)
      Updates the column widths.
      void updateSorting()
      Updates the file table sorting.
      • Methods inherited from class com.vaadin.ui.CustomComponent

        getComponentCount, getCompositionRoot, getState, getState, iterator, setCompositionRoot
      • Methods 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, writeDesign
      • Methods 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, updateDiffstate
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods 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, setErrorHandler
      • Methods 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, writeDesign
      • Methods inherited from interface com.vaadin.shared.Connector

        getConnectorId
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface com.vaadin.server.Sizeable

        getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined
    • Method Detail

      • getStateStyle

        public static java.lang.String getStateStyle​(com.vaadin.v7.data.Item resourceItem)
        Returns the resource state specific style name.

        Parameters:
        resourceItem - the resource item
        Returns:
        the style name
      • addAdditionalStyleGenerator

        public void addAdditionalStyleGenerator​(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator)
        Adds an additional cell style generator.

        Parameters:
        styleGenerator - the cell style generator
      • applyWorkplaceAppSettings

        public void applyWorkplaceAppSettings()
        Applies settings generally used within workplace app file lists.

      • clearFilters

        public void clearFilters()
        Clears all container filters.
      • containsId

        public boolean containsId​(CmsUUID structureId)
        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

        public void filterTable​(java.lang.String search)
        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

        public byte[] 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
      • getFirstVisibleItemIndex

        public int getFirstVisibleItemIndex()
        Returns the index of the first visible item.

        Returns:
        the first visible item
      • getSelectedIds

        public java.util.Collection<CmsUUIDgetSelectedIds()
        Gets the selected structure ids.

        Returns:
        the set of selected structure ids
      • getSelectedResources

        public java.util.List<CmsResourcegetSelectedResources()
        Gets the list of selected resources.

        Returns:
        the list of selected resources
      • handleSelection

        public void handleSelection​(java.lang.String itemId)
        Handles the item selection.

        Parameters:
        itemId - the selected item id
      • isEditing

        public boolean isEditing()
        Returns if a file property is being edited.

        Returns:
        true if a file property is being edited
      • isEditProperty

        public boolean isEditProperty​(CmsResourceTableProperty propertyId)
        Returns if the given property is being edited.

        Parameters:
        propertyId - the property id
        Returns:
        true if the given property is being edited
      • openContextMenu

        public void openContextMenu​(com.vaadin.v7.event.ItemClickEvent event)
        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

        public void restoreFilters()
        Restores container filters to the ones previously saved via saveFilters().
      • saveFilters

        public void saveFilters()
        Saves currently active filters.

      • setFirstVisibleItemIndex

        public void setFirstVisibleItemIndex​(int i)
        Sets the first visible item index.

        Parameters:
        i - the item index
      • stopEdit

        public void stopEdit()
        Stops the current edit process to save the changed property value.

      • update

        public void update​(java.util.Collection<CmsUUID> ids,
                           boolean remove)
        Updates all items with ids from the given list.

        Parameters:
        ids - the resource structure ids to update
        remove - true if the item should be removed only
      • updateColumnWidths

        public void updateColumnWidths​(int estimatedSpace)
        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

        public void updateSorting()
        Updates the file table sorting.