you can write your own model that first tries to get the resource from the panel and then falls back.
-igor On Tue, Nov 17, 2009 at 2:58 AM, Xavier López <[email protected]> wrote: > Hi, > > I've set up a custom MyTabbedPanel by modifying class TabbedPanel. It will > include a row of buttons, added on setSelectedTab which will be the same for > all tabs. > Now, I'd like each tab (panel) to be able to override the text of each > button, like this: > > public final void setSelectedTab(int index) { > ... > // Add Panel with content for the tab to global form variable > final MyTabPanel panel = tabs.get(index).getPanel(TAB_PANEL_ID); > form.addOrReplace(panel); > // Add generic buttons to form, with specific settings depending on panel's > properties > Button button1 = new Button("button1"){ ... }; > button1.setModel(new StringResourceModel("button1.label",panel, null)); > form.addOrReplace(button1); > ... > } > > The problem is that the StringResourceModel is always pointing to the > property in MyTabbedPanel.xml, and not the panel's. > I've noticed that if I remove "button1.label" from MyTabbedPanel's property > file, Wicket gets the panel's "button1.label" property, but I'd like to > provide some kind of 'default' label for the buttons so that panels aren't > forced to explicitly define this property. > > I expected specifying the 'panel' component on StringResourceModel's > constructor would do the trick, but it doesn't work. Is it possible to > accomplish what I'm trying to do ? > > Thanks, > Xavier > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
