You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yeargan Yancey <ya...@unt.edu> on 2009/04/18 21:48:03 UTC

Custom Property Editor for String Array

Before I go banging my head against a wall for too long, is it  
possible to create a custom property editor to handle a complex (multi- 
valued) property?

I am working with a directory services database via LDAP and it would  
be extremely helpful if I can mange to enhance BeanEditForm and  
BeanDisplay to handle LDAP entries where a property (LDAP attribute)  
may have multiple values.

To be more specific, I want to create a property editor for the  
String[] type. At the moment, I just want to display String[]  
properties using the BeanDisplay component, but I can already foresee  
a need to be able to fully edit a String[] property (including  
adding / removing values from the array, using AJAX to add/remove  
fields to the form).

Yancey


Re: Custom Property Editor for String Array

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Mon, 20 Apr 2009 00:35:43 -0300, Yancey Yeargan <ya...@unt.edu>  
escreveu:

> For my application, I will need to allow users to enter their own
> (essentially random) e-mail addresses. The Palette component seems to
> require a pre-defined set of available options, which unfortunately
> does not meet my particular requirement. So I will continue work on my
> own custom property editor.

In this case, Tapestry does not have such a component. I guess you can  
implement it with a little of Javascript, something Prototype will help.

> I discovered that the BeanEditForm guide page almost completely
> neglects to discuss PropertyEditContext objects, knowledge of which
> seem rather critical to fully understanding how to create a custom
> property editor.

You're right. Please file a JIRA for a documentation improvement. ;)

> I believe I now have the general idea and will start working out the
> details by experimenting in code.I may yet have questions, but at
> least I know where I'm headed now.  Many thanks for pointing me in the
> correct direction.

You're welcome!

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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


Re: Custom Property Editor for String Array

Posted by Yancey Yeargan <ya...@unt.edu>.
For my application, I will need to allow users to enter their own  
(essentially random) e-mail addresses. The Palette component seems to  
require a pre-defined set of available options, which unfortunately  
does not meet my particular requirement. So I will continue work on my  
own custom property editor.

I discovered that the BeanEditForm guide page almost completely  
neglects to discuss PropertyEditContext objects, knowledge of which  
seem rather critical to fully understanding how to create a custom  
property editor. I found some discussion of PropertyEditContext at the  
following wiki topic.

http://wiki.apache.org/tapestry/Tapestry5HowToCreateAPropertyEditBlock

I believe I now have the general idea and will start working out the  
details by experimenting in code.I may yet have questions, but at  
least I know where I'm headed now.  Many thanks for pointing me in the  
correct direction.

Yancey




On Apr 18, 2009, at 9:27 PM, Thiago H. de Paula Figueiredo wrote:

> Em Sat, 18 Apr 2009 16:48:03 -0300, Yeargan Yancey <ya...@unt.edu>
> escreveu:
>
>> Before I go banging my head against a wall for too long, is it
>> possible to create a custom property editor to handle a complex  
>> (multi-
>> valued) property?
>
> Yes! :) There's a guide here:
> http://tapestry.apache.org/tapestry5/guide/beaneditform.html. If it  
> is not
> enough, post yourr doubts here and we'll try to help you. ;)
>
>> I am working with a directory services database via LDAP and it would
>> be extremely helpful if I can mange to enhance BeanEditForm and
>> BeanDisplay to handle LDAP entries where a property (LDAP attribute)
>> may have multiple values.
>>
>> To be more specific, I want to create a property editor for the
>> String[] type. At the moment, I just want to display String[]
>> properties using the BeanDisplay component, but I can already foresee
>> a need to be able to fully edit a String[] property (including
>> adding / removing values from the array, using AJAX to add/remove
>> fields to the form).
>
> Have you taken a look at the Palette component? It looks like it it
> already implements what you need:
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Palette.html 
> .
> It, together with a custom DataTypeAnalyzer, one view block (for
> BeanDisplay) and one edit block (for BeanEditForm/BeanEditor). The
> BeanEditForm guide previously mentioned tells you how to do it.
>
> -- 
> Thiago H. de Paula Figueiredo
> Independent Java consultant, developer, and instructor
> http://www.arsmachina.com.br/thiago
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: Custom Property Editor for String Array

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Sat, 18 Apr 2009 16:48:03 -0300, Yeargan Yancey <ya...@unt.edu>  
escreveu:

> Before I go banging my head against a wall for too long, is it
> possible to create a custom property editor to handle a complex (multi-
> valued) property?

Yes! :) There's a guide here:  
http://tapestry.apache.org/tapestry5/guide/beaneditform.html. If it is not  
enough, post yourr doubts here and we'll try to help you. ;)

> I am working with a directory services database via LDAP and it would
> be extremely helpful if I can mange to enhance BeanEditForm and
> BeanDisplay to handle LDAP entries where a property (LDAP attribute)
> may have multiple values.
>
> To be more specific, I want to create a property editor for the
> String[] type. At the moment, I just want to display String[]
> properties using the BeanDisplay component, but I can already foresee
> a need to be able to fully edit a String[] property (including
> adding / removing values from the array, using AJAX to add/remove
> fields to the form).

Have you taken a look at the Palette component? It looks like it it  
already implements what you need:  
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Palette.html.  
It, together with a custom DataTypeAnalyzer, one view block (for  
BeanDisplay) and one edit block (for BeanEditForm/BeanEditor). The  
BeanEditForm guide previously mentioned tells you how to do it.

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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