Class StockToAdjustController

  • 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 StockToAdjustController
    extends com.hybris.cockpitng.util.DefaultWidgetController
    This controller creates a pop-up to create one or several stock level adjustment(s).
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int COLUMN_INDEX_QTY  
      protected static int COLUMN_INDEX_REASON  
      protected static java.lang.Object COMPLETED  
      protected static java.lang.String IN_SOCKET  
      protected static java.lang.String OUT_CONFIRM  
      • Fields inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer

        _separator, application, applicationScope, arg, componentScope, desktop, desktopScope, execution, page, pageScope, param, requestScope, self, session, sessionScope, spaceOwner, spaceScope
      • Fields inherited from class org.zkoss.zk.ui.util.GenericComposer

        _applied
    • Field Detail

      • COMPLETED

        protected static final java.lang.Object COMPLETED
    • Constructor Detail

      • StockToAdjustController

        public StockToAdjustController()
    • Method Detail

      • initStockLevelAdjustmentForm

        public void initStockLevelAdjustmentForm​(StockLevelModel inputObject)
        Initialize the popup to create stock level adjustment(s)
        Parameters:
        inputObject - the StockLevelModel for which we want to create one or several stock level adjustment(s)
      • addAdjustment

        public void addAdjustment()
        Add a new row of stock adjustment reason.
      • reset

        public void reset()
        Reinitialize the popup.
      • refreshGrid

        protected void refreshGrid()
        Refresh the rendering of the grid of stock adjustment to create
      • addListeners

        protected void addListeners()
        Add listeners on Intbox, Combobox and Textbox so that when a change happens on one of these components, we are catching it.
      • addListComponentListeners

        protected void addListComponentListeners​(org.zkoss.zk.ui.Component component)
        Adds a listener according to the type of component inside a vertical box
        Parameters:
        component - the vertical box component containing the element to target to add a listener
      • handleIndividualReason

        protected void handleIndividualReason​(org.zkoss.zk.ui.event.Event event)
        Updates an individual entry with the selected reason
        Parameters:
        event - the event that triggered the change
      • matchingComboboxStockAdjustmentReason

        protected java.util.Optional<StockLevelAdjustmentReason> matchingComboboxStockAdjustmentReason​(java.lang.String stockAdjustmentReasonLabel)
        Retrieve the StockLevelAdjustmentReason according to the selected label in the combobox
        Parameters:
        stockAdjustmentReasonLabel - a String
        Returns:
        the StockLevelAdjustmentReason corresponding to the label
      • addButtonListeners

        protected void addButtonListeners​(org.zkoss.zk.ui.Component myComponent)
        Add listeners on the buttons for each line
        Parameters:
        myComponent - the initial component
      • addStockAdjustment

        protected void addStockAdjustment​(org.zkoss.zk.ui.event.Event event)
        Adds an individual stock adjustment.
        Parameters:
        event - the click event triggered by the user
      • removeStockAdjustment

        protected void removeStockAdjustment​(org.zkoss.zk.ui.event.Event event)
        Removes an individual stock adjustment.
        Parameters:
        event - the click event triggered by the user
      • editStockAdjustment

        protected void editStockAdjustment​(org.zkoss.zk.ui.event.Event event)
        Edits an individual stock adjustment.
        Parameters:
        event - the click event triggered by the user
      • manageFieldsVisibility

        protected void manageFieldsVisibility​(org.zkoss.zul.Row myRow,
                                              StockAdjustmentDto stockAdjustmentDto)
        Handles buttons visibility
        Parameters:
        myRow - the row for which the visibility change is requested
        stockAdjustmentDto - the stock adjustment dto containing informations about the reason selected
      • manageButtonsVisibility

        protected void manageButtonsVisibility​(boolean isEditable,
                                               org.zkoss.zk.ui.Component myComponent)
        Handles the display of the buttons according to the situation (editable or not)
        Parameters:
        isEditable - the line is editable or not
        myComponent - the component containing the buttons
      • confirmStockAdjustmentCreation

        public void confirmStockAdjustmentCreation()
                                            throws java.lang.InterruptedException
        Confirm the creation of the listed stock level adjustments
        Throws:
        java.lang.InterruptedException
      • validateStockAdjustmentCreation

        protected void validateStockAdjustmentCreation()
        Check if the data provided by the form are compliant with the validation rules
      • getLocale

        protected java.util.Locale getLocale()
      • setStockLevel

        public void setStockLevel​(StockLevelModel stockLevel)
      • getModelService

        protected ModelService getModelService()
      • getStockAdjustments

        public org.zkoss.zul.Grid getStockAdjustments()
      • getNotificationService

        protected com.hybris.backoffice.widgets.notificationarea.NotificationService getNotificationService()