Package com.hybris.cockpitng.util
Class DefaultWidgetController
- 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
-
- 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>
- Direct Known Subclasses:
AbstractInitAdvancedSearchAdapter,AbstractSearchController,AdvancedSearchEngineController,AuthorityGroupSelector,BackofficeMainLayoutController,BackofficeSpaceManagementController,BorderLayoutWidgetController,BreadboardController,ChatWidgetController,CollapsibleContainerController,CollectionBrowserController,CollectionEditorAreaController,CollectionPreviewController,CompareViewController,ConceptActionWidgetController,ConceptL10nWidgetController,ConceptWidgetController,ConditionEvaluatorWidgetController,ConfigurableFlowController,ContextPopulatorController,DashboardWidgetController,DataPassingWidgetController,DefaultEditorAreaController,DefaultFlowWidgetController,EditorExampleMVCController,EditorWidgetController,EventAcceptorWidgetController,EventProducerWidgetController,ExampleDefaultWidgetController,ExampleWysiwygWidgetController,ExplorerTreeController,ExtendedSplitLayoutWidgetController,FlexibleLayoutWidgetController,GenericBookmarkHandlerController,GlobalLinksController,HtmlBasedWidgetController,InputTestController,MapEditorsDemoController,MultiplexerController,NavigationHistoryController,NetworkChartController,NextItemSelectorController,NotGateController,NotificationController,OutputTestWidgetController,PermissionManagementController,PermissionManagementGroupController,PerspectiveChooserWidgetController,PreviousItemSelectorController,PropertyExtractorController,QuickListController,QuickToggleLocaleController,ReferenceAdvancedSearchController,RefineByController,SimpleCastController,SimpleListController,SplitterLayoutController,SummaryViewController,SystemBarController,TabWidgetController,TextSearchController,ToolbarWidgetController,TryitWidgetController,UserRoleChooserWidgetController,ValueChooserController,ViewSwitcherWidgetController
public class DefaultWidgetController extends ViewAnnotationAwareComposer implements WidgetController, WidgetInstanceManagerAware, WidgetDragAndDropAware
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultWidgetController()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddoAfterCompose(org.zkoss.zk.ui.Component comp)This method is final, useinitialize(Component)instead.org.zkoss.zk.ui.metainfo.ComponentInfodoBeforeCompose(org.zkoss.zk.ui.Page page, org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.metainfo.ComponentInfo compInfo)voiddoBeforeComposeChildren(org.zkoss.zk.ui.Component comp)protected voidexecuteOperation(Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, java.lang.String busyMessage)Executes anOperationin a separate thread.lDragAndDropStrategygetDragAndDropStrategy()java.lang.StringgetLabel(java.lang.String key)java.lang.StringgetLabel(java.lang.String key, java.lang.Object[] args)WidgetModelgetModel()<T> TgetValue(java.lang.String key, java.lang.Class<T> expectedClass)protected WidgetDragAndDropStrategyRepositorygetWidgetDragAndDropStrategyRepository()WidgetInstanceManagergetWidgetInstanceManager()java.lang.StringgetWidgetRoot()Returns root path prefix for the given widget.TypedSettingsMapgetWidgetSettings()WidgetslotgetWidgetslot()java.lang.StringgetWidgetTitle()Gets the title of the current widget instanceWidgetUtilsgetWidgetUtils()protected voidinitDragAndDropAwareness()Deprecated, for removal: This API element is subject to removal in a future version.since 6.6 we don't put beans to Widget Modelvoidinitialize(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 voidinitWidgetSetting(java.lang.String key)Same as initWidgetSetting(key, "").protected voidinitWidgetSetting(java.lang.String key, boolean initialValue)Same as initWidgetSetting(key, Boolean.valueOf(initialValue)).protected voidinitWidgetSetting(java.lang.String key, double initialValue)Same as initWidgetSetting(key, Double.valueOf(initialValue)).protected voidinitWidgetSetting(java.lang.String key, int initialValue)Same as initWidgetSetting(key, Integer.valueOf(initialValue)).protected voidinitWidgetSetting(java.lang.String key, java.lang.Object initialValue)Initializes a widget setting and sets an initial value if there is none, i.e.protected voidinvokeListenerMethod(java.lang.reflect.Method method, org.zkoss.zk.ui.event.Event event, ViewEvent viewAnnotation)Override to intercept listener callsvoidonSocketInput(org.zkoss.zk.ui.event.Event event)Override this method to handle all input socket events.voidpreInitialize(org.zkoss.zk.ui.Component comp)Override this method to initialize widget settings.voidsendOutput(java.lang.String id, java.lang.Object data)Sends an output event to the output socket with the given id.protected voidsendOutputAfterOperation(java.lang.String id, Operation operation)Same as sendOutputAfterOperation(id, operation, null, null).protected voidsendOutputAfterOperation(java.lang.String id, Operation operation, java.lang.String busyMessage)Same as sendOutputAfterOperation(id, operation, null, busyMessage).protected voidsendOutputAfterOperation(java.lang.String id, Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, java.lang.String busyMessage)Executes anOperationin a separate thread and sends an output event to the output socket with the given id after the operation has been finished.voidsetValue(java.lang.String key, java.lang.Object value)voidsetWidgetInstanceManager(WidgetInstanceManager widgetInstanceManager)voidsetWidgetTitle(java.lang.String title)Sets the title of the current widget instance-
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
-
-
-
-
Method Detail
-
getWidgetInstanceManager
public WidgetInstanceManager getWidgetInstanceManager()
-
setWidgetInstanceManager
public void setWidgetInstanceManager(WidgetInstanceManager widgetInstanceManager)
- Specified by:
setWidgetInstanceManagerin interfaceWidgetInstanceManagerAware
-
preInitialize
public void preInitialize(org.zkoss.zk.ui.Component comp)
Override this method to initialize widget settings. Do not refer to view components since they may not have been wired yet.
-
initialize
public void initialize(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. This method will be invoked bydoAfterCompose(Component)everytime your widget view is created. SeeGenericForwardComposer.doAfterCompose(Component)for more details.
-
doBeforeComposeChildren
public void doBeforeComposeChildren(org.zkoss.zk.ui.Component comp) throws java.lang.Exception- Specified by:
doBeforeComposeChildrenin interfaceorg.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>- Overrides:
doBeforeComposeChildrenin classorg.zkoss.zk.ui.util.GenericComposer<org.zkoss.zk.ui.Component>- Throws:
java.lang.Exception
-
doBeforeCompose
public org.zkoss.zk.ui.metainfo.ComponentInfo doBeforeCompose(org.zkoss.zk.ui.Page page, org.zkoss.zk.ui.Component parent, org.zkoss.zk.ui.metainfo.ComponentInfo compInfo)- Specified by:
doBeforeComposein interfaceorg.zkoss.zk.ui.util.ComposerExt<org.zkoss.zk.ui.Component>- Overrides:
doBeforeComposein classorg.zkoss.zk.ui.util.GenericComposer<org.zkoss.zk.ui.Component>
-
doAfterCompose
public final void doAfterCompose(org.zkoss.zk.ui.Component comp) throws java.lang.ExceptionThis method is final, useinitialize(Component)instead.- Specified by:
doAfterComposein interfaceorg.zkoss.zk.ui.util.Composer<org.zkoss.zk.ui.Component>- Overrides:
doAfterComposein classViewAnnotationAwareComposer- Throws:
java.lang.Exception
-
getWidgetRoot
public java.lang.String getWidgetRoot()
Returns root path prefix for the given widget. All resource paths within the widget must be preceded by this.
-
getWidgetslot
public Widgetslot getWidgetslot()
-
getModel
public WidgetModel getModel()
- Specified by:
getModelin interfaceWidgetController
-
setValue
public void setValue(java.lang.String key, java.lang.Object value)
-
getValue
public <T> T getValue(java.lang.String key, java.lang.Class<T> expectedClass)
-
invokeListenerMethod
protected final void invokeListenerMethod(java.lang.reflect.Method method, org.zkoss.zk.ui.event.Event event, ViewEvent viewAnnotation) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetExceptionDescription copied from class:ViewAnnotationAwareComposerOverride to intercept listener calls- Overrides:
invokeListenerMethodin classViewAnnotationAwareComposer- Throws:
java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetException
-
initWidgetSetting
protected void initWidgetSetting(java.lang.String key, java.lang.Object initialValue)Initializes a widget setting and sets an initial value if there is none, i.e. this method does nothing if there is already a value set for the given key. A common place to invoke this method is withininitialize(Component).
-
initWidgetSetting
protected void initWidgetSetting(java.lang.String key)
Same as initWidgetSetting(key, "").
-
initWidgetSetting
protected void initWidgetSetting(java.lang.String key, int initialValue)Same as initWidgetSetting(key, Integer.valueOf(initialValue)).
-
initWidgetSetting
protected void initWidgetSetting(java.lang.String key, boolean initialValue)Same as initWidgetSetting(key, Boolean.valueOf(initialValue)).
-
initWidgetSetting
protected void initWidgetSetting(java.lang.String key, double initialValue)Same as initWidgetSetting(key, Double.valueOf(initialValue)).
-
sendOutput
public final void sendOutput(java.lang.String id, java.lang.Object data)Sends an output event to the output socket with the given id.- Parameters:
id- The output socket id.data- The data to send or null.
-
getLabel
public java.lang.String getLabel(java.lang.String key)
-
getLabel
public java.lang.String getLabel(java.lang.String key, java.lang.Object[] args)
-
sendOutputAfterOperation
protected final void sendOutputAfterOperation(java.lang.String id, Operation operation)Same as sendOutputAfterOperation(id, operation, null, null).
-
sendOutputAfterOperation
protected final void sendOutputAfterOperation(java.lang.String id, Operation operation, java.lang.String busyMessage)Same as sendOutputAfterOperation(id, operation, null, busyMessage).
-
sendOutputAfterOperation
protected final void sendOutputAfterOperation(java.lang.String id, Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, java.lang.String busyMessage)Executes anOperationin a separate thread and sends an output event to the output socket with the given id after the operation has been finished.- Parameters:
id- 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.
-
executeOperation
protected final void executeOperation(Operation operation, org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent, java.lang.String busyMessage)
Executes anOperationin a separate thread.l- Parameters:
operation- 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.
-
onSocketInput
public void onSocketInput(org.zkoss.zk.ui.event.Event event)
Override this method to handle all input socket events.- Parameters:
event- Usually an instance ofForwardEvent. UseForwardEvent.getOrigin()to get the original event.
-
getWidgetSettings
public TypedSettingsMap getWidgetSettings()
- Specified by:
getWidgetSettingsin interfaceWidgetController
-
getWidgetUtils
public WidgetUtils getWidgetUtils()
-
getWidgetTitle
public java.lang.String getWidgetTitle()
Gets the title of the current widget instance
-
setWidgetTitle
public void setWidgetTitle(java.lang.String title)
Sets the title of the current widget instance
-
initDragAndDropAwareness
@Deprecated(since="6.6", forRemoval=true) protected void initDragAndDropAwareness()Deprecated, for removal: This API element is subject to removal in a future version.since 6.6 we don't put beans to Widget Model
-
getDragAndDropStrategy
public DragAndDropStrategy getDragAndDropStrategy()
- Specified by:
getDragAndDropStrategyin interfaceWidgetDragAndDropAware
-
getWidgetDragAndDropStrategyRepository
protected WidgetDragAndDropStrategyRepository getWidgetDragAndDropStrategyRepository()
-
-