I think the PickList(multiple choice) control[1] would be a better option. Regards,
Gilberto [1] http://click.apache.org/docs/extras-api/org/apache/click/extras/control/PickList.html 2013/5/20 Kristian Lind <[email protected]> > So now my OnGet looks like : > @Override > public void onGet() { > super.onGet(); > customerName = getContext().getRequest().getUserPrincipal().getName(); > id = getContext().getRequest().getParameter("id"); > try { > printCustomerEnt = dashboardSBBeanLocal.findCustomer(customerName); > if (StringUtils.isNotBlank(id)) { > printProviderMockEnt = > dashboardSBBeanLocal.getPrintProviderMock(Long.parseLong(id)); > form.copyFrom(printProviderMockEnt); > form.exception.setValue(""+printProviderMockEnt.getException().getId()); > form.printProviderMockEntId.setValueObject(printProviderMockEnt.getId()); > } else { > newTestPrintProvider = true; > } > } catch (BusinessException e) { > addModel("error", e.getMessage()); > return; > } catch (SystemException e) { > // TODO show errorpage > logger.error(e.getMessage(), e); > } > } > > And now it is working. :) > > What when the user can choose multiple exceptions... ?? > setSelectedValues maybe... but that takes a list of Strings... and my > Select uses Long. ?? > > > > > > > On Mon, May 20, 2013 at 11:43 AM, Bob Schellink <[email protected]> wrote: > >> On 2013/05/20 18:44, Kristian Lind wrote: >> >> To try this I made a method >> public PrintProviderExceptionMockEnt getException() { >> That just returns the first and only exception in the list.. >> >> and change my Select to... >> >> // Select exception >> exception = new Select("exception", true); >> >> But nothing is happening :( >> >> >> Correct. The Select is populated with Options as follow: >> options.add(new Option(printProviderExceptionMockEnt.getId() ....); >> >> By setting the selected value to a PrintProviderExceptionMockEnt, Click >> will just call toString on it. The Select control isn't smart enough to >> know about the PrintProviderExceptionMockEnt,getId() method. >> >> So basically you just need to set the value yourself. So after this line: >> form.copyFrom >> >> do this: >> form.exception.setValue(someIdOfAnException); >> >> regards >> >> Bob >> > > > > -- > Best regards > > Kristian Lind >
