public class DefaultWidgetInstanceManager extends Object implements WidgetInstanceManager
| Modifier and Type | Field and Description |
|---|---|
static String |
CNG_CURRENT_TITLE |
CNG_TITLE_CHANGE_LISTENER| Constructor and Description |
|---|
DefaultWidgetInstanceManager(Widgetslot widgetslot,
CockpitWidgetEngine cockpitWidgetEngine,
WidgetUtils widgetUtils,
CockpitThreadContextCreator ctxCreator,
Map<String,Object> labels,
List<WidgetConfigurationContextDecorator> contextDecorators,
CockpitConfigurationService cockpitConfigurationService,
LabelService labelService) |
| Modifier and Type | Method and Description |
|---|---|
<CONFIG> ConfigContext |
buildConfigurationContext(ConfigContext additionalContext,
Class<CONFIG> configurationType)
Builds cockpit configuration context for this widget.
|
protected org.zkoss.zk.ui.Component |
createNotificationComponent()
Creates component on which long operation notification will be displayed.
|
void |
executeOperation(Operation operation,
org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent,
String busyMessage)
Executes an
Operation in a separate thread. |
void |
executeOperationInParallel(Operation operation,
org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent)
Executes an
Operation in a separate thread regardless is there is already running another operation for
the
widget. |
CockpitComponentDefinitionService |
getComponentDefinitionService() |
String |
getLabel(String key)
Returns a localized label in the current locale.
|
String |
getLabel(String key,
Object[] args)
Returns a localized label in the current locale and formats it with the given arguments.
|
LabelService |
getLabelService() |
WidgetModel |
getModel()
Returns the widget view model as specified in the definition.xml of the widget.
|
String |
getTitle()
Returns the current widget title.
|
TypedSettingsMap |
getWidgetSettings()
Returns the widget settings map.
|
Widgetslot |
getWidgetslot()
Returns the widget slot the widget related to this manager is placed in.
|
void |
initWidgetSetting(String key,
Object initialValue)
Initializes a widget setting and sets an initial value if there is none, i.e.
|
<CONFIG> CONFIG |
loadConfiguration(ConfigContext context,
Class<CONFIG> configurationType)
Delegate to cockpitConfigurationService.
|
protected boolean |
lockOperationIfPossible(String operationIdentityValue,
Object operationId)
Checks whether widgetSlot has an attribute with given operationId.
|
void |
registerAfterEditorCallback(CallbackOperation callback)
Method complementary to com.hybris.cockpitng.engine.WidgetInstanceManager#registerEditorListener.
|
void |
registerBeforeEditorCallback(CallbackOperation callback)
Method complementary to com.hybris.cockpitng.engine.WidgetInstanceManager#registerEditorListener.
|
EditorListener |
registerEditorListener(EditorContext context,
EditorListener listener)
Whenever an editor is created in the context of a widget it may be needed to inform the parent widget that the
editor wants to interact with its model.
|
void |
sendOutput(String socketId,
Object data)
Sends data to the output socked with the given ID.
|
void |
sendOutputAfterOperation(String socketId,
Operation operation,
org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent,
String busyMessage)
Executes an
Operation in a separate thread and sends an output event to the output socket with the given
id after the operation has been finished. |
void |
setTitle(String title)
Changes the title of the widget dynamically.
|
<CONFIG> void |
storeConfiguration(ConfigContext context,
CONFIG configuration)
Delegate to cockpitConfigurationService.
|
protected void |
unlockOperation(String operationIdentityValue,
Object operationId)
Removed widget slot's information for given operation id.
|
public static final String CNG_CURRENT_TITLE
public DefaultWidgetInstanceManager(Widgetslot widgetslot, CockpitWidgetEngine cockpitWidgetEngine, WidgetUtils widgetUtils, CockpitThreadContextCreator ctxCreator, Map<String,Object> labels, List<WidgetConfigurationContextDecorator> contextDecorators, CockpitConfigurationService cockpitConfigurationService, LabelService labelService)
public void sendOutput(String socketId, Object data)
WidgetInstanceManagersendOutput in interface WidgetInstanceManagersocketId - output socket ID to sent the data todata - the data to be sentpublic TypedSettingsMap getWidgetSettings()
WidgetInstanceManagergetWidgetSettings in interface WidgetInstanceManagerpublic WidgetModel getModel()
WidgetInstanceManagergetModel in interface WidgetInstanceManagerpublic Widgetslot getWidgetslot()
WidgetInstanceManagergetWidgetslot in interface WidgetInstanceManagerpublic CockpitComponentDefinitionService getComponentDefinitionService()
public void initWidgetSetting(String key, Object initialValue)
initWidgetSetting in interface WidgetInstanceManagerpublic final void sendOutputAfterOperation(String socketId, Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, String busyMessage)
WidgetInstanceManagerOperation in a separate thread and sends an output event to the output socket with the given
id after the operation has been finished.sendOutputAfterOperation in interface WidgetInstanceManagersocketId - The output socket id.operation - The operation to execute.callbackEvent - An optional callback event listener that is invoked after the output event has been sent.busyMessage - A busy message that should be displayed while the operation is executed.public void executeOperation(Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, String busyMessage)
WidgetInstanceManagerOperation in a separate thread.executeOperation in interface WidgetInstanceManageroperation - The operation to execute.callbackEvent - An optional callback event listener that is invoked after the operation has been finished.busyMessage - A busy message that should be displayed while the operation is executed.public void executeOperationInParallel(Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent)
WidgetInstanceManagerOperation in a separate thread regardless is there is already running another operation for
the
widget.executeOperationInParallel in interface WidgetInstanceManageroperation - The operation to execute.callbackEvent - An optional callback event listener that is invoked after the operation has been finished.public String getLabel(String key)
WidgetInstanceManagergetLabel in interface WidgetInstanceManagerkey - localization key as specified in the locales_*.properties in your widget definition.public String getLabel(String key, Object[] args)
WidgetInstanceManagerMessageFormat.getLabel in interface WidgetInstanceManagerkey - localization key as specified in the locales_*.properties in your widget definition.args - list of arguments for the formatingprotected org.zkoss.zk.ui.Component createNotificationComponent()
protected boolean lockOperationIfPossible(String operationIdentityValue, Object operationId)
operationIdentityValue - operation identity value.operationId - result of Operation.getId()protected void unlockOperation(String operationIdentityValue, Object operationId)
operationIdentityValue - operation identity value.operationId - result of Operation.getId()public String getTitle()
WidgetInstanceManagergetTitle in interface WidgetInstanceManagerpublic void setTitle(String title)
WidgetInstanceManagersetTitle in interface WidgetInstanceManagertitle - the new titlepublic <CONFIG> ConfigContext buildConfigurationContext(ConfigContext additionalContext, Class<CONFIG> configurationType)
WidgetInstanceManagerwidgetConfigurationContextDecoratorList for list of
installed WidgetConfigurationContextDecorators).buildConfigurationContext in interface WidgetInstanceManageradditionalContext - additional configuration context for the widget, this can contain dynamic context
parameters as "type" or similarconfigurationType - type of the configuration this context is to be built for. This might influence the logic
in WidgetConfigurationContextDecorators.public <CONFIG> CONFIG loadConfiguration(ConfigContext context, Class<CONFIG> configurationType) throws CockpitConfigurationException
WidgetInstanceManagerloadConfiguration in interface WidgetInstanceManagercontext - the context to be used to look for the configurationconfigurationType - desired configuration typeCockpitConfigurationException - if configuration could not be found or some error occured during loadingCockpitConfigurationService.loadConfiguration(ConfigContext, Class)public <CONFIG> void storeConfiguration(ConfigContext context, CONFIG configuration) throws CockpitConfigurationException
WidgetInstanceManagerstoreConfiguration in interface WidgetInstanceManagercontext - the context to be used to store the configurationconfiguration - the configuration to be storedCockpitConfigurationException - if configuration could not be stored for some reasonCockpitConfigurationService.storeConfiguration(ConfigContext, Object)public EditorListener registerEditorListener(EditorContext context, EditorListener listener)
WidgetInstanceManagerregisterEditorListener in interface WidgetInstanceManagercontext - editor contextlistener - original editor listener @return wrapped listener (by default it returns the original listener,public void registerBeforeEditorCallback(CallbackOperation callback)
WidgetInstanceManagerregisterBeforeEditorCallback in interface WidgetInstanceManagercallback - the callback to be invokedpublic void registerAfterEditorCallback(CallbackOperation callback)
WidgetInstanceManagerregisterAfterEditorCallback in interface WidgetInstanceManagercallback - the callback to be invokedpublic LabelService getLabelService()
Copyright © 2018. All rights reserved.