Re: An Apache Wicket reusable Data List

andrew goh <gohandrew-/[email protected]> Wed, 16 Apr 2025 18:18:27 +0800
Newsgroups gmane.comp.java.wicket.devel,gmane.comp.jakarta.avalon.user
Message-ID <625b62b3-0cad-d4c0-040e-e976ed182c98__4061.99061996944$1744798802$gmane$org@yahoo.com>
The codes is committed in part of a demo here as well:

https://github.com/ag88/wickettest1

On 16/04/2025 17:25, andrew goh wrote:
> While I'm learning the ropes of Apache Wicket currently and I'm 
> exploring making reusable components.
>
> I tried making An Apache Wicket reusable Data List
>
> This component displays a list of JavaBeans as a html table
>
> DataListPanel takes as input in the constructor :
>
> the wicket:id of the component
> itemclass The java class of the JavaBean
> List items the list of JavaBeans
>
> https://gist.github.com/ag88/a0232510c28b4c45b82943527b7ea87e
>
> This version is pretty rough as I'm trying out as a 'proof of concept' 
> test.
> it actually works, rendering the list of JavaBeans as a html table.
>
> I used an often 'neglected' java package java.beans, technology Javabeans
> https://en.wikipedia.org/wiki/JavaBeans
> https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/ 
>
> practically as 'old' as Java itself.
>
> It is probably quite interesting as many database interfaces basically 
> use JavaBeans to represent the records and as well used in forms.
> This practically makes the task of displaying records in a (html) 
> table done using a reusable component.
>
> It is likely possible to implement similar setup say with 
> spring-framework, spring-boot and templates, but that Apache Wicket 
> makes the codes and templates very concise.
> The magic is implemented by the repeating views
> https://nightlies.apache.org/wicket/guide/9.x/single.html#_the_repeatingview_component 
>
> and java.beans itself which I get the 'field' (beaninfo) names and 
> java reflection retrieval.
>
> I think it is likely feasible to implement such reusable pages as form 
> components too, i.e. give a form a JavaBean it renders it and 
> handles/process it with database CRUD and all.
>
> Cheers,
>   Andrew
>
>