Package org.opencms.ui.components
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
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
Modifier and TypeClassDescriptionstatic 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
Modifier and TypeFieldDescriptionstatic 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
ConstructorDescriptionConstuctor.CmsResourceIcon
(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDefaultFileOrDetailType
(CmsObject cms, CmsResource resource) 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
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 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
-
ICON_CLASS_CHANGED
The changed icon class.- See Also:
-
ICON_CLASS_LOCK_OTHER
The other user lock icon class.- See Also:
-
ICON_CLASS_LOCK_OWN
The own user lock icon class.- See Also:
-
ICON_CLASS_LOCK_PUBLISH
The publish lock icon class.- See Also:
-
ICON_CLASS_LOCK_SHARED
The shared lock icon class.- See Also:
-
ICON_CLASS_SIBLING
The sibling icon class.- See Also:
-
-
Constructor Details
-
CmsResourceIcon
public CmsResourceIcon()Constuctor.To be used in declarative layouts. Make sure to call initContent later on.
-
CmsResourceIcon
Constructor.- Parameters:
resUtil
- the resource utilstate
- the resource stateshowLocks
-true
to show the resource locks
-
-
Method Details
-
getDefaultFileOrDetailType
Returns the default file type or detail type for the given resource.- Parameters:
cms
- the cms contextresource
- the container page resource- Returns:
- the detail content type
-
getDetailType
Returns the detail content type for container pages that may be detail pages.- Parameters:
cms
- the cms contextdetailPage
- the container page resourceparentFolder
- the parent folder ornull
- 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 resourcestate
- the resource stateshowLocks
-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 contextresource
- a resourceiconMode
- 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 displayresUtil
- the resource util for the resourcestate
- the resource stateshowLocks
-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 utilstate
- the resource stateshowLocks
-true
to show the resource locksshowDetailIcon
-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 utiliconResource
- the icon pathstate
- the resource stateshowLocks
-true
to show the resource locksshowDetailIcon
-true
to show the detail icon overlay
-