Class ItemCommentsController
- java.lang.Object
-
- org.zkoss.zk.ui.event.GenericEventListener
-
- org.zkoss.zk.ui.util.GenericComposer<T>
-
- org.zkoss.zk.ui.util.GenericAutowireComposer<T>
-
- org.zkoss.zk.ui.util.GenericForwardComposer<org.zkoss.zk.ui.Component>
-
- com.hybris.cockpitng.util.ViewAnnotationAwareComposer
-
- com.hybris.cockpitng.util.DefaultWidgetController
-
- com.hybris.backoffice.widgets.itemcomments.ItemCommentsController
-
- All Implemented Interfaces:
com.hybris.cockpitng.core.WidgetController
,com.hybris.cockpitng.dnd.WidgetDragAndDropAware
,com.hybris.cockpitng.engine.WidgetInstanceManagerAware
,java.io.Serializable
,org.zkoss.zk.ui.event.EventListener
,org.zkoss.zk.ui.event.SerializableEventListener
,org.zkoss.zk.ui.util.ComponentActivationListener
,org.zkoss.zk.ui.util.ComponentCloneListener
,org.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>
,org.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>
public class ItemCommentsController extends com.hybris.cockpitng.util.DefaultWidgetController
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
COMPONENT_ADD_COMMENT_BUTTON
protected static java.lang.String
COMPONENT_COMMENTS_COUNT_LABEL
Deprecated.since 1811, the field is unusedprotected static java.lang.String
COMPONENT_SHOW_POPUP_BUTTON
Deprecated.since 1811, the field is unusedprotected static java.lang.String
LABEL_NO_COMMENTS
protected static java.lang.String
MODEL_COMMENTS
protected static java.lang.String
MODEL_DATA_TYPE
static java.lang.String
MODEL_DATE_FORMATTER
protected static java.lang.String
MODEL_INPUT_ITEM
protected static java.lang.String
SCLASS_ADD_COMMENT_SECTION
protected static java.lang.String
SCLASS_ADD_COMMENT_SECTION_BUTTON_CANCEL
protected static java.lang.String
SCLASS_ADD_COMMENT_SECTION_BUTTON_OK
protected static java.lang.String
SCLASS_ADD_COMMENT_SECTION_TEXTBOX
protected static java.lang.String
SCLASS_COMMENTS_LIST_EMPTY
protected static java.lang.String
SETTING_COMMENTS_LIST_RENDERER
protected static java.lang.String
SETTING_DATE_FORMAT
protected static java.lang.String
SETTING_DEFAULT_COMMENTS_COMMENT_TYPE
protected static java.lang.String
SETTING_DEFAULT_COMMENTS_COMPONENT
protected static java.lang.String
SETTING_DEFAULT_COMMENTS_DOMAIN
protected static java.lang.String
SETTING_DEFAULT_COMMENTS_LIST_RENDERER
protected static java.lang.String
SETTING_POPUP_POSITION
protected static java.lang.String
SOCKET_IN_INPUT_ITEM
-
Constructor Summary
Constructors Constructor Description ItemCommentsController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCommentToItem(CommentModel newComment)
protected boolean
canCreateComment()
protected boolean
canReadThisComment(CommentModel comment)
protected void
closePopup()
protected org.zkoss.zul.Div
createAddCommentContainer(org.zkoss.zul.Textbox textbox, org.zkoss.zul.Button okButton, org.zkoss.zul.Button cancelButton)
protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
createCancelButtonListener()
protected java.util.Optional<CommentModel>
createNewComment(java.lang.String text, ComponentModel component, CommentTypeModel commentType)
protected java.util.Optional<CommentModel>
createNewComment(org.zkoss.zul.Textbox textbox)
protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
createOkButtonEventListener(org.zkoss.zul.Textbox textbox)
protected java.util.List<CommentModel>
filterNotPermitted(java.util.List<CommentModel> comments)
org.zkoss.zul.Button
getAddCommentButton()
org.zkoss.zul.Div
getAddCommentContainer()
com.hybris.cockpitng.widgets.common.WidgetComponentRenderer<org.zkoss.zul.Div,java.lang.Void,CommentModel>
getCommentRenderer()
org.zkoss.zul.Label
getCommentsCountLabel()
CommentService
getCommentService()
java.util.List<CommentModel>
getCommentsFromModel()
org.zkoss.zul.Div
getCommentsListContainer()
org.zkoss.zul.Popup
getCommentsPopup()
protected java.lang.String
getDefaultDateFormat()
ItemModel
getInputItemModel()
protected com.hybris.backoffice.widgets.notificationarea.NotificationService
getNotificationService()
com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade
getObjectFacade()
protected java.util.Collection<org.zkoss.zk.ui.Component>
getOpenPopupAwareComponents()
com.hybris.cockpitng.dataaccess.facades.permissions.PermissionFacade
getPermissionFacade()
PopupPosition
getPopupPosition()
org.zkoss.zul.Button
getShowCommentsButton()
com.hybris.cockpitng.dataaccess.facades.type.TypeFacade
getTypeFacade()
UserService
getUserService()
protected void
handleCommentSavingException(com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectSavingException exception)
protected void
initDataType(ItemModel inputItem)
protected void
initDateFormatter()
void
initialize(org.zkoss.zk.ui.Component component)
protected void
initPopupPosition()
protected void
initRenderer()
protected boolean
isCommentsChanged(ItemModel freshInputItemModel)
protected void
loadNewCommentsIfPossible()
protected void
notifyUserOfWrongSettings(java.lang.String wrongSettingsMessage)
void
onHeartbeat(com.hybris.cockpitng.core.events.CockpitEvent cockpitEvent)
void
onInputItemReceive(ItemModel inputItem)
void
openPopup()
protected void
render()
protected void
renderComments()
protected void
renderCommentsList()
protected void
renderContent()
protected void
renderEmptyMessage()
protected void
runWithReopeningPopup(com.hybris.cockpitng.core.Executable executable)
Performs passed operation and closes and reopens comments popup so any modified elements in it will be recalculated correctly.protected void
scrollToLastComment()
void
setAddCommentButton(org.zkoss.zul.Button addCommentButton)
void
setAddCommentContainer(org.zkoss.zul.Div addCommentContainer)
void
setCommentRenderer(com.hybris.cockpitng.widgets.common.WidgetComponentRenderer<org.zkoss.zul.Div,java.lang.Void,CommentModel> commentRenderer)
void
setCommentsCountLabel(org.zkoss.zul.Label commentsCountLabel)
void
setCommentService(CommentService commentService)
void
setCommentsListContainer(org.zkoss.zul.Div commentsListContainer)
void
setCommentsPopup(org.zkoss.zul.Popup commentsPopup)
void
setNotificationService(com.hybris.backoffice.widgets.notificationarea.NotificationService notificationService)
void
setObjectFacade(com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade objectFacade)
protected void
setOnClickEventListenersForOpenPopupAwareComponent(org.zkoss.zk.ui.Component component, boolean clickable)
protected void
setOpenPopupAwareComponentsClickability()
void
setPermissionFacade(com.hybris.cockpitng.dataaccess.facades.permissions.PermissionFacade permissionFacade)
void
setPopupPosition(PopupPosition popupPosition)
void
setShowCommentsButton(org.zkoss.zul.Button showCommentsButton)
void
setTypeFacade(com.hybris.cockpitng.dataaccess.facades.type.TypeFacade typeFacade)
protected void
setUIStateForOpenPopupAwareComponent(org.zkoss.zk.ui.Component component, boolean clickable)
void
setUserService(UserService userService)
void
showNewCommentSection()
protected void
sortAndSetComments(java.util.List<CommentModel> comments)
protected void
tryToSaveItemComment(CommentModel comment)
-
Methods inherited from class com.hybris.cockpitng.util.DefaultWidgetController
doAfterCompose, doBeforeCompose, doBeforeComposeChildren, executeOperation, getDragAndDropStrategy, getLabel, getLabel, getModel, getValue, getWidgetDragAndDropStrategyRepository, getWidgetInstanceManager, getWidgetRoot, getWidgetSettings, getWidgetslot, getWidgetTitle, getWidgetUtils, initDragAndDropAwareness, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, initWidgetSetting, invokeListenerMethod, onSocketInput, preInitialize, sendOutput, sendOutputAfterOperation, sendOutputAfterOperation, sendOutputAfterOperation, setValue, setWidgetInstanceManager, setWidgetTitle
-
Methods inherited from class com.hybris.cockpitng.util.ViewAnnotationAwareComposer
scanEventListeners
-
Methods inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer
alert, didActivate, getPage, willClone, willPassivate
-
-
-
-
Field Detail
-
MODEL_DATE_FORMATTER
public static final java.lang.String MODEL_DATE_FORMATTER
- See Also:
- Constant Field Values
-
SOCKET_IN_INPUT_ITEM
protected static final java.lang.String SOCKET_IN_INPUT_ITEM
- See Also:
- Constant Field Values
-
SETTING_COMMENTS_LIST_RENDERER
protected static final java.lang.String SETTING_COMMENTS_LIST_RENDERER
- See Also:
- Constant Field Values
-
SETTING_POPUP_POSITION
protected static final java.lang.String SETTING_POPUP_POSITION
- See Also:
- Constant Field Values
-
SETTING_DATE_FORMAT
protected static final java.lang.String SETTING_DATE_FORMAT
- See Also:
- Constant Field Values
-
SETTING_DEFAULT_COMMENTS_LIST_RENDERER
protected static final java.lang.String SETTING_DEFAULT_COMMENTS_LIST_RENDERER
- See Also:
- Constant Field Values
-
SETTING_DEFAULT_COMMENTS_DOMAIN
protected static final java.lang.String SETTING_DEFAULT_COMMENTS_DOMAIN
- See Also:
- Constant Field Values
-
SETTING_DEFAULT_COMMENTS_COMPONENT
protected static final java.lang.String SETTING_DEFAULT_COMMENTS_COMPONENT
- See Also:
- Constant Field Values
-
SETTING_DEFAULT_COMMENTS_COMMENT_TYPE
protected static final java.lang.String SETTING_DEFAULT_COMMENTS_COMMENT_TYPE
- See Also:
- Constant Field Values
-
COMPONENT_SHOW_POPUP_BUTTON
@Deprecated protected static final java.lang.String COMPONENT_SHOW_POPUP_BUTTON
Deprecated.since 1811, the field is unused- See Also:
- Constant Field Values
-
COMPONENT_COMMENTS_COUNT_LABEL
@Deprecated protected static final java.lang.String COMPONENT_COMMENTS_COUNT_LABEL
Deprecated.since 1811, the field is unused- See Also:
- Constant Field Values
-
COMPONENT_ADD_COMMENT_BUTTON
protected static final java.lang.String COMPONENT_ADD_COMMENT_BUTTON
- See Also:
- Constant Field Values
-
SCLASS_ADD_COMMENT_SECTION
protected static final java.lang.String SCLASS_ADD_COMMENT_SECTION
- See Also:
- Constant Field Values
-
SCLASS_ADD_COMMENT_SECTION_TEXTBOX
protected static final java.lang.String SCLASS_ADD_COMMENT_SECTION_TEXTBOX
- See Also:
- Constant Field Values
-
SCLASS_ADD_COMMENT_SECTION_BUTTON_OK
protected static final java.lang.String SCLASS_ADD_COMMENT_SECTION_BUTTON_OK
- See Also:
- Constant Field Values
-
SCLASS_ADD_COMMENT_SECTION_BUTTON_CANCEL
protected static final java.lang.String SCLASS_ADD_COMMENT_SECTION_BUTTON_CANCEL
- See Also:
- Constant Field Values
-
SCLASS_COMMENTS_LIST_EMPTY
protected static final java.lang.String SCLASS_COMMENTS_LIST_EMPTY
- See Also:
- Constant Field Values
-
LABEL_NO_COMMENTS
protected static final java.lang.String LABEL_NO_COMMENTS
- See Also:
- Constant Field Values
-
MODEL_DATA_TYPE
protected static final java.lang.String MODEL_DATA_TYPE
- See Also:
- Constant Field Values
-
MODEL_COMMENTS
protected static final java.lang.String MODEL_COMMENTS
- See Also:
- Constant Field Values
-
MODEL_INPUT_ITEM
protected static final java.lang.String MODEL_INPUT_ITEM
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(org.zkoss.zk.ui.Component component)
- Overrides:
initialize
in classcom.hybris.cockpitng.util.DefaultWidgetController
-
onInputItemReceive
public void onInputItemReceive(ItemModel inputItem)
-
scrollToLastComment
protected void scrollToLastComment()
-
showNewCommentSection
public void showNewCommentSection()
-
onHeartbeat
public void onHeartbeat(com.hybris.cockpitng.core.events.CockpitEvent cockpitEvent)
-
openPopup
public void openPopup()
-
loadNewCommentsIfPossible
protected void loadNewCommentsIfPossible() throws com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectNotFoundException
- Throws:
com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectNotFoundException
-
setOpenPopupAwareComponentsClickability
protected void setOpenPopupAwareComponentsClickability()
-
getOpenPopupAwareComponents
protected java.util.Collection<org.zkoss.zk.ui.Component> getOpenPopupAwareComponents()
-
setUIStateForOpenPopupAwareComponent
protected void setUIStateForOpenPopupAwareComponent(org.zkoss.zk.ui.Component component, boolean clickable)
-
setOnClickEventListenersForOpenPopupAwareComponent
protected void setOnClickEventListenersForOpenPopupAwareComponent(org.zkoss.zk.ui.Component component, boolean clickable)
-
isCommentsChanged
protected boolean isCommentsChanged(ItemModel freshInputItemModel)
-
runWithReopeningPopup
protected void runWithReopeningPopup(com.hybris.cockpitng.core.Executable executable)
Performs passed operation and closes and reopens comments popup so any modified elements in it will be recalculated correctly. If popup was closed is not opened again (in case to call this method fromonHeartbeat(CockpitEvent)
)- Parameters:
executable
- passed operation which will be executed before popup will be reopened.
-
closePopup
protected void closePopup()
-
createAddCommentContainer
protected org.zkoss.zul.Div createAddCommentContainer(org.zkoss.zul.Textbox textbox, org.zkoss.zul.Button okButton, org.zkoss.zul.Button cancelButton)
-
createOkButtonEventListener
protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> createOkButtonEventListener(org.zkoss.zul.Textbox textbox)
-
createCancelButtonListener
protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> createCancelButtonListener()
-
tryToSaveItemComment
protected void tryToSaveItemComment(CommentModel comment)
-
handleCommentSavingException
protected void handleCommentSavingException(com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectSavingException exception)
-
addCommentToItem
protected void addCommentToItem(CommentModel newComment) throws com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectSavingException
- Throws:
com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectSavingException
-
createNewComment
protected java.util.Optional<CommentModel> createNewComment(org.zkoss.zul.Textbox textbox) throws com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectCreationException
- Throws:
com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectCreationException
-
notifyUserOfWrongSettings
protected void notifyUserOfWrongSettings(java.lang.String wrongSettingsMessage)
-
createNewComment
protected java.util.Optional<CommentModel> createNewComment(java.lang.String text, ComponentModel component, CommentTypeModel commentType) throws com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectCreationException
- Throws:
com.hybris.cockpitng.dataaccess.facades.object.exceptions.ObjectCreationException
-
getInputItemModel
public ItemModel getInputItemModel()
-
getCommentsFromModel
public java.util.List<CommentModel> getCommentsFromModel()
-
render
protected void render()
-
renderCommentsList
protected void renderCommentsList()
-
renderContent
protected void renderContent()
-
renderEmptyMessage
protected void renderEmptyMessage()
-
renderComments
protected void renderComments()
-
getDefaultDateFormat
protected java.lang.String getDefaultDateFormat()
-
initDataType
protected void initDataType(ItemModel inputItem)
-
initDateFormatter
protected void initDateFormatter()
-
initRenderer
protected void initRenderer()
-
initPopupPosition
protected void initPopupPosition()
-
sortAndSetComments
protected void sortAndSetComments(java.util.List<CommentModel> comments)
-
filterNotPermitted
protected java.util.List<CommentModel> filterNotPermitted(java.util.List<CommentModel> comments)
-
canReadThisComment
protected boolean canReadThisComment(CommentModel comment)
-
canCreateComment
protected boolean canCreateComment()
-
getCommentsListContainer
public org.zkoss.zul.Div getCommentsListContainer()
-
setCommentsListContainer
public void setCommentsListContainer(org.zkoss.zul.Div commentsListContainer)
-
getShowCommentsButton
public org.zkoss.zul.Button getShowCommentsButton()
-
setShowCommentsButton
public void setShowCommentsButton(org.zkoss.zul.Button showCommentsButton)
-
getCommentsCountLabel
public org.zkoss.zul.Label getCommentsCountLabel()
-
setCommentsCountLabel
public void setCommentsCountLabel(org.zkoss.zul.Label commentsCountLabel)
-
getPopupPosition
public PopupPosition getPopupPosition()
-
setPopupPosition
public void setPopupPosition(PopupPosition popupPosition)
-
getCommentsPopup
public org.zkoss.zul.Popup getCommentsPopup()
-
setCommentsPopup
public void setCommentsPopup(org.zkoss.zul.Popup commentsPopup)
-
getAddCommentButton
public org.zkoss.zul.Button getAddCommentButton()
-
setAddCommentButton
public void setAddCommentButton(org.zkoss.zul.Button addCommentButton)
-
getAddCommentContainer
public org.zkoss.zul.Div getAddCommentContainer()
-
setAddCommentContainer
public void setAddCommentContainer(org.zkoss.zul.Div addCommentContainer)
-
getObjectFacade
public com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade getObjectFacade()
-
setObjectFacade
public void setObjectFacade(com.hybris.cockpitng.dataaccess.facades.object.ObjectFacade objectFacade)
-
getTypeFacade
public com.hybris.cockpitng.dataaccess.facades.type.TypeFacade getTypeFacade()
-
setTypeFacade
public void setTypeFacade(com.hybris.cockpitng.dataaccess.facades.type.TypeFacade typeFacade)
-
getUserService
public UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getCommentService
public CommentService getCommentService()
-
setCommentService
public void setCommentService(CommentService commentService)
-
getCommentRenderer
public com.hybris.cockpitng.widgets.common.WidgetComponentRenderer<org.zkoss.zul.Div,java.lang.Void,CommentModel> getCommentRenderer()
-
setCommentRenderer
public void setCommentRenderer(com.hybris.cockpitng.widgets.common.WidgetComponentRenderer<org.zkoss.zul.Div,java.lang.Void,CommentModel> commentRenderer)
-
getPermissionFacade
public com.hybris.cockpitng.dataaccess.facades.permissions.PermissionFacade getPermissionFacade()
-
setPermissionFacade
public void setPermissionFacade(com.hybris.cockpitng.dataaccess.facades.permissions.PermissionFacade permissionFacade)
-
getNotificationService
protected com.hybris.backoffice.widgets.notificationarea.NotificationService getNotificationService()
-
setNotificationService
public void setNotificationService(com.hybris.backoffice.widgets.notificationarea.NotificationService notificationService)
-
-