Class ConsignmentToReallocateController
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.consignment.ConsignmentToReallocateController
- 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 ConsignmentToReallocateController
extends com.hybris.cockpitng.util.DefaultWidgetController
This controller creates a pop-up to reallocate part or entire consignment. It offers to select manually the new
location where to reallocate. If not specified, the reallocation will be automatic. It also offers to set the reason
for the decline as well as an optional comment.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intprotected static final Objectprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields 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, spaceScopeFields inherited from class org.zkoss.zk.ui.util.GenericComposer
_applied -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd listeners on Intbox, Combobox and Textbox so that when a change happens on one of these components, we are catching it.protected voidapplyToCheckboxRow(Object data, org.zkoss.zk.ui.Component component) Applies a specific change if the current element is a checkboxprotected voidapplyToComboboxRow(Object data, org.zkoss.zk.ui.Component component) Applies a specific change if the current element is a comboboxprotected voidapplyToGrid(Object data, int childrenIndex) Apply a value to the elements contained in the gridprotected voidapplyToRow(Object data, int childrenIndex, org.zkoss.zk.ui.Component row) Apply a specific change to a specific row of the gridprotected voidautoSelect(org.zkoss.zk.ui.event.Event event) Automatically select the checkbox in front of the rowprotected voidbuildDeclineParam(ConsignmentProcessModel processModel, Collection<DeclineEntry> entriesToReallocate) Build and save the context parameter for decline entries and set it into the given processprotected voidcleanDeclineParam(ConsignmentProcessModel processModel) Removes the old decline entries fromBusinessProcessModel.CONTEXTPARAMETERS(if any exists), before attempting to declinevoidConfirm the reallocation requestprotected voidcreateDeclineEntry(Collection<DeclineEntry> entriesToReallocate, org.zkoss.zk.ui.Component component) Creates a decline entry for the current rowprotected com.hybris.cockpitng.core.events.CockpitEventQueueprotected BackofficeLocaleServiceprotected ConsignmentModelprotected org.zkoss.zul.Gridprotected Optional<DeclineReason>getCustomSelectedDeclineReason(org.zkoss.zk.ui.event.Event event) Gets the label for the selected decline reason in case the event has a target of Comboboxprotected EnumerationServiceprotected intgetLocationIndex(WarehouseModel location) Gets the location index within the combobox modelprotected ModelServiceprotected com.hybris.backoffice.widgets.notificationarea.NotificationServiceprotected intgetReasonIndex(DeclineReason declineReason) Gets the reason index within the combobox modelprotected Optional<DeclineReason>getSelectedDeclineReason(org.zkoss.zk.ui.event.Event event) get the corresponding decline reason according to the selected item in the combobox if existingprotected WarehouseModelgetSelectedLocation(org.zkoss.zk.ui.event.Event event) Get the corresponding warehouse location according to the selected item in the combobox if anything is selectedprotected DefaultWarehouseStockServiceprotected voidhandleGlobalComment(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global commentprotected voidhandleGlobalLocation(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global locationprotected voidhandleGlobalReason(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global reasonprotected voidhandleIndividualLocation(org.zkoss.zk.ui.event.Event event) Updates an individual entry with the selected locationprotected voidhandleIndividualReason(org.zkoss.zk.ui.event.Event event) Updates an individual entry with the selected reasonprotected voidhandleRow(org.zkoss.zul.Row row) Set or Reset the given row with the appropriate default informationsvoidinitReallocationConsignmentForm(ConsignmentModel inputObject) Initialize the popup to reallocate consignment entriesprotected booleanisDeclinedQuantityCorrect(ConsignmentModel latestConsignmentModel, DeclineEntry declineEntry) Check if the declined quantity of the passed consignment model matches the expected quantity to be declined.protected booleanisDeclineProcessDone(ConsignmentModel latestConsignmentModel, Collection<DeclineEntry> entriesToReallocate) Check if the decline process is done or not.protected Optional<DeclineReason>matchingComboboxDeclineReason(String declineReasonLabel) Retrieve theDeclineReasonaccording to the selected label in the comboboxvoidreset()Reinitialize the popup.protected voidSelect or unselect all the rows of the grid and sets the default values for each of them.voidsetConsignment(ConsignmentModel consignment) protected org.zkoss.zk.ui.ComponenttargetFieldToApplyValidation(String stringToValidate, int indexLabelToCheck, int indexTargetComponent) Retrieve the row who needs to apply a validation messageprotected voidValidate each consignment entry and throw aWrongValueExceptionif it fails any checkprotected voidCheck if the data provided by the form are compliant with the validation rulesMethods 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, setWidgetTitleMethods inherited from class com.hybris.cockpitng.util.ViewAnnotationAwareComposer
scanEventListenersMethods inherited from class org.zkoss.zk.ui.util.GenericAutowireComposer
alert, didActivate, getPage, willClone, willPassivateMethods inherited from class org.zkoss.zk.ui.util.GenericComposer
doCatch, doFinallyMethods inherited from class org.zkoss.zk.ui.event.GenericEventListener
bindComponent, getController, onEvent, unbindComponent
-
Field Details
-
IN_SOCKET
- See Also:
-
OUT_CONFIRM
- See Also:
-
COMPLETED
-
CONSIGNMENT_ACTION_EVENT_NAME
- See Also:
-
REALLOCATE_CONSIGNMENT_CHOICE
- See Also:
-
DECLINE_ENTRIES
- See Also:
-
COLUMN_INDEX_REALLOCATION_QUANTITY
protected static final int COLUMN_INDEX_REALLOCATION_QUANTITY- See Also:
-
COLUMN_INDEX_REALLOCATION_REASON
protected static final int COLUMN_INDEX_REALLOCATION_REASON- See Also:
-
COLUMN_INDEX_REALLOCATION_LOCATION
protected static final int COLUMN_INDEX_REALLOCATION_LOCATION- See Also:
-
COLUMN_INDEX_REALLOCATION_COMMENT
protected static final int COLUMN_INDEX_REALLOCATION_COMMENT- See Also:
-
-
Constructor Details
-
ConsignmentToReallocateController
public ConsignmentToReallocateController()
-
-
Method Details
-
initReallocationConsignmentForm
Initialize the popup to reallocate consignment entries- Parameters:
inputObject- the consignment for which we want to ask for one or several reallocation(s)
-
confirmReallocation
Confirm the reallocation request- Throws:
InterruptedException
-
createDeclineEntry
protected void createDeclineEntry(Collection<DeclineEntry> entriesToReallocate, org.zkoss.zk.ui.Component component) Creates a decline entry for the current row- Parameters:
entriesToReallocate- the list to which the newly created decline entry will be added tocomponent- the current row from which the decline entry will be created
-
reset
public void reset()Reinitialize the popup. -
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. -
applyToGrid
Apply a value to the elements contained in the grid- Parameters:
data- the value to pass to the gridchildrenIndex- the index indicating where to find the right component in the grid
-
applyToRow
Apply a specific change to a specific row of the grid- Parameters:
data- the new value to setchildrenIndex- the index of the component in the gridrow- the row to which the change needs to be applied
-
applyToComboboxRow
Applies a specific change if the current element is a combobox- Parameters:
data- the element for which the change has to be appliedcomponent- the component which will have the change applied
-
applyToCheckboxRow
Applies a specific change if the current element is a checkbox- Parameters:
data- the element for which the change has to be appliedcomponent- the component which will have the change applied
-
autoSelect
protected void autoSelect(org.zkoss.zk.ui.event.Event event) Automatically select the checkbox in front of the row- Parameters:
event- the event that triggered the autoselect
-
buildDeclineParam
protected void buildDeclineParam(ConsignmentProcessModel processModel, Collection<DeclineEntry> entriesToReallocate) Build and save the context parameter for decline entries and set it into the given process- Parameters:
processModel- the process model for which the context parameters has to be registerentriesToReallocate- the entries to be reallocated
-
cleanDeclineParam
Removes the old decline entries fromBusinessProcessModel.CONTEXTPARAMETERS(if any exists), before attempting to decline- Parameters:
processModel- theConsignmentProcessModelfor the consignment to be declined
-
getLocationIndex
Gets the location index within the combobox model- Parameters:
location- the location which the item(s) will be reallocated to- Returns:
- the index of the given location
-
getReasonIndex
Gets the reason index within the combobox model- Parameters:
declineReason- the reason for which we want to know the index- Returns:
- the index of the given decline reason
-
getSelectedDeclineReason
get the corresponding decline reason according to the selected item in the combobox if existing- Parameters:
event- the select event on the combobox- Returns:
- the corresponding decline reason
-
getCustomSelectedDeclineReason
Gets the label for the selected decline reason in case the event has a target of Combobox- Parameters:
event- the event that was fired- Returns:
- the DeclineReason corresponding to the label.
-
getSelectedLocation
Get the corresponding warehouse location according to the selected item in the combobox if anything is selected- Parameters:
event- the select event on the combobox- Returns:
- the corresponding warehouse location
-
handleGlobalComment
protected void handleGlobalComment(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global comment- Parameters:
event- the event that triggered the change
-
handleGlobalLocation
protected void handleGlobalLocation(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global location- Parameters:
event- the event that triggered the change
-
handleGlobalReason
protected void handleGlobalReason(org.zkoss.zk.ui.event.Event event) Updates all entries with the selected global reason- Parameters:
event- the event that triggered the change
-
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
-
handleIndividualLocation
protected void handleIndividualLocation(org.zkoss.zk.ui.event.Event event) Updates an individual entry with the selected location- Parameters:
event- the event that triggered the change
-
handleRow
protected void handleRow(org.zkoss.zul.Row row) Set or Reset the given row with the appropriate default informations- Parameters:
row- the row to set/reset
-
isDeclineProcessDone
protected boolean isDeclineProcessDone(ConsignmentModel latestConsignmentModel, Collection<DeclineEntry> entriesToReallocate) Check if the decline process is done or not.- Parameters:
latestConsignmentModel- the updated consignment modelentriesToReallocate- the entries to be reallocated- Returns:
- true if the process is done. Otherwise false
-
isDeclinedQuantityCorrect
protected boolean isDeclinedQuantityCorrect(ConsignmentModel latestConsignmentModel, DeclineEntry declineEntry) Check if the declined quantity of the passed consignment model matches the expected quantity to be declined.- Parameters:
latestConsignmentModel-declineEntry-- Returns:
- true if the declined quantity is matching the expected declined quantity. Otherwise, returns false.
-
matchingComboboxDeclineReason
Retrieve theDeclineReasonaccording to the selected label in the combobox- Parameters:
declineReasonLabel- aString- Returns:
- the decline reason corresponding to the label
-
selectAllEntries
protected void selectAllEntries()Select or unselect all the rows of the grid and sets the default values for each of them. -
targetFieldToApplyValidation
protected org.zkoss.zk.ui.Component targetFieldToApplyValidation(String stringToValidate, int indexLabelToCheck, int indexTargetComponent) Retrieve the row who needs to apply a validation message- Parameters:
stringToValidate- the string to compare to identify a specific row in the gridindexLabelToCheck- the index of the label to which we want to compare the passed stringindexTargetComponent- the index of the grid where the target component is located
-
validateConsignmentEntry
Validate each consignment entry and throw aWrongValueExceptionif it fails any check- Parameters:
entry- the individual entry to validate
-
validateRequest
protected void validateRequest()Check if the data provided by the form are compliant with the validation rules -
getConsignment
-
setConsignment
-
getEnumerationService
-
getConsignmentEntries
protected org.zkoss.zul.Grid getConsignmentEntries() -
getConsignmentBusinessProcessService
protected WarehousingBusinessProcessService<ConsignmentModel> getConsignmentBusinessProcessService() -
getModelService
-
getCockpitLocaleService
-
getCockpitEventQueue
protected com.hybris.cockpitng.core.events.CockpitEventQueue getCockpitEventQueue() -
getWarehouseStockService
-
getNotificationService
protected com.hybris.backoffice.widgets.notificationarea.NotificationService getNotificationService()
-