Java Doc for Listbox.java in  » Ajax » zk » org » zkoss » zul » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » zk » org.zkoss.zul 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.zkoss.zul.impl.XulElement
   org.zkoss.zul.Listbox

Listbox
public class Listbox extends XulElement (Code)
A listbox.

Event:

  1. org.zkoss.zk.ui.event.SelectEvent is sent when user changes the selection.

See Specification.

Besides creating Listitem programmingly, you could assign a data model (a ListModel instance) to a listbox via Listbox.setModel and then the listbox will retrieve data via ListModel.getElementAt 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 . 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 row by calling toString against the object returned by ListModel.getElementAt

There are two ways to handle long content: scrolling and paging. If Listbox.getMold is "default", scrolling is used if Listbox.setHeight is called and too much content to display. If Listbox.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 Listbox.setPageSize .

If paging is used, the page controller is either created automatically or assigned explicity by Listbox.setPaginal . The paging controller specified explicitly by Listbox.setPaginal 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 Listbox.getSclass : listbox.

To have a list box without stripping, you can specify a non-existent style class to Listbox.setOddRowSclass . If you want to disable all striping, you can specify the style:


 tr.odd {
 background: white;
 }
 

author:
   tomyeh
See Also:   ListModel
See Also:   ListitemRenderer
See Also:   ListitemRendererExt

Inner Class :protected class ExtraCtrl extends XulElement.ExtraCtrl implements InnerWidth,Selectable,Cropper,RenderOnDemand


Constructor Summary
public  Listbox()
    

Method Summary
public  voidaddItemToSelection(Listitem item)
     Selects the given item, without deselecting any other items that are already selected..
public  ListitemappendItem(String label, String value)
     Appends an item.
public  voidclearSelection()
     Clears the selection.
public  Objectclone()
    
public  CollectiongetHeads()
     Returns a collection of heads, including Listbox.getListhead and auxiliary heads ( Auxhead ) (never null).
public  intgetIndexOfItem(Listitem item)
     Returns the index of the specified item, or -1 if not found.
public  StringgetInnerWidth()
     Returns the inner width of this component.
public  ListitemgetItemAtIndex(int index)
     Returns the item at the specified index.
public  intgetItemCount()
     Returns the number of items.
public  ListitemRenderergetItemRenderer()
     Returns the renderer to render each item, or null if the default renderer is used.
public  ListgetItems()
     Returns a live list of all Listitem . By live we mean you can add or remove them directly with the List interface.
public  ListfootgetListfoot()
     Returns Listfoot belonging to this listbox, or null if no list footers at all.
public  ListheadgetListhead()
     Returns Listhead belonging to this listbox, or null if no list headers at all.
public  intgetMaxlength()
     Returns the maximal length of each item's label.
public  ListModelgetModel()
     Returns the list model associated with this listbox, or null if this listbox is not associated with any list data model.
public  StringgetName()
     Returns the name of this component.

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.

public  StringgetOddRowSclass()
     Returns the style class for the odd rows.
public  StringgetOuterAttrs()
    
public  intgetPageSize()
     Returns the page size, aka., the number items per page.
public  PaginalgetPaginal()
     Returns the paging controller, or null if not available.
public  PaginggetPaging()
     Returns the child paging controller that is created automatically, or null if mold is not "paging", or the controller is specified externally by Listbox.setPaginal .
public  intgetPreloadSize()
     Returns the number of items to preload when receiving the rendering request from the client.
public  intgetRows()
     Returns the rows.
public  intgetSelectedCount()
     Returns the number of items being selected.
public  intgetSelectedIndex()
     Returns the index of the selected item (-1 if no one is selected).
public  ListitemgetSelectedItem()
     Returns the selected item.
public  SetgetSelectedItems()
     Returns all selected items.
public  StringgetSeltype()
     Returns the seltype.
public  intgetTabindex()
     Returns the tab order of this component.
public  intgetVisibleBegin()
     Returns the index of the first visible child.
public  intgetVisibleEnd()
     Returns the index of the last visible child.
 booleaninPagingMold()
     Returns whether this listbox is in the paging mold.
final  booleaninSelectMold()
     Returns whether the HTML's select tag is used.
public  booleaninsertBefore(Component newChild, Component refChild)
    
final public  booleanisCheckmark()
     Returns whether the check mark shall be displayed in front of each item.
final public  booleanisDisabled()
     Returns whether it is disabled.
public  booleanisMultiple()
     Returns whether multiple selections are allowed.
final public  booleanisVflex()
     Returns whether to grow and shrink vertical to fit their given space, so called vertial flexibility.
protected  ObjectnewExtraCtrl()
    
public  voidonChildAdded(Component child)
    
public  voidonChildRemoved(Component child)
    
public  voidonInitRender()
     Handles a private event, onInitRender.
public  booleanremoveChild(Component child)
    
public  ListitemremoveItemAt(int index)
     Removes the child item in the list box at the given index.
public  voidremoveItemFromSelection(Listitem item)
     Deselects the given item without deselecting other items.
public  voidrenderAll()
     Renders all Listitem if not loaded yet, with Listbox.getItemRenderer .
public  ListitemrenderItem(Listitem li)
     Renders the specified Listitem if not loaded yet, with Listbox.getItemRenderer .
public  voidrenderItems(Set items)
    
public  voidselectAll()
     Selects all items.
public  voidselectItem(Listitem item)
     Deselects all of the currently selected items and selects the given item.

It is the same as Listbox.setSelectedItem .
Parameters:
  item - the item to select.

public  voidsetCheckmark(boolean checkmark)
     Sets whether the check mark shall be displayed in front of each item.

The check mark is a checkbox if Listbox.isMultiple returns true.

public  voidsetDisabled(boolean disabled)
     Sets whether it is disabled.
public  voidsetInnerWidth(String innerWidth)
     Sets the inner width of this component. The inner width is the width of the inner table. By default, it is 100%.
public  voidsetItemRenderer(ListitemRenderer renderer)
     Sets the renderer which is used to render each item if Listbox.getModel is not null.
public  voidsetItemRenderer(String clsnm)
     Sets the renderer by use of a class name.
public  voidsetMaxlength(int maxlength)
     Sets the maximal length of each item's label.
public  voidsetModel(ListModel model)
     Sets the list model associated with this listbox.
public  voidsetMold(String mold)
    
public  voidsetMultiple(boolean multiple)
     Sets whether multiple selections are allowed.
public  voidsetName(String name)
     Sets the name of this component.

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.

public  voidsetOddRowSclass(String scls)
     Sets the style class for the odd rows.
public  voidsetPageSize(int pgsz)
     Sets the page size, aka., the number items per page.
public  voidsetPaginal(Paginal pgi)
    
public  voidsetPreloadSize(int sz)
     Sets the number of items to preload when receiving the rendering request from the client.

It is used only if live data ( Listbox.setModel and not paging ( Listbox.getPaging .
Parameters:
  sz - the number of items to preload.

public  voidsetRows(int rows)
     Sets the rows.
public  voidsetSelectedIndex(int jsel)
     Deselects all of the currently selected items and selects the item with the given index.
public  voidsetSelectedItem(Listitem item)
     Deselects all of the currently selected items and selects the given item.
public  voidsetSeltype(String seltype)
     Sets the seltype.
public  voidsetTabindex(int tabindex)
     Sets the tab order of this component.
public  voidsetVflex(boolean vflex)
     Sets whether to grow and shrink vertical to fit their given space, so called vertial flexibility.
public  voidsmartUpdate(String attr, String value)
    
public  voidtoggleItemSelection(Listitem item)
     If the specified item is selected, it is deselected. If it is not selected, it is selected.


Constructor Detail
Listbox
public Listbox()(Code)




Method Detail
addItemToSelection
public void addItemToSelection(Listitem item)(Code)
Selects the given item, without deselecting any other items that are already selected..



appendItem
public Listitem appendItem(String label, String value)(Code)
Appends an item.

Note: if live data is used ( Listbox.getModel is not null), the returned item might NOT be loaded yet. To ensure it is loaded, you have to invoke Listbox.renderItem .




clearSelection
public void clearSelection()(Code)
Clears the selection.



clone
public Object clone()(Code)



getHeads
public Collection getHeads()(Code)
Returns a collection of heads, including Listbox.getListhead and auxiliary heads ( Auxhead ) (never null).
since:
   3.0.0



getIndexOfItem
public int getIndexOfItem(Listitem item)(Code)
Returns the index of the specified item, or -1 if not found.



getInnerWidth
public String getInnerWidth()(Code)
Returns the inner width of this component. The inner width is the width of the inner table.

Default: "100%"
See Also:   Listbox.setInnerWidth
since:
   3.0.0




getItemAtIndex
public Listitem getItemAtIndex(int index)(Code)
Returns the item at the specified index.

Note: if live data is used ( Listbox.getModel is not null), the returned item might NOT be loaded yet. To ensure it is loaded, you have to invoke Listbox.renderItem .




getItemCount
public int getItemCount()(Code)
Returns the number of items.



getItemRenderer
public ListitemRenderer getItemRenderer()(Code)
Returns the renderer to render each item, or null if the default renderer is used.



getItems
public List getItems()(Code)
Returns a live list of all 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.



getListfoot
public Listfoot getListfoot()(Code)
Returns Listfoot belonging to this listbox, or null if no list footers at all.



getListhead
public Listhead getListhead()(Code)
Returns Listhead belonging to this listbox, or null if no list headers at all.



getMaxlength
public int getMaxlength()(Code)
Returns the maximal length of each item's label.



getModel
public ListModel getModel()(Code)
Returns the list model associated with this listbox, or null if this listbox is not associated with any list data model.



getName
public String getName()(Code)
Returns the name of this component.

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.




getOddRowSclass
public String getOddRowSclass()(Code)
Returns the style class for the odd rows.

Default: odd.
since:
   3.0.0




getOuterAttrs
public String getOuterAttrs()(Code)



getPageSize
public int getPageSize()(Code)
Returns the page size, aka., the number items per page.
exception:
  IllegalStateException - if Listbox.getPaginal returns null,i.e., mold is not "paging" and no external controller is specified.



getPaginal
public Paginal getPaginal()(Code)
Returns the paging controller, or null if not available. Note: the paging controller is used only if Listbox.getMold is "paging".

If mold is "paging", this method never returns null, because a child paging controller is created automcatically (if not specified by developers with Listbox.setPaginal ).

If a paging controller is specified (either by Listbox.setPaginal , or by Listbox.setMold with "paging"), the listbox will rely on the paging controller to handle long-content instead of scrolling.




getPaging
public Paging getPaging()(Code)
Returns the child paging controller that is created automatically, or null if mold is not "paging", or the controller is specified externally by Listbox.setPaginal .



getPreloadSize
public int getPreloadSize()(Code)
Returns the number of items to preload when receiving the rendering request from the client.

Default: 7.

It is used only if live data ( Listbox.setModel and not paging ( Listbox.getPaging .
since:
   2.4.1




getRows
public int getRows()(Code)
Returns the rows. Zero means no limitation.

Default: 0.




getSelectedCount
public int getSelectedCount()(Code)
Returns the number of items being selected.



getSelectedIndex
public int getSelectedIndex()(Code)
Returns the index of the selected item (-1 if no one is selected).



getSelectedItem
public Listitem getSelectedItem()(Code)
Returns the selected item.

Note: if live data is used ( Listbox.getModel is not null), the returned item might NOT be loaded yet. To ensure it is loaded, you have to invoke Listbox.renderItem .




getSelectedItems
public Set getSelectedItems()(Code)
Returns all selected items.

Note: if live data is used ( Listbox.getModel is not null), the returned item might NOT be loaded yet. To ensure it is loaded, you have to invoke Listbox.renderItem .




getSeltype
public String getSeltype()(Code)
Returns the seltype.

Default: "single".




getTabindex
public int getTabindex()(Code)
Returns the tab order of this component.

Currently, only the "select" mold supports this property.

Default: -1 (means the same as browser's default).




getVisibleBegin
public int getVisibleBegin()(Code)
Returns the index of the first visible child.

Used only for component development, not for application developers.




getVisibleEnd
public int getVisibleEnd()(Code)
Returns the index of the last visible child.

Used only for component development, not for application developers.




inPagingMold
boolean inPagingMold()(Code)
Returns whether this listbox is in the paging mold.



inSelectMold
final boolean inSelectMold()(Code)
Returns whether the HTML's select tag is used.



insertBefore
public boolean insertBefore(Component newChild, Component refChild)(Code)



isCheckmark
final public boolean isCheckmark()(Code)
Returns whether the check mark shall be displayed in front of each item.

Default: false.




isDisabled
final public boolean isDisabled()(Code)
Returns whether it is disabled.

Default: false.




isMultiple
public boolean isMultiple()(Code)
Returns whether multiple selections are allowed.

Default: false.




isVflex
final public boolean isVflex()(Code)
Returns whether to grow and shrink vertical to fit their given space, so called vertial flexibility.

Note: this attribute is ignored if Listbox.setRows is specified

Default: false.




newExtraCtrl
protected Object newExtraCtrl()(Code)



onChildAdded
public void onChildAdded(Component child)(Code)



onChildRemoved
public void onChildRemoved(Component child)(Code)



onInitRender
public void onInitRender()(Code)
Handles a private event, onInitRender. It is used only for implementation, and you rarely need to invoke it explicitly.



removeChild
public boolean removeChild(Component child)(Code)



removeItemAt
public Listitem removeItemAt(int index)(Code)
Removes the child item in the list box at the given index.

Note: if live data is used ( Listbox.getModel is not null), the returned item might NOT be loaded yet. To ensure it is loaded, you have to invoke Listbox.renderItem . the removed item.




removeItemFromSelection
public void removeItemFromSelection(Listitem item)(Code)
Deselects the given item without deselecting other items.



renderAll
public void renderAll()(Code)
Renders all Listitem if not loaded yet, with Listbox.getItemRenderer .
See Also:   Listbox.renderItem
See Also:   Listbox.renderItems



renderItem
public Listitem renderItem(Listitem li)(Code)
Renders the specified Listitem if not loaded yet, with Listbox.getItemRenderer .

It does nothing if Listbox.getModel returns null. In other words, it is meaningful only if live data model is used.
See Also:   Listbox.renderItems
See Also:   Listbox.renderAll the list item being passed to this method




renderItems
public void renderItems(Set items)(Code)



selectAll
public void selectAll()(Code)
Selects all items.



selectItem
public void selectItem(Listitem item)(Code)
Deselects all of the currently selected items and selects the given item.

It is the same as Listbox.setSelectedItem .
Parameters:
  item - the item to select. If null, all items are deselected.




setCheckmark
public void setCheckmark(boolean checkmark)(Code)
Sets whether the check mark shall be displayed in front of each item.

The check mark is a checkbox if Listbox.isMultiple returns true. It is a radio button if Listbox.isMultiple returns false.




setDisabled
public void setDisabled(boolean disabled)(Code)
Sets whether it is disabled.



setInnerWidth
public void setInnerWidth(String innerWidth)(Code)
Sets the inner width of this component. The inner width is the width of the inner table. By default, it is 100%. That is, it is the same as the width of this component. However, it is changed when the user is sizing the column's width.

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 ( Listbox.getInnerWidth ), and then restore them when re-creating this component.
Parameters:
  innerWidth - the inner width. If null, "100%" is assumed.
since:
   3.0.0




setItemRenderer
public void setItemRenderer(ListitemRenderer renderer)(Code)
Sets the renderer which is used to render each item if Listbox.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.
Parameters:
  renderer - the renderer, or null to use the default.
exception:
  UiException - if failed to initialize with the model




setItemRenderer
public void setItemRenderer(String clsnm) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, java.lang.reflect.InvocationTargetException(Code)
Sets the renderer by use of a class name. It creates an instance automatically.



setMaxlength
public void setMaxlength(int maxlength)(Code)
Sets the maximal length of each item's label.



setModel
public void setModel(ListModel model)(Code)
Sets the list model associated with this listbox. If a non-null model is assigned, no matter whether it is the same as the previous, it will always cause re-render.
Parameters:
  model - the list model to associate, or null to dis-associateany previous model.
exception:
  UiException - if failed to initialize with the model



setMold
public void setMold(String mold)(Code)



setMultiple
public void setMultiple(boolean multiple)(Code)
Sets whether multiple selections are allowed.



setName
public void setName(String name)(Code)
Sets the name of this component.

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.
Parameters:
  name - the name of this component.




setOddRowSclass
public void setOddRowSclass(String scls)(Code)
Sets the style class for the odd rows. If the style class doesn't exist, the striping effect disappears. You can provide different effects by providing the proper style classes.
since:
   3.0.0



setPageSize
public void setPageSize(int pgsz)(Code)
Sets the page size, aka., the number items per page.
exception:
  IllegalStateException - if Listbox.getPaginal returns null,i.e., mold is not "paging" and no external controller is specified.



setPaginal
public void setPaginal(Paginal pgi)(Code)



setPreloadSize
public void setPreloadSize(int sz)(Code)
Sets the number of items to preload when receiving the rendering request from the client.

It is used only if live data ( Listbox.setModel and not paging ( Listbox.getPaging .
Parameters:
  sz - the number of items to preload. If zero, no preloadat all.
exception:
  UiException - if sz is negative
since:
   2.4.1




setRows
public void setRows(int rows) throws WrongValueException(Code)
Sets the rows.

Note: if both Listbox.setHeight is specified with non-empty, Listbox.setRows is ignored




setSelectedIndex
public void setSelectedIndex(int jsel)(Code)
Deselects all of the currently selected items and selects the item with the given index.



setSelectedItem
public void setSelectedItem(Listitem item)(Code)
Deselects all of the currently selected items and selects the given item.

It is the same as Listbox.selectItem .




setSeltype
public void setSeltype(String seltype) throws WrongValueException(Code)
Sets the seltype.



setTabindex
public void setTabindex(int tabindex) throws WrongValueException(Code)
Sets the tab order of this component.

Currently, only the "select" mold supports this property.




setVflex
public void setVflex(boolean vflex)(Code)
Sets whether to grow and shrink vertical to fit their given space, so called vertial flexibility.

Note: this attribute is ignored if Listbox.setRows is specified




smartUpdate
public void smartUpdate(String attr, String value)(Code)



toggleItemSelection
public void toggleItemSelection(Listitem item)(Code)
If the specified item is selected, it is deselected. If it is not selected, it is selected. Other items in the list box that are selected are not affected, and retain their selected state.



Methods inherited from org.zkoss.zul.impl.XulElement
public String getAction()(Code)(Java Doc)
public String getActionAttrs()(Code)(Java Doc)
protected String getAllOnClickAttrs(boolean ignoreOnClick)(Code)(Java Doc)
public String getContext()(Code)(Java Doc)
public String getInnerAttrs()(Code)(Java Doc)
public String getOuterAttrs()(Code)(Java Doc)
public String getPopup()(Code)(Java Doc)
public String getTooltip()(Code)(Java Doc)
public void setAction(String action)(Code)(Java Doc)
public void setContext(String context)(Code)(Java Doc)
public void setContext(Popup popup)(Code)(Java Doc)
public void setPopup(String popup)(Code)(Java Doc)
public void setPopup(Popup popup)(Code)(Java Doc)
public void setTooltip(String tooltip)(Code)(Java Doc)
public void setTooltip(Popup popup)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.