Search in sources :

Example 1 with SplitButton

use of com.extjs.gxt.ui.client.widget.button.SplitButton in project activityinfo by bedatadriven.

the class ActionToolBar method addSaveSplitButton.

public void addSaveSplitButton() {
    saveSplitButton = new SplitButton(I18N.CONSTANTS.save());
    saveSplitButton.setIcon(IconImageBundle.ICONS.save());
    saveSplitButton.setItemId(UIActions.SAVE);
    saveSplitButton.addListener(Events.Select, this);
    Menu menu = new Menu();
    MenuItem saveItem = new MenuItem(I18N.CONSTANTS.save(), IconImageBundle.ICONS.save(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            if (listener != null) {
                listener.onUIAction(UIActions.SAVE);
            }
        }
    });
    menu.add(saveItem);
    MenuItem discardItem = new MenuItem(I18N.CONSTANTS.discardChanges(), IconImageBundle.ICONS.cancel(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            listener.onUIAction(UIActions.DISCARD_CHANGES);
        }
    });
    menu.add(discardItem);
    saveSplitButton.setMenu(menu);
    add(saveSplitButton);
}
Also used : SplitButton(com.extjs.gxt.ui.client.widget.button.SplitButton) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu)

Aggregations

SplitButton (com.extjs.gxt.ui.client.widget.button.SplitButton)1 Menu (com.extjs.gxt.ui.client.widget.menu.Menu)1 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)1