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
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum used to control icon display style.Nested classes/interfaces inherited from class com.vaadin.v7.ui.Label
com.vaadin.v7.ui.Label.ValueChangeEventNested 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.DetachListenerNested 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.ListenerNested 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>, com.vaadin.v7.data.Property.ValueChangeListener, com.vaadin.v7.data.Property.ValueChangeNotifier, com.vaadin.v7.data.Property.ViewerNested classes/interfaces inherited from interface com.vaadin.server.Sizeable
com.vaadin.server.Sizeable.Unit -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe changed icon class.static final StringThe other user lock icon class.static final StringThe own user lock icon class.static final StringThe publish lock icon class.static final StringThe shared lock icon class.static final Stringstatic final StringThe sibling icon class.Fields inherited from class com.vaadin.v7.ui.Label
CONTENT_DEFAULT, CONTENT_PREFORMATTED, CONTENT_RAW, CONTENT_TEXT, CONTENT_XHTML, CONTENT_XMLFields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXTFields 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
ConstructorsConstructorDescriptionConstuctor.CmsResourceIcon(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetDefaultFileOrDetailType(CmsObject cms, CmsResource resource) Returns the default file type or detail type for the given resource.static StringgetDetailType(CmsObject cms, CmsResource detailPage, CmsResource parentFolder) Returns the detail content type for container pages that may be detail pages.static StringgetIconHTML(CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks) Returns the icon HTML.static com.vaadin.server.ResourcegetSitemapResourceIcon(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 StringgetTreeCaptionHTML(String resourceName, CmsResourceUtil resUtil, CmsResourceState state, boolean showLocks) Returns the tree caption HTML including the resource icon.voidinitContent(CmsResourceUtil resUtil, com.vaadin.server.Resource iconResource, CmsResourceState state, boolean showLocks, boolean showDetailIcon) Initializes the content.voidinitContent(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, writeDesignMethods inherited from class com.vaadin.v7.ui.AbstractLegacyComponent
beforeClientResponse, getExplicitImmediateValue, isImmediate, isReadOnly, setImmediate, setReadOnlyMethods 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, setWidthUndefinedMethods 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, updateDiffstateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlerMethods inherited from interface com.vaadin.ui.Component
addStyleNames, getUI, removeStyleNames, setStyleNameMethods inherited from interface com.vaadin.shared.Connector
getConnectorIdMethods inherited from interface com.vaadin.v7.data.Property
isReadOnly, setReadOnly
-
Field Details
-
ICON_CLASS_CHANGED
The changed icon class.- See Also:
-
ICON_CLASS_ONLINE_FOLDER
- 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-trueto 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-trueto 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-trueto 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-trueto show the resource locksshowDetailIcon-trueto 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-trueto show the resource locksshowDetailIcon-trueto show the detail icon overlay
-