You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Chiappone <ch...@gmail.com> on 2005/08/12 19:37:55 UTC

Creating a dynamic SelectionModel

I was wondering if there was a way to create a dynamic PropertySelection Model.

The normal way I create a PropertySelectionModel is like this:

public static IPropertySelectionModel SELECTIONS = new
StringPropertySelectionModel(SelectionModelBuilder.buildSelections());

This works great for static selection lists.

However I wanted to create a dynamic on like:

public IPropertySelectionModel SELECTIONS = new
StringPropertySelectionModel(SelectionModelBuilder.buildSelections(getListOfActiveStates()));

I obviosly get an exception because IPropertySelectionModel must be
static.  Is there anyother way to do this?  Thanks.

-- 
~chris

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


Re: Creating a dynamic SelectionModel

Posted by Chris Chiappone <ch...@gmail.com>.
That was easy enough thanks.

On 8/12/05, Darío Vasconcelos <da...@gmail.com> wrote:
> The model has to be static only if you're using the @Page@variable
> notation, but you could use a regular helper method -or a
> property-specification- to get the value of your model...
> 
> helper method:
> public IPropertySelectionModel getSelections() {
>  return SelectionModelBuilder.buildSelections(getListOfActiveStates();
> }
> 
> property:
> in PageBeginRender,
> 
>  setSelections(SelectionModelBuilder.buildSelections(getListOfActiveStates());
> 
> or something like that, depending on your code.
> 
> 
> On 8/12/05, Chris Chiappone <ch...@gmail.com> wrote:
> > I was wondering if there was a way to create a dynamic PropertySelection Model.
> >
> > The normal way I create a PropertySelectionModel is like this:
> >
> > public static IPropertySelectionModel SELECTIONS = new
> > StringPropertySelectionModel(SelectionModelBuilder.buildSelections());
> >
> > This works great for static selection lists.
> >
> > However I wanted to create a dynamic on like:
> >
> > public IPropertySelectionModel SELECTIONS = new
> > StringPropertySelectionModel(SelectionModelBuilder.buildSelections(getListOfActiveStates()));
> >
> > I obviosly get an exception because IPropertySelectionModel must be
> > static.  Is there anyother way to do this?  Thanks.
> >
> > --
> > ~chris
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
> 
> 
> --
> I have enough money to last me the rest of my life, unless I buy something.
>    Jackie Mason
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
~chris

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


Re: Creating a dynamic SelectionModel

Posted by Darío Vasconcelos <da...@gmail.com>.
The model has to be static only if you're using the @Page@variable
notation, but you could use a regular helper method -or a
property-specification- to get the value of your model...

helper method:
public IPropertySelectionModel getSelections() {
  return SelectionModelBuilder.buildSelections(getListOfActiveStates();
}

property:
in PageBeginRender,

  setSelections(SelectionModelBuilder.buildSelections(getListOfActiveStates());

or something like that, depending on your code.


On 8/12/05, Chris Chiappone <ch...@gmail.com> wrote:
> I was wondering if there was a way to create a dynamic PropertySelection Model.
> 
> The normal way I create a PropertySelectionModel is like this:
> 
> public static IPropertySelectionModel SELECTIONS = new
> StringPropertySelectionModel(SelectionModelBuilder.buildSelections());
> 
> This works great for static selection lists.
> 
> However I wanted to create a dynamic on like:
> 
> public IPropertySelectionModel SELECTIONS = new
> StringPropertySelectionModel(SelectionModelBuilder.buildSelections(getListOfActiveStates()));
> 
> I obviosly get an exception because IPropertySelectionModel must be
> static.  Is there anyother way to do this?  Thanks.
> 
> --
> ~chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
I have enough money to last me the rest of my life, unless I buy something.
    Jackie Mason

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