You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2009/05/18 08:28:45 UTC
[jira] Commented: (WICKET-2283) Means to obtain panels from
TabbedPanel component
[ https://issues.apache.org/jira/browse/WICKET-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710283#action_12710283 ]
Martin Grigorov commented on WICKET-2283:
-----------------------------------------
Hi Phillip,
You can always save them in your own "index":
{code}
List tabs = new ArrayList();
Map<String, Panel> index = new HashMap<String, Panel>();
tabs.add(new AbstractTab(new Model("My Tab)) {
public Panel getPanel(String panelId) {
Panel panel = new CustomPanel(panelId);
index.put(panelId, panel);
return panel;
}
});
TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
Panel customPanel = index.get("someTabPanelId");
{code}
If you want to get the panel by position then use :
{code}
List<Integer> index = new ArrayList<Integer>();
....
index.add(panel);
....
Panel customPanel = index.get(1);
{code}
> Means to obtain panels from TabbedPanel component
> -------------------------------------------------
>
> Key: WICKET-2283
> URL: https://issues.apache.org/jira/browse/WICKET-2283
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Environment: n/a
> Reporter: Phillip Rhodes
>
> I am communicating from one panel to another panel. These panels are in a TabbedPanel. It's a lot of code in order to make this happen. If I call the tabbedPanel to obtain a Tab, it returns an AbstractTab, which I cannot cast to my original panel. I should not call the AbstractPanel.getPanel() method because I want to retrieve the exact same instance of my panel that the TabbedPanel has.
> This would be nice:
> List tabs = new ArrayList();
> tabs.add(new AbstractTab(new Model("My Tab)) {
> public Panel getPanel(String panelId) {
> return new CustomPanel(panelId);
> }
> });
> TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
> Panel customPanel = tabbedPanel.getTabPanel(1);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.