Class StockToAdjustController
- 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
-
- de.hybris.platform.warehousingbackoffice.widgets.stocks.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.DefaultWidgetControllerThis 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 intCOLUMN_INDEX_QTYprotected static intCOLUMN_INDEX_REASONprotected static java.lang.ObjectCOMPLETEDprotected static java.lang.StringIN_SOCKETprotected static java.lang.StringOUT_CONFIRM
-
Constructor Summary
Constructors Constructor Description StockToAdjustController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAdjustment()Add a new row of stock adjustment reason.protected voidaddButtonListeners(org.zkoss.zk.ui.Component myComponent)Add listeners on the buttons for each lineprotected voidaddListComponentListeners(org.zkoss.zk.ui.Component component)Adds a listener according to the type of component inside a vertical boxprotected voidaddListeners()Add listeners on Intbox, Combobox and Textbox so that when a change happens on one of these components, we are catching it.protected voidaddStockAdjustment(org.zkoss.zk.ui.event.Event event)Adds an individual stock adjustment.voidconfirmStockAdjustmentCreation()Confirm the creation of the listed stock level adjustmentsprotected voideditStockAdjustment(org.zkoss.zk.ui.event.Event event)Edits an individual stock adjustment.protected BackofficeLocaleServicegetCockpitLocaleService()protected EnumerationServicegetEnumerationService()protected java.util.LocalegetLocale()protected ModelServicegetModelService()protected com.hybris.backoffice.widgets.notificationarea.NotificationServicegetNotificationService()org.zkoss.zul.GridgetStockAdjustments()protected StockLevelModelgetStockLevel()protected StockLevelAdjustmentDatagetStockLevelAdjustmentData(StockAdjustmentDto stockAdjustmentDto)Instantiate aStockLevelAdjustmentDataand populate it from the givenStockAdjustmentDtoDefaultWarehousingStockLevelFacadegetWarehousingStockLevelFacade()protected voidhandleIndividualReason(org.zkoss.zk.ui.event.Event event)Updates an individual entry with the selected reasonvoidinitStockLevelAdjustmentForm(StockLevelModel inputObject)Initialize the popup to create stock level adjustment(s)protected voidmanageButtonsVisibility(boolean isEditable, org.zkoss.zk.ui.Component myComponent)Handles the display of the buttons according to the situation (editable or not)protected voidmanageFieldsVisibility(org.zkoss.zul.Row myRow, StockAdjustmentDto stockAdjustmentDto)Handles buttons visibilityprotected java.util.Optional<StockLevelAdjustmentReason>matchingComboboxStockAdjustmentReason(java.lang.String stockAdjustmentReasonLabel)Retrieve theStockLevelAdjustmentReasonaccording to the selected label in the comboboxprotected voidrefreshGrid()Refresh the rendering of the grid of stock adjustment to createprotected voidremoveStockAdjustment(org.zkoss.zk.ui.event.Event event)Removes an individual stock adjustment.voidreset()Reinitialize the popup.voidsetStockLevel(StockLevelModel stockLevel)protected voidvalidateStockAdjustmentCreation()Check if the data provided by the form are compliant with the validation rules-
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, initialize, 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
-
IN_SOCKET
protected static final java.lang.String IN_SOCKET
- See Also:
- Constant Field Values
-
OUT_CONFIRM
protected static final java.lang.String OUT_CONFIRM
- See Also:
- Constant Field Values
-
COMPLETED
protected static final java.lang.Object COMPLETED
-
COLUMN_INDEX_REASON
protected static final int COLUMN_INDEX_REASON
- See Also:
- Constant Field Values
-
COLUMN_INDEX_QTY
protected static final int COLUMN_INDEX_QTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
initStockLevelAdjustmentForm
public void initStockLevelAdjustmentForm(StockLevelModel inputObject)
Initialize the popup to create stock level adjustment(s)- Parameters:
inputObject- theStockLevelModelfor 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 theStockLevelAdjustmentReasonaccording to the selected label in the combobox- Parameters:
stockAdjustmentReasonLabel- aString- Returns:
- the
StockLevelAdjustmentReasoncorresponding 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 requestedstockAdjustmentDto- 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 notmyComponent- the component containing the buttons
-
confirmStockAdjustmentCreation
public void confirmStockAdjustmentCreation() throws java.lang.InterruptedExceptionConfirm 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
-
getStockLevelAdjustmentData
protected StockLevelAdjustmentData getStockLevelAdjustmentData(StockAdjustmentDto stockAdjustmentDto)
Instantiate aStockLevelAdjustmentDataand populate it from the givenStockAdjustmentDto- Parameters:
stockAdjustmentDto- the stock adjustment DTO to use for population- Returns:
- the new instance of
StockLevelAdjustmentData
-
getLocale
protected java.util.Locale getLocale()
-
getStockLevel
protected StockLevelModel getStockLevel()
-
setStockLevel
public void setStockLevel(StockLevelModel stockLevel)
-
getCockpitLocaleService
protected BackofficeLocaleService getCockpitLocaleService()
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
getModelService
protected ModelService getModelService()
-
getStockAdjustments
public org.zkoss.zul.Grid getStockAdjustments()
-
getWarehousingStockLevelFacade
public DefaultWarehousingStockLevelFacade getWarehousingStockLevelFacade()
-
getNotificationService
protected com.hybris.backoffice.widgets.notificationarea.NotificationService getNotificationService()
-
-