Class CommentLayerComponent
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Div
de.hybris.platform.cockpit.components.mvc.commentlayer.CommentLayerComponent
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
public class CommentLayerComponent
extends org.zkoss.zul.Div
Use this component as comment - layer over other, parent
HTML component. Its purpose is allow placing positioned
comments over images (i.e. in printcockpit - over page previews), but it is possible to use a custom div
component with any content as parent of such component.
This component is design in the MVC pattern. It must be constructed with an instance of
CommentLayerComponentController and CommentLayerComponentModel. The former triggers any comment-layer
actions, like placing new comment, reading comment for the comment layer, while the later holds the current state of
the component. Besides controller and model, the constructor requires the HTML component that is the
parent of the comment layer component (or in other words, lays below the comment layer)- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrlNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
ConstructorsConstructorDescriptionCommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, org.zkoss.zk.ui.HtmlBasedComponent parent) -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddIconComponent(CommentIcon icon) Adds new comment icon component to the comment layer.voidappendCanvas(de.hybris.platform.cockpit.components.canvas.Canvas canvas) Appends canvas element to this comment layer component.booleancontainsComment(CommentModel commentModel) Returns true if this component contains given comment or false otherwise.de.hybris.platform.cockpit.components.canvas.CanvasgetCommentIcon(CommentModel commentModel) ReturnsCommentIconcorresponding to the targetCommentModelinstancegetCommentIcon(String id) ReturnsCommentIconcontained in this component and having target component id.protected org.zkoss.zul.MenupopupCreates the context menu for the right-click listener.Returns the comment layer's controller.Returns all comment icons components that are currently contained by this comment layer.protected org.zkoss.zul.MenupopupgetModel()Returns current state of the comment layer component -CommentLayerComponentModel.org.zkoss.zk.ui.HtmlBasedComponentvoidrefresh()Refreshes the component according to the current state in the model.voidRefreshes the component according to the current state in the model.protected voidRefreshes (if the comment layer component is in edit mode) or clears the canvas component.booleanremoveIcon(CommentIcon icon) Removes icon comment component from the comment layer.voidresize(double scaleFactor) Resizes the component according to the given scale factor.protected voidvoidSets model to the component.Methods inherited from class org.zkoss.zul.Div
getAlign, renderProperties, setAlignMethods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerializeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
invalidatePartial
-
Constructor Details
-
CommentLayerComponent
public CommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, org.zkoss.zk.ui.HtmlBasedComponent parent)
-
-
Method Details
-
setModel
Sets model to the component.- Parameters:
model- -CommentLayerComponentModel
-
getModel
Returns current state of the comment layer component -CommentLayerComponentModel. -
getController
Returns the comment layer's controller. -
refresh
Refreshes the component according to the current state in the model. Besides the width and height, it also sets the listeners according to the given state in the model. Refresh is propagated further to the contained components:- comment icons
- canvas
- Parameters:
model- - the state representation
-
refreshCanvas
protected void refreshCanvas()Refreshes (if the comment layer component is in edit mode) or clears the canvas component. -
refresh
public void refresh()Refreshes the component according to the current state in the model. Besides the width and height, it also sets the listeners according to the current state in the model. Refresh is propagated further to the contained components:- comment icons
- canvas
-
resize
public void resize(double scaleFactor) Resizes the component according to the given scale factor. the dimensions are changed in the model, so the actual view will nor be changed untilrefresh()is called. -
getIconComponents
Returns all comment icons components that are currently contained by this comment layer.- Returns:
ListofCommentIcons
-
addIconComponent
Adds new comment icon component to the comment layer.- Parameters:
icon-CommentIcon
-
removeIcon
Removes icon comment component from the comment layer.- Parameters:
icon- - icon to remove
-
containsComment
Returns true if this component contains given comment or false otherwise.- Parameters:
commentModel- comment to search for
-
getCommentIcon
ReturnsCommentIconcorresponding to the targetCommentModelinstance- Parameters:
commentModel-- Returns:
CommentIconor null.
-
getCommentIcon
ReturnsCommentIconcontained in this component and having target component id.- Parameters:
id- - commentIcon Id
-
getCanvas
public de.hybris.platform.cockpit.components.canvas.Canvas getCanvas()- Returns:
- the canvas element
-
appendCanvas
public void appendCanvas(de.hybris.platform.cockpit.components.canvas.Canvas canvas) Appends canvas element to this comment layer component. It should be drawn over the component.- Parameters:
canvas-Canvas
-
getParent
public org.zkoss.zk.ui.HtmlBasedComponent getParent()- Specified by:
getParentin interfaceorg.zkoss.zk.ui.Component- Overrides:
getParentin classorg.zkoss.zk.ui.AbstractComponent- Returns:
- the parent
-
getContextMenu
protected org.zkoss.zul.Menupopup getContextMenu()Creates the context menu for the right-click listener. The method delegates to thecontroller-CommentLayerComponentController.createContextMenu(CommentLayerComponent);- Returns:
Menupopup
-
getIconContextMenu
-
setListeners
protected void setListeners()
-