It's hackish but this modified selectMultiple works for me: public void selectMultiple(String formComponentId, int[] indexes) { checkClosed();
// This is a hack to get Palette selection working with FormTester. // Note we can't reference the palette class directly since FormTester // is in wicket and Palette is in wicket-extensions so we need to do // some acrobatics to deal with this. Component c = (Component) workingForm.get(formComponentId); if (!(c instanceof FormComponent)) { // Palette is not a FormComponent FormComponent recorder = (FormComponent) workingForm.get(formComponentId + ":recorder"); String recorderValue = recorder.getValue(); IChoiceRenderer renderer = (IChoiceRenderer)callGetter(c, "getChoiceRenderer"); Collection choices = (Collection)callGetter(c, "getChoices"); List choiceList = new ArrayList(choices); for (int i = 0; i < indexes.length; i++) { int j = indexes[i]; Object value = choiceList.get(j); String val = renderer.getIdValue(value, j); recorderValue += val; if (i + 1 < indexes.length) { recorderValue += ","; } } setFormComponentValue(recorder, recorderValue); return; } FormComponent fc = (FormComponent) c; ChoiceSelector choiceSelector = choiceSelectorFactory.createForMultiple(fc); for (int i = 0; i < indexes.length; i++) { choiceSelector.doSelect(indexes[i]); } } private Object callGetter(Object self, String method) { try { Method m = self.getClass().getMethod(method, null); return m.invoke(self, null); } catch (Exception e) { throw new RuntimeException(e); } } mperham wrote: > > Does anyone have a version of FormTester that works with the Palette > extension? I'd like to get the selectMultiple() method working with > Palette so we can adequately test our pages which have this component. > > mike > -- View this message in context: http://www.nabble.com/Palette-and-FormTester-tf4117814.html#a11715188 Sent from the Wicket - User mailing list archive at Nabble.com. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user