Re: [T5] Select component: howto create a SelectModel out of ListString

2008-09-26 Thread Filip S. Adamsen

Hi,

Just implement org.apache.tapestry5.SelectModel. You can extend 
org.apache.tapestry5.util.AbstractSelectModel when you do.


-Filip

On 2008-09-26 12:20, Andy Pahne wrote:


I have a simple list of Strings that should be the source of a 
SelectModel. How do I create one?


I had a look at
   http://wiki.apache.org/tapestry/Tapestry5SelectObject
but it's outdated (before the T5 package name refactoring) and just 
looks to complicated for my simple purpose. Also I am not a great fan of 
forking core lib components and keeping them in touch with the current 
development.


There must be an easier way, I think.


Andy


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Select component: howto create a SelectModel out of ListString

2008-09-26 Thread Ulrich Stärk
If you want to use it with the select component then there is no need to
write your own selectmodel. Just provide an array of strings to the model
parameter, e.g. t:select model=literal:foo,bar,baz... or t:select
model=strings... where strings is an array or list in your page class.

Uli

Am Fr, 26.09.2008, 12:32, schrieb Filip S. Adamsen:
 Hi,

 Just implement org.apache.tapestry5.SelectModel. You can extend
 org.apache.tapestry5.util.AbstractSelectModel when you do.

 -Filip

 On 2008-09-26 12:20, Andy Pahne wrote:

 I have a simple list of Strings that should be the source of a
 SelectModel. How do I create one?

 I had a look at
http://wiki.apache.org/tapestry/Tapestry5SelectObject
 but it's outdated (before the T5 package name refactoring) and just
 looks to complicated for my simple purpose. Also I am not a great fan of
 forking core lib components and keeping them in touch with the current
 development.

 There must be an easier way, I think.


 Andy


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Select component: howto create a SelectModel out of ListString

2008-09-26 Thread Andy Pahne

Ulrich Stärk schrieb:

If you want to use it with the select component then there is no need to
write your own selectmodel. Just provide an array of strings to the model
parameter, e.g. t:select model=literal:foo,bar,baz... or t:select
model=strings... where strings is an array or list in your page class.

Uli




That's the easier way I thought of, thanks. I was tricked by the 
component reference, which states that the type of the parameter is 
SelectModel.


Andy

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Select component: howto create a SelectModel out of ListString

2008-09-26 Thread Thiago H. de Paula Figueiredo

Em Fri, 26 Sep 2008 08:35:11 -0300, Andy Pahne [EMAIL PROTECTED] escreveu:

That's the easier way I thought of, thanks. I was tricked by the  
component reference, which states that the type of the parameter is  
SelectModel.


The parameter type *is* SelectModel, but Tapestry has coercions:  
conversions from one type to another. There must be a String -  
SelectModel coercer somewhere in Tapestry's code.


That's the same case with Grid's source parameter: its type is  
GridDataSource, but you can pass a List to it. ;)


Thiago

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Select component + onchange()

2008-04-25 Thread Geoff Callender
It seems to me that Zones would make it very simple.  Perhaps you  
would like to vote for this issue:


Add Zone parameter to Select component
https://issues.apache.org/jira/browse/TAPESTRY-2361

Cheers,

Geoff
http://files.doublenegative.com.au/jumpstart/

On 25/04/2008, at 12:04 AM, Marcelo Lotif wrote:

Yeah, i know this, but none of these responses suit to my needs  
(maybe a
Page response, but this will force a reload)... i tried to return a  
block
with the part of the code that i was trying to change, but i had no  
success


And i don't have the enough knowledge of the JSON api and  
javascript...


So i'm using the onchange='this.form.submit()'...

=)

2008/4/24 Sven Homburg [EMAIL PROTECTED]:


the JSONObject/JSONArray response too

2008/4/24, Sven Homburg [EMAIL PROTECTED]:


the return type is not limited to StreamResponse.
all you can respond all that tapestry allowes here
http://tapestry.apache.org/tapestry5/tapestry-core/guide/ 
pagenav.html

its up to you

2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:


I had the same issue as Leon some days ago (and this seems to be  
a very
common issue), and i tried your component. It's very good, with  
some

ajax,
but the return type is a little bit limited for what i was trying  
to
achieve(update a combo with information from another combo, which  
has

your
mixin). The only way to do it was hardcoding the select in my  
java(or

javascript, whatever), that was too creepy for me.

My questions:
1 - Is there any way of change my page data with something more

elaborate

than TextStreamResponse?
1 - Is there any efforts on adding some similar behavior to future
releases?

Thank you!

2008/4/24 Sven Homburg [EMAIL PROTECTED]:



try this





http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html


2008/4/24, Leon Derks [EMAIL PROTECTED]:


Hello

Is it possible to catch the onChange event from a select  
component

in

the

java  page?

I would expect something like: onChangeFromSelect(long id) {}

Because I want to update information on my page, based on the  
value

that

is

selected.

How can I do that?

Leon




-

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com






--
Atenciosamente,

Marcelo Lotif





--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com





--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com





--
Atenciosamente,
Marcelo Lotif




Re: T5: Select component + onchange()

2008-04-25 Thread Marcelo Lotif
hmmm, I thought about it earlier, but i did not search for a JIRA... this
would be really nice!

and nice piece of code Sven, I'll try to get this working and take off the
workaround with submit...

2008/4/25 Geoff Callender [EMAIL PROTECTED]:

 It seems to me that Zones would make it very simple.  Perhaps you would
 like to vote for this issue:

Add Zone parameter to Select component
https://issues.apache.org/jira/browse/TAPESTRY-2361

 Cheers,

 Geoff
 http://files.doublenegative.com.au/jumpstart/


 On 25/04/2008, at 12:04 AM, Marcelo Lotif wrote:

  Yeah, i know this, but none of these responses suit to my needs (maybe a
 Page response, but this will force a reload)... i tried to return a block
 with the part of the code that i was trying to change, but i had no
 success

 And i don't have the enough knowledge of the JSON api and javascript...

 So i'm using the onchange='this.form.submit()'...

 =)

 2008/4/24 Sven Homburg [EMAIL PROTECTED]:

  the JSONObject/JSONArray response too

 2008/4/24, Sven Homburg [EMAIL PROTECTED]:


 the return type is not limited to StreamResponse.
 all you can respond all that tapestry allowes here
 http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
 its up to you

 2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:


 I had the same issue as Leon some days ago (and this seems to be a very
 common issue), and i tried your component. It's very good, with some

 ajax,

 but the return type is a little bit limited for what i was trying to
 achieve(update a combo with information from another combo, which has

 your

 mixin). The only way to do it was hardcoding the select in my java(or
 javascript, whatever), that was too creepy for me.

 My questions:
 1 - Is there any way of change my page data with something more

 elaborate

 than TextStreamResponse?
 1 - Is there any efforts on adding some similar behavior to future
 releases?

 Thank you!

 2008/4/24 Sven Homburg [EMAIL PROTECTED]:


  try this




 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html


 2008/4/24, Leon Derks [EMAIL PROTECTED]:


 Hello

 Is it possible to catch the onChange event from a select component

 in

 the

 java  page?

 I would expect something like: onChangeFromSelect(long id) {}

 Because I want to update information on my page, based on the value

 that

 is

 selected.

 How can I do that?

 Leon



 -

 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com





 --
 Atenciosamente,

 Marcelo Lotif




 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com




 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com




 --
 Atenciosamente,
 Marcelo Lotif





-- 
Atenciosamente,
Marcelo Lotif


Re: T5: Select component + onchange()

2008-04-24 Thread Sven Homburg
try this
http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html

2008/4/24, Leon Derks [EMAIL PROTECTED]:

 Hello

 Is it possible to catch the onChange event from a select component in the
 java  page?

 I would expect something like: onChangeFromSelect(long id) {}

 Because I want to update information on my page, based on the value that is
 selected.

 How can I do that?

 Leon


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com


Re: T5: Select component + onchange()

2008-04-24 Thread Marcelo Lotif
I had the same issue as Leon some days ago (and this seems to be a very
common issue), and i tried your component. It's very good, with some ajax,
but the return type is a little bit limited for what i was trying to
achieve(update a combo with information from another combo, which has your
mixin). The only way to do it was hardcoding the select in my java(or
javascript, whatever), that was too creepy for me.

My questions:
1 - Is there any way of change my page data with something more elaborate
than TextStreamResponse?
1 - Is there any efforts on adding some similar behavior to future releases?

Thank you!

2008/4/24 Sven Homburg [EMAIL PROTECTED]:

 try this

 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html

 2008/4/24, Leon Derks [EMAIL PROTECTED]:
 
  Hello
 
  Is it possible to catch the onChange event from a select component in the
  java  page?
 
  I would expect something like: onChangeFromSelect(long id) {}
 
  Because I want to update information on my page, based on the value that
 is
  selected.
 
  How can I do that?
 
  Leon
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com




-- 
Atenciosamente,
Marcelo Lotif


Re: T5: Select component + onchange()

2008-04-24 Thread Sven Homburg
the return type is not limited to StreamResponse.
all you can respond all that tapestry allowes here
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
its up to you

2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:

 I had the same issue as Leon some days ago (and this seems to be a very
 common issue), and i tried your component. It's very good, with some ajax,
 but the return type is a little bit limited for what i was trying to
 achieve(update a combo with information from another combo, which has your
 mixin). The only way to do it was hardcoding the select in my java(or
 javascript, whatever), that was too creepy for me.

 My questions:
 1 - Is there any way of change my page data with something more elaborate
 than TextStreamResponse?
 1 - Is there any efforts on adding some similar behavior to future
 releases?

 Thank you!

 2008/4/24 Sven Homburg [EMAIL PROTECTED]:


  try this
 
 
 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html
 
  2008/4/24, Leon Derks [EMAIL PROTECTED]:
  
   Hello
  
   Is it possible to catch the onChange event from a select component in
 the
   java  page?
  
   I would expect something like: onChangeFromSelect(long id) {}
  
   Because I want to update information on my page, based on the value
 that
  is
   selected.
  
   How can I do that?
  
   Leon
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  with regards
  Sven Homburg
  http://tapestry5-components.googlecode.com
 




 --
 Atenciosamente,

 Marcelo Lotif




-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com


Re: T5: Select component + onchange()

2008-04-24 Thread Sven Homburg
the JSONObject/JSONArray response too

2008/4/24, Sven Homburg [EMAIL PROTECTED]:

 the return type is not limited to StreamResponse.
 all you can respond all that tapestry allowes here
 http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
 its up to you

 2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:

 I had the same issue as Leon some days ago (and this seems to be a very
 common issue), and i tried your component. It's very good, with some ajax,
 but the return type is a little bit limited for what i was trying to
 achieve(update a combo with information from another combo, which has your
 mixin). The only way to do it was hardcoding the select in my java(or
 javascript, whatever), that was too creepy for me.

 My questions:
 1 - Is there any way of change my page data with something more elaborate
 than TextStreamResponse?
 1 - Is there any efforts on adding some similar behavior to future
 releases?

 Thank you!

 2008/4/24 Sven Homburg [EMAIL PROTECTED]:


  try this
 
 
 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html
 
  2008/4/24, Leon Derks [EMAIL PROTECTED]:
  
   Hello
  
   Is it possible to catch the onChange event from a select component in
 the
   java  page?
  
   I would expect something like: onChangeFromSelect(long id) {}
  
   Because I want to update information on my page, based on the value
 that
  is
   selected.
  
   How can I do that?
  
   Leon
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  with regards
  Sven Homburg
  http://tapestry5-components.googlecode.com
 




 --
 Atenciosamente,

 Marcelo Lotif




 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com




-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com


Re: T5: Select component + onchange()

2008-04-24 Thread Chris Lewis
Unless https://issues.apache.org/jira/browse/TAPESTRY-2286 has been
addressed, you cannot respond with JSONArray, but you can with JSONObject.

Sven Homburg wrote:
 the JSONObject/JSONArray response too

 2008/4/24, Sven Homburg [EMAIL PROTECTED]:
   
 the return type is not limited to StreamResponse.
 all you can respond all that tapestry allowes here
 http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
 its up to you

 2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:
 
 I had the same issue as Leon some days ago (and this seems to be a very
 common issue), and i tried your component. It's very good, with some ajax,
 but the return type is a little bit limited for what i was trying to
 achieve(update a combo with information from another combo, which has your
 mixin). The only way to do it was hardcoding the select in my java(or
 javascript, whatever), that was too creepy for me.

 My questions:
 1 - Is there any way of change my page data with something more elaborate
 than TextStreamResponse?
 1 - Is there any efforts on adding some similar behavior to future
 releases?

 Thank you!

 2008/4/24 Sven Homburg [EMAIL PROTECTED]:


   
 try this


 
 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html
   
 2008/4/24, Leon Derks [EMAIL PROTECTED]:
 
 Hello

 Is it possible to catch the onChange event from a select component in
   
 the
   
 java  page?

 I would expect something like: onChangeFromSelect(long id) {}

 Because I want to update information on my page, based on the value
   
 that
   
 is
 
 selected.

 How can I do that?

 Leon


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


   
 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com

 


 --
 Atenciosamente,

 Marcelo Lotif

   

 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com

 



   

-- 
http://thegodcode.net



Re: T5: Select component + onchange()

2008-04-24 Thread Marcelo Lotif
Yeah, i know this, but none of these responses suit to my needs (maybe a
Page response, but this will force a reload)... i tried to return a block
with the part of the code that i was trying to change, but i had no success

And i don't have the enough knowledge of the JSON api and javascript...

So i'm using the onchange='this.form.submit()'...

=)

2008/4/24 Sven Homburg [EMAIL PROTECTED]:

 the JSONObject/JSONArray response too

 2008/4/24, Sven Homburg [EMAIL PROTECTED]:
 
  the return type is not limited to StreamResponse.
  all you can respond all that tapestry allowes here
  http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
  its up to you
 
  2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:
 
  I had the same issue as Leon some days ago (and this seems to be a very
  common issue), and i tried your component. It's very good, with some
 ajax,
  but the return type is a little bit limited for what i was trying to
  achieve(update a combo with information from another combo, which has
 your
  mixin). The only way to do it was hardcoding the select in my java(or
  javascript, whatever), that was too creepy for me.
 
  My questions:
  1 - Is there any way of change my page data with something more
 elaborate
  than TextStreamResponse?
  1 - Is there any efforts on adding some similar behavior to future
  releases?
 
  Thank you!
 
  2008/4/24 Sven Homburg [EMAIL PROTECTED]:
 
 
   try this
  
  
 
 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html
  
   2008/4/24, Leon Derks [EMAIL PROTECTED]:
   
Hello
   
Is it possible to catch the onChange event from a select component
 in
  the
java  page?
   
I would expect something like: onChangeFromSelect(long id) {}
   
Because I want to update information on my page, based on the value
  that
   is
selected.
   
How can I do that?
   
Leon
   
   
   
 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
  
   --
   with regards
   Sven Homburg
   http://tapestry5-components.googlecode.com
  
 
 
 
 
  --
  Atenciosamente,
 
  Marcelo Lotif
 
 
 
 
  --
  with regards
  Sven Homburg
  http://tapestry5-components.googlecode.com
 



 --
 with regards
 Sven Homburg
 http://tapestry5-components.googlecode.com




-- 
Atenciosamente,
Marcelo Lotif


Re: T5: Select component + onchange()

2008-04-24 Thread Sven Homburg
here some sample code sequences

your page class (simplified):

@Component(parameters={event=change
onCompleteCallback=onSelect1Changed})
@Mixins(t5components/OnEvent)
private Select _select1

@Component
private Select _select2

@OnEvent(component = select1, value = change)
JSONObject select1ElementChanged(String value)
{
JSONObject json = new JSONObject();
json.put(result, new JSONArray([['a', 'value a'], ['b', 'value b'], ['c',
'value c'], ['d', 'value d']]));
return json;
}


your page tml (simplified):

select t:id=select1
option value=1first value/option
/select

select t:id=select2
/select

script type=text/javascript
function onSelect1Changed(response)
{
var json = response.evalJSON();
var array = $A(json.result)

array.each(function(item){

// create new option for select tag select2 and fill value attribute with
item[0]
// and fill option.innerText with item[1]

})
}
/script



2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:

 Yeah, i know this, but none of these responses suit to my needs (maybe a
 Page response, but this will force a reload)... i tried to return a block
 with the part of the code that i was trying to change, but i had no success

 And i don't have the enough knowledge of the JSON api and javascript...

 So i'm using the onchange='this.form.submit()'...

 =)


 2008/4/24 Sven Homburg [EMAIL PROTECTED]:

  the JSONObject/JSONArray response too
 
  2008/4/24, Sven Homburg [EMAIL PROTECTED]:
  
   the return type is not limited to StreamResponse.
   all you can respond all that tapestry allowes here
   http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
   its up to you
  
   2008/4/24, Marcelo Lotif [EMAIL PROTECTED]:
  
   I had the same issue as Leon some days ago (and this seems to be a
 very
   common issue), and i tried your component. It's very good, with some
  ajax,
   but the return type is a little bit limited for what i was trying to
   achieve(update a combo with information from another combo, which has
  your
   mixin). The only way to do it was hardcoding the select in my java(or
   javascript, whatever), that was too creepy for me.
  
   My questions:
   1 - Is there any way of change my page data with something more
  elaborate
   than TextStreamResponse?
   1 - Is there any efforts on adding some similar behavior to future
   releases?
  
   Thank you!
  
   2008/4/24 Sven Homburg [EMAIL PROTECTED]:
  
  
try this
   
   
  
 
 http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html
   
2008/4/24, Leon Derks [EMAIL PROTECTED]:

 Hello

 Is it possible to catch the onChange event from a select component
  in
   the
 java  page?

 I would expect something like: onChangeFromSelect(long id) {}

 Because I want to update information on my page, based on the
 value
   that
is
 selected.

 How can I do that?

 Leon



  -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


   
   
--
with regards
Sven Homburg
http://tapestry5-components.googlecode.com
   
  
  
  
  
   --
   Atenciosamente,
  
   Marcelo Lotif
  
  
  
  
   --
   with regards
   Sven Homburg
   http://tapestry5-components.googlecode.com
  
 
 
 
  --
  with regards
  Sven Homburg
  http://tapestry5-components.googlecode.com
 




 --
 Atenciosamente,

 Marcelo Lotif




-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com


Re: T5 : select component in a form didn't show the selected value [EDIT MODE]

2007-12-21 Thread dwi ardi irawan
hi it works i just changed like this :
tr
   tdt:label for=clubSelect//td
   tdnbsp;/td
   tdt:select t:id=clubSelect model=clubSelectionModel value=
Player.club encoder=clubValueEncoder label=Club//td
/tr

cos in the player object contains club object (i'm using iBatis+Spring for
ORM) so what i should do it's to call Player.club not Player.idClub or
Player.clubName(Club Properties).

Thnx guys

On Dec 21, 2007 9:52 PM, dwi ardi irawan [EMAIL PROTECTED] wrote:

 ir works with the that one, but i'm still curious bout how implemented it
 inside aq form...
 Hmmm
 I already override the equals method but still didn't work


 On Dec 21, 2007 4:30 AM, Sylwek  [EMAIL PROTECTED] wrote:

 
  Hi,
  will it be possible to use in this case BeanEditForm with component
  Select ?
 
  Something like this:
 
  t:beaneditform  object=player
   t:parameter name=club
 t:label for=club/
 t:select t:id=club model=clubSelectionModel value=player.club
  encoder=clubValueEncoder/
   /t:parameter
  /t:beaneditform
 
 
  Sylwek
  --
  View this message in context:
  http://www.nabble.com/T5-%3A-select-component-in-a-form-didn%27t-show-the-selected-value--EDIT-MODE--tp14414479p14445453.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 http://dwiardiirawan.blogspot.com
 cos everyone could be extraordinary...lighten up !




-- 
http://dwiardiirawan.blogspot.com
cos everyone could be extraordinary...lighten up !


Re: T5 : select component in a form didn't show the selected value [EDIT MODE]

2007-12-21 Thread dwi ardi irawan
ir works with the that one, but i'm still curious bout how implemented it
inside aq form...
Hmmm
I already override the equals method but still didn't work

On Dec 21, 2007 4:30 AM, Sylwek [EMAIL PROTECTED] wrote:


 Hi,
 will it be possible to use in this case BeanEditForm with component
 Select ?

 Something like this:

 t:beaneditform  object=player
  t:parameter name=club
t:label for=club/
t:select t:id=club model=clubSelectionModel value=player.club
 encoder=clubValueEncoder/
  /t:parameter
 /t:beaneditform


 Sylwek
 --
 View this message in context:
 http://www.nabble.com/T5-%3A-select-component-in-a-form-didn%27t-show-the-selected-value--EDIT-MODE--tp14414479p14445453.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
http://dwiardiirawan.blogspot.com
cos everyone could be extraordinary...lighten up !


Re: T5 : select component in a form didn't show the selected value [EDIT MODE]

2007-12-21 Thread dwi ardi irawan
and also overide the equals method :

public boolean equals(Object object) {
if (!(object instanceof Club)) {
return false;
}
Club obj = (Club) object;
return new EqualsBuilder()
.append(this.idClub, obj.idClub)
.append(this.clubName, obj.clubName)
.isEquals();
}


changed the encoder :

package edu.its.dreamteam.web.util;

import java.util.List;
import org.apache.tapestry.ValueEncoder;
import edu.its.dreamteam.daf.beans.Club;

public class ClubValueEncoder implements ValueEncoderClub {
private ListClub clubList;

public ClubValueEncoder(ListClub clubList) {
this.clubList = clubList;
}

public String toClient(Club club) {

return club.getIdClub();
}

public Club toValue(String value) {
for(Club club : clubList){
if(club.getIdClub().equals(value)){
return club;
}
}
return null;
}



}


On Dec 21, 2007 10:04 PM, dwi ardi irawan [EMAIL PROTECTED] wrote:

 hi it works i just changed like this :
 tr
tdt:label for=clubSelect//td
tdnbsp;/td
tdt:select t:id=clubSelect model=clubSelectionModel value=
 Player.club encoder=clubValueEncoder label=Club//td
 /tr

 cos in the player object contains club object (i'm using iBatis+Spring for
 ORM) so what i should do it's to call Player.club not Player.idClub or
 Player.clubName(Club Properties).

 Thnx guys


 On Dec 21, 2007 9:52 PM, dwi ardi irawan [EMAIL PROTECTED]  wrote:

  ir works with the that one, but i'm still curious bout how implemented
  it inside aq form...
  Hmmm
  I already override the equals method but still didn't work
 
 
  On Dec 21, 2007 4:30 AM, Sylwek  [EMAIL PROTECTED]
  wrote:
 
  
   Hi,
   will it be possible to use in this case BeanEditForm with
   component
   Select ?
  
   Something like this:
  
   t:beaneditform  object=player
t:parameter name=club
  t:label for=club/
  t:select t:id=club model=clubSelectionModel value=player.club
   
   encoder=clubValueEncoder/
/t:parameter
   /t:beaneditform
  
  
   Sylwek
   --
   View this message in context:
   http://www.nabble.com/T5-%3A-select-component-in-a-form-didn%27t-show-the-selected-value--EDIT-MODE--tp14414479p14445453.html
   Sent from the Tapestry - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  http://dwiardiirawan.blogspot.com
  cos everyone could be extraordinary...lighten up !
 



 --
 http://dwiardiirawan.blogspot.com
 cos everyone could be extraordinary...lighten up !




-- 
http://dwiardiirawan.blogspot.com
cos everyone could be extraordinary...lighten up !


Re: T5 : select component in a form didn't show the selected value [EDIT MODE]

2007-12-20 Thread Sylwek

Hi, 
 will it be possible to use in this case BeanEditForm with component
Select ?

Something like this:

t:beaneditform  object=player
  t:parameter name=club
t:label for=club/ 
t:select t:id=club model=clubSelectionModel value=player.club
encoder=clubValueEncoder/
  /t:parameter
/t:beaneditform


Sylwek
-- 
View this message in context: 
http://www.nabble.com/T5-%3A-select-component-in-a-form-didn%27t-show-the-selected-value--EDIT-MODE--tp14414479p14445453.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 : select component in a form didn't show the selected value [EDIT MODE]

2007-12-19 Thread Marcelo Lotif
Hi,
Try to override the equals() method from the Object on your Club class

2007/12/19, Penyihir Kecil [EMAIL PROTECTED]:

 Hi...

 i got another problem here, using select component inside a form.
 well, when it's on add modeit works to add new  entry in the
 database.

 but when i try to edit it (edit mode).
 the select component didn't showed the selected value but back to normal
 condition (ordered list value).

 could anyone help me to solve this problem ?

 here's my code :


 --
 *PlayerForm.java*

 public class PlayerForm extends BaseFormPage{
 @Inject
 private IPlayerDao playerDao;
 @Inject
 private IClubDao clubDao;

 @Persist
 private Player player;
 private Club club;

 @Component
 private Form playerForm;

 private ListClub clubList;

 private String idPlayer;

 public IClubDao getClubDao() {
 return clubDao;
 }

 public IPlayerDao getPlayerDao() {
 return playerDao;
 }

 public Player getPlayer() {
 return player;
 }

 public Club getClub() {
 return club;
 }
 public void setClub(Club club) {
 this.club = club;
 }

 public ListClub getClubList() {
 clubList = getClubDao().queryForList(, );
 return clubList;
 }


 public ClubSelectionModel getClubSelectionModel() {
 return new ClubSelectionModel(getClubList());
 }
 public ValueEncoderClub getClubValueEncoder(){
 return new ClubValueEncoder(getClubList());
 }

 void onPrepare(){
 if(player == null){
 player = new Player();
 }
 if(club == null){
 club = new Club();
 }
 }

 //it's used for back button action, so it's turn back the value into
 null
 void cleanupRender() {
 player = null;
 club = null;
 }

 void onActionFromClear(){
 player = null;
 playerForm.clearErrors();
 }

 //submit action, i have to make player back to null
 Object onSuccessFromPlayerForm(){
 if(getPlayer().getIdPlayer()==null){
 getPlayer().setIdPlayer(getIdPrimaryKey().generateId());
 getPlayer().setIdClub(getClub().getIdClub());

 getPlayerDao().insert(getPlayer());
 }else{
 getPlayer().setClub(club);
 getPlayerDao().update(getPlayer());

 }

 player = null;
 return PlayerGrid.class;
 }

 void onActivate(String idPlayer){
 this.idPlayer = idPlayer;
 player = (Player) getPlayerDao().findByPrimaryKey(idPlayer);
 }

 String onPassivate(){
 return idPlayer;
 }

 }


 --

 *PlayerForm.tml*

 form t:type=Form t:id=playerForm
 t:errors/
 table class=soria
 tr
 tdt:label for=firstNameField//td
 tdnbsp; :/td
 tdinput t:type=TextField t:id=firstNameField
 value=
 Player.firstName
  validate=required,minlength=3 size=20
 label=First
 Name//td
 /tr
 tr
 tdt:label for=midNameField//td
 tdnbsp; :/td
 tdinput t:type=TextField t:id=midNameField value=
 Player.midName
  size=20 label=Middle Name//td
 /tr
 tr
 tdt:label for=lastNameField//td
 tdnbsp; :/td
 tdinput t:type=TextField t:id=lastNameField value=
 Player.lastName
  validate=required size=20 label=Last
 Name//td
 /tr
 tr
 tdt:label for=clubSelect//td
 tdnbsp;/td
 tdt:select t:id=clubSelect model=clubSelectionModel
 value=club encoder=clubValueEncoder label=Club//td
 /tr
 tr
 tdt:label for=defaultPriceField//td
 tdnbsp;/td
 tdinput t:type=TextField t:id=defaultPriceField
 value=Player.defaultPrice
  validate=required size=20 label=Default
 Price//td
 /tr
 trtd colspan=3/td/tr
 tr
 td colspan=3
 input type=submit label=Save dojoType=
 dijit.form.Button iconClass=dijitEditorIcon dijitEditorIconSave/
 /td
 /tr
 /table
 /form


 --
 *ClubSelectionModel.java*

 public class ClubSelectionModel implements SelectModel {
 private ListClub clubList;

 public ClubSelectionModel(ListClub clubList){
 this.clubList = clubList;
 }
 public ListOptionGroupModel 

Re: T5: select component with support for attribute multiple

2007-06-07 Thread Michael Maier

Am 06.06.2007 um 23:00 schrieb Martin Grotzke:


Do you have getters/setters with a Set then? Does the method signature
depend on the value?

no, I use the value-encoder to map the objects in the set to strings  
and vice versa...

I didn't change the type of _value to be able to use the component
with or without multiple=true, but perhaps it's better to have a
dedicated multiselect component, so the _value could also be a
collection as in your implementation...


yes that was the goal...I need a multiple selection based on  
sets...so I can now bind the value to a set and I get a modified set  
back...


cheers

Michael



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: select component with support for attribute multiple

2007-06-07 Thread Martin Grotzke
On Thu, 2007-06-07 at 10:39 +0200, Michael Maier wrote:
 Am 06.06.2007 um 23:00 schrieb Martin Grotzke:
  I didn't change the type of _value to be able to use the component
  with or without multiple=true, but perhaps it's better to have a
  dedicated multiselect component, so the _value could also be a
  collection as in your implementation...
 
 yes that was the goal...I need a multiple selection based on  
 sets...so I can now bind the value to a set and I get a modified set  
 back...
on the other hand, with an additional attribute multiple but the
_value still as an object, it should be possible to integrate that
in the current Select component, which IMHO would be valuable.

cheers,
Martin


 
 cheers
 
 Michael
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


signature.asc
Description: This is a digitally signed message part


Re: T5: select component with support for attribute multiple

2007-06-06 Thread Daniel Jue

I'm not sure how that would work with a combobox/dropdown rendering
(since one click selects an item)

It would have to render it like a listbox, the way it's done in Palette.

BTW- I think the Palette super component is ready for use in T5.0.5
SNAPSHOT.  That should at least give you the same functionality for
now.

On 6/6/07, Martin Grotzke [EMAIL PROTECTED] wrote:

Hi,

AFAICS doesn't the select component support the attribute
multiple, only the first selected option is set on the
value.

Is there some way to get this to work with support for multiple?

Thx  cheers,
Martin






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: select component with support for attribute multiple

2007-06-06 Thread Michael Maier
Yes...it seems that multiple selects are not yet supported, but it is  
very easy to write a component...just take the select component from  
tapestry, look for value and the isOptionValueSelected method. I  
changed the value to Set type and changed the


protected void processSubmission(FormSupport formSupport, String  
elementName) {


String[] primaryKey= _request.getParameters(elementName);
if( primaryKey != null ) {
Set selectedValues= new HashSet();
for( String key : primaryKey ) {

selectedValues.add( _encoder.toValue( key ) );
} // for

try {
_validate.validate(selectedValues);
_value= selectedValues;

} catch (ValidationException ex) {

_tracker.recordError(this, ex.getMessage());
return;
}
} // if
}

method. Now I have a multiple-select component which takes a value  
parameter as a set...and it works fine...


cheers

Michael

Am 06.06.2007 um 21:51 schrieb Martin Grotzke:


Hi,

AFAICS doesn't the select component support the attribute
multiple, only the first selected option is set on the
value.

Is there some way to get this to work with support for multiple?

Thx  cheers,
Martin



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: select component with support for attribute multiple

2007-06-06 Thread Martin Grotzke
On Wed, 2007-06-06 at 21:51 +0200, Martin Grotzke wrote:
 Hi,
 
 AFAICS doesn't the select component support the attribute
 multiple, only the first selected option is set on the
 value.
 
 Is there some way to get this to work with support for multiple?

I just extended the current Select component class and added
support for the attribute multiple:
if you specify multiple=true in your template, then the select
component sets a list of converted values on the value property.

There's one issue left: how can I have getters/setters in my page
class that do not work with Object but with a List?

I just tried this, but then tapestry couldn't find the setter for
the value any more...

So I have a setter for an Object now and cast this to List - not
very nice indeed...

Btw: would it be intended to have s.th. like this (support for
multiple) in T5, or is there another approach planned?

Cheers,
Martin



ps. this is the diff:


-public final class Select extends AbstractField
-{
+public class SelectMultiSupport extends AbstractField {
+
 private class Renderer extends SelectModelRenderer
 {

@@ -63,7 +65,19 @@

 private boolean isOptionValueSelected(Object value)
 {
-return value == _value || (value != null  value.equals(_value));
+if (_multiple == null || !_multiple) {
+return value == _value || (value != null  value.equals(_value));
+}
+else {
+if (_value != null) {
+for(Object item : (Iterable)_value) {
+if (value == item || (value != null  
value.equals(item))) {
+return true;
+}
+}
+}
+return false;
+}
 }

 private ValueEncoder getEncoder()
@@ -124,24 +138,55 @@
 @Parameter(required = true, principal = true)
 private Object _value;

+/** The value to read or update. */
+@Parameter(required = false, principal = true)
+private Boolean _multiple;
+
 @Override
 protected void processSubmission(FormSupport formSupport, String 
elementName)
 {
-String primaryKey = _request.getParameter(elementName);
+if (_multiple == null || !_multiple) {

-Object selectedValue = _encoder.toValue(primaryKey);
+String primaryKey = _request.getParameter(elementName);

-try
-{
-_validate.validate(selectedValue);
+Object selectedValue = _encoder.toValue(primaryKey);

-_value = selectedValue;
+try
+{
+_validate.validate(selectedValue);
+
+_value = selectedValue;
+}
+catch (ValidationException ex)
+{
+_tracker.recordError(this, ex.getMessage());
+return;
+}
+
 }
-catch (ValidationException ex)
-{
-_tracker.recordError(this, ex.getMessage());
-return;
+else {
+
+final String[] primaryKeys = _request.getParameters(elementName);
+
+final ListObject selectedValues = new ArrayListObject();
+for(String primaryKey : primaryKeys) {
+final Object selectedValue = _encoder.toValue(primaryKey);
+selectedValues.add( selectedValue );
+}
+
+try
+{
+_validate.validate(selectedValues);
+_value = selectedValues;
+}
+catch (ValidationException ex)
+{
+_tracker.recordError(this, ex.getMessage());
+return;
+}
+
 }
+
 }

 void afterRender(MarkupWriter writer)
@@ -151,7 +196,10 @@

 void beginRender(MarkupWriter writer)
 {
-writer.element(select, name, getElementName(), id, 
getClientId());
+final Object[] attrs = (_multiple == null || !_multiple)
+? new Object[]{name, getElementName(), id, getClientId()}
+: new Object[]{name, getElementName(), id, getClientId(), 
multiple, _multiple};
+writer.element(select, attrs);

 // Disabled, informals via mixins
 }


signature.asc
Description: This is a digitally signed message part


Re: T5: select component with support for attribute multiple

2007-06-06 Thread Martin Grotzke
On Wed, 2007-06-06 at 22:47 +0200, Michael Maier wrote:
 Yes...it seems that multiple selects are not yet supported, but it is  
 very easy to write a component...
You're right, it's really easy to do this - it took about 30 minutes
and some testing :)

 just take the select component from  
 tapestry, look for value and the isOptionValueSelected method. I  
 changed the value to Set type
Do you have getters/setters with a Set then? Does the method signature
depend on the value?

I didn't change the type of _value to be able to use the component
with or without multiple=true, but perhaps it's better to have a
dedicated multiselect component, so the _value could also be a
collection as in your implementation...

Cheers,
Martin


  and changed the
 
  protected void processSubmission(FormSupport formSupport, String  
 elementName) {
 
  String[] primaryKey= _request.getParameters(elementName);
  if( primaryKey != null ) {
  Set selectedValues= new HashSet();
  for( String key : primaryKey ) {
 
  selectedValues.add( _encoder.toValue( key ) );
  } // for
 
  try {
  _validate.validate(selectedValues);
  _value= selectedValues;
 
  } catch (ValidationException ex) {
 
  _tracker.recordError(this, ex.getMessage());
  return;
  }
  } // if
  }
 
 method. Now I have a multiple-select component which takes a value  
 parameter as a set...and it works fine...
 
 cheers
 
 Michael
 
 Am 06.06.2007 um 21:51 schrieb Martin Grotzke:
 
  Hi,
 
  AFAICS doesn't the select component support the attribute
  multiple, only the first selected option is set on the
  value.
 
  Is there some way to get this to work with support for multiple?
 
  Thx  cheers,
  Martin
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


signature.asc
Description: This is a digitally signed message part


Re: T5: select component with support for attribute multiple

2007-06-06 Thread Martin Grotzke
On Wed, 2007-06-06 at 16:42 -0400, Daniel Jue wrote:
 I'm not sure how that would work with a combobox/dropdown rendering
 (since one click selects an item)
 
 It would have to render it like a listbox, the way it's done in Palette.
 
 BTW- I think the Palette super component is ready for use in T5.0.5
 SNAPSHOT.  That should at least give you the same functionality for
 now.
Whooo, also very nice :)

Although, after I added an option to the selected items, it didn't
show it in the right box - and T5 didn't tell me anything in the logs
that s.th. isn't right...
However, it's very nice, but I think for now I stick to the
simple MultiSelect version...

Cheers,
Martin


 
 On 6/6/07, Martin Grotzke [EMAIL PROTECTED] wrote:
  Hi,
 
  AFAICS doesn't the select component support the attribute
  multiple, only the first selected option is set on the
  value.
 
  Is there some way to get this to work with support for multiple?
 
  Thx  cheers,
  Martin
 
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Martin Grotzke
http://www.javakaffee.de/blog/


signature.asc
Description: This is a digitally signed message part


Re: T5 Select component

2007-03-16 Thread Anjana Gopinath

Thanks a lot Weisu, will try this now.


Anjana Gopinath






On Mar 15, 2007, at 8:23 PM, Weisu wrote:



In 5.0.3, you can use a List to display the dropdown. The html  
template looks

like:
select t:type=select t:model=supplierName t:value=nameValue/
And the component class looks like:
public List getSupplierName() { 
  //define your list
  List result = ..;
  return  result;
}

public void setSupplierName(List _supplierName){
this._supplierName = _supplierName;
}


Anjana Gopinath-2 wrote:


Hi

I am trying to use the tapestry 5 Select component to display a drop
down box. I created a enum with different values and tried giving
this enum as the model parameter. It seems to be displaying only the
first element of the enum. I  get a dropdown with the all the values
if the enum is a part of beanform. Can some one please help me out? i
couldnt find any thing related to this in the tapestry 5 website



Anjana Gopinath









--
View this message in context: http://www.nabble.com/T5-Select- 
component-tf3411735.html#a9506331

Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






Re: T5 Select component

2007-03-15 Thread Weisu

In 5.0.3, you can use a List to display the dropdown. The html template looks
like: 
select t:type=select t:model=supplierName t:value=nameValue/
And the component class looks like:
public List getSupplierName() { 
  //define your list
  List result = ..;
  return  result;
}

public void setSupplierName(List _supplierName){
this._supplierName = _supplierName;
}


Anjana Gopinath-2 wrote:
 
 Hi
 
 I am trying to use the tapestry 5 Select component to display a drop  
 down box. I created a enum with different values and tried giving  
 this enum as the model parameter. It seems to be displaying only the  
 first element of the enum. I  get a dropdown with the all the values  
 if the enum is a part of beanform. Can some one please help me out? i  
 couldnt find any thing related to this in the tapestry 5 website
 
 
 
 Anjana Gopinath
 
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/T5-Select-component-tf3411735.html#a9506331
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]