First look at the Repeatingview:
Html:
<tr wicket:id= "Repeating" > <td><span wicket:id= "Actions" >[actions]</span></td> <td><span wicket:id= "ContactID" >[contactid]</span> </td> <td><span wicket:id= "fir Stname ">[firstname]</span></td> <td><span wicket:id=" LastName ">[lastname]</span ></td> <td><span wicket:id= "HomePhone" >[homephone]</span></td> <TD>&L T;span wicket:id= "Cellphone" >[cellphone]</span></td> </tr>
Java:
RepeatingView repeating = new Repeatingview ("repeating"); add (repeating); int index = 0; while (Contacts.hasnext ()) { abstractitem item = new abstractitem ( Repeating.newchildid ()); repeating.add ( Item); contact contact = contacts.next (); item.add (new actionpanel ("Actions", new detachablecontactmodel (Contact))); item.add(New label ("ContactID", string.valueof (Contact.getid ()))); item.add (New label ("FirstName", contact.getfirstname ())); item.add (New label ("LastName", Contact.getlastname ())); item.add (new label ("HomePhone", contact.gethomephone ())); item.add (New label ("Cellphone", contact.getcellphone ())); .....
If it is a regular component, it should be repeating.add (XXX), but the repeating component is the most obvious difference by creating a new item and adding subcomponents from the template to the item. At the same time, this item represents a peripheral component that you can add properties to, modify properties, and so on.
Refreshingview:
<tr wicket:id= "View" >&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;<TD ><span wicket:id= "Itemid" >[item id]</span></td> <td><span wicket:id= "Actions" >[actions]</span></td> <td><span wicket:id= "ContactID" >[contactid]</span> </td> <td><span wicket:id= "FirstName" >[firstname]</span></td> <td><span wicket:id= "LastName" >[lastname]</span></td> <td><span wicket:id= "HomePhone" >[homephone]</span></td> <td><span wicket:id= "Cellphone" >[cellphone]</span></td > &nBsp;</tr>
RefreshingView<Contact> view = new RefreshingView<Contact> ("View") { private static final long serialVersionUID = 1L; /** * return an iterator over models for items in the view */ @Override protected Iterator<IModel<Contact>> Getitemmodels () { &Nbsp; return contacts.iterator (); } @ override protected void Populateitem (Final item<contact> item) { contact contact = item.getmodelobject (); item.add (New label ("Itemid", item.getid ())); item.add (new Actionpanel ("Actions", item.getmodel ())); &nbsP;item.add (New label ("ContactID", string.valueof (Contact.getid ()))); item.add (New label ("FirstName", Contact.getfirstname ())); item.add (New label ("LastName", contact.getlastname ())); item.add (New label ("HomePhone", Contact.gethomephone ())); item.add (New label ("Cellphone", contact.getcellphone ())); item.add (Attributemodifier.replace ("Class", new AbstractReadOnlyModel<String> () { private static final long serialVersionUID = 1L; @Override public string getobject () { return (Item.getindex () % 2 == 1) ? "even" : "odd"; } })); } };
Visible Refreshingview look more modular, more oo, beyond that, I do not see what the difference.
Next comes the DataView,
DataView is a basic implementation of Abstractpageableview. Data views Aim-make it very-populate your repeating view from a database by utilizing idataprovider to act as An interface between the database and the DataView.
DataView is the end of this class of branching, and the controllability and encapsulation are the appropriate implementations.
DataView above is Dataviewbase, under which the class branches are:
Gridview,datagridview, the convenience of these two classes increased, controllability decreased.
<table cellspacing= "0" cellpadding= "2" border= "1" > <tr wicket:id= "Rows" > <td wicket:id= "Cells" > <span wicket:id= "Cell" >cell content goes here</span> </td> </tr></table>
public datagridpage () { List<ICellPopulator<Contact>> columns = new ArrayList< Icellpopulator<contact>> (); columns.add (new Propertypopulator<contact> ("id")); columns.add (new Propertypopulator<contact> ("FirstName")); columns.add (new PropertyPopulator<Contact> ("LastName"); Columns.Add (new propertypopulator<contact> ("HomePhone")); columns.add (new propertypopulator<contact> ("CellPhone")); add (new datagridview<contact> ("Rows", columns, new Sortablecontactdataprovider ())); }
The latter two may be more suitable for the presence of the data, without the need for interaction. At the same time more light weight.
Wicket's Repeatingview