Interface CommentLayerComponentController<T extends CommentLayerComponent>
- All Known Implementing Classes:
DefaultCommentLayerComponentController
public interface CommentLayerComponentController<T extends CommentLayerComponent>
Controller for the
CommentLayerComponent-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommentIcon(T commentLayerComponent, int x_Position, int y_Position) Appends new comment icon on thecommentLayercomponentat the x,y position.booleanChecks if current user can create new comment instances.booleancanDeleteComment(CommentModel comment) Evaluates if current user is eligible to delete the target comment instance.booleancanEditComment(CommentModel comment) Evaluates if current user can edit a comment behind the comment icon on the comment layer component.booleanEvaluates if current user can move given comment on the comment layer.booleancanReplyToComment(CommentModel comment) Evaluates if current user can reply to a comment behind the comment icon on the comment layer component.voidchangeCommentLayerMode(CommentLayerContext context, String mode) Changes the mode of all comment layer components in the context.voidchangeCommentLayerMode(T component, String mode) Changes the mode of the comment layer component.voidChanges the mode of all comment layer components in the context to default mode.voidchangeCommentLayerToDefaultMode(T component) Changes the mode of the target comment layer component to default mode.org.zkoss.zul.MenupopupcreateContextMenu(T component) Creates context menu component for the right-click actions on the comment layerorg.zkoss.zul.MenupopupcreateIconContextMenu(T commentLayerComponent, CommentIcon icon) Creates context menu component for the right-click actions on the icons on comment layervoiddeleteCommentFromCommentLayer(T component, CommentIcon icon) Removes the given icon from the target comment layer component.voiddrawCommentLayerOverArea(org.zkoss.zk.ui.HtmlBasedComponent parent, T commentLayerComponent) Draws the comment layer over the given parenthtmlcomponent.voideditCommentPopup(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel) Method for rendering popup for reply edit.getCommentIconForComment(T component, CommentModel comment) Returns CommentIcon component for the givenCommentModelwhich is placed on the givenCommentLayerComponent;double[]getWidthAndHeight(CommentLayerComponent component, double scaleFactor) Return comment layer dimensions according to the given scale factor.voidmoveCommentIcon(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).Refreshes the instance of comment icon.voidrefreshContextList(CommentLayerAwareModel commentLayerAwareModel, boolean refreshItems) Tries to perform refresh of theContextAreaCommentTreeComponentvoidreplyComment(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel) Renders reply popup for theAbstractCommentModelinstance.voidselectCommentIcon(T commentLayerComponent, CommentIcon icon) Marks the target icon as selected on the given comment layer component.
-
Method Details
-
changeCommentLayerMode
Changes the mode of the comment layer component.- Parameters:
component-CommentLayerComponentmode- - 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
Changes the mode of all comment layer components in the context.- Parameters:
context- -CommentLayerContextmode- - Please use one of the out-of-the-box modes or any other, customized mode.
-
changeCommentLayerToDefaultMode
Changes the mode of all comment layer components in the context to default mode.- Parameters:
context- -CommentLayerContext
-
changeCommentLayerToDefaultMode
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
Appends new comment icon on thecommentLayercomponentat the x,y position. Calling this method will create:- new comment instance for the target item
CommentLayerComponentModel.getCommentTarget()) - and additional meta relation (
CommentMetadataModel) with the comment layer target item ( i. e Page preview in print cockpitCommentLayerComponentModel.getCommentLayerTarget()).
- Parameters:
commentLayerComponent- - componentx_Position- - x position (left)y_Position- - y position (top)- Throws:
IllegalArgumentException- if commentLayerComponent is null or either x or y is negative.
- new comment instance for the target item
-
deleteCommentFromCommentLayer
Removes the given icon from the target comment layer component. The underlying Comment instance will also be removed.- Parameters:
component- - Comment layer componenticon- - icon to remove- Throws:
IllegalArgumentException- if either component or icon is nullIllegalStateException- if the target icon is not a child of the given comment layer component.
-
drawCommentLayerOverArea
Draws the comment layer over the given parenthtmlcomponent. 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 :- comments target -
CommentLayerComponentModel.getCommentTarget()and - comment layer target -
CommentLayerComponentModel.getCommentLayerTarget().
- Parameters:
parent- - comment layer targetcommentLayerComponent- - comment layer to draw- Throws:
IllegalArgumentException- if either parent or commentLayerComponent is null
- comments target -
-
selectCommentIcon
Marks the target icon as selected on the given comment layer component. The icon model's flagCommentIconModel.isSelected()is set to true and also currently selected icon is unselected.- Parameters:
commentLayerComponent- - parent commentCommentLayerComponentcomponent.icon- - icon to select.
-
createContextMenu
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
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
Returns CommentIcon component for the givenCommentModelwhich is placed on the givenCommentLayerComponent;- Returns:
- corresponding
CommentIconor null if no such icon was found.
-
canEditComment
Evaluates if current user can edit a comment behind the comment icon on the comment layer component. -
canReplyToComment
Evaluates if current user can reply to a comment behind the comment icon on the comment layer component. The method call finally hits the appropriateCommentPermissionCheckStrategy, which can be customized per project installation.- Parameters:
comment- - targetCommentModel- Returns:
- true or false
-
canCreateComment
boolean canCreateComment()Checks if current user can create new comment instances.- Returns:
- true or false.
-
canDeleteComment
Evaluates if current user is eligible to delete the target comment instance. The method call finally hits the appropriateCommentPermissionCheckStrategy, which can be customized per project installation.- Parameters:
comment- - targetCommentModel
-
canMoveCommentIcon
Evaluates if current user can move given comment on the comment layer.- Parameters:
icon- - targetCommentIcon- 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- -CommentLayerComponenticon- -CommentIconto be movedx_Position- - target x position (HtmlBasedComponent.setLeft(String))y_Position- - target x position (HtmlBasedComponent.setTop(String))
-
replyComment
Renders reply popup for theAbstractCommentModelinstance.- Parameters:
model- - model of the active comment layerabstractCommentModel- - instance to reply
-
refreshCommentIcon
Refreshes the instance of comment icon. Layout parameters are refreshed, but also with theCommentModelinstance residing in theCommentIconModel.- Parameters:
icon- -CommentIconto refresh- Returns:
- refreshed
CommentIcon
-
editCommentPopup
Method for rendering popup for reply edit.- Parameters:
model- -CommentLayerAwareModelabstractCommentModel- -AbstractCommentModelto edit
-
getWidthAndHeight
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 layerscaleFactor- -target scale factor- Throws:
IllegalArgumentException- if component is null or scaleFactor is less or equal zero.
-
refreshContextList
Tries to perform refresh of theContextAreaCommentTreeComponent
-