Package com.hybris.cockpitng.actions
Class AbstractStatefulActionRenderer<INPUT,OUTPUT>
- java.lang.Object
-
- com.hybris.cockpitng.actions.impl.DefaultActionRenderer<INPUT,OUTPUT>
-
- com.hybris.cockpitng.actions.AbstractStatefulActionRenderer<INPUT,OUTPUT>
-
- All Implemented Interfaces:
CockpitActionRenderer<INPUT,OUTPUT>
- Direct Known Subclasses:
AbstractToggleActionRenderer
public abstract class AbstractStatefulActionRenderer<INPUT,OUTPUT> extends DefaultActionRenderer<INPUT,OUTPUT>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.hybris.cockpitng.actions.impl.DefaultActionRenderer
DefaultActionRenderer.DefaultActionRendererEventListener<T extends org.zkoss.zk.ui.event.Event>
-
-
Field Summary
-
Fields inherited from class com.hybris.cockpitng.actions.impl.DefaultActionRenderer
LABEL_CONTAINER_SCLASS, tooltipText
-
-
Constructor Summary
Constructors Constructor Description AbstractStatefulActionRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddStateSocketListener(Action parent, ActionContext<INPUT> context, java.lang.String listenerIdentity, java.lang.String socket, java.util.function.Supplier<org.zkoss.zk.ui.event.EventListener<SocketEvent>> listenerSupplier)Registers new socket listener on parent's widget, if it hasn't been done yet.protected org.zkoss.zk.ui.event.EventListener<SocketEvent>createStateSocketListener(Action parent, ActionContext<INPUT> context, java.lang.String key, java.util.function.Function valueSupplier)Creates new instance of socket listener.protected <V> VgetValue(ActionContext<INPUT> actionContext, java.lang.String key)Reads a value from parent's widget model.protected org.zkoss.zk.ui.event.EventListener<SocketEvent>initializeStateSocketListener(Action parent, java.lang.String listenerIdentity, org.zkoss.zk.ui.event.EventListener<SocketEvent> socketListener)Initialized newly created listener.protected voidsetValue(ActionContext<INPUT> actionContext, java.lang.String key, java.lang.Object value)Puts a value to parent's widget model.-
Methods inherited from class com.hybris.cockpitng.actions.impl.DefaultActionRenderer
addEventListener, addKeyboardSupport, adjustUri, checkDataCompatibleWithDefinedInput, createEventListener, createYTestId, extractIconDisabledUri, extractIconHoverUri, extractIconUri, extractKeyEvent, findActionComponent, findGroupComponent, findParentComponent, getActionBodySclass, getIconHoverUri, getIconUri, getKeyboardSupportService, getLocalizedName, getOrCreateContainer, getOrCreateIcon, getOrCreateIcon, getOrCreateLabel, getOrCreateLabel, getTooltipText, getToolTipWithCtrlKeysText, loadFromParentModel, perform, performWithConfirmationCheck, registerHoverEventsOnContainer, removeEventListeners, removeEventListeners, removeIcon, removeLabel, render, setTooltipText, storeInParentModel, triggerFromKeyEvent
-
-
-
-
Method Detail
-
getValue
protected <V> V getValue(ActionContext<INPUT> actionContext, java.lang.String key)
Reads a value from parent's widget model.Method is resistant to situation when many instances of a particular action used in single parent widgets.
- Type Parameters:
V- value type- Parameters:
actionContext- action contextkey- value key- Returns:
- value found or
null
-
setValue
protected void setValue(ActionContext<INPUT> actionContext, java.lang.String key, java.lang.Object value)
Puts a value to parent's widget model.Method is resistant to situation when many instances of a particular action used in single parent widgets.
- Parameters:
actionContext- action contextkey- value keyvalue- value to be put
-
addStateSocketListener
protected void addStateSocketListener(Action parent, ActionContext<INPUT> context, java.lang.String listenerIdentity, java.lang.String socket, java.util.function.Supplier<org.zkoss.zk.ui.event.EventListener<SocketEvent>> listenerSupplier)
Registers new socket listener on parent's widget, if it hasn't been done yet. Otherwise nothing happens. Messages received through provided socket will be processed and stored under specified key.- Parameters:
parent- action componentcontext- action contextlistenerIdentity- unique identity of listener in scope of actionsocket- name of socket to attach tolistenerSupplier- a method creating new instance of listener- See Also:
initializeStateSocketListener(Action, String, EventListener),createStateSocketListener(Action, ActionContext, String, Function)
-
initializeStateSocketListener
protected org.zkoss.zk.ui.event.EventListener<SocketEvent> initializeStateSocketListener(Action parent, java.lang.String listenerIdentity, org.zkoss.zk.ui.event.EventListener<SocketEvent> socketListener)
Initialized newly created listener.- Parameters:
parent- action componentlistenerIdentity- unique identity of listener in scope of actionsocketListener- listener to be initialized- Returns:
- initialized listener that will be registered
- See Also:
addStateSocketListener(Action, ActionContext, String, String, Supplier),createStateSocketListener(Action, ActionContext, String, Function)
-
createStateSocketListener
protected org.zkoss.zk.ui.event.EventListener<SocketEvent> createStateSocketListener(Action parent, ActionContext<INPUT> context, java.lang.String key, java.util.function.Function valueSupplier)
Creates new instance of socket listener.- Parameters:
parent- action componentcontext- action contextkey- model key under which a processed input message will be keptvalueSupplier- processing method- Returns:
- new instance of socket listener
-
-