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.String
LAZY_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 void
cleanup()
Called whenever this widget is invalidated or when a cleanup is needed.org.zkoss.zk.ui.api.HtmlBasedComponent
getCaption()
Returns this widget's caption component.org.zkoss.zk.ui.api.HtmlBasedComponent
getContent()
Returns this widget's content componentjava.lang.String
getControllerCtx()
Returns this widget's controller context.java.lang.String
getWidgetCode()
Returns the widget's code.WidgetContainer
getWidgetContainer()
Returns the widget container to which this widget belongs.U
getWidgetController()
Returns the widget's controller.T
getWidgetModel()
Returns the widget's (view) model.WidgetRenderer
getWidgetRenderer()
Returns the widget renderer.java.lang.String
getWidgetTitle()
Returns the widget's title.void
handleFocus(boolean focused)
Called whenever the focus view state of this component should be changed.void
initialize(java.util.Map<java.lang.String,java.lang.Object> params)
Initializes this widget.boolean
isFocusable()
Returns whether this widget can be focused or not.boolean
isInitialized()
Returns whether this widget has been initialized or not.boolean
isLazyLoadingEnabled()
Returns whether content lazy loading is enabled or not.protected void
setCaption(org.zkoss.zk.ui.api.HtmlBasedComponent caption)
Sets this widget's caption component tocaption
.protected void
setContent(org.zkoss.zk.ui.api.HtmlBasedComponent content)
Sets this widget's content component tocontent
.void
setControllerCtx(java.lang.String controllerCtx)
Sets this widget's controller context i.e.void
setFocusable(boolean focusable)
Sets whether this widget can be focused or not.void
setLazyLoadingEnabled(boolean lazyLoading)
Enables or disables content lazy loading.void
setWidgetCode(java.lang.String widgetCode)
Sets the widget's code.void
setWidgetContainer(WidgetContainer container)
Sets the widget container to which this widget belongs.void
setWidgetController(U widgetController)
Sets the widget's controller tocontroller
.void
setWidgetModel(T model)
Sets the widget's (view) model.void
setWidgetRenderer(WidgetRenderer widgetRenderer)
Sets the widget renderer.void
setWidgetTitle(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
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, 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, equals, 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
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:Widget
Initializes this widget.- Specified by:
initialize
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
params
- initialization parameters
-
isInitialized
public boolean isInitialized()
Description copied from interface:Widget
Returns whether this widget has been initialized or not.- Specified by:
isInitialized
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
true
if widget has been initialized,false
otherwise
-
handleFocus
public void handleFocus(boolean focused)
Description copied from interface:FocusableComponent
Called whenever the focus view state of this component should be changed.- Specified by:
handleFocus
in interfaceFocusableComponent
- Parameters:
focused
-true
if the component should be rendered as focused,false
otherwise
-
cleanup
public abstract void cleanup()
Description copied from interface:Widget
Called whenever this widget is invalidated or when a cleanup is needed. Typically unregisters itself and releases any acquired resources.- Specified by:
cleanup
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
-
getContent
public org.zkoss.zk.ui.api.HtmlBasedComponent getContent()
Description copied from interface:Widget
Returns this widget's content component- Specified by:
getContent
in 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:Widget
Returns this widget's caption component.- Specified by:
getCaption
in 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:Widget
Sets the widget container to which this widget belongs.- Specified by:
setWidgetContainer
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
container
- widget container
-
getWidgetContainer
public WidgetContainer getWidgetContainer()
Description copied from interface:Widget
Returns the widget container to which this widget belongs.- Specified by:
getWidgetContainer
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- this widget's widget container
-
setWidgetModel
public void setWidgetModel(T model)
Description copied from interface:Widget
Sets the widget's (view) model.- Specified by:
setWidgetModel
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
model
- the model
-
getWidgetModel
public T getWidgetModel()
Description copied from interface:Widget
Returns the widget's (view) model.- Specified by:
getWidgetModel
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- widget's model or
null
if no model is available
-
setWidgetCode
public void setWidgetCode(java.lang.String widgetCode)
Description copied from interface:Widget
Sets 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:
setWidgetCode
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
widgetCode
- widget code
-
getWidgetCode
public java.lang.String getWidgetCode()
Description copied from interface:Widget
Returns the widget's code.- Specified by:
getWidgetCode
in 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:Widget
Sets the widget renderer.- Specified by:
setWidgetRenderer
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
widgetRenderer
- widget renderer
-
getWidgetRenderer
public WidgetRenderer getWidgetRenderer()
Description copied from interface:Widget
Returns the widget renderer.- Specified by:
getWidgetRenderer
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- widget renderer
-
setFocusable
public void setFocusable(boolean focusable)
Description copied from interface:Widget
Sets whether this widget can be focused or not.- Specified by:
setFocusable
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
focusable
-true
means focusing is enabled,false
means disabled
-
isFocusable
public boolean isFocusable()
Description copied from interface:Widget
Returns whether this widget can be focused or not.- Specified by:
isFocusable
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
true
if focusing is enabled,false
otherwise
-
setWidgetController
public void setWidgetController(U widgetController)
Description copied from interface:Widget
Sets the widget's controller tocontroller
.- Specified by:
setWidgetController
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
widgetController
- widget controller
-
getWidgetController
public U getWidgetController()
Description copied from interface:Widget
Returns the widget's controller.- Specified by:
getWidgetController
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- widget controller
-
setControllerCtx
public void setControllerCtx(java.lang.String controllerCtx)
Description copied from interface:Widget
Sets this widget's controller context i.e. the context for which this widget should use when dealing with its controller.- Specified by:
setControllerCtx
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
controllerCtx
- controller context code
-
getControllerCtx
public java.lang.String getControllerCtx()
Description copied from interface:Widget
Returns this widget's controller context.- Specified by:
getControllerCtx
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- controller context code
-
isLazyLoadingEnabled
public boolean isLazyLoadingEnabled()
Description copied from interface:Widget
Returns whether content lazy loading is enabled or not.- Specified by:
isLazyLoadingEnabled
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
true
if lazy loading is enabled,false
otherwise
-
setLazyLoadingEnabled
public void setLazyLoadingEnabled(boolean lazyLoading)
Description copied from interface:Widget
Enables or disables content lazy loading.- Specified by:
setLazyLoadingEnabled
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Parameters:
lazyLoading
- lazy loading
-
setWidgetTitle
public void setWidgetTitle(java.lang.String title)
Description copied from interface:Widget
Sets the widget's title totitle
.- Specified by:
setWidgetTitle
in 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:Widget
Returns 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:
getWidgetTitle
in interfaceWidget<T extends WidgetModel,U extends WidgetController>
- Returns:
- widget's title
-
-