Class CancelOrderController
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.omsbackoffice.widgets.order.cancelorder.CancelOrderController
- 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 CancelOrderController
extends com.hybris.cockpitng.util.DefaultWidgetController
This controller creates a pop-up to cancel an order or its entries.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected 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 Stringprotected 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 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 OrderCancelRequestBuild the context parameter to cancel an order and return the given processvoidConfirm the cancel order requestprotected voidcreateOrderCancelEntry(List<OrderCancelEntry> orderCancelEntries, Object entry) Creates anOrderCancelEntryprotected StringdetermineDeliveryMode(AbstractOrderEntryModel orderEntry) determines the delivery mode for a given orderEntry.protected com.hybris.cockpitng.core.events.CockpitEventQueueprotected BackofficeLocaleServiceprotected Optional<CancelReason>getCustomSelectedCancelReason(org.zkoss.zk.ui.event.Event event) Gets the label for the selected cancel reason in case the event has a target of Comboboxprotected EnumerationServiceprotected Localeprotected ModelServiceprotected com.hybris.cockpitng.util.notifications.NotificationServiceprotected OrderCancelServiceprotected org.zkoss.zul.Gridprotected List<org.zkoss.zk.ui.Component>protected OrderModelprotected intgetReasonIndex(CancelReason cancelReason) Gets the reason index within the combobox modelprotected Optional<CancelReason>getSelectedCancelReason(org.zkoss.zk.ui.event.Event event) get the corresponding cancel reason according to the selected item in the combobox if existingprotected UserServiceprotected voidhandleGlobalCancelComment(org.zkoss.zk.ui.event.Event event) Applies a global comment to all individual entries after an event is triggeredprotected voidhandleGlobalCancelReason(org.zkoss.zk.ui.event.Event event) Applies a global reason to all individual entries after an event is triggeredprotected voidhandleIndividualCancelReason(org.zkoss.zk.ui.event.Event event) Applies a cancel reason to an individual entry after an event is triggeredprotected voidhandleRow(org.zkoss.zul.Row row) Set or Reset the given row with the appropriate default informationvoidinitCancellationOrderForm(OrderModel inputObject) Initialize the popup to cancel ordersprotected Optional<CancelReason>matchingComboboxCancelReason(String cancelReasonLabel) Retrieve theCancelReasonaccording to the selected label in the comboboxprotected voidprocessCancellation(org.zkoss.zk.ui.event.Event obj) Process the cancellation Check if the user confirm the cancellation, then it sends the information to the service.voidreset()Reinitialize the popupprotected voidSelect or unselect all the rows of the grid and set the default values for each of themvoidsetOrderModel(OrderModel orderModel) protected voidDisplays a message box whether the user wants to cancel the orderprotected org.zkoss.zk.ui.ComponenttargetFieldToApplyValidation(String stringToValidate, int indexLabelToCheck, int indexTargetComponent) Retrieve the row who needs to apply a validation messageprotected voidValidate each order 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:
-
CONFIRM_ID
- See Also:
-
COMPLETED
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_PICKUP
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_TITLE
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_ERROR
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_CONFIRM_MSG
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_QTYCANCELLED_INVALID
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_QUANTITY
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_ERROR_REASON
- See Also:
-
CUSTOMERSUPPORTBACKOFFICE_CANCELORDER_MISSING_SELECTED_LINE
- See Also:
-
CANCELORDER_CONFIRM_ICON
- See Also:
-
COLUMN_INDEX_PENDING_QUANTITY
protected static final int COLUMN_INDEX_PENDING_QUANTITY- See Also:
-
COLUMN_INDEX_CANCEL_QUANTITY
protected static final int COLUMN_INDEX_CANCEL_QUANTITY- See Also:
-
COLUMN_INDEX_CANCEL_REASON
protected static final int COLUMN_INDEX_CANCEL_REASON- See Also:
-
COLUMN_INDEX_CANCEL_COMMENT
protected static final int COLUMN_INDEX_CANCEL_COMMENT- See Also:
-
-
Constructor Details
-
CancelOrderController
public CancelOrderController()
-
-
Method Details
-
confirmCancellation
public void confirmCancellation()Confirm the cancel order request -
initCancellationOrderForm
Initialize the popup to cancel orders- Parameters:
inputObject- the order for which we want to cancel several entries
-
determineDeliveryMode
determines the delivery mode for a given orderEntry. A pick up Entry is an entry that have a DeliveryPointOfService, other wise we take the value from Entry DeliveryMode if not null, other wise we take the value from DeliveryMode on order level.- Parameters:
orderEntry- theAbstractOrderEntryModelfor which to determine the delivery mode- Returns:
- the delivery mode name for a given orderEntry
-
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
-
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
-
buildCancelRequest
Build the context parameter to cancel an order and return the given process- Returns:
- a cancel request with the selected fields
-
createOrderCancelEntry
Creates anOrderCancelEntry- Parameters:
orderCancelEntries- the list which contains allOrderCancelEntryentry- the entry to be converted into aOrderCancelEntry
-
getReasonIndex
Gets the reason index within the combobox model- Parameters:
cancelReason- the reason for which we want to know the index- Returns:
- the index of the given cancel reason
-
getSelectedCancelReason
get the corresponding cancel reason according to the selected item in the combobox if existing- Parameters:
event- the select event on the combobox- Returns:
- the corresponding cancel reason
-
handleGlobalCancelComment
protected void handleGlobalCancelComment(org.zkoss.zk.ui.event.Event event) Applies a global comment to all individual entries after an event is triggered- Parameters:
event- the on changing event that was triggered by the user
-
handleGlobalCancelReason
protected void handleGlobalCancelReason(org.zkoss.zk.ui.event.Event event) Applies a global reason to all individual entries after an event is triggered- Parameters:
event- the on select event that was triggered by the user
-
handleIndividualCancelReason
protected void handleIndividualCancelReason(org.zkoss.zk.ui.event.Event event) Applies a cancel reason to an individual entry after an event is triggered- Parameters:
event- the on select event that was triggered by the user
-
handleRow
protected void handleRow(org.zkoss.zul.Row row) Set or Reset the given row with the appropriate default information- Parameters:
row- the row to set/reset
-
getCustomSelectedCancelReason
Gets the label for the selected cancel reason in case the event has a target of Combobox- Parameters:
event- the event that was fired- Returns:
- the CancelReason corresponding to the label.
-
matchingComboboxCancelReason
Retrieve theCancelReasonaccording to the selected label in the combobox- Parameters:
cancelReasonLabel- aStringrepresentation of the reason- Returns:
- the CancelReason corresponding to the label
-
processCancellation
protected void processCancellation(org.zkoss.zk.ui.event.Event obj) Process the cancellation Check if the user confirm the cancellation, then it sends the information to the service.- Parameters:
obj- theEvent
-
selectAllEntries
protected void selectAllEntries()Select or unselect all the rows of the grid and set the default values for each of them -
showMessageBox
protected void showMessageBox()Displays a message box whether the user wants to cancel the order -
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
-
validateOrderEntry
Validate each order 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 -
getOrderEntriesGridRows
-
getLocale
-
getCockpitLocaleService
-
getOrderEntries
protected org.zkoss.zul.Grid getOrderEntries() -
getOrderModel
-
setOrderModel
-
getOrderCancelService
-
getEnumerationService
-
getModelService
-
getCockpitEventQueue
protected com.hybris.cockpitng.core.events.CockpitEventQueue getCockpitEventQueue() -
getUserService
-
getNotificationService
protected com.hybris.cockpitng.util.notifications.NotificationService getNotificationService()
-