PDA

View Full Version : [GXT 1.2.4] Toggle Groups



sam_mooball
8 Jun 2009, 3:30 PM
Hi, I'm just starting out with GXT, after using ExtJS for about a year and a half. I'm trying to set up an interface which is reasonably dynamic, with a number of panels adding themselves to a main page.

Part of this is adding buttons to a menu, and having them link in as part of a toggle group.

From what I've been able to find, there's no toggle group (or equivalent) in GXT. I'm also at a bit of a loss as to how I'm meant to show the panels.

This is what I'm trying to do:



public void addPanel(String linkTitle, final LayoutContainer panel) {
contentPanel.add(panel);

ToggleToolItem menuButton = new ToggleToolItem(linkTitle);

menuButton.addSelectionListener(new SelectionListener<ComponentEvent>() {
@Override
public void componentSelected(ComponentEvent ce) {
showPanel(panel);
}
});

menuMain.insert(menuButton,moduleCounter);
moduleCounter ++;
}

public void showPanel(LayoutContainer panel) {
((CardLayout) contentPanel.getLayout()).setActiveItem(contentPanel.findComponent(panel));
}


Am I missing something, or am I on entirely the wrong track?

Thanks.