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.ExtraCtrl

    Nested 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

    _zclass

    Fields inherited from interface org.zkoss.zk.ui.Component

    APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE

    Fields 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

    Constructors
    Constructor
    Description
    CommentLayerComponent(CommentLayerComponentController controller, CommentLayerComponentModel model, org.zkoss.zk.ui.HtmlBasedComponent parent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds new comment icon component to the comment layer.
    void
    appendCanvas(de.hybris.platform.cockpit.components.canvas.Canvas canvas)
    Appends canvas element to this comment layer component.
    boolean
    Returns true if this component contains given comment or false otherwise.
    de.hybris.platform.cockpit.components.canvas.Canvas
     
    Returns CommentIcon corresponding to the target CommentModel instance
    Returns CommentIcon contained in this component and having target component id.
    protected org.zkoss.zul.Menupopup
    Creates 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.Menupopup
     
    Returns current state of the comment layer component - CommentLayerComponentModel.
    org.zkoss.zk.ui.HtmlBasedComponent
     
    void
    Refreshes the component according to the current state in the model.
    void
    Refreshes the component according to the current state in the model.
    protected void
    Refreshes (if the comment layer component is in edit mode) or clears the canvas component.
    boolean
    Removes icon comment component from the comment layer.
    void
    resize(double scaleFactor)
    Resizes the component according to the given scale factor.
    protected void
     
    void
    Sets model to the component.

    Methods inherited from class org.zkoss.zul.Div

    getAlign, renderProperties, setAlign

    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, 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, 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, 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, willSerialize

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl

    invalidatePartial
  • Constructor Details

  • Method Details

    • 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 until refresh() is called.
    • getIconComponents

      public List<CommentIcon> getIconComponents()
      Returns all comment icons components that are currently contained by this comment layer.
      Returns:
      List of CommentIcons
    • 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)
      Returns CommentIcon corresponding to the target CommentModel instance
      Parameters:
      commentModel -
      Returns:
      CommentIcon or null.
    • getCommentIcon

      public CommentIcon getCommentIcon(String id)
      Returns CommentIcon contained 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:
      getParent in interface org.zkoss.zk.ui.Component
      Overrides:
      getParent in class org.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 the controller - CommentLayerComponentController.createContextMenu(CommentLayerComponent);
      Returns:
      Menupopup
    • getIconContextMenu

      protected org.zkoss.zul.Menupopup getIconContextMenu(CommentIcon icon)
    • setListeners

      protected void setListeners()