In this wiki page
http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects
are missing method in GenericSelectModel.java file
public void addOptionGroup(String label, boolean disabled, List<T>
options) {
List<OptionModel> optionModels = new ArrayList<OptionModel>();
if (labelFieldAdapter == null) {
for (T obj : options) {
optionModels.add(new OptionModelImpl(nvl(obj), obj));
}
} else {
for (T obj : options) {
optionModels.add(new
OptionModelImpl(nvl(labelFieldAdapter.get(obj)), obj));
}
}
if (optionGroups == null) {
optionGroups = new ArrayList<OptionGroupModel>();
}
optionGroups.add(new OptionGroupModelImpl(label, disabled,
optionModels, new String[0]));
}
And use of it:
_beans = new
GenericSelectModel<SomeBean>(list1,SomeBean.class,"name","id",_access);
_beans.addOptionGroup("Teine grupp", false, list2);
_beans.addOptionGroup("Kolmas grupp", false, list3);
After this this example works fine!
Can anyone fix this wiki page?
Argo
2008/8/28 Marcelo Lotif <[EMAIL PROTECTED]>
> If your select is simple and static, you can use an Enum attribute as the
> value parameter. Tapestry will automatically do the rest for you.
>
> But if you want something more complicated, there are many examples on the
> wiki page:
> http://wiki.apache.org/tapestry/Tapestry5HowTos
>
> more specifically:
> http://wiki.apache.org/tapestry/Tapestry5SelectObject
> http://wiki.apache.org/tapestry/Tapestry5MultipleSelectOnObjects
> http://wiki.apache.org/tapestry/Tapestry5HowtoSelectWithObjects
> http://wiki.apache.org/tapestry/Tapestry5AnotherSelectWithObjects
>
> On Thu, Aug 28, 2008 at 6:24 AM, Argo Vilberg <[EMAIL PROTECTED]> wrote:
>
> > hi,
> >
> > I try simple select component in tapestry form.
> >
> > <t:form t:id="form">
> > <div class="panel">
> > <div class="stepcontainer">
> > <div class="step left"><span
> > class="subnumber">1.1</span> <span class="title">Vali lepinguprojekti
> > tüüp</span><br />
> > <select name="lepingu_tyyp">
> > <optgroup label="VƵƵrandamislepingud">
> >
> >
> > And then in onSuccess component.
> >
> > java.util.Map lepingu_tyyp =
> > requestGlobals.getHTTPServletRequest().getParameter("lepingu_tyype");
> >
> > But parameter was empty.
> >
> > Any ideas?
> >
> >
> >
> > I use simple select in my tml file, becouse of i dont understand
> tapeestry
> > select component with optgroup options.
> > I tried but i cant understand tapeestry select and selectmodel component.
> > Also i cant find any example.
> >
> >
> >
> > Argo
> >
>
>
>
> --
> Atenciosamente,
>
> Marcelo Lotif
> Programador Java e Tapestry
> FIEC - Federação das Indústrias do Estado do Ceará
> (85) 3477-5910
>