Class DefaultCommentLayerComponentController
java.lang.Object
de.hybris.platform.cockpit.components.mvc.commentlayer.controller.impl.DefaultCommentLayerComponentController
- All Implemented Interfaces:
CommentLayerComponentController<CommentLayerComponent>
public class DefaultCommentLayerComponentController
extends Object
implements CommentLayerComponentController<CommentLayerComponent>
Default implementation of
CommentLayerComponentController.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ModelHelperprotected TypeServiceprotected static final Stringprotected static final Stringprotected CommentLayerServiceprotected CommentServiceprotected TooltipRendererprotected CommentTypeModelprotected ComponentModelprotected DomainModelprotected static final org.slf4j.Loggerprotected ModelServiceprotected static final Stringprotected UIAccessRightService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommentIcon(CommentLayerComponent commentLayerComponent, int x_Position, int y_Position) Appends new comment icon on thecommentLayercomponentat the x,y position.protected voidaddExistingComments(CommentLayerComponent commentLayerComponent) booleanChecks if current user can create new comment instances.protected booleancanCreateComment(TypedObject commentTarget) 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(CommentLayerComponent component, String mode) Changes the mode of the comment layer component.voidchangeCommentLayerMode(CommentLayerContext context, String mode) Changes the mode of all comment layer components in the context.voidChanges the mode of the target comment layer component to default mode.voidChanges the mode of all comment layer components in the context to default mode.protected CockpitBasicFCKEditorcreateCockpitFCKEditor(Map<String, ? extends Object> editorParameters) protected CommentMetadataModelcreateCommentMetadata(CommentLayerComponentModel model, CommentModel commentToSave, CommentIcon newIcon) org.zkoss.zul.MenupopupcreateContextMenu(CommentLayerComponent component) Creates context menu component for the right-click actions on the comment layerprotected voidcreateEditPopupContentForComment(org.zkoss.zul.Window newCommentPopup, CommentLayerComponent clComponent, CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) Create additional content for comment creation and edit popup.protected org.zkoss.zul.WindowcreateEditPopupForComment(CommentLayerComponent clComponent, CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) protected org.zkoss.zul.WindowcreateEditPopupForComment(CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) org.zkoss.zul.MenupopupcreateIconContextMenu(CommentLayerComponent component, CommentIcon icon) Creates context menu component for the right-click actions on the icons on comment layerprotected CommentIconcreateNewIcon(CommentIconModel model) protected org.zkoss.zul.WindowcreateReplyPopup(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel, boolean edit) voiddeleteCommentFromCommentLayer(CommentLayerComponent component, CommentIcon icon) Removes the given icon from the target comment layer component.protected booleandisplayCommentIcon(TypedObject commentLayerTarget, CommentMetadataModel metaData) Determines if comment icon represented by the meta data should be displayed over givencommentLayerTerget.protected booleandisplayCommentIcon(TypedObject commentLayerTarget, CommentMetadataModel metaData, int pageIndex) Determines if comment icon represented by the meta data should be displayed over givencommentLayerTerget.voiddrawCommentLayerOverArea(org.zkoss.zk.ui.HtmlBasedComponent parent, CommentLayerComponent commentLayerComponent) Draws the comment layer over the given parenthtmlcomponent.voideditCommentPopup(CommentLayerAwareModel model, AbstractCommentModel abstractComment) Method for rendering popup for reply edit.getCommentIconForComment(CommentLayerComponent component, CommentModel comment) Returns CommentIcon component for the givenCommentModelwhich is placed on the givenCommentLayerComponent;protected CommentTypeModelprotected UserModelprotected ComponentModelprotected double[]getDimensionsFromParent(org.zkoss.zk.ui.HtmlBasedComponent area) protected DomainModelprotected intgetPagePreviewIndex(ItemModel commentLayerTarget) Computes preview index basing on the comet file code.protected IntegergetRealPositionCoordinate(int scaledCoordinate, double scaleFactor) protected TypeServicedouble[]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).protected voidprepareCommentUpdate(org.zkoss.zul.Window newCommentPopup, AbstractCommentModel commentToSave, boolean create) Prepare comment for saving.protected voidprepareReplyUpdate(org.zkoss.zul.Window replyPopup, AbstractCommentModel abstractCommentModel, boolean edit) Prepare comment for saving.Refreshes the instance of comment icon.voidrefreshContextList(CommentLayerAwareModel commentLayerAwareModel, boolean refreshItems) Tries to perform refresh of theContextAreaCommentTreeComponentprotected voidrenderSimpleDecisionNavigation(org.zkoss.zk.ui.HtmlBasedComponent container, org.zkoss.zul.Button positiveButton, org.zkoss.zul.Button negativeButton) voidreplyComment(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel) Renders reply popup for theAbstractCommentModelinstance.voidselectCommentIcon(CommentLayerComponent commentLayerComponent, CommentIcon icon) Marks the target icon as selected on the given comment layer component.voidsetCockpitModelHelper(ModelHelper cockpitModelHelper) voidsetCockpitTypeService(TypeService cockpitTypeService) protected voidsetCommentAttachments(CommentModel comment, Object currentValue) voidsetCommentLayerService(CommentLayerService commentLayerService) voidsetCommentService(CommentService commentService) voidsetCommentTooltipRenderer(TooltipRenderer commentTooltipRenderer) voidsetModelService(ModelService modelService) voidsetUiAccessRightService(UIAccessRightService uiAccessRightService) protected voidupdateComment(CommentModel comment, ObjectValueContainer ovc, String text) protected voidupdateComponentIcon(CommentLayerComponent clComponent, CommentIcon newIcon, CommentModel commentToSave) protected voidvalidateCommentLayer(CommentLayerComponent component)
-
Field Details
-
NORMAL_BORDER
- See Also:
-
LOG
protected static final org.slf4j.Logger LOG -
COMMENT_LAYER_ARG_NAME
- See Also:
-
COMMENTLAYER_INDEX
- See Also:
-
domain
-
component
-
commentType
-
commentService
-
modelService
-
cockpitModelHelper
-
cockpitTypeService
-
commentLayerService
-
uiAccessRightService
-
commentTooltipRenderer
-
-
Constructor Details
-
DefaultCommentLayerComponentController
public DefaultCommentLayerComponentController()
-
-
Method Details
-
drawCommentLayerOverArea
public void drawCommentLayerOverArea(org.zkoss.zk.ui.HtmlBasedComponent parent, CommentLayerComponent commentLayerComponent) Description copied from interface:CommentLayerComponentControllerDraws 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().
- Specified by:
drawCommentLayerOverAreain interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
parent- - comment layer targetcommentLayerComponent- - comment layer to draw
- comments target -
-
createContextMenu
Description copied from interface:CommentLayerComponentControllerCreates context menu component for the right-click actions on the comment layer- Specified by:
createContextMenuin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
component- - comment layer component
-
canCreateComment
public boolean canCreateComment()Description copied from interface:CommentLayerComponentControllerChecks if current user can create new comment instances.- Specified by:
canCreateCommentin interfaceCommentLayerComponentController<CommentLayerComponent>- Returns:
- true or false.
-
canCreateComment
-
createIconContextMenu
public org.zkoss.zul.Menupopup createIconContextMenu(CommentLayerComponent component, CommentIcon icon) Description copied from interface:CommentLayerComponentControllerCreates context menu component for the right-click actions on the icons on comment layer- Specified by:
createIconContextMenuin interfaceCommentLayerComponentController<CommentLayerComponent>icon- - icon from a comment layer component
-
addExistingComments
-
displayCommentIcon
Determines if comment icon represented by the meta data should be displayed over givencommentLayerTerget.- Parameters:
commentLayerTarget-metaData- - meta data of the comment under investigation
-
displayCommentIcon
protected boolean displayCommentIcon(TypedObject commentLayerTarget, CommentMetadataModel metaData, int pageIndex) Determines if comment icon represented by the meta data should be displayed over givencommentLayerTerget.- Parameters:
commentLayerTarget-metaData- - meta data of the comment under investigation
-
getPagePreviewIndex
Computes preview index basing on the comet file code. -
getDimensionsFromParent
protected double[] getDimensionsFromParent(org.zkoss.zk.ui.HtmlBasedComponent area) -
changeCommentLayerMode
Description copied from interface:CommentLayerComponentControllerChanges the mode of the comment layer component.- Specified by:
changeCommentLayerModein interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
component-CommentLayerComponentmode- - Please use one of the out-of-the-box modes or any other, customized mode.
-
changeCommentLayerToDefaultMode
Description copied from interface:CommentLayerComponentControllerChanges the mode of the target comment layer component to default mode.- Specified by:
changeCommentLayerToDefaultModein interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
component-CommentLayerComponent
-
addCommentIcon
public void addCommentIcon(CommentLayerComponent commentLayerComponent, int x_Position, int y_Position) Description copied from interface:CommentLayerComponentControllerAppends 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()).
- Specified by:
addCommentIconin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
commentLayerComponent- - componentx_Position- - x position (left)y_Position- - y position (top)
- new comment instance for the target item
-
deleteCommentFromCommentLayer
Description copied from interface:CommentLayerComponentControllerRemoves the given icon from the target comment layer component. The underlying Comment instance will also be removed.- Specified by:
deleteCommentFromCommentLayerin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
component- - Comment layer componenticon- - icon to remove
-
selectCommentIcon
Description copied from interface:CommentLayerComponentControllerMarks 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.- Specified by:
selectCommentIconin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
commentLayerComponent- - parent commentCommentLayerComponentcomponent.icon- - icon to select.
-
getCommentIconForComment
Description copied from interface:CommentLayerComponentControllerReturns CommentIcon component for the givenCommentModelwhich is placed on the givenCommentLayerComponent;- Specified by:
getCommentIconForCommentin interfaceCommentLayerComponentController<CommentLayerComponent>- Returns:
- corresponding
CommentIconor null if no such icon was found.
-
getCurentUser
-
getDomain
-
getCurrentComponent
-
getCommentType
-
prepareCommentUpdate
protected void prepareCommentUpdate(org.zkoss.zul.Window newCommentPopup, AbstractCommentModel commentToSave, boolean create) Prepare comment for saving.- Parameters:
newCommentPopup-commentToSave-create-
-
prepareReplyUpdate
protected void prepareReplyUpdate(org.zkoss.zul.Window replyPopup, AbstractCommentModel abstractCommentModel, boolean edit) Prepare comment for saving.- Parameters:
replyPopup-abstractCommentModel-edit-
-
updateComment
-
setCommentAttachments
-
getRealPositionCoordinate
-
validateCommentLayer
-
refreshContextList
Description copied from interface:CommentLayerComponentControllerTries to perform refresh of theContextAreaCommentTreeComponent- Specified by:
refreshContextListin interfaceCommentLayerComponentController<CommentLayerComponent>
-
getTypeService
-
canEditComment
Description copied from interface:CommentLayerComponentControllerEvaluates if current user can edit a comment behind the comment icon on the comment layer component.- Specified by:
canEditCommentin interfaceCommentLayerComponentController<CommentLayerComponent>
-
canReplyToComment
Description copied from interface:CommentLayerComponentControllerEvaluates 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.- Specified by:
canReplyToCommentin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
comment- - targetCommentModel- Returns:
- true or false
-
canMoveCommentIcon
Description copied from interface:CommentLayerComponentControllerEvaluates if current user can move given comment on the comment layer.- Specified by:
canMoveCommentIconin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
icon- - targetCommentIcon- Returns:
- true or false
-
canDeleteComment
Description copied from interface:CommentLayerComponentControllerEvaluates 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.- Specified by:
canDeleteCommentin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
comment- - targetCommentModel
-
createEditPopupContentForComment
protected void createEditPopupContentForComment(org.zkoss.zul.Window newCommentPopup, CommentLayerComponent clComponent, CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) Create additional content for comment creation and edit popup.- Parameters:
newCommentPopup-clComponent-clAwareModel-newIcon-commentToEdit-create-
-
createEditPopupForComment
protected org.zkoss.zul.Window createEditPopupForComment(CommentLayerComponent clComponent, CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) -
createCommentMetadata
protected CommentMetadataModel createCommentMetadata(CommentLayerComponentModel model, CommentModel commentToSave, CommentIcon newIcon) -
updateComponentIcon
protected void updateComponentIcon(CommentLayerComponent clComponent, CommentIcon newIcon, CommentModel commentToSave) -
createEditPopupForComment
protected org.zkoss.zul.Window createEditPopupForComment(CommentLayerAwareModel clAwareModel, CommentIcon newIcon, CommentModel commentToEdit, boolean create) -
moveCommentIcon
public void moveCommentIcon(CommentLayerComponent commentLayerComponent, CommentIcon icon, int x_Position, int y_Position) Description copied from interface:CommentLayerComponentControllerMoves the target comment icon on the comment layer component to the target position (x, y).- Specified by:
moveCommentIconin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
commentLayerComponent- -CommentLayerComponenticon- -CommentIconto be movedx_Position- - target x position (HtmlBasedComponent.setLeft(String))y_Position- - target x position (HtmlBasedComponent.setTop(String))
-
createCockpitFCKEditor
protected CockpitBasicFCKEditor createCockpitFCKEditor(Map<String, ? extends Object> editorParameters) -
createReplyPopup
protected org.zkoss.zul.Window createReplyPopup(CommentLayerAwareModel model, AbstractCommentModel abstractCommentModel, boolean edit) -
createNewIcon
-
replyComment
Description copied from interface:CommentLayerComponentControllerRenders reply popup for theAbstractCommentModelinstance.- Specified by:
replyCommentin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
model- - model of the active comment layerabstractCommentModel- - instance to reply
-
refreshCommentIcon
Description copied from interface:CommentLayerComponentControllerRefreshes the instance of comment icon. Layout parameters are refreshed, but also with theCommentModelinstance residing in theCommentIconModel.- Specified by:
refreshCommentIconin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
icon- -CommentIconto refresh- Returns:
- refreshed
CommentIcon
-
editCommentPopup
Description copied from interface:CommentLayerComponentControllerMethod for rendering popup for reply edit.- Specified by:
editCommentPopupin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
model- -CommentLayerAwareModelabstractComment- -AbstractCommentModelto edit
-
getWidthAndHeight
Description copied from interface:CommentLayerComponentControllerReturn comment layer dimensions according to the given scale factor. This method allows to influence the actual dimensions of the comment layer component- Specified by:
getWidthAndHeightin interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
component- - Comment layerscaleFactor- -target scale factor
-
setCommentLayerService
-
setCommentService
-
setModelService
-
setCockpitTypeService
-
setUiAccessRightService
-
setCockpitModelHelper
-
changeCommentLayerMode
Description copied from interface:CommentLayerComponentControllerChanges the mode of all comment layer components in the context.- Specified by:
changeCommentLayerModein interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
context- -CommentLayerContextmode- - Please use one of the out-of-the-box modes or any other, customized mode.
-
changeCommentLayerToDefaultMode
Description copied from interface:CommentLayerComponentControllerChanges the mode of all comment layer components in the context to default mode.- Specified by:
changeCommentLayerToDefaultModein interfaceCommentLayerComponentController<CommentLayerComponent>- Parameters:
context- -CommentLayerContext
-
setCommentTooltipRenderer
-