Interface CommentLayerComponentController<T extends CommentLayerComponent>

All Known Implementing Classes:
DefaultCommentLayerComponentController

public interface CommentLayerComponentController<T extends CommentLayerComponent>
Controller for the CommentLayerComponent
  • Method Details

    • changeCommentLayerMode

      void changeCommentLayerMode(T component, String mode)
      Changes the mode of the comment layer component.
      Parameters:
      component - CommentLayerComponent
      mode - - Please use one of the out-of-the-box modes or any other, customized mode.
      Throws:
      IllegalArgumentException - if either component or mode is null
    • changeCommentLayerMode

      void changeCommentLayerMode(CommentLayerContext context, String mode)
      Changes the mode of all comment layer components in the context.
      Parameters:
      context - - CommentLayerContext
      mode - - Please use one of the out-of-the-box modes or any other, customized mode.
    • changeCommentLayerToDefaultMode

      void changeCommentLayerToDefaultMode(CommentLayerContext context)
      Changes the mode of all comment layer components in the context to default mode.
      Parameters:
      context - - CommentLayerContext
    • changeCommentLayerToDefaultMode

      void changeCommentLayerToDefaultMode(T component)
      Changes the mode of the target comment layer component to default mode.
      Parameters:
      component - CommentLayerComponent
      Throws:
      IllegalArgumentException - if either component or mode is null
    • addCommentIcon

      void addCommentIcon(T commentLayerComponent, int x_Position, int y_Position)
      Appends new comment icon on the commentLayercomponent at the x,y position.
      Calling this method will create: This Meta-data stores information where the new comment should be displayed on the comment layer.
      Parameters:
      commentLayerComponent - - component
      x_Position - - x position (left)
      y_Position - - y position (top)
      Throws:
      IllegalArgumentException - if commentLayerComponent is null or either x or y is negative.
    • deleteCommentFromCommentLayer

      void deleteCommentFromCommentLayer(T component, CommentIcon icon)
      Removes the given icon from the target comment layer component. The underlying Comment instance will also be removed.
      Parameters:
      component - - Comment layer component
      icon - - icon to remove
      Throws:
      IllegalArgumentException - if either component or icon is null
      IllegalStateException - if the target icon is not a child of the given comment layer component.
    • drawCommentLayerOverArea

      void drawCommentLayerOverArea(org.zkoss.zk.ui.HtmlBasedComponent parent, T commentLayerComponent)
      Draws the comment layer over the given parent html component. Comment icons corresponding to the current state of the model will also be drawn on the layer. The comments are found from the data base according to the :
      Parameters:
      parent - - comment layer target
      commentLayerComponent - - comment layer to draw
      Throws:
      IllegalArgumentException - if either parent or commentLayerComponent is null
    • selectCommentIcon

      void selectCommentIcon(T commentLayerComponent, CommentIcon icon)
      Marks the target icon as selected on the given comment layer component. The icon model's flag CommentIconModel.isSelected() is set to true and also currently selected icon is unselected.
      Parameters:
      commentLayerComponent - - parent comment CommentLayerComponent component.
      icon - - icon to select.
    • createContextMenu

      org.zkoss.zul.Menupopup createContextMenu(T component)
      Creates context menu component for the right-click actions on the comment layer
      Parameters:
      component - - comment layer component
      Throws:
      IllegalArgumentException - if component is null
    • createIconContextMenu

      org.zkoss.zul.Menupopup createIconContextMenu(T commentLayerComponent, CommentIcon icon)
      Creates context menu component for the right-click actions on the icons on comment layer
      Parameters:
      icon - - icon from a comment layer component
      Throws:
      IllegalArgumentException - if icon or comment layer component is null
    • getCommentIconForComment

      CommentIcon getCommentIconForComment(T component, CommentModel comment)
      Returns CommentIcon component for the given CommentModel which is placed on the given CommentLayerComponent;
      Returns:
      corresponding CommentIcon or null if no such icon was found.
    • canEditComment

      boolean canEditComment(CommentModel comment)
      Evaluates if current user can edit a comment behind the comment icon on the comment layer component.
    • canReplyToComment

      boolean canReplyToComment(CommentModel comment)
      Evaluates if current user can reply to a comment behind the comment icon on the comment layer component. The method call finally hits the appropriate CommentPermissionCheckStrategy, which can be customized per project installation.
      Parameters:
      comment - - target CommentModel
      Returns:
      true or false
    • canCreateComment

      boolean canCreateComment()
      Checks if current user can create new comment instances.
      Returns:
      true or false.
    • canDeleteComment

      boolean canDeleteComment(CommentModel comment)
      Evaluates if current user is eligible to delete the target comment instance. The method call finally hits the appropriate CommentPermissionCheckStrategy, which can be customized per project installation.
      Parameters:
      comment - - target CommentModel
    • canMoveCommentIcon

      boolean canMoveCommentIcon(CommentIcon icon)
      Evaluates if current user can move given comment on the comment layer.
      Parameters:
      icon - - target CommentIcon
      Returns:
      true or false
    • moveCommentIcon

      void moveCommentIcon(CommentLayerComponent commentLayerComponent, CommentIcon icon, int x_Position, int y_Position)
      Moves the target comment icon on the comment layer component to the target position (x, y).
      Parameters:
      commentLayerComponent - - CommentLayerComponent
      icon - - CommentIcon to be moved
      x_Position - - target x position (HtmlBasedComponent.setLeft(String))
      y_Position - - target x position (HtmlBasedComponent.setTop(String))
    • replyComment

      void replyComment(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel)
      Renders reply popup for the AbstractCommentModel instance.
      Parameters:
      model - - model of the active comment layer
      abstractCommentModel - - instance to reply
    • refreshCommentIcon

      CommentIcon refreshCommentIcon(CommentIcon icon)
      Refreshes the instance of comment icon. Layout parameters are refreshed, but also with the CommentModel instance residing in the CommentIconModel.
      Parameters:
      icon - - CommentIcon to refresh
      Returns:
      refreshed CommentIcon
    • editCommentPopup

      void editCommentPopup(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel)
      Method for rendering popup for reply edit.
      Parameters:
      model - - CommentLayerAwareModel
      abstractCommentModel - - AbstractCommentModel to edit
    • getWidthAndHeight

      double[] getWidthAndHeight(CommentLayerComponent component, double scaleFactor)
      Return comment layer dimensions according to the given scale factor. This method allows to influence the actual dimensions of the comment layer component
      Parameters:
      component - - Comment layer
      scaleFactor - -target scale factor
      Throws:
      IllegalArgumentException - if component is null or scaleFactor is less or equal zero.
    • refreshContextList

      void refreshContextList(CommentLayerAwareModel commentLayerAwareModel, boolean refreshItems)
      Tries to perform refresh of the ContextAreaCommentTreeComponent