BTW, we use Wicket 1.3.6 I will try to rephrase my original question: why are getChoicesComponent and ‪getSelectionComponent()‬ private? Can I add a Wish in Jira to make them public?
Eyal Golan [email protected] Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Thu, Jun 11, 2009 at 5:30 PM, Eyal Golan <[email protected]> wrote: > Hi, > I have a situation that I want to change possible choices in a palette > according to a DropDown. > I added to the DropDown the Ajax Updating > add(new AjaxFormComponentUpdatingBehavior("onchange") {...} > I have this palette: > final CustomPalette palette = new CustomPalette("palette", new > PropertyModel(rolesCoverage, "comparedConfigurations"), > allConfigurationsModel, choiceRenderer, 10, true); > and: > final IModel allConfigurationsModel = new AbstractReadOnlyModel() { > private static final long serialVersionUID = 1L; > > @Override > public Object getObject() { > final List<Configuration> allConfigs = > sageDal.getConfigurations(); > allConfigs.remove(rolesCoverage.getMainConfiguration()); > return allConfigs; > } > }; > The page uses CompoundPropertModel: super(id, new > CompoundPropertyModel(rolesCoverage)); in the constructor. > The problem that I encountered is that if I added to the target of the > DropDown the palette, it kept remembering my selected values. > > In order to change that I hacked a bit with our CustomPalette: > @Override > protected Component newChoicesComponent() { > final Component result = super.newChoicesComponent(); > externalizedChoiceComponent = result; > externalizedChoiceComponent.setOutputMarkupId(true); > return result; > } > > public Component getExternalizedChoiceComponent() { > return this.externalizedChoiceComponent; > } > > And in the DropDown, instead of adding the palette, I used > target.addComponent(customPalette.getExternalizedChoiceComponent()); > > It works. > > My question is if this is the correct way? Is there a better way doing > that? > > Eyal Golan > [email protected] > > Visit: http://jvdrums.sourceforge.net/ > LinkedIn: http://www.linkedin.com/in/egolan74 > > P Save a tree. Please don't print this e-mail unless it's really necessary >
