You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thilo Tanner <th...@reprisk.com> on 2015/01/12 12:46:12 UTC

[T5.4] Dynamic Forms

Hi all,

I'm currently working on a report generation tool (using JasperReports in the background). The reports will consist of multiple components. Beside having "static" parameters, I will need runtime parameters shared across the different components. The challenge I'm facing now, is to create a dynamic form for this runtime parameters. I imagine to have a Map<String, Class> or a similar construct calculated from the from the different components. For example, the Map could look this:

"title" => java.lang.String
"date" => java.util.Date
"companies" => java.util.List<Company>​
...

Is it possible to generate a dynamic form containing each of the parameters by loading a form fragment based on the given type?
Can I use the Dynamic component for it and if yes how (unfortunately, I couldn't find an example)?

http://tapestry.apache.org/5.3/apidocs/org/apache/tapestry5/corelib/components/Dynamic.html

All inputs are appreciated!

Thanks a lot and best,
Thilo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org

Re: [T5.4] Dynamic Forms

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 12 Jan 2015 11:49:35 -0200, Thilo Tanner  
<th...@reprisk.com> wrote:

> Hi Thiago,

Hi!

> Thanks a lot for your prompt feedback! I will try to use the BeanEditor  
> by contributing new property editors. :)

;)

> I also thought about looping through the map entries and use the  
> delegate component for the different field types.

BeanEditor does that, so I don't think there's any need for you to  
reimplement that. :)

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] Dynamic Forms

Posted by Thilo Tanner <th...@reprisk.com>.
Hi Thiago,

Thanks a lot for your prompt feedback! I will try to use the BeanEditor by contributing new property editors. I also thought about looping through the map entries and use the delegate component for the different field types. Let's see.

Best,
Thilo

--

Thilo Tanner
IT Development Lead

Direct +41 43 300 54 42
Mobile +41 79 506 46 36
thilo.tanner@reprisk.com

RepRisk AG, Stampfenbachstrasse 42, 8006 Zurich, Switzerland
Tel. +41 43 300 54 40, Fax +41 43 300 54 46
www.reprisk.com

Follow us on Facebook or Twitter:
www.facebook.com/RepRisk    |    www.twitter.com/RepRisk

If you are not the intended recipient, please notify the sender - thank you.

________________________________________
From: Thiago H de Paula Figueiredo <th...@gmail.com>
Sent: Monday, January 12, 2015 13:56
To: Tapestry users
Subject: Re: [T5.4] Dynamic Forms

On Mon, 12 Jan 2015 09:46:12 -0200, Thilo Tanner
<th...@reprisk.com> wrote:

> Is it possible to generate a dynamic form containing each of the
> parameters by loading a form fragment based on the given type?

BeanEditor/BeanEditModel already do that. See section Adding New Property
Editors in http://tapestry.apache.org/beaneditform-guide.html. Any further
questions, just ask. :)

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] Dynamic Forms

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 12 Jan 2015 09:46:12 -0200, Thilo Tanner  
<th...@reprisk.com> wrote:

> Is it possible to generate a dynamic form containing each of the  
> parameters by loading a form fragment based on the given type?

BeanEditor/BeanEditModel already do that. See section Adding New Property  
Editors in http://tapestry.apache.org/beaneditform-guide.html. Any further  
questions, just ask. :)

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: [T5.4] Dynamic Forms

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 12 Jan 2015 09:46:12 -0200, Thilo Tanner  
<th...@reprisk.com> wrote:

> Hi all,

Hi!

> I'm currently working on a report generation tool (using JasperReports  
> in the background). The reports will consist of multiple components.  
> Beside having "static" parameters, I will need runtime parameters shared  
> across the different components. The challenge I'm facing now, is to  
> create a dynamic form for this runtime parameters. I imagine to have a  
> Map<String, Class> or a similar construct calculated from the from the  
> different components. For example, the Map could look this:
>
> "title" => java.lang.String
> "date" => java.util.Date
> "companies" => java.util.List<Company>​

I think BeanEditor/BeanEditForm with BeanModel and one or more  
custom-written PropertyConduits is the way to go. BeanEditor already  
creates form fields dinamycally. In this case, the values you need to edit  
don't come from Java properties, so create a BeanModel using  
BeanModelSource and use BeanModel.add(String propertyName, PropertyConduit  
conduit) to add your Map-backed properties. PropertyModel is in interface  
used by BeanModel to get and set value.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org