}
item.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
ButtonEvent e = new ButtonEvent(sb);
e.setEvent(ce.getEvent());
sb.fireEvent(Events.Select, e);
}
});
menu.add(item);
} else if (c instanceof Button) {
final Button b = (Button) c;
MenuItem item = new MenuItem(b.getText(), b.getIcon());
item.setItemId(c.getItemId());
if (b.getData("gxt-menutext") != null) {
item.setText(b.getData("gxt-menutext").toString());
}
if (b.getMenu() != null) {
item.setHideOnClick(false);
item.setSubMenu(b.getMenu());
}
item.setEnabled(c.isEnabled());
item.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
ButtonEvent e = new ButtonEvent(b);
e.setEvent(ce.getEvent());
b.fireEvent(Events.Select, e);
}
});
menu.add(item);