You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Anastasios Angelidis <vo...@videotron.ca> on 2005/03/13 06:03:53 UTC
Setting up custom selection model...
I managed to implement the IPropertySelectionModel and it's populated
from the database...
But how can I set the value to my own Id so I can match a label with an
Id from the db?
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Setting up custom selection model...
Posted by Anastasios Angelidis <vo...@videotron.ca>.
Bassically when my form gets rendered I would like to load my music
genre list in a drop down and if my artist has already selected his
music genre, I want the list to display his selected music genre.
I have provided below exactly what am doing. this all works. Except when
I go back to redit the artist info, thelist is all the way at the top,
instead of the artist selected genre...
Thanks
My edit.html:
<span jwcid="selectItem"/>
My edit.page
<property-specification name="artist" type="com.mamoth.Artist"
persistent="yes"/>
<property-specification name="genre" type="com.mamoth.Genre"
persistent="yes"/>
<property-specification name="genreSelectionModel"
type="com.mamoth.GenreSelectionModel" persistent="yes"/>
<component id="selectItem" type="PropertySelection">
<binding name="model" expression="genreSelectionModel"/>
<binding name="value" expression="genre"/>
</component>
edit.java:
public void pageBeginRender(PageEvent event)
{
System.out.println(getGenre().getGenre());
if(getGenreSelectionModel() == null)
{
Global global = (Global)getGlobal();
GenreDAO genreDAO = global.getGenreDAO();
setGenreSelectionModel(new
GenreSelectionModel(genreDAO.getGenreList()));
}
}
Listener in home.java:
public void editArtist(IRequestCycle cycle)
{
Edit nextPage = (Edit) cycle.getPage("Artist/Edit");
Global global = (Global)getGlobal();
ArtistDAO artistDAO = global.getArtistDAO();
Atist artist =
artistDAO.getArtistByPrincipal(cycle.getRequestContext().getRequest().getRemoteUser());
nextPage.setArtist(artist);
nextPage.setGenre(artist.getGenre());
System.out.println(nextPage.getGenre().getGenre());
cycle.activate(nextPage);
}
ron wrote:
> The Model gives the Possible entries.
> The "value" parameter should evaluate to an Object.
> Lets say, you have a property on your page, called 'selected'.
> you use <select jwcid="@PropertySelection" model="..."
> value="ognl:selected"/>
>
> The 'selected' property of your page will be read and changed
> automatically by Taps.
> Cheers,
> Ron
>
>
>
> Anastasios Angelidis:
>
>> There is no setter methods?
>>
>> Or can I just implement my own setter method?
>>
>>
>> Hanson Char wrote:
>>
>>>> But how do I set up a selected option?
>>>>
>>>
>>>
>>>
>>> How about setting the "value" of your PropertySelection to the object
>>> that corresponds to the selected option.
>>>
>>> H
>>>
>>>
>>> On Sun, 13 Mar 2005 00:49:19 -0500, Anastasios Angelidis
>>> <vo...@videotron.ca> wrote:
>>>
>>>
>>>> Never mind I understand how it works now...
>>>>
>>>> But how do I set up a selected option?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> Anastasios Angelidis wrote:
>>>>
>>>>
>>>>
>>>>> I managed to implement the IPropertySelectionModel and it's populated
>>>>> from the database...
>>>>>
>>>>> But how can I set the value to my own Id so I can match a label with
>>>>> an Id from the db?
>>>>>
>>>>> Thanks
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail:
>>>>> tapestry-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Setting up custom selection model...
Posted by ron <ro...@gmx.net>.
The Model gives the Possible entries.
The "value" parameter should evaluate to an Object.
Lets say, you have a property on your page, called 'selected'.
you use <select jwcid="@PropertySelection" model="..."
value="ognl:selected"/>
The 'selected' property of your page will be read and changed
automatically by Taps.
Cheers,
Ron
Anastasios Angelidis:
> There is no setter methods?
>
> Or can I just implement my own setter method?
>
>
> Hanson Char wrote:
>
>>> But how do I set up a selected option?
>>>
>>
>>
>> How about setting the "value" of your PropertySelection to the object
>> that corresponds to the selected option.
>>
>> H
>>
>>
>> On Sun, 13 Mar 2005 00:49:19 -0500, Anastasios Angelidis
>> <vo...@videotron.ca> wrote:
>>
>>
>>> Never mind I understand how it works now...
>>>
>>> But how do I set up a selected option?
>>>
>>> Thanks
>>>
>>>
>>> Anastasios Angelidis wrote:
>>>
>>>
>>>
>>>> I managed to implement the IPropertySelectionModel and it's populated
>>>> from the database...
>>>>
>>>> But how can I set the value to my own Id so I can match a label with
>>>> an Id from the db?
>>>>
>>>> Thanks
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Setting up custom selection model...
Posted by Anastasios Angelidis <vo...@videotron.ca>.
There is no setter methods?
Or can I just implement my own setter method?
Hanson Char wrote:
>>But how do I set up a selected option?
>>
>>
>
>How about setting the "value" of your PropertySelection to the object
>that corresponds to the selected option.
>
>H
>
>
>On Sun, 13 Mar 2005 00:49:19 -0500, Anastasios Angelidis
><vo...@videotron.ca> wrote:
>
>
>>Never mind I understand how it works now...
>>
>>But how do I set up a selected option?
>>
>>Thanks
>>
>>
>>Anastasios Angelidis wrote:
>>
>>
>>
>>>I managed to implement the IPropertySelectionModel and it's populated
>>>from the database...
>>>
>>>But how can I set the value to my own Id so I can match a label with
>>>an Id from the db?
>>>
>>>Thanks
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Setting up custom selection model...
Posted by Hanson Char <ha...@gmail.com>.
> But how do I set up a selected option?
How about setting the "value" of your PropertySelection to the object
that corresponds to the selected option.
H
On Sun, 13 Mar 2005 00:49:19 -0500, Anastasios Angelidis
<vo...@videotron.ca> wrote:
> Never mind I understand how it works now...
>
> But how do I set up a selected option?
>
> Thanks
>
>
> Anastasios Angelidis wrote:
>
> > I managed to implement the IPropertySelectionModel and it's populated
> > from the database...
> >
> > But how can I set the value to my own Id so I can match a label with
> > an Id from the db?
> >
> > Thanks
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Setting up custom selection model...
Posted by Anastasios Angelidis <vo...@videotron.ca>.
Never mind I understand how it works now...
But how do I set up a selected option?
Thanks
Anastasios Angelidis wrote:
> I managed to implement the IPropertySelectionModel and it's populated
> from the database...
>
> But how can I set the value to my own Id so I can match a label with
> an Id from the db?
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org