Re: An Apache Wicket reusable Data List

andrew goh <gohandrew-/[email protected]> Thu, 24 Apr 2025 00:41:10 +0800
Newsgroups gmane.comp.java.wicket.devel,gmane.comp.version-control.subversion.user
Message-ID <c411b004-a6ad-feae-db11-2adfddc838d0__44654.9646834441$1745426524$gmane$org@yahoo.com>
It turns out RepeatingView component works in Forms as well

https://nightlies.apache.org/wicket/guide/9.x/single.html#_the_repeatingview_component

And I've been able to make a reusable form given a java bean and its 
customized BeanInfo class.
The BeanInfo serves as 'configuration metadata' to configure the 
rendering and setup of the form and fields.


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 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
>
>