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:
java.io.Serializable,java.lang.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.DivUse this component as comment - layer over other, parentHTMLcomponent. Its purpose is allow placing positioned comments over images (i.e. in printcockpit - over page previews), but it is possible to use a customdivcomponent with any content as parent of such component. This component is design in the MVC pattern. It must be constructed with an instance ofCommentLayerComponentControllerandCommentLayerComponentModel. 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 theHTMLcomponent that is the parent of the comment layer component (or in other words, lays below the comment layer)- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, org.zkoss.zk.ui.HtmlBasedComponent parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddIconComponent(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.CanvasgetCanvas()CommentIcongetCommentIcon(CommentModel commentModel)ReturnsCommentIconcorresponding to the targetCommentModelinstanceCommentIcongetCommentIcon(java.lang.String id)ReturnsCommentIconcontained in this component and having target component id.protected org.zkoss.zul.MenupopupgetContextMenu()Creates the context menu for the right-click listener.CommentLayerComponentControllergetController()Returns the comment layer's controller.java.util.List<CommentIcon>getIconComponents()Returns all comment icons components that are currently contained by this comment layer.protected org.zkoss.zul.MenupopupgetIconContextMenu(CommentIcon icon)CommentLayerComponentModelgetModel()Returns current state of the comment layer component -CommentLayerComponentModel.org.zkoss.zk.ui.HtmlBasedComponentgetParent()voidrefresh()Refreshes the component according to the current state in the model.voidrefresh(CommentLayerComponentModel model)Refreshes the component according to the current state in the model.protected voidrefreshCanvas()Refreshes (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 voidsetListeners()voidsetModel(CommentLayerComponentModel model)Sets model to the component.-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, 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, setZIndexDirectly
-
Methods 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, isChildable, 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, willSerialize
-
-
-
-
Constructor Detail
-
CommentLayerComponent
public CommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, org.zkoss.zk.ui.HtmlBasedComponent parent)
-
-
Method Detail
-
setModel
public void setModel(CommentLayerComponentModel model)
Sets model to the component.- Parameters:
model- -CommentLayerComponentModel
-
getModel
public CommentLayerComponentModel getModel()
Returns current state of the comment layer component -CommentLayerComponentModel.
-
getController
public CommentLayerComponentController getController()
Returns the comment layer's controller.
-
refresh
public void refresh(CommentLayerComponentModel model)
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
public java.util.List<CommentIcon> getIconComponents()
Returns all comment icons components that are currently contained by this comment layer.- Returns:
ListofCommentIcons
-
addIconComponent
public boolean addIconComponent(CommentIcon icon)
Adds new comment icon component to the comment layer.- Parameters:
icon-CommentIcon
-
removeIcon
public boolean removeIcon(CommentIcon icon)
Removes icon comment component from the comment layer.- Parameters:
icon- - icon to remove
-
containsComment
public boolean containsComment(CommentModel commentModel)
Returns true if this component contains given comment or false otherwise.- Parameters:
commentModel- comment to search for
-
getCommentIcon
public CommentIcon getCommentIcon(CommentModel commentModel)
ReturnsCommentIconcorresponding to the targetCommentModelinstance- Parameters:
commentModel-- Returns:
CommentIconor null.
-
getCommentIcon
public CommentIcon getCommentIcon(java.lang.String id)
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
protected org.zkoss.zul.Menupopup getIconContextMenu(CommentIcon icon)
-
setListeners
protected void setListeners()
-
-