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, 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:
  • Field Details

  • Constructor Details

    • ItemCommentsController

      public ItemCommentsController()
  • Method Details

    • initialize

      public void initialize(org.zkoss.zk.ui.Component component)
      Overrides:
      initialize in class com.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 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 from onHeartbeat(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 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(String wrongSettingsMessage)
    • createNewComment

      protected Optional<CommentModel> createNewComment(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 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 String getDefaultDateFormat()
    • initDataType

      protected void initDataType(ItemModel inputItem)
    • initDateFormatter

      protected void initDateFormatter()
    • initRenderer

      protected void initRenderer()
    • initPopupPosition

      protected void initPopupPosition()
    • sortAndSetComments

      protected void sortAndSetComments(List<CommentModel> comments)
    • filterNotPermitted

      protected List<CommentModel> filterNotPermitted(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,Void,CommentModel> getCommentRenderer()
    • setCommentRenderer

      public void setCommentRenderer(com.hybris.cockpitng.widgets.common.WidgetComponentRenderer<org.zkoss.zul.Div,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)
    • setUIDateRendererProvider

      public void setUIDateRendererProvider(UIDateRendererProvider uiDateRendererProvider)
    • getUIDateRendererProvider

      public UIDateRendererProvider getUIDateRendererProvider()