Class NotificationController
- 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.notificationarea.NotificationController
-
- All Implemented Interfaces:
WidgetController,WidgetDragAndDropAware,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 NotificationController extends DefaultWidgetController
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringATTRIBUTE_NOTIFICATION_EVENTprotected static java.lang.StringMESSAGE_COMPONENTstatic java.lang.StringMODEL_DYNAMIC_NOTIFICATION_IDstatic java.lang.StringNOTIFICATION_MESSAGE_YTESTID_PREFIXstatic java.lang.StringRENDERER_PARAMETER_WIDGET_INSTANCE_MANAGERstatic java.lang.StringSELECTED_ELEMENT_OUT_SOCKETprotected static java.lang.StringSETTING_DEBUG_LOGprotected static java.lang.StringSETTING_NOTIFICATION_IDprotected static java.lang.StringSETTING_STACK_SIZEprotected static java.lang.StringSETTING_USE_DYNAMIC_NOTIFICATION_ID
-
Constructor Summary
Constructors Constructor Description NotificationController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMessageComponent(org.zkoss.zul.Div container, NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected voidaddNotification(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected org.zkoss.zk.ui.ComponentcreateLink(NotificationEvent notificationEvent, NotificationReference referenceConfig, ExpressionResolver resolver)protected org.zkoss.zk.ui.ComponentcreateNotificationComponent(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected NotificationextractNotificationConfig(NotificationEvent notificationEvent, NotificationArea notificationArea)protected NotificationDefaultsextractNotificationDefaults(NotificationArea notificationArea)protected java.util.Optional<java.lang.Class<?>>findElementClassFromStream(java.util.stream.Stream<?> stream)protected java.util.Optional<java.lang.Class<?>>findElementsClass(java.lang.Object ob)protected ExpressionResolverFactorygetExpressionResolverFactory()protected NotificationReferencegetFallbackReferenceConfig(int placeHolder, boolean linksEnabledByDefaults)protected intgetIndexOrPlaceholder(NotificationReference reference)protected LabelServicegetLabelService()protected NotificationAreagetNotificationAreaConfig(NotificationEvent notificationEvent)org.zkoss.zul.DivgetNotificationContainer()protected DestinationgetNotificationDestination(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected java.util.Deque<org.zkoss.zk.ui.Component>getNotificationEventsStack()protected java.lang.StringgetNotificationId()protected NotificationReferencegetNotificationReference(int index, Notification notificationConfig)protected NotificationRenderergetNotificationRenderer(java.lang.String rendererBean)protected org.zkoss.zk.ui.ComponentgetNotificationRendererComponent(NotificationEvent notificationEvent, java.lang.String rendererBean, java.util.List<NotificationParameter> parameters)protected java.math.BigIntegergetNotificationTimeout(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected java.lang.ObjectgetReferencedObject(NotificationEvent event, NotificationReference ref)protected java.lang.StringgetReferenceLabel(NotificationEvent notificationEvent, NotificationReference referenceConfig, ExpressionResolver resolver)voidinitialize(org.zkoss.zk.ui.Component comp)Override this method to do initialization stuff for your widget, like initialize widget settings, restore view state from viewmodel, etc.protected booleanisAlreadyNotified(NotificationEvent notificationEvent)protected booleanisDebugLog()protected booleanisGlobalNotification(java.lang.String notificationId)protected booleanisLinkEnabled(NotificationEvent event, Notification notificationConfig, NotificationDefaults notificationDefaults)protected booleanisLinkEnabled(NotificationEvent notificationEvent, NotificationReference reference, ExpressionResolver resolver)protected booleanisMatchingNotification(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)protected booleannotificationsMatches(Destination expected, java.lang.String current)protected booleannotificationsMatches(java.lang.String expectedId, java.lang.String currentId)voidonClearNotifications(ClearNotificationsEvent clearEvent)Processes clearEvent which removes notifications of specified source and type (if specified in clearEventClearNotificationsEvent.getLevel()).voidonNotification(NotificationEvent notificationEvent)Starting point of notification processing.protected booleanreferencedTypeMatches(java.lang.String notificationReferenceType, java.lang.Object[] referencedTypes)protected voidrefreshView()Calls invalidate onDefaultWidgetController.getWidgetslot().protected voidremoveNotification(org.zkoss.zk.ui.Component notificationComponent)protected NotificationresolveConfigurationDuplications(Notification a, Notification b)voidsetExpressionResolverFactory(ExpressionResolverFactory expressionResolverFactory)voidsetLabelService(LabelService labelService)voidsetNotificationStack(NotificationStack notificationStack)protected booleanvalidateMessage(Notification notification, NotificationEvent notificationEvent)protected booleanvalidateReferenceIndex(NotificationReference ref, NotificationEvent event)-
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, 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
-
RENDERER_PARAMETER_WIDGET_INSTANCE_MANAGER
public static final java.lang.String RENDERER_PARAMETER_WIDGET_INSTANCE_MANAGER
- See Also:
- Constant Field Values
-
SELECTED_ELEMENT_OUT_SOCKET
public static final java.lang.String SELECTED_ELEMENT_OUT_SOCKET
- See Also:
- Constant Field Values
-
NOTIFICATION_MESSAGE_YTESTID_PREFIX
public static final java.lang.String NOTIFICATION_MESSAGE_YTESTID_PREFIX
- See Also:
- Constant Field Values
-
MODEL_DYNAMIC_NOTIFICATION_ID
public static final java.lang.String MODEL_DYNAMIC_NOTIFICATION_ID
- See Also:
- Constant Field Values
-
SETTING_DEBUG_LOG
protected static final java.lang.String SETTING_DEBUG_LOG
- See Also:
- Constant Field Values
-
MESSAGE_COMPONENT
protected static final java.lang.String MESSAGE_COMPONENT
- See Also:
- Constant Field Values
-
SETTING_NOTIFICATION_ID
protected static final java.lang.String SETTING_NOTIFICATION_ID
- See Also:
- Constant Field Values
-
SETTING_STACK_SIZE
protected static final java.lang.String SETTING_STACK_SIZE
- See Also:
- Constant Field Values
-
SETTING_USE_DYNAMIC_NOTIFICATION_ID
protected static final java.lang.String SETTING_USE_DYNAMIC_NOTIFICATION_ID
- See Also:
- Constant Field Values
-
ATTRIBUTE_NOTIFICATION_EVENT
protected static final java.lang.String ATTRIBUTE_NOTIFICATION_EVENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(org.zkoss.zk.ui.Component comp)
Description copied from class:DefaultWidgetControllerOverride this method to do initialization stuff for your widget, like initialize widget settings, restore view state from viewmodel, etc. This method will be invoked byDefaultWidgetController.doAfterCompose(Component)everytime your widget view is created. SeeGenericForwardComposer.doAfterCompose(Component)for more details.- Overrides:
initializein classDefaultWidgetController
-
onNotification
public void onNotification(NotificationEvent notificationEvent)
Starting point of notification processing.- Parameters:
notificationEvent- contains all data necessary for a notification to be shown or discarded.
-
onClearNotifications
public void onClearNotifications(ClearNotificationsEvent clearEvent)
Processes clearEvent which removes notifications of specified source and type (if specified in clearEventClearNotificationsEvent.getLevel()).- Parameters:
clearEvent- contains an id and notification type to remove (not mandatory).
-
getNotificationAreaConfig
protected NotificationArea getNotificationAreaConfig(NotificationEvent notificationEvent) throws CockpitConfigurationException
- Throws:
CockpitConfigurationException
-
extractNotificationConfig
protected Notification extractNotificationConfig(NotificationEvent notificationEvent, NotificationArea notificationArea)
-
resolveConfigurationDuplications
protected Notification resolveConfigurationDuplications(Notification a, Notification b)
-
referencedTypeMatches
protected boolean referencedTypeMatches(java.lang.String notificationReferenceType, java.lang.Object[] referencedTypes)
-
findElementsClass
protected java.util.Optional<java.lang.Class<?>> findElementsClass(java.lang.Object ob)
-
findElementClassFromStream
protected java.util.Optional<java.lang.Class<?>> findElementClassFromStream(java.util.stream.Stream<?> stream)
-
extractNotificationDefaults
protected NotificationDefaults extractNotificationDefaults(NotificationArea notificationArea)
-
getNotificationTimeout
protected java.math.BigInteger getNotificationTimeout(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
getNotificationDestination
protected Destination getNotificationDestination(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
addNotification
protected void addNotification(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
isAlreadyNotified
protected boolean isAlreadyNotified(NotificationEvent notificationEvent)
-
isGlobalNotification
protected boolean isGlobalNotification(java.lang.String notificationId)
-
notificationsMatches
protected boolean notificationsMatches(Destination expected, java.lang.String current)
-
notificationsMatches
protected boolean notificationsMatches(java.lang.String expectedId, java.lang.String currentId)
-
getNotificationId
protected java.lang.String getNotificationId()
-
isMatchingNotification
protected boolean isMatchingNotification(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
removeNotification
protected void removeNotification(org.zkoss.zk.ui.Component notificationComponent)
-
refreshView
protected void refreshView()
Calls invalidate onDefaultWidgetController.getWidgetslot().
-
createNotificationComponent
protected org.zkoss.zk.ui.Component createNotificationComponent(NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
getNotificationRendererComponent
protected org.zkoss.zk.ui.Component getNotificationRendererComponent(NotificationEvent notificationEvent, java.lang.String rendererBean, java.util.List<NotificationParameter> parameters)
-
getNotificationRenderer
protected NotificationRenderer getNotificationRenderer(java.lang.String rendererBean)
-
isLinkEnabled
protected boolean isLinkEnabled(NotificationEvent notificationEvent, NotificationReference reference, ExpressionResolver resolver)
-
isLinkEnabled
protected boolean isLinkEnabled(NotificationEvent event, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
validateReferenceIndex
protected boolean validateReferenceIndex(NotificationReference ref, NotificationEvent event)
-
getIndexOrPlaceholder
protected int getIndexOrPlaceholder(NotificationReference reference)
-
getNotificationReference
protected NotificationReference getNotificationReference(int index, Notification notificationConfig)
-
addMessageComponent
protected void addMessageComponent(org.zkoss.zul.Div container, NotificationEvent notificationEvent, Notification notificationConfig, NotificationDefaults notificationDefaults)
-
validateMessage
protected boolean validateMessage(Notification notification, NotificationEvent notificationEvent)
-
getFallbackReferenceConfig
protected NotificationReference getFallbackReferenceConfig(int placeHolder, boolean linksEnabledByDefaults)
-
getReferenceLabel
protected java.lang.String getReferenceLabel(NotificationEvent notificationEvent, NotificationReference referenceConfig, ExpressionResolver resolver)
-
createLink
protected org.zkoss.zk.ui.Component createLink(NotificationEvent notificationEvent, NotificationReference referenceConfig, ExpressionResolver resolver)
-
getReferencedObject
protected java.lang.Object getReferencedObject(NotificationEvent event, NotificationReference ref)
-
getNotificationEventsStack
protected java.util.Deque<org.zkoss.zk.ui.Component> getNotificationEventsStack()
-
isDebugLog
protected boolean isDebugLog()
-
getNotificationContainer
public org.zkoss.zul.Div getNotificationContainer()
-
getExpressionResolverFactory
protected ExpressionResolverFactory getExpressionResolverFactory()
-
setExpressionResolverFactory
public void setExpressionResolverFactory(ExpressionResolverFactory expressionResolverFactory)
-
getLabelService
protected LabelService getLabelService()
-
setLabelService
public void setLabelService(LabelService labelService)
-
setNotificationStack
public void setNotificationStack(NotificationStack notificationStack)
-
-