Java Doc for ListView.java in  » J2EE » wicket » wicket » markup » html » list » 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 » J2EE » wicket » wicket.markup.html.list 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


wicket.markup.html.WebMarkupContainer
   wicket.markup.html.list.ListView

All known Subclasses:   wicket.examples.displaytag.utils.SimpleListView,  wicket.markup.html.list.PropertyListView,  wicket.markup.MyTable,  wicket.examples.displaytag.utils.ListViewWithAlternatingRowStyle,  wicket.markup.html.list.PageableListView,
ListView
abstract public class ListView extends WebMarkupContainer (Code)
A ListView holds ListItem children. Items can be re-ordered and deleted, either one at a time or many at a time.

Example:

 <tbody>
 <tr wicket:id="rows" class="even">
 <td><span wicket:id="id">Test ID</span></td>
 ...    
 

Though this example is about a HTML table, ListView is not at all limited to HTML tables. Any kind of list can be rendered using ListView.

The related Java code:

 add(new ListView("rows", listData)
 {
 public void populateItem(final ListItem item)
 {
 final UserDetails user = (UserDetails)item.getModelObject();
 item.add(new Label("id", user.getId()));
 }
 });
 

WARNING: though you can nest ListViews within Forms, you HAVE to set the optimizeItemRemoval property to true in order to have validation work properly. By default, optimizeItemRemoval is false, which has the effect that ListView replaces all child components by new instances. The idea behind this is that you always render the fresh data, and as people usually use ListViews for displaying read-only lists (at least, that's what we think), this is good default behavior.
However, as the components are replaced before the rendering starts, the search for specific messages for these components fails as they are replaced with other instances. Another problem is that 'wrong' user input is kept as (temporary) instance data of the components. As these components are replaced by new ones, your user will never see the wrong data when optimizeItemRemoval is false.


author:
   Jonathan Locke
author:
   Juergen Donnerstag
author:
   Johan Compagner
author:
   Eelco Hillenius



Constructor Summary
public  ListView(String id)
    
public  ListView(String id, IModel model)
    
public  ListView(String id, List list)
    

Method Summary
final public  ListgetList()
     Gets the list of items in the listView.
protected  IModelgetListItemModel(IModel listViewModel, int index)
     Subclasses may provide their own ListItemModel with extended functionality.
public  booleangetOptimizeItemRemoval()
     If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems.
public  booleangetReuseItems()
     If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems.
final public  intgetStartIndex()
     Get index of first cell in page.
public  intgetViewSize()
     Based on the model object's list size, firstIndex and view size, determine what the view size really will be.
protected  voidinternalOnAttach()
    
final public  LinkmoveDownLink(String id, ListItem item)
     Returns a link that will move the given item "down" (towards the end) in the listView.
final public  LinkmoveUpLink(String id, ListItem item)
     Returns a link that will move the given item "up" (towards the beginning) in the listView.
protected  ListItemnewItem(int index)
     Create a new ListItem for list item at index.
protected  voidonBeginPopulateItem(ListItem item)
     Comes handy for ready made ListView based components which must implement populateItem() but you don't want to lose compile time error checking reminding the user to implement abstract populateItem().
protected  voidonRender(MarkupStream markupStream)
    
abstract protected  voidpopulateItem(ListItem item)
     Populate a given item.

be carefull to add any components to the list item.

final public  LinkremoveLink(String id, ListItem item)
     Returns a link that will remove this ListItem from the ListView that holds it.
protected  voidrenderItem(ListItem item)
     Render a single item.
public  ComponentsetList(List list)
     Sets the model as the provided list and removes all children, so that the next render will be using the contents of the model.
Parameters:
  list - The list for the new model.
public  ComponentsetModel(IModel model)
     Sets the model and removes all current children, so that the next render will be using the contents of the model.
public  ListViewsetOptimizeItemRemoval(boolean reuseItems)
     If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems.
public  ListViewsetReuseItems(boolean reuseItems)
     If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems.
public  ListViewsetStartIndex(int startIndex)
    
public  ListViewsetViewSize(int size)
     Define the maximum number of items to render.


Constructor Detail
ListView
public ListView(String id)(Code)

See Also:   wicket.Component.Component(String)



ListView
public ListView(String id, IModel model)(Code)

See Also:   wicket.Component.Component(StringIModel)



ListView
public ListView(String id, List list)(Code)

Parameters:
  id - See Component
Parameters:
  list - List to cast to Serializable
See Also:   wicket.Component.Component(StringIModel)




Method Detail
getList
final public List getList()(Code)
Gets the list of items in the listView. This method is final because it is not designed to be overridden. If it were allowed to be overridden, the values returned by getModelObject() and getList() might not coincide. The list of items in this list view.



getListItemModel
protected IModel getListItemModel(IModel listViewModel, int index)(Code)
Subclasses may provide their own ListItemModel with extended functionality. The default ListItemModel works fine with mostly static lists where index remains valid. In cases where the underlying list changes a lot (many users using the application), it may not longer be appropriate. In that case your own ListItemModel implementation should use an id (e.g. the database' record id) to identify and load the list item model object.
Parameters:
  listViewModel - The ListView's model
Parameters:
  index - The list item index The ListItemModel created



getOptimizeItemRemoval
public boolean getOptimizeItemRemoval()(Code)
If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems. If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly. Whether to reuse itemsListView.getReuseItems()



getReuseItems
public boolean getReuseItems()(Code)
If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems. If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly. Whether to reuse items



getStartIndex
final public int getStartIndex()(Code)
Get index of first cell in page. Default is: 0. Index of first cell in page. Default is: 0



getViewSize
public int getViewSize()(Code)
Based on the model object's list size, firstIndex and view size, determine what the view size really will be. E.g. default for viewSize is Integer.MAX_VALUE, if not set via setViewSize(). If the underlying list has 10 elements, the value returned by getViewSize() will be 10 if startIndex = 0. The number of items to be populated and rendered.



internalOnAttach
protected void internalOnAttach()(Code)

See Also:   wicket.MarkupContainer.internalOnAttach



moveDownLink
final public Link moveDownLink(String id, ListItem item)(Code)
Returns a link that will move the given item "down" (towards the end) in the listView.
Parameters:
  id - Name of move-down link component to create
Parameters:
  item - The link component



moveUpLink
final public Link moveUpLink(String id, ListItem item)(Code)
Returns a link that will move the given item "up" (towards the beginning) in the listView.
Parameters:
  id - Name of move-up link component to create
Parameters:
  item - The link component



newItem
protected ListItem newItem(int index)(Code)
Create a new ListItem for list item at index.
Parameters:
  index - ListItem



onBeginPopulateItem
protected void onBeginPopulateItem(ListItem item)(Code)
Comes handy for ready made ListView based components which must implement populateItem() but you don't want to lose compile time error checking reminding the user to implement abstract populateItem().
Parameters:
  item -



onRender
protected void onRender(MarkupStream markupStream)(Code)

See Also:   wicket.Component.onRender(wicket.markup.MarkupStream)



populateItem
abstract protected void populateItem(ListItem item)(Code)
Populate a given item.

be carefull to add any components to the list item. So, don't do:

 add(new Label("foo", "bar"));
 
but:
 item.add(new Label("foo", "bar"));
 


Parameters:
  item - The item to populate



removeLink
final public Link removeLink(String id, ListItem item)(Code)
Returns a link that will remove this ListItem from the ListView that holds it.
Parameters:
  id - Name of remove link component to create
Parameters:
  item - The link component



renderItem
protected void renderItem(ListItem item)(Code)
Render a single item.
Parameters:
  item - The item to be rendered



setList
public Component setList(List list)(Code)
Sets the model as the provided list and removes all children, so that the next render will be using the contents of the model.
Parameters:
  list - The list for the new model. The list must implementSerializable. This for chaining



setModel
public Component setModel(IModel model)(Code)
Sets the model and removes all current children, so that the next render will be using the contents of the model.
Parameters:
  model - The new model This for chaining
See Also:   wicket.MarkupContainer.setModel(wicket.model.IModel)



setOptimizeItemRemoval
public ListView setOptimizeItemRemoval(boolean reuseItems)(Code)
If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems. If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly.
Parameters:
  reuseItems - Whether to reuse items thisListView.setReuseItems(boolean)



setReuseItems
public ListView setReuseItems(boolean reuseItems)(Code)
If true re-rendering the list view is more efficient if the windows doesn't get changed at all or if it gets scrolled (compared to paging). But if you modify the listView model object, than you must manually call listView.removeAll() in order to rebuild the ListItems. If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly.
Parameters:
  reuseItems - Whether to reuse the child items. this



setStartIndex
public ListView setStartIndex(int startIndex)(Code)
Set the index of the first item to render
Parameters:
  startIndex - First index of model object's list to display This



setViewSize
public ListView setViewSize(int size)(Code)
Define the maximum number of items to render. Default: render all.
Parameters:
  size - Number of items to display This



Methods inherited from wicket.markup.html.WebMarkupContainer
final public String getMarkupType()(Code)(Java Doc)
final public WebPage getWebPage()(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.