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

public class CmsFileTable extends CmsResourceTable
Table for displaying resources.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    File edit handler.
    class 
    Field factory to enable inline editing of individual file properties.
    static class 
    Extends the default sorting to differentiate between files and folder when sorting by name.
    static interface 
    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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    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_propertyProviders

    Fields inherited from class com.vaadin.ui.AbstractComponent

    DESIGN_ATTR_PLAIN_TEXT

    Fields 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

    Constructors
    Constructor
    Description
    Default constructor.
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAdditionalStyleGenerator(com.vaadin.v7.ui.Table.CellStyleGenerator styleGenerator)
    Adds an additional cell style generator.
    void
    Applies settings generally used within workplace app file lists.
    void
    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
    Filters the displayed resources.
    byte[]
    Generates UTF-8 encoded CSV for currently active table columns (standard columns only).
    Returns the dialog context provider.
    int
    Returns the index of the first visible item.
    Gets the selected structure ids.
    Gets the list of selected resources.
    static String
    getStateStyle(com.vaadin.v7.data.Item resourceItem)
    Returns the resource state specific style name.
    Returns the current table state.
    void
    Handles the item selection.
    boolean
    Returns if a file property is being edited.
    boolean
    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
    Restores container filters to the ones previously saved via saveFilters().
    void
    Saves currently active filters.
    void
    Sets the default action column property.
    void
    Sets the dialog context provider.
    void
    Sets the first visible item index.
    void
    Sets the folder select handler.
    void
    Sets the menu builder.
    void
    Sets the table state.
    void
    Starts inline editing of the given file property.
    void
    Stops the current edit process to save the changed property value.
    void
    update(Collection<CmsUUID> ids, boolean remove)
    Updates all items with ids from the given list.
    void
    updateColumnWidths(int estimatedSpace)
    Updates the column widths.
    void
    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
  • Field Details

  • Constructor Details

  • Method Details

    • getStateStyle

      public static 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

      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(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
    • 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

      public void handleSelection(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.

    • setActionColumnProperty

      public void setActionColumnProperty(CmsResourceTableProperty actionColumnProperty)
      Sets the default action column property.

      Parameters:
      actionColumnProperty - the default action column property
    • setContextProvider

      public void setContextProvider(I_CmsContextProvider provider)
      Sets the dialog context provider.

      Parameters:
      provider - the dialog context provider
    • setFirstVisibleItemIndex

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

      Parameters:
      i - the item index
    • setFolderSelectHandler

      Sets the folder select handler.

      Parameters:
      folderSelectHandler - the folder select handler
    • setMenuBuilder

      public void setMenuBuilder(I_CmsContextMenuBuilder builder)
      Sets the menu builder.

      Parameters:
      builder - the menu builder
    • 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 id
      propertyId - the property to edit
      editHandler - the edit handler
    • stopEdit

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

    • update

      public void update(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.