Class 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<java.lang.String>, com.vaadin.v7.data.Property.ValueChangeListener, com.vaadin.v7.data.Property.ValueChangeNotifier, com.vaadin.v7.data.Property.Viewer, java.io.Serializable, java.lang.Comparable<com.vaadin.v7.ui.Label>, java.util.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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CmsResourceIcon.IconMode
      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 java.lang.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 java.lang.String ICON_CLASS_CHANGED
      The changed icon class.
      static java.lang.String ICON_CLASS_LOCK_OTHER
      The other user lock icon class.
      static java.lang.String ICON_CLASS_LOCK_OWN
      The own user lock icon class.
      static java.lang.String ICON_CLASS_LOCK_PUBLISH
      The publish lock icon class.
      static java.lang.String ICON_CLASS_LOCK_SHARED
      The shared lock icon class.
      static java.lang.String ICON_CLASS_SIBLING
      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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getDefaultFileOrDetailType​(CmsObject cms, CmsResource resource)
      Returns the default file type or detail type for the given resource.
      static java.lang.String getDetailType​(CmsObject cms, CmsResource detailPage, CmsResource parentFolder)
      Returns the detail content type for container pages that may be detail pages.
      static java.lang.String getIconHTML​(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
      Returns the icon HTML.
      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.
      static java.lang.String getTreeCaptionHTML​(java.lang.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
    • Constructor Detail

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

      • getDefaultFileOrDetailType

        public static java.lang.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 java.lang.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 java.lang.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 java.lang.String getTreeCaptionHTML​(java.lang.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