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 Mylonas <ch...@opencsta.org> on 2013/11/04 00:50:08 UTC

Re: Fun with Enums - suggestion wanted for edit subset of enum types (netmask)

Thanks Jens, that sounds handy.
Between Thiago's and your response I'll be able to build something when I
get around to it today/tomorrow.

Have a good week Tappers
Chris


On Thu, Oct 31, 2013 at 10:15 PM, mailinglist@j-b-s.de <mailinglist@j-b-s.de
> wrote:

> Well, the values shown solely depends on your model. Just filter / sort it
> accordingly? By default Tapestry adds all enum values to options (see
> EnumSelectModel). Unfortunately you can not derive from EnumSelectModel, so
> I would try to start from AbstractSelectModel copy and paste a few lines
> from EnumSelectModel and provide a filter predicate which filters results
> in "getOptions" according to your requirements (retrieve all, filter and
> return the filtered list)
>
> Jens
>
> Von meinem iPhone gesendet
>
> > Am 31.10.2013 um 11:51 schrieb Chris Mylonas <ch...@opencsta.org>:
> >
> > Hi Tapestry Users!
> >
> > I am positive we've all had fun with enums (and netmasks) at some
> point!!!
> > I got through the afternoon accomplishing my page rendering *[1]
> >
> >
> > I now have my entity class with an enum saved.
> > It is a netmask for an ip address.
> > So if an IP address belongs in a /24 subnet, I'd like to be able to
> assign
> > it to a /32 subnet.
> >
> > I would like the t:select component to only display this option (or
> perhaps
> > a /31 & /32), but not the whole range of available netmasks in my app
> (/24
> > /25 /26...../32)
> >
> >
> > How would I go about doing this (displaying certain enum values from the
> > type)?
> >
> > Cheers for any awesome suggestions, ditto for reading!
> > Chris
> >
> >
> >
> > [1]
> > The t:select component reads the message catalog, however rendering in a
> > table (not a grid) seemed to ignore it.  I progressed with it by calling
> a
> > helper method from the template with something like
> > ${convertEnum(passedEnum)}
> >
> > page class has this method
> >
> > public String convertEnum(EnumType n){
> >    switch(n){
> >       case EnumType.ONE: return "Hooray One";
> >       case EnumType.TWO: return "Hooray Two";
> >       default: return "Not Set";
> >    }
> > }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>