Class CmsResourceIcon

java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.v7.ui.AbstractLegacyComponent
com.vaadin.v7.ui.Label
org.opencms.ui.components.CmsResourceIcon
All Implemented Interfaces:
com.vaadin.event.ContextClickEvent.ContextClickNotifier, com.vaadin.event.MethodEventSource, com.vaadin.event.SerializableEventListener, com.vaadin.server.ClientConnector, com.vaadin.server.Sizeable, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.v7.data.Property<String>, com.vaadin.v7.data.Property.ValueChangeListener, com.vaadin.v7.data.Property.ValueChangeNotifier, com.vaadin.v7.data.Property.Viewer, Serializable, Comparable<com.vaadin.v7.ui.Label>, EventListener

public class CmsResourceIcon extends com.vaadin.v7.ui.Label
Displays the resource icon and state and lock info.

Important: To avoid issues with click event propagation within tables, we are required to extent the Label component.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Enum used to control icon display style.

    Nested classes/interfaces inherited from class com.vaadin.v7.ui.Label

    com.vaadin.v7.ui.Label.ValueChangeEvent

    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.v7.data.Property

    com.vaadin.v7.data.Property.Editor, com.vaadin.v7.data.Property.ReadOnlyException, com.vaadin.v7.data.Property.ReadOnlyStatusChangeEvent, com.vaadin.v7.data.Property.ReadOnlyStatusChangeListener, com.vaadin.v7.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.v7.data.Property.Transactional<T extends Object>, com.vaadin.v7.data.Property.ValueChangeListener, com.vaadin.v7.data.Property.ValueChangeNotifier, com.vaadin.v7.data.Property.Viewer

    Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable

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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The changed icon class.
    static final String
    The other user lock icon class.
    static final String
    The own user lock icon class.
    static final String
    The publish lock icon class.
    static final String
    The shared lock icon class.
    static final String
    The sibling icon class.

    Fields inherited from class com.vaadin.v7.ui.Label

    CONTENT_DEFAULT, CONTENT_PREFORMATTED, CONTENT_RAW, CONTENT_TEXT, CONTENT_XHTML, CONTENT_XML

    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
    Constuctor.
    CmsResourceIcon(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    Returns the default file type or detail type for the given resource.
    static String
    getDetailType(CmsObject cms, CmsResource detailPage, CmsResource parentFolder)
    Returns the detail content type for container pages that may be detail pages.
    static String
    getIconHTML(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
    Returns the icon HTML.
    static com.vaadin.server.Resource
    Gets the resource icon for a resource for use in a CmsResourceInfo widget when used in a sitemap context.
    static String
    getTreeCaptionHTML(String resourceName, CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
    Returns the tree caption HTML including the resource icon.
    void
    initContent(CmsResourceUtil resUtil, com.vaadin.server.Resource iconResource, CmsResourceState state, boolean showLocks, boolean showDetailIcon)
    Initializes the content.
    void
    initContent(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks, boolean showDetailIcon)
    Initializes the content.

    Methods inherited from class com.vaadin.v7.ui.Label

    addListener, addValueChangeListener, attach, compareTo, fireValueChange, getContentMode, getConverter, getCustomAttributes, getPropertyDataSource, getState, getState, getType, getValue, readDesign, removeListener, removeValueChangeListener, setContentMode, setConverter, setLocale, setPropertyDataSource, setValue, valueChange, writeDesign

    Methods inherited from class com.vaadin.v7.ui.AbstractLegacyComponent

    beforeClientResponse, getExplicitImmediateValue, isImmediate, isReadOnly, setImmediate, setReadOnly

    Methods inherited from class com.vaadin.ui.AbstractComponent

    addContextClickListener, addListener, addShortcutListener, addStyleName, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, focus, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setParent, setPrimaryStyleName, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthFull, setWidthUndefined

    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, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler

    Methods inherited from interface com.vaadin.ui.Component

    addStyleNames, getUI, removeStyleNames, setStyleName

    Methods inherited from interface com.vaadin.shared.Connector

    getConnectorId

    Methods inherited from interface com.vaadin.v7.data.Property

    isReadOnly, setReadOnly
  • Field Details

  • Constructor Details

    • CmsResourceIcon

      public CmsResourceIcon()
      Constuctor.

      To be used in declarative layouts. Make sure to call initContent later on.

    • CmsResourceIcon

      public CmsResourceIcon(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
      Constructor.

      Parameters:
      resUtil - the resource util
      state - the resource state
      showLocks - true to show the resource locks
  • Method Details

    • getDefaultFileOrDetailType

      public static String getDefaultFileOrDetailType(CmsObject cms, CmsResource resource)
      Returns the default file type or detail type for the given resource.

      Parameters:
      cms - the cms context
      resource - the container page resource
      Returns:
      the detail content type
    • getDetailType

      public static String getDetailType(CmsObject cms, CmsResource detailPage, CmsResource parentFolder)
      Returns the detail content type for container pages that may be detail pages.

      Parameters:
      cms - the cms context
      detailPage - the container page resource
      parentFolder - the parent folder or null
      Returns:
      the detail content type
    • getIconHTML

      public static String getIconHTML(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
      Returns the icon HTML.

      Parameters:
      resUtil - the resource util for the resource
      state - the resource state
      showLocks - true to show lock state overlay
      Returns:
      the icon HTML
    • getSitemapResourceIcon

      public static com.vaadin.server.Resource getSitemapResourceIcon(CmsObject cms, CmsResource resource, CmsResourceIcon.IconMode iconMode)
      Gets the resource icon for a resource for use in a CmsResourceInfo widget when used in a sitemap context.

      Parameters:
      cms - the CMS context
      resource - a resource
      iconMode - the icon mode
      Returns:
      the path for the resource icon
    • getTreeCaptionHTML

      public static String getTreeCaptionHTML(String resourceName, CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
      Returns the tree caption HTML including the resource icon.

      Parameters:
      resourceName - the resource name to display
      resUtil - the resource util for the resource
      state - the resource state
      showLocks - true to show lock state overlay
      Returns:
      the icon HTML
    • initContent

      public void initContent(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks, boolean showDetailIcon)
      Initializes the content.

      Parameters:
      resUtil - the resource util
      state - the resource state
      showLocks - true to show the resource locks
      showDetailIcon - true to show the detail icon overlay
    • initContent

      public void initContent(CmsResourceUtil resUtil, com.vaadin.server.Resource iconResource, CmsResourceState state, boolean showLocks, boolean showDetailIcon)
      Initializes the content.

      Parameters:
      resUtil - the resource util
      iconResource - the icon path
      state - the resource state
      showLocks - true to show the resource locks
      showDetailIcon - true to show the detail icon overlay