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<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
-
-
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.
-
Constructor Summary
Constructors Constructor Description CmsResourceIcon()
Constuctor.CmsResourceIcon(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks)
Constructor.
-
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
-
-
-
-
Field Detail
-
ICON_CLASS_CHANGED
public static final java.lang.String ICON_CLASS_CHANGED
The changed icon class.- See Also:
- Constant Field Values
-
ICON_CLASS_LOCK_OTHER
public static final java.lang.String ICON_CLASS_LOCK_OTHER
The other user lock icon class.- See Also:
- Constant Field Values
-
ICON_CLASS_LOCK_OWN
public static final java.lang.String ICON_CLASS_LOCK_OWN
The own user lock icon class.- See Also:
- Constant Field Values
-
ICON_CLASS_LOCK_PUBLISH
public static final java.lang.String ICON_CLASS_LOCK_PUBLISH
The publish lock icon class.- See Also:
- Constant Field Values
-
ICON_CLASS_LOCK_SHARED
public static final java.lang.String ICON_CLASS_LOCK_SHARED
The shared lock icon class.- See Also:
- Constant Field Values
-
ICON_CLASS_SIBLING
public static final java.lang.String ICON_CLASS_SIBLING
The sibling icon class.- See Also:
- Constant Field Values
-
-
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 utilstate
- the resource stateshowLocks
-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 contextresource
- 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 contextdetailPage
- the container page resourceparentFolder
- the parent folder ornull
- 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 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 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 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
-
-