msauter
3 Sep 2009, 7:23 AM
I have the following class which contains a TabPanel:
public class MyTabPanel extends Composite {
private TabPanel tabPanel = new TabPanel();
public MyTabPanel() {
initComponent(tabPanel);
....
}
public void addTabItem(TabItem item) {
tabPanel.add(item);
tabPanel.setSelection(item);
}
}
Now i want to add from an other widget a TabItem to the TabPanel. I use a Button like this:
public class MenuWidget extends ContentPanel {
....
Button addNewTab = new Button("Add Tab");
SelectionListener<ButtonEvent> sel;
sel = new SelectionListener<ButtonEvent>() {
@override
public void componentSelected(ButtonEvent ce) {
// Here should be called MyTabPanel.add(item)
// but how?
}
};
..
Any idea how to create a reference from MenuWidget to MyTabPanel ?
public class MyTabPanel extends Composite {
private TabPanel tabPanel = new TabPanel();
public MyTabPanel() {
initComponent(tabPanel);
....
}
public void addTabItem(TabItem item) {
tabPanel.add(item);
tabPanel.setSelection(item);
}
}
Now i want to add from an other widget a TabItem to the TabPanel. I use a Button like this:
public class MenuWidget extends ContentPanel {
....
Button addNewTab = new Button("Add Tab");
SelectionListener<ButtonEvent> sel;
sel = new SelectionListener<ButtonEvent>() {
@override
public void componentSelected(ButtonEvent ce) {
// Here should be called MyTabPanel.add(item)
// but how?
}
};
..
Any idea how to create a reference from MenuWidget to MyTabPanel ?