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

    Constructors
    Constructor
    Description
    Default Constructor
    Create Listbox with items from pairs
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    void
    addDoubleClickListener(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
    Add listener for DOUBLE_CLICK event for list item
    void
    Shortcut for appendItem(pp.getName(), pp.getKey()), to ease porting of swing form
    void
    Shortcut for appendItem(pp.getName(), pp.getValue()), to ease porting of swing form
    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.
    protected void
    afterInsert(org.zkoss.zk.ui.Component comp)
    Override to eset selected index.
    appendItem(String label, Object value)
    Add and return new ListItem
    appendItem(String label, String value)
    Add and return new ListItem
    getItemAtIndex(int index)
     
     
     
    int[]
    Get selected indices
     
    Get selected item for the list box based on the value of list item
    boolean
    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 form
    void
    Remove all items, to ease porting of swing form
    boolean
    removeChild(org.zkoss.zk.ui.Component child)
    Override to eset selected index.
    void
    setEnabled(boolean enabled)
    Set enable/disable listbox
    void
    setItemDraggable(boolean b)
     
    void
     
    void
    setSelectedIndices(int[] selected)
    Set selected indices
    void
    Set selected item base on kp.getKey, to ease porting of swing form
    void
    Set selected item base on vp.getValue, to ease porting of swing form
    void
    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.
     

    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Listbox

      public Listbox()
      Default Constructor
    • Listbox

      public Listbox(KeyNamePair[] pairs)
      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

      public ListItem appendItem(String label, Object value)
      Add and return new ListItem
      Parameters:
      label -
      value -
      Returns:
      ListItem
    • appendItem

      public ListItem appendItem(String label, String value)
      Add and return new ListItem
      Overrides:
      appendItem in class org.zkoss.zul.Listbox
      Parameters:
      label -
      value -
    • getItemAtIndex

      public ListItem getItemAtIndex(int index)
      Overrides:
      getItemAtIndex in class org.zkoss.zul.Listbox
      Parameters:
      index -
      Returns:
      ListItem at index
    • getSelectedItem

      public ListItem getSelectedItem()
      Overrides:
      getSelectedItem in class org.zkoss.zul.Listbox
      Returns:
      Current selected ListItem
    • setValue

      public void setValue(Object value)
      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

      public ListHead 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 interface org.zkoss.zk.ui.Component
      Overrides:
      insertBefore in class org.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

      public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception
      Specified by:
      onEvent in interface org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
      Throws:
      Exception
    • addItem

      public void addItem(KeyNamePair pp)
      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

      public void addItem(ValueNamePair pp)
      Shortcut for appendItem(pp.getName(), pp.getValue()), to ease porting of swing form
      Parameters:
      pp -
    • setSelectedValueNamePair

      public void setSelectedValueNamePair(ValueNamePair vp)
      Set selected item base on vp.getValue, to ease porting of swing form
      Parameters:
      vp - ValueNamePair
    • setSelectedKeyNamePair

      public void setSelectedKeyNamePair(KeyNamePair kp)
      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 class org.zkoss.zul.Listbox
    • removeChild

      public boolean removeChild(org.zkoss.zk.ui.Component child)
      Override to eset selected index.
      Specified by:
      removeChild in interface org.zkoss.zk.ui.Component
      Overrides:
      removeChild in class org.zkoss.zul.Listbox
    • getOddRowSclass

      public String getOddRowSclass()
      Overrides:
      getOddRowSclass in class org.zkoss.zul.Listbox
    • setOddRowSclass

      public void setOddRowSclass(String scls)
      Overrides:
      setOddRowSclass in class org.zkoss.zul.Listbox
    • toString

      public String toString()
      Overrides:
      toString in class org.zkoss.zk.ui.AbstractComponent
    • getValue

      public Object getValue()
      Get selected item for the list box based on the value of list item
      Returns:
      Value of selected ListItem