Class AbstractWidget<T extends WidgetModel,U extends WidgetController>
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.Div
-
- de.hybris.platform.cockpit.widgets.impl.AbstractWidget<T,U>
-
- All Implemented Interfaces:
FocusableComponent,WidgetModelListener,Widget<T,U>,java.io.Serializable,java.lang.Cloneable,org.zkoss.zk.ui.api.HtmlBasedComponent,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
- Direct Known Subclasses:
DefaultWidget
public abstract class AbstractWidget<T extends WidgetModel,U extends WidgetController> extends org.zkoss.zul.Div implements Widget<T,U>
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringLAZY_LOAD_EVT_KEY
-
Constructor Summary
Constructors Constructor Description AbstractWidget()Creates a new widget instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcleanup()Called whenever this widget is invalidated or when a cleanup is needed.org.zkoss.zk.ui.api.HtmlBasedComponentgetCaption()Returns this widget's caption component.org.zkoss.zk.ui.api.HtmlBasedComponentgetContent()Returns this widget's content componentjava.lang.StringgetControllerCtx()Returns this widget's controller context.java.lang.StringgetWidgetCode()Returns the widget's code.WidgetContainergetWidgetContainer()Returns the widget container to which this widget belongs.UgetWidgetController()Returns the widget's controller.TgetWidgetModel()Returns the widget's (view) model.WidgetRenderergetWidgetRenderer()Returns the widget renderer.java.lang.StringgetWidgetTitle()Returns the widget's title.voidhandleFocus(boolean focused)Called whenever the focus view state of this component should be changed.voidinitialize(java.util.Map<java.lang.String,java.lang.Object> params)Initializes this widget.booleanisFocusable()Returns whether this widget can be focused or not.booleanisInitialized()Returns whether this widget has been initialized or not.booleanisLazyLoadingEnabled()Returns whether content lazy loading is enabled or not.protected voidsetCaption(org.zkoss.zk.ui.api.HtmlBasedComponent caption)Sets this widget's caption component tocaption.protected voidsetContent(org.zkoss.zk.ui.api.HtmlBasedComponent content)Sets this widget's content component tocontent.voidsetControllerCtx(java.lang.String controllerCtx)Sets this widget's controller context i.e.voidsetFocusable(boolean focusable)Sets whether this widget can be focused or not.voidsetLazyLoadingEnabled(boolean lazyLoading)Enables or disables content lazy loading.voidsetWidgetCode(java.lang.String widgetCode)Sets the widget's code.voidsetWidgetContainer(WidgetContainer container)Sets the widget container to which this widget belongs.voidsetWidgetController(U widgetController)Sets the widget's controller tocontroller.voidsetWidgetModel(T model)Sets the widget's (view) model.voidsetWidgetRenderer(WidgetRenderer widgetRenderer)Sets the widget renderer.voidsetWidgetTitle(java.lang.String title)Sets the widget's title totitle.-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, clone, detach, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientAttribute, getClientDataAttribute, getDefinition, getDesktop, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getShadowVariable, getShadowVariable, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isInvalidated, isListenerAvailable, isVisible, query, queryAll, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisible, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride
-
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
-
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
-
Methods inherited from interface de.hybris.platform.cockpit.widgets.events.WidgetModelListener
onModelEvent
-
-
-
-
Field Detail
-
LAZY_LOAD_EVT_KEY
protected static final java.lang.String LAZY_LOAD_EVT_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(java.util.Map<java.lang.String,java.lang.Object> params)
Description copied from interface:WidgetInitializes this widget.- Specified by:
initializein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
params- initialization parameters
-
isInitialized
public boolean isInitialized()
Description copied from interface:WidgetReturns whether this widget has been initialized or not.- Specified by:
isInitializedin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
trueif widget has been initialized,falseotherwise
-
handleFocus
public void handleFocus(boolean focused)
Description copied from interface:FocusableComponentCalled whenever the focus view state of this component should be changed.- Specified by:
handleFocusin interfaceFocusableComponent- Parameters:
focused-trueif the component should be rendered as focused,falseotherwise
-
cleanup
public abstract void cleanup()
Description copied from interface:WidgetCalled whenever this widget is invalidated or when a cleanup is needed. Typically unregisters itself and releases any acquired resources.- Specified by:
cleanupin interfaceWidget<T extends WidgetModel,U extends WidgetController>
-
getContent
public org.zkoss.zk.ui.api.HtmlBasedComponent getContent()
Description copied from interface:WidgetReturns this widget's content component- Specified by:
getContentin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- the content component
- See Also:
WidgetRenderer.createContent(Widget)
-
setContent
protected void setContent(org.zkoss.zk.ui.api.HtmlBasedComponent content)
Sets this widget's content component tocontent. Note: If a content component has already been set the old one will be removed.- Parameters:
content- content component
-
getCaption
public org.zkoss.zk.ui.api.HtmlBasedComponent getCaption()
Description copied from interface:WidgetReturns this widget's caption component.- Specified by:
getCaptionin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- the caption component
- See Also:
WidgetRenderer.createCaption(Widget)
-
setCaption
protected void setCaption(org.zkoss.zk.ui.api.HtmlBasedComponent caption)
Sets this widget's caption component tocaption. Note: If a caption component has already been set the old one will be removed.- Parameters:
caption- caption component
-
setWidgetContainer
public void setWidgetContainer(WidgetContainer container)
Description copied from interface:WidgetSets the widget container to which this widget belongs.- Specified by:
setWidgetContainerin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
container- widget container
-
getWidgetContainer
public WidgetContainer getWidgetContainer()
Description copied from interface:WidgetReturns the widget container to which this widget belongs.- Specified by:
getWidgetContainerin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- this widget's widget container
-
setWidgetModel
public void setWidgetModel(T model)
Description copied from interface:WidgetSets the widget's (view) model.- Specified by:
setWidgetModelin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
model- the model
-
getWidgetModel
public T getWidgetModel()
Description copied from interface:WidgetReturns the widget's (view) model.- Specified by:
getWidgetModelin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- widget's model or
nullif no model is available
-
setWidgetCode
public void setWidgetCode(java.lang.String widgetCode)
Description copied from interface:WidgetSets the widget's code. The code of a widget is used for focus handling and internal mapping, thus it is important that widgets' codes are unique within oneWidgetContainer.- Specified by:
setWidgetCodein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
widgetCode- widget code
-
getWidgetCode
public java.lang.String getWidgetCode()
Description copied from interface:WidgetReturns the widget's code.- Specified by:
getWidgetCodein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- this widget's code
- See Also:
Widget.setWidgetCode(String)
-
setWidgetRenderer
public void setWidgetRenderer(WidgetRenderer widgetRenderer)
Description copied from interface:WidgetSets the widget renderer.- Specified by:
setWidgetRendererin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
widgetRenderer- widget renderer
-
getWidgetRenderer
public WidgetRenderer getWidgetRenderer()
Description copied from interface:WidgetReturns the widget renderer.- Specified by:
getWidgetRendererin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- widget renderer
-
setFocusable
public void setFocusable(boolean focusable)
Description copied from interface:WidgetSets whether this widget can be focused or not.- Specified by:
setFocusablein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
focusable-truemeans focusing is enabled,falsemeans disabled
-
isFocusable
public boolean isFocusable()
Description copied from interface:WidgetReturns whether this widget can be focused or not.- Specified by:
isFocusablein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
trueif focusing is enabled,falseotherwise
-
setWidgetController
public void setWidgetController(U widgetController)
Description copied from interface:WidgetSets the widget's controller tocontroller.- Specified by:
setWidgetControllerin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
widgetController- widget controller
-
getWidgetController
public U getWidgetController()
Description copied from interface:WidgetReturns the widget's controller.- Specified by:
getWidgetControllerin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- widget controller
-
setControllerCtx
public void setControllerCtx(java.lang.String controllerCtx)
Description copied from interface:WidgetSets this widget's controller context i.e. the context for which this widget should use when dealing with its controller.- Specified by:
setControllerCtxin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
controllerCtx- controller context code
-
getControllerCtx
public java.lang.String getControllerCtx()
Description copied from interface:WidgetReturns this widget's controller context.- Specified by:
getControllerCtxin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- controller context code
-
isLazyLoadingEnabled
public boolean isLazyLoadingEnabled()
Description copied from interface:WidgetReturns whether content lazy loading is enabled or not.- Specified by:
isLazyLoadingEnabledin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
trueif lazy loading is enabled,falseotherwise
-
setLazyLoadingEnabled
public void setLazyLoadingEnabled(boolean lazyLoading)
Description copied from interface:WidgetEnables or disables content lazy loading.- Specified by:
setLazyLoadingEnabledin interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
lazyLoading- lazy loading
-
setWidgetTitle
public void setWidgetTitle(java.lang.String title)
Description copied from interface:WidgetSets the widget's title totitle.- Specified by:
setWidgetTitlein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Parameters:
title- widget title as either i3-label key or direct value
-
getWidgetTitle
public java.lang.String getWidgetTitle()
Description copied from interface:WidgetReturns the widget's title. Note: This method will return the raw title as set by previous call toWidget.setWidgetTitle(String)i.e. in the case of an i3-label key, no evaluation is done.- Specified by:
getWidgetTitlein interfaceWidget<T extends WidgetModel,U extends WidgetController>- Returns:
- widget's title
-
-