Package org.adempiere.webui.component
Class Listbox
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.impl.MeshElement
org.zkoss.zul.Listbox
org.adempiere.webui.component.Listbox
- All Implemented Interfaces:
Serializable
,Cloneable
,org.zkoss.zk.ui.Component
,org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
,org.zkoss.zk.ui.ext.Scope
,org.zkoss.zk.ui.sys.ComponentCtrl
,org.zkoss.zul.ext.Paginated
- Direct Known Subclasses:
WListbox
public class Listbox
extends org.zkoss.zul.Listbox
implements org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
Extend
Listbox
- Author:
- Ashley G Ramdass
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zul.Listbox
org.zkoss.zul.Listbox.Children, org.zkoss.zul.Listbox.ExtraCtrl
Nested classes/interfaces inherited from class org.zkoss.zul.impl.MeshElement
org.zkoss.zul.impl.MeshElement.InternalPaging
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo
-
Field Summary
Fields inherited from class org.zkoss.zul.Listbox
LOADING_MODEL, SYNCING_MODEL
Fields inherited from class org.zkoss.zul.impl.MeshElement
CSS_FLEX_AUTO_DISABLED_COUNT
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
-
Constructor Summary
ConstructorDescriptionListbox()
Default ConstructorListbox
(KeyNamePair[] pairs) Create Listbox with items from pairs -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionListener
(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Shortcut for addEventListener(Events.ON_SELECT, listener), to ease porting of swing formvoid
addDoubleClickListener
(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Add listener for DOUBLE_CLICK event for list itemvoid
addItem
(KeyNamePair pp) Shortcut for appendItem(pp.getName(), pp.getKey()), to ease porting of swing formvoid
addItem
(ValueNamePair pp) Shortcut for appendItem(pp.getName(), pp.getValue()), to ease porting of swing formvoid
addOnDropListener
(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Add listener for ON_DROP event for list item.
This should be called before the adding of any list items.protected void
afterInsert
(org.zkoss.zk.ui.Component comp) Override to eset selected index.
appendItem
(String label, Object value) Add and return newListItem
appendItem
(String label, String value) Add and return newListItem
getItemAtIndex
(int index) int[]
Get selected indicesgetValue()
Get selected item for the list box based on the value of list itemboolean
insertBefore
(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild) boolean
boolean
void
onEvent
(org.zkoss.zk.ui.event.Event event) void
removeActionListener
(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Shortcut for removeEventListener(Events.ON_SELECT, listener), to ease porting of swing formvoid
Remove all items, to ease porting of swing formboolean
removeChild
(org.zkoss.zk.ui.Component child) Override to eset selected index.
void
setEnabled
(boolean enabled) Set enable/disable listboxvoid
setItemDraggable
(boolean b) void
setOddRowSclass
(String scls) void
setSelectedIndices
(int[] selected) Set selected indicesvoid
Set selected item base on kp.getKey, to ease porting of swing formvoid
Set selected item base on vp.getValue, to ease porting of swing formvoid
Set selected item for the list box based on the value of list item.
Set selected to none if no item found matching the value given or value is null.toString()
Methods inherited from class org.zkoss.zul.Listbox
addItemToSelection, beforeChildAdded, beforeRemove, clearSelection, clone, getChildren, getEmptyMessage, getExtraCtrl, getFrozen, getGroupCount, getGroups, getGroupsModel, getHeads, getIndexOfItem, getInnerWidth, getItemCount, getItemRenderer, getItems, getListfoot, getListhead, getListModel, getMaxlength, getModel, getName, getNonselectableTags, getPaginal, getPagingChild, getPropertyAccess, getRows, getSelectedCount, getSelectedIndex, getSelectedItems, getSeltype, getVisibleItemCount, getZclass, hasGroup, isAutohidePaging, isCheckmark, isDisabled, isMultiple, isSelectOnHighlightDisabled, isVflex, onAfterRender, onInitRender, onPageAttached, onPageDetached, onPagingInitRender, pgi, removeItemAt, removeItemFromSelection, renderAll, renderItem, renderItems, renderProperties, scrollToIndex, selectAll, selectItem, service, sessionDidActivate, sessionWillPassivate, setActivePage, setActivePage, setCheckmark, setDisabled, setEmptyMessage, setHeight, setInnerWidth, setItemRenderer, setItemRenderer, setMaxlength, setModel, setModel, setMold, setMultiple, setName, setNonselectableTags, setPageSize, setPaginal, setRows, setSelectedIndex, setSelectedItem, setSelectedItems, setSeltype, setVflex, setVflex, shallUpdateScrollPos, toggleItemSelection
Methods inherited from class org.zkoss.zul.impl.MeshElement
checkBeforeSetRows, evalCSSFlex, getActivePage, getPageCount, getPageSize, getPagingPosition, getSpan, isAutopaging, isPagingDisabled, isSizedByContent, isSpan, setAutopaging, setPagingDisabled, setPagingPosition, setSizedByContent, setSpan, setSpan
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
Listbox
public Listbox()Default Constructor -
Listbox
Create Listbox with items from pairs- Parameters:
pairs
- KeyNamePair[]
-
-
Method Details
-
setEnabled
public void setEnabled(boolean enabled) Set enable/disable listbox- Parameters:
enabled
-
-
isEnabled
public boolean isEnabled()- Returns:
- true if enable, false otherwise
-
appendItem
Add and return newListItem
- Parameters:
label
-value
-- Returns:
- ListItem
-
appendItem
Add and return newListItem
- Overrides:
appendItem
in classorg.zkoss.zul.Listbox
- Parameters:
label
-value
-
-
getItemAtIndex
- Overrides:
getItemAtIndex
in classorg.zkoss.zul.Listbox
- Parameters:
index
-- Returns:
- ListItem at index
-
getSelectedItem
- Overrides:
getSelectedItem
in classorg.zkoss.zul.Listbox
- Returns:
- Current selected ListItem
-
setValue
Set selected item for the list box based on the value of list item.
Set selected to none if no item found matching the value given or value is null.- Parameters:
value
- Value of ListItem to set as selected
-
getListHead
- Returns:
- ListHead
-
getSelectedIndices
public int[] getSelectedIndices()Get selected indices- Returns:
- int[] selected indices
-
setSelectedIndices
public void setSelectedIndices(int[] selected) Set selected indices- Parameters:
selected
- int[] selected indices
-
addOnDropListener
public void addOnDropListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Add listener for ON_DROP event for list item.
This should be called before the adding of any list items.- Parameters:
listener
-
-
addDoubleClickListener
public void addDoubleClickListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Add listener for DOUBLE_CLICK event for list item- Parameters:
listener
-
-
insertBefore
public boolean insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild) - Specified by:
insertBefore
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
insertBefore
in classorg.zkoss.zul.Listbox
-
isItemDraggable
public boolean isItemDraggable()- Returns:
- true if ListItem should be draggable
-
setItemDraggable
public void setItemDraggable(boolean b) - Parameters:
b
- true to enable draggable support for ListItem
-
onEvent
- Specified by:
onEvent
in interfaceorg.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
- Throws:
Exception
-
addItem
Shortcut for appendItem(pp.getName(), pp.getKey()), to ease porting of swing form- Parameters:
pp
-
-
removeAllItems
public void removeAllItems()Remove all items, to ease porting of swing form -
removeActionListener
public void removeActionListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Shortcut for removeEventListener(Events.ON_SELECT, listener), to ease porting of swing form- Parameters:
listener
-
-
addActionListener
public void addActionListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener) Shortcut for addEventListener(Events.ON_SELECT, listener), to ease porting of swing form- Parameters:
listener
-
-
addItem
Shortcut for appendItem(pp.getName(), pp.getValue()), to ease porting of swing form- Parameters:
pp
-
-
setSelectedValueNamePair
Set selected item base on vp.getValue, to ease porting of swing form- Parameters:
vp
- ValueNamePair
-
setSelectedKeyNamePair
Set selected item base on kp.getKey, to ease porting of swing form- Parameters:
kp
- KeyNamePair
-
afterInsert
protected void afterInsert(org.zkoss.zk.ui.Component comp) Override to eset selected index.
- Overrides:
afterInsert
in classorg.zkoss.zul.Listbox
-
removeChild
public boolean removeChild(org.zkoss.zk.ui.Component child) Override to eset selected index.
- Specified by:
removeChild
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
removeChild
in classorg.zkoss.zul.Listbox
-
getOddRowSclass
- Overrides:
getOddRowSclass
in classorg.zkoss.zul.Listbox
-
setOddRowSclass
- Overrides:
setOddRowSclass
in classorg.zkoss.zul.Listbox
-
toString
- Overrides:
toString
in classorg.zkoss.zk.ui.AbstractComponent
-
getValue
Get selected item for the list box based on the value of list item- Returns:
- Value of selected ListItem
-