public class Listbox extends MeshElement
Event:
SelectEvent
is sent when user changes the
selection.See Specification.
Besides creating Listitem
programmatically, you could assign a data
model (a ListModel
or GroupsModel
instance) to a listbox via
setModel(ListModel)
or setModel(GroupsModel)
and then the
listbox will retrieve data via ListModel.getElementAt(int)
when necessary.
Besides assign a list model, you could assign a renderer (a
ListitemRenderer
instance) to a listbox, such that the listbox will
use this renderer to render the data returned by
ListModel.getElementAt(int)
. If not assigned, the default renderer, which
assumes a label per list item, is used. In other words, the default renderer
adds a label to a Listitem by calling toString against the object returned by
ListModel.getElementAt(int)
To retrieve what are selected in Listbox with a Selectable
ListModel
, you shall use Selectable.getSelection()
to get what
is currently selected object in ListModel
rather than using
getSelectedItems()
. That is, you shall operate on the item of
the ListModel
rather than on the Listitem
of the Listbox
if you use the Selectable
ListModel
.
Set selection = ((Selectable)getModel()).getSelection();
[Since 6.0.0] If a model is set, whether the listbox allows
the multiple selection depends on Selectable.setMultiple(boolean)
.
In other words, the application shall not access listbox directly if
a model is assigned. Rather, the application shall access the model
directly.
There are two ways to handle long content: scrolling and paging. If
AbstractComponent.getMold()
is "default", scrolling is used if HtmlBasedComponent.setHeight(java.lang.String)
is
called and too much content to display. If AbstractComponent.getMold()
is "paging",
paging is used if two or more pages are required. To control the number of
items to display in a page, use setPageSize(int)
.
If paging is used, the page controller is either created automatically or
assigned explicitly by setPaginal(org.zkoss.zul.ext.Paginal)
. The paging controller specified
explicitly by setPaginal(org.zkoss.zul.ext.Paginal)
is called the external page controller. It
is useful if you want to put the paging controller at different location
(other than as a child component), or you want to use the same controller to
control multiple listboxes.
Default getZclass()
: z-listbox.(since 3.5.0)
To have a list box without stripping, you can specify a non-existent style
class to setOddRowSclass(java.lang.String)
.
When used in a clustering environment, you have to make
ListitemRenderer
(setItemRenderer(org.zkoss.zul.ListitemRenderer<?>)
) and ListModel
(
setModel(org.zkoss.zul.ListModel<?>)
) either serializable or re-assign them when
sessionDidActivate(org.zkoss.zk.ui.Page)
is called.
For huge data, you can turn on Listbox's ROD to request ZK engine to load from
ListModel
only the required data chunk and create only the required
Listitem
s in memory and render only the required DOM elements in
browser. So it saves both the memory and the processing time in both server
and browser for huge data. If you don't use the ListModel
with the
Listbox, turn on the ROD will still have ZK engine to render only a chunk of
DOM elements in browser so it at least saves the memory and processing time
in browser. Note that ROD works only if the Listbox is configured to has a
limited "view port" height. That is, either the Listbox is in the "paging"
mold or you have to HtmlBasedComponent.setHeight(String)
,HtmlBasedComponent.setVflex(String)
,
or setRows(int)
of the Listbox to make ROD works.
You can turn on/off ROD for all Listboxes in the application or only for a specific Listbox. To turn on ROD for all Listboxes in the application, you have to specify the Library Property "org.zkoss.zul.listbox.rod" to "true" in WEB-INF/zk.xml. If you did not specify the Library Property, default is false.
org.zkoss.zul.listbox.rod
true
To turn on ROD for a specific Listbox, you have to specify the Listbox's attribute map with key "org.zkoss.zul.listbox.rod" to true. That is, for example, if in a zul file, you shall specify <custom-attributes> of the Listbox like this:
You can mix the Library Property and <custom-attributes> ways together. The <custom-attributes> way always takes higher priority. So you can turn OFF ROD in general and turn ON only some specific Listbox component. Or you can turn ON ROD in general and turn OFF only some specific Listbox component.
Since only partial Listitem
s are created and rendered in the
Listbox if you turn the ROD on, there will be some limitations on accessing
Listitem
s. For example, if you call
Listitem itemAt100 = (Listitem) getItemAtIndex(100);
The Listitem
in index 100 is not necessary created yet if it is
not in the current "view port" and you will get "null" instead.
And it is generally a bad idea to "cache" the created Listitem
in your application if you turn the ROD on because Listitems might be removed
later. Basically, you shall operate on the item of the ListModel
rather than on the Listitem
of the Listbox
if you use the
ListModel
and ROD.
isCheckmark()
) is enabled.
Notice that you could specify this attribute in any of its ancestor's attributes.
It will be inherited.setModel(org.zkoss.zul.ListModel<?>)
is called and Listheader.setSortDirection(java.lang.String)
is set.Listheader.setSortDirection(java.lang.String)
is called.ListDataEvent
and Listheader.setSortDirection(java.lang.String)
is set.ListDataEvent
,
you can specifies the value as "ignore.change".
Notice that you could specify this attribute in any of its ancestor's attributes.
It will be inherited.It is used only if live data (setModel(ListModel)
and
not paging (getPagingChild()
).
It is used only if live data (setModel(ListModel)
and not paging
(getPagingChild()
).
ListModel
,
ListitemRenderer
,
ListitemRendererExt
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected class |
Listbox.Children |
protected class |
Listbox.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl() . |
MeshElement.InternalPaging
Modifier and Type | Field and Description |
---|---|
static String |
LOADING_MODEL |
static String |
SYNCING_MODEL |
AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED
Constructor and Description |
---|
Listbox() |
Modifier and Type | Method and Description |
---|---|
void |
addItemToSelection(Listitem item)
Selects the given item, without deselecting any other items that are
already selected..
|
protected void |
afterInsert(org.zkoss.zk.ui.Component comp)
Callback if a list item has been inserted.
|
Listitem |
appendItem(String label,
String value)
Appends an item.
|
void |
beforeChildAdded(org.zkoss.zk.ui.Component newChild,
org.zkoss.zk.ui.Component refChild) |
protected void |
beforeRemove(org.zkoss.zk.ui.Component comp)
Callback if a list item will be removed (not removed yet).
|
void |
clearSelection()
Clears the selection.
|
Object |
clone() |
<T extends org.zkoss.zk.ui.Component> |
getChildren() |
String |
getEmptyMessage()
Returns the message to display when there are no items
|
Object |
getExtraCtrl() |
Frozen |
getFrozen()
Returns the frozen child.
|
int |
getGroupCount()
Returns the number of listgroup
|
List<Listgroup> |
getGroups()
Returns a list of all
Listgroup . |
<D,G,F> GroupsModel<D,G,F> |
getGroupsModel()
Returns the groups model associated with this list box, or null if this
list box is associated with a
ListModel or not associated with
any list data model. |
Collection<org.zkoss.zk.ui.Component> |
getHeads()
Returns a collection of heads, including
getListhead() and
auxiliary heads (Auxhead ) (never null). |
int |
getIndexOfItem(Listitem item)
Returns the index of the specified item, or -1 if not found.
|
String |
getInnerWidth()
Returns the inner width of this component.
|
Listitem |
getItemAtIndex(int index)
Returns the item at the specified index.
|
int |
getItemCount()
Returns the number of items.
|
<T> ListitemRenderer<T> |
getItemRenderer()
Returns the renderer to render each item, or null if the default renderer
is used.
|
List<Listitem> |
getItems()
Returns a live list of all
Listitem . |
Listfoot |
getListfoot()
Returns
Listfoot belonging to this listbox, or null if no list
footers at all. |
Listhead |
getListhead()
Returns
Listhead belonging to this listbox, or null if no list
headers at all. |
<T> ListModel<T> |
getListModel()
Returns the list model associated with this list box, or null if this
list box is associated with a
GroupsModel or not associated with
any list data model. |
int |
getMaxlength()
Returns the maximal length of each item's label.
|
<T> ListModel<T> |
getModel()
Returns the model associated with this list box, or null if this list box
is not associated with any list data model.
|
String |
getName()
Returns the name of this component.
|
String |
getNonselectableTags()
Returns a list of HTML tag names that shall not cause the list item
being selected if they are clicked.
|
String |
getOddRowSclass()
Returns the style class for the odd rows.
|
Paginal |
getPaginal()
Returns the paging controller, or null if not available.
|
Paging |
getPagingChild()
Returns the child paging controller that is created automatically, or
null if mold is not "paging", or the controller is specified externally
by
setPaginal(org.zkoss.zul.ext.Paginal) . |
int |
getPreloadSize()
Deprecated.
As of release 5.0.8, use custom attributes (org.zkoss.zul.listbox.preloadSize) instead.
Returns the number of items to preload when receiving the rendering
request from the client.
Default: 50. (Since 6.0.1)
It is used only if live data ( Note: if the "pre-load-size" attribute of component is specified, it's prior to the original value.(@since 3.0.4) |
int |
getRows()
Returns the rows.
|
int |
getSelectedCount()
Returns the number of items being selected.
|
int |
getSelectedIndex()
Returns the index of the selected item (-1 if no one is selected).
|
Listitem |
getSelectedItem()
Returns the selected item.
|
Set<Listitem> |
getSelectedItems()
Returns all selected items.
|
String |
getSeltype()
Returns the seltype.
|
int |
getVisibleItemCount()
Returns the number of visible descendant
Listitem . |
String |
getZclass() |
boolean |
hasGroup()
Returns whether listgroup exists.
|
boolean |
insertBefore(org.zkoss.zk.ui.Component newChild,
org.zkoss.zk.ui.Component refChild) |
protected boolean |
isAutohidePaging() |
boolean |
isCheckmark()
Returns whether the check mark shall be displayed in front of each item.
|
boolean |
isDisabled()
Returns whether it is disabled.
|
boolean |
isFixedLayout()
Deprecated.
since 5.0.0, use !
MeshElement.isSizedByContent() instead |
boolean |
isMultiple()
Returns whether multiple selections are allowed.
|
protected boolean |
isSelectOnHighlightDisabled() |
boolean |
isVflex()
Returns whether to grow and shrink vertical to fit their given space, so
called vertical flexibility.
|
void |
onInitRender()
Handles a private event, onInitRender.
|
void |
onPageAttached(org.zkoss.zk.ui.Page newpage,
org.zkoss.zk.ui.Page oldpage) |
void |
onPagingInitRender()
Handles a private event, onPagingInitRender.
|
protected Paginal |
pgi()
Returns the instance of the @{link Paginal}
|
boolean |
removeChild(org.zkoss.zk.ui.Component child)
If the child is a listgroup, its listgroupfoot will be removed at the
same time.
|
Listitem |
removeItemAt(int index)
Removes the child item in the list box at the given index.
|
void |
removeItemFromSelection(Listitem item)
Deselects the given item without deselecting other items.
|
void |
renderAll()
Renders all
Listitem if not loaded yet, with
getItemRenderer() . |
Listitem |
renderItem(Listitem li)
Renders the specified
Listitem if not loaded yet, with
getItemRenderer() . |
void |
renderItems(Set<? extends Listitem> items)
Renders the given set of list items.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
selectAll()
Selects all items.
|
void |
selectItem(Listitem item)
Deselects all of the currently selected items and selects the given item.
|
void |
service(org.zkoss.zk.au.AuRequest request,
boolean everError)
Processes an AU request.
|
void |
sessionDidActivate(org.zkoss.zk.ui.Page page) |
void |
sessionWillPassivate(org.zkoss.zk.ui.Page page) |
void |
setActivePage(int pg)
Sets the active page (starting from 0).
|
void |
setActivePage(Listitem item)
Sets the active page in which the specified item is.
|
void |
setCheckmark(boolean checkmark)
Sets whether the check mark shall be displayed in front of each item.
|
void |
setDisabled(boolean disabled)
Sets whether it is disabled.
|
void |
setEmptyMessage(String emptyMessage)
Sets the message to display when there are no items
|
void |
setFixedLayout(boolean fixedLayout)
Deprecated.
since 5.0.0, use
MeshElement.setSizedByContent(boolean) (!fixedLayout)
instead |
void |
setInnerWidth(String innerWidth)
Sets the inner width of this component.
|
void |
setItemRenderer(ListitemRenderer<?> renderer)
Sets the renderer which is used to render each item if
getModel()
is not null. |
void |
setItemRenderer(String clsnm)
Sets the renderer by use of a class name.
|
void |
setMaxlength(int maxlength)
Sets the maximal length of each item's label.
|
void |
setModel(GroupsModel<?,?,?> model)
Sets the groups model associated with this list box.
|
void |
setModel(ListModel<?> model)
Sets the list model associated with this listbox.
|
void |
setMold(String mold)
Sets the mold to render this component.
|
void |
setMultiple(boolean multiple)
Sets whether multiple selections are allowed.
|
void |
setName(String name)
Sets the name of this component.
|
void |
setNonselectableTags(String tags)
Sets a list of HTML tag names that shall not cause the list item
being selected if they are clicked.
|
void |
setOddRowSclass(String scls)
Sets the style class for the odd rows.
|
void |
setPageSize(int pgsz)
Sets the page size, a.k.a., the number rows per page.
|
void |
setPaginal(Paginal pgi)
Specifies the paging controller.
|
void |
setPreloadSize(int sz)
Deprecated.
As of release 5.0.8, use custom attributes (org.zkoss.zul.listbox.preloadSize) instead.
Sets the number of items to preload when receiving the rendering request
from the client.
It is used only if live data ( |
void |
setRows(int rows)
Sets the rows.
|
void |
setSelectedIndex(int jsel)
Deselects all of the currently selected items and selects the item with
the given index.
|
void |
setSelectedItem(Listitem item)
Deselects all of the currently selected items and selects the given item.
|
void |
setSelectedItems(Set<Listitem> listItems)
Selects the given listitems.
|
void |
setSeltype(String seltype)
Sets the seltype.
|
void |
setVflex(boolean vflex)
Sets whether to grow and shrink vertical to fit their given space, so
called vertical flexibility.
|
void |
toggleItemSelection(Listitem item)
If the specified item is selected, it is deselected.
|
getActivePage, getPageCount, getPageSize, getPagingPosition, getSpan, isAutopaging, isPagingDisabled, isSizedByContent, isSpan, setAutopaging, setPagingDisabled, setPagingPosition, setSizedByContent, setSpan, setSpan
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, 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
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, 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, 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, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, replace, response, response, response, service, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, 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
public static final String LOADING_MODEL
public static final String SYNCING_MODEL
public <T extends org.zkoss.zk.ui.Component> List<T> getChildren()
getChildren
in interface org.zkoss.zk.ui.Component
getChildren
in class org.zkoss.zk.ui.AbstractComponent
public void setFixedLayout(boolean fixedLayout)
MeshElement.setSizedByContent(boolean)
(!fixedLayout)
insteadfixedLayout
- true to outline this listbox by browserpublic boolean isFixedLayout()
MeshElement.isSizedByContent()
insteadpublic Listhead getListhead()
Listhead
belonging to this listbox, or null if no list
headers at all.public Listfoot getListfoot()
Listfoot
belonging to this listbox, or null if no list
footers at all.public Frozen getFrozen()
public Collection<org.zkoss.zk.ui.Component> getHeads()
getListhead()
and
auxiliary heads (Auxhead
) (never null).public boolean isCheckmark()
Default: false.
public void setCheckmark(boolean checkmark)
The check mark is a checkbox if isMultiple()
returns true. It is a
radio button if isMultiple()
returns false.
public void setInnerWidth(String innerWidth)
Application developers rarely call this method, unless they want to
preserve the widths of sizable columns changed by the user. To preserve
the widths, the developer have to store the widths of all columns and the
inner width (getInnerWidth()
), and then restore them when
re-creating this component.
innerWidth
- the inner width. If null, "100%" is assumed.public String getInnerWidth()
Default: "100%"
setInnerWidth(java.lang.String)
public boolean isVflex()
Note: this attribute is ignored if setRows(int)
is specified
Default: false.
public void setVflex(boolean vflex)
Note: this attribute is ignored if setRows(int)
is specified
public boolean isDisabled()
Default: false.
public void setDisabled(boolean disabled)
Note that it is only applied when mold is "select".
public int getRows()
Default: 0.
public void setRows(int rows) throws org.zkoss.zk.ui.WrongValueException
Note: if both HtmlBasedComponent.setHeight(java.lang.String)
is specified with non-empty,
setRows(int)
is ignored
org.zkoss.zk.ui.WrongValueException
public String getSeltype()
Default: "single".
public void setSeltype(String seltype) throws org.zkoss.zk.ui.WrongValueException
org.zkoss.zk.ui.WrongValueException
public boolean isMultiple()
Default: false.
public void setMultiple(boolean multiple)
Notice that, if a model is assigned, it will change the model's
state (by Selectable.setMultiple(boolean)
).
public int getMaxlength()
It is meaningful only for the select mold.
public void setMaxlength(int maxlength)
It is meaningful only for the select mold.
public String getName()
Default: null.
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
public void setName(String name)
The name is used only to work with "legacy" Web application that handles user's request by servlets. It works only with HTTP/HTML-based browsers. It doesn't work with other kind of clients.
Don't use this method if your application is purely based on ZK's event-driven model.
name
- the name of this component.public void setNonselectableTags(String tags)
Default: null (it means button, input, textarea and a). If you want to select no matter which tag is clicked, please specify an empty string.
tags
- a list of HTML tag names that will not cause the list item
being selected if clicked. Specify null to use the default and "" to
indicate none.public String getNonselectableTags()
Refer to setNonselectableTags(java.lang.String)
for details.
public List<Listitem> getItems()
Listitem
. By live we mean you can add
or remove them directly with the List interface. In other words, you
could add or remove an item by manipulating the returned list directly.public int getItemCount()
public Listitem getItemAtIndex(int index)
Note: if live data is used (getModel()
is not null), the returned
item might NOT be loaded yet. To ensure it is loaded, you have to invoke
renderItem(org.zkoss.zul.Listitem)
.
public int getIndexOfItem(Listitem item)
public int getSelectedIndex()
public void setSelectedIndex(int jsel)
public void selectItem(Listitem item)
It is the same as setSelectedItem(org.zkoss.zul.Listitem)
.
item
- the item to select. If null, all items are deselected.public void addItemToSelection(Listitem item)
Notice that if you assign a model to a listbox (setModel(org.zkoss.zul.ListModel<?>)
),
you shall not invoke this method directly. Rather, use Selectable
instead.
public void removeItemFromSelection(Listitem item)
Notice that if you assign a model to a listbox (setModel(org.zkoss.zul.ListModel<?>)
),
you shall not invoke this method directly. Rather, use Selectable
instead.
public void toggleItemSelection(Listitem item)
public void clearSelection()
public void selectAll()
public Listitem getSelectedItem()
Note: if live data is used (getModel()
is not null), the returned
item might NOT be loaded yet. To ensure it is loaded, you have to invoke
renderItem(org.zkoss.zul.Listitem)
.
public void setSelectedItem(Listitem item)
It is the same as selectItem(org.zkoss.zul.Listitem)
.
public void setSelectedItems(Set<Listitem> listItems)
public Set<Listitem> getSelectedItems()
Note: if live data is used (getModel()
is not null), the returned
item might NOT be loaded yet. To ensure it is loaded, you have to invoke
renderItem(org.zkoss.zul.Listitem)
.
public int getSelectedCount()
public Listitem appendItem(String label, String value)
Note: if live data is used (getModel()
is not null), the returned
item might NOT be loaded yet. To ensure it is loaded, you have to invoke
renderItem(org.zkoss.zul.Listitem)
.
public Listitem removeItemAt(int index)
Note: if live data is used (getModel()
is not null), the returned
item might NOT be loaded yet. To ensure it is loaded, you have to invoke
renderItem(org.zkoss.zul.Listitem)
.
public Paginal getPaginal()
AbstractComponent.getMold()
is "paging".
If mold is "paging", this method never returns null, because a child
paging controller is created automatically (if not specified by
developers with setPaginal(org.zkoss.zul.ext.Paginal)
).
If a paging controller is specified (either by setPaginal(org.zkoss.zul.ext.Paginal)
, or by
setMold(java.lang.String)
with "paging"), the listbox will rely on the paging
controller to handle long-content instead of scrolling.
public void setPaginal(Paginal pgi)
AbstractComponent.getMold()
is "paging".
It is OK, though without any effect, to specify a paging controller even if mold is not "paging".
pgi
- the paging controller. If null and AbstractComponent.getMold()
is
"paging", a paging controller is created automatically as a child
component (see getPagingChild()
).public Paging getPagingChild()
setPaginal(org.zkoss.zul.ext.Paginal)
.protected Paginal pgi()
MeshElement
pgi
in class MeshElement
public void setActivePage(Listitem item)
item
- the item to show. If the item is null or doesn't belong to
this listbox, nothing happens.setActivePage(int)
public void setActivePage(int pg) throws org.zkoss.zk.ui.WrongValueException
MeshElement
setActivePage
in class MeshElement
org.zkoss.zk.ui.WrongValueException
public int getVisibleItemCount()
Listitem
.public String getOddRowSclass()
Default: getZclass()
-odd. (since 3.5.0)
public void setOddRowSclass(String scls)
public int getGroupCount()
public boolean hasGroup()
public void beforeChildAdded(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
beforeChildAdded
in interface org.zkoss.zk.ui.sys.ComponentCtrl
beforeChildAdded
in class org.zkoss.zk.ui.AbstractComponent
public boolean insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
insertBefore
in interface org.zkoss.zk.ui.Component
insertBefore
in class org.zkoss.zk.ui.AbstractComponent
public boolean removeChild(org.zkoss.zk.ui.Component child)
removeChild
in interface org.zkoss.zk.ui.Component
removeChild
in class org.zkoss.zk.ui.AbstractComponent
protected void afterInsert(org.zkoss.zk.ui.Component comp)
Note: it won't be called if other kind of child is inserted.
When this method is called, the index is correct.
Default: invalidate if it is the paging mold and it affects the view of the active page.
protected void beforeRemove(org.zkoss.zk.ui.Component comp)
Default: invalidate if it is the paging mold and it affects the view of the active page.
public <T> ListModel<T> getModel()
Note: if setModel(GroupsModel)
was called with a groups model,
this method returns an instance of ListModel
encapsulating it.
setModel(ListModel)
,
setModel(GroupsModel)
public <T> ListModel<T> getListModel()
GroupsModel
or not associated with
any list data model.setModel(ListModel)
public <D,G,F> GroupsModel<D,G,F> getGroupsModel()
ListModel
or not associated with
any list data model.setModel(GroupsModel)
public void setModel(ListModel<?> model)
model
- the list model to associate, or null to dis-associate any
previous model. If not null, it must implement Selectable
.org.zkoss.zk.ui.UiException
- if failed to initialize with the modelgetListModel()
,
setModel(GroupsModel)
public void setModel(GroupsModel<?,?,?> model)
The groups model is used to represent a list of data with grouping.
model
- the groups model to associate, or null to dis-associate any
previous model.org.zkoss.zk.ui.UiException
- if failed to initialize with the modelsetModel(ListModel)
,
getGroupsModel()
public <T> ListitemRenderer<T> getItemRenderer()
public void setItemRenderer(ListitemRenderer<?> renderer)
getModel()
is not null.
Note: changing a render will not cause the listbox to re-render. If you
want it to re-render, you could assign the same model again (i.e.,
setModel(getModel())), or fire an ListDataEvent
event.
renderer
- the renderer, or null to use the default.org.zkoss.zk.ui.UiException
- if failed to initialize with the modelpublic void setItemRenderer(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException
public int getPreloadSize()
Default: 50. (Since 6.0.1)
It is used only if live data (setModel(ListModel)
and not paging
(getPagingChild()
.
Note: if the "pre-load-size" attribute of component is specified, it's prior to the original value.(@since 3.0.4)
public void setPreloadSize(int sz)
It is used only if live data (setModel(ListModel)
and not paging
(getPagingChild()
.
sz
- the number of items to preload. If zero, no preload at all.org.zkoss.zk.ui.UiException
- if sz is negativepublic void onInitRender()
public void onPagingInitRender()
public Listitem renderItem(Listitem li)
Listitem
if not loaded yet, with
getItemRenderer()
.
It does nothing if getModel()
returns null. In other words, it is
meaningful only if live data model is used.
renderItems(java.util.Set<? extends org.zkoss.zul.Listitem>)
,
renderAll()
public void renderAll()
Listitem
if not loaded yet, with
getItemRenderer()
.public void renderItems(Set<? extends Listitem> items)
public void setMold(String mold)
setMold
in interface org.zkoss.zk.ui.Component
setMold
in class org.zkoss.zk.ui.AbstractComponent
mold
- the mold. If null or empty, "default" is assumed.
Allowed values: default, select, pagingComponentDefinition
public String getEmptyMessage()
public void setEmptyMessage(String emptyMessage)
emptyMessage
- public String getZclass()
getZclass
in class org.zkoss.zk.ui.HtmlBasedComponent
public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
onPageAttached
in interface org.zkoss.zk.ui.sys.ComponentCtrl
onPageAttached
in class org.zkoss.zk.ui.AbstractComponent
public Object clone()
clone
in interface org.zkoss.zk.ui.Component
clone
in class XulElement
public void sessionWillPassivate(org.zkoss.zk.ui.Page page)
sessionWillPassivate
in interface org.zkoss.zk.ui.sys.ComponentCtrl
sessionWillPassivate
in class org.zkoss.zk.ui.AbstractComponent
public void sessionDidActivate(org.zkoss.zk.ui.Page page)
sessionDidActivate
in interface org.zkoss.zk.ui.sys.ComponentCtrl
sessionDidActivate
in class org.zkoss.zk.ui.AbstractComponent
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
renderProperties
in class MeshElement
IOException
protected boolean isAutohidePaging()
isAutohidePaging
in class MeshElement
protected boolean isSelectOnHighlightDisabled()
public void service(org.zkoss.zk.au.AuRequest request, boolean everError)
Default: in addition to what are handled by HtmlBasedComponent.service(org.zkoss.zk.au.AuRequest, boolean)
,
it also handles onSelect.
service
in interface org.zkoss.zk.ui.sys.ComponentCtrl
service
in class org.zkoss.zk.ui.HtmlBasedComponent
public Object getExtraCtrl()
getExtraCtrl
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getExtraCtrl
in class org.zkoss.zk.ui.HtmlBasedComponent
public void setPageSize(int pgsz) throws org.zkoss.zk.ui.WrongValueException
MeshElement
setPageSize
in class MeshElement
org.zkoss.zk.ui.WrongValueException
Copyright © 2017. All rights reserved.