Search in sources :

Example 1 with SeparatorMenuItem

use of com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem in project activityinfo by bedatadriven.

the class LayersWidget method createLayerMenu.

private void createLayerMenu() {
    layerMenu = new Menu();
    layerMenu.add(new MenuItem(I18N.CONSTANTS.style(), AbstractImagePrototype.create(MapResources.INSTANCE.styleIcon()), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            optionsPanel.showStyle(getSelectedLayer());
        }
    }));
    clusterMenuItem = new MenuItem(I18N.CONSTANTS.clustering(), AbstractImagePrototype.create(MapResources.INSTANCE.clusterIcon()), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            optionsPanel.showAggregation(getSelectedLayer());
        }
    });
    layerMenu.add(clusterMenuItem);
    layerMenu.add(new MenuItem(I18N.CONSTANTS.filter(), IconImageBundle.ICONS.filter(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            optionsPanel.showFilter(getSelectedLayer());
        }
    }));
    layerMenu.add(new SeparatorMenuItem());
    layerMenu.add(new MenuItem(I18N.CONSTANTS.delete(), IconImageBundle.ICONS.delete(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            removeLayer(getSelectedLayer());
        }
    }));
    layerMenu.setWidth(CONTEXT_MENU_WIDTH);
}
Also used : SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem)

Example 2 with SeparatorMenuItem

use of com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem in project activityinfo by bedatadriven.

the class AppBar method localeClick.

@UiHandler("localeButton")
void localeClick(ClickEvent e) {
    if (localeMenu == null) {
        localeMenu = new Menu();
        for (final ApplicationLocale applicationLocale : ApplicationLocale.values()) {
            CheckMenuItem menuItem = new CheckMenuItem(applicationLocale.getLocalizedName());
            menuItem.setChecked(LocaleSwitcher.isCurrent(applicationLocale));
            menuItem.setGroup("lang");
            menuItem.setDirectionEstimated(false);
            menuItem.addSelectionListener(new SelectionListener<MenuEvent>() {

                @Override
                public void componentSelected(MenuEvent ce) {
                    LocaleSwitcher.switchLocale(applicationLocale);
                }
            });
            localeMenu.add(menuItem);
        }
        localeMenu.add(new SeparatorMenuItem());
        MenuItem preferenceItem = new MenuItem(I18N.CONSTANTS.language());
        preferenceItem.setDirectionEstimated(false);
        preferenceItem.addSelectionListener(new SelectionListener<MenuEvent>() {

            @Override
            public void componentSelected(MenuEvent ce) {
                eventBus.fireEvent(new NavigationEvent(NavigationHandler.NAVIGATION_REQUESTED, new UserProfilePage.State()));
            }
        });
        localeMenu.add(preferenceItem);
    }
    localeMenu.show(localeButton.getElement(), "?");
}
Also used : CheckMenuItem(com.extjs.gxt.ui.client.widget.menu.CheckMenuItem) NavigationEvent(org.activityinfo.ui.client.page.NavigationEvent) ApplicationLocale(org.activityinfo.i18n.shared.ApplicationLocale) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) CheckMenuItem(com.extjs.gxt.ui.client.widget.menu.CheckMenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem) MenuEvent(com.extjs.gxt.ui.client.event.MenuEvent) UiHandler(com.google.gwt.uibinder.client.UiHandler)

Example 3 with SeparatorMenuItem

use of com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem in project activityinfo by bedatadriven.

the class DbEditor method initToolBar.

private void initToolBar() {
    toolBar.addSaveButton();
    SelectionListener<MenuEvent> listener = new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent ce) {
            onNew(ce.getItem().getItemId());
        }
    };
    newMenu = new DbEditorMenu(listener);
    Button newButtonMenu = new Button(I18N.CONSTANTS.newText(), IconImageBundle.ICONS.add());
    newButtonMenu.setMenu(newMenu.asMenu());
    toolBar.add(newButtonMenu);
    toolBar.add(new SeparatorMenuItem());
    toolBar.addButton(UIActions.EDIT, I18N.CONSTANTS.openFormDesigner(), IconImageBundle.ICONS.edit());
    toolBar.addButton(UIActions.OPEN_TABLE, I18N.CONSTANTS.openTable(), IconImageBundle.ICONS.table());
    toolBar.addDeleteButton();
    toolBar.add(new SeparatorToolItem());
    toolBar.addImportButton();
    Menu exportMenu = new Menu();
    exportMenu.add(new MenuItem("Export complete database (classic)", IconImageBundle.ICONS.excel(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent menuEvent) {
            exportFullDatabase();
        }
    }));
    exportMenu.add(new MenuItem("Export complete database (beta)", IconImageBundle.ICONS.excel(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent menuEvent) {
            exportFullDatabaseBeta();
        }
    }));
    exportMenu.add(new SeparatorMenuItem());
    exportMenu.add(new MenuItem("Export selected form as XLSForm", IconImageBundle.ICONS.excel(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent menuEvent) {
            exportFormAsXlsForm();
        }
    }));
    exportMenu.add(new SeparatorMenuItem());
    exportMenu.add(new MenuItem("Export audit log", IconImageBundle.ICONS.excel(), new SelectionListener<MenuEvent>() {

        @Override
        public void componentSelected(MenuEvent menuEvent) {
            exportAuditLog();
        }
    }));
    Button exportButton = new Button(I18N.CONSTANTS.export(), IconImageBundle.ICONS.excel());
    exportButton.setMenu(exportMenu);
    toolBar.add(exportButton);
}
Also used : Button(com.extjs.gxt.ui.client.widget.button.Button) SeparatorToolItem(com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem) MenuItem(com.extjs.gxt.ui.client.widget.menu.MenuItem) Menu(com.extjs.gxt.ui.client.widget.menu.Menu) SeparatorMenuItem(com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem)

Aggregations

Menu (com.extjs.gxt.ui.client.widget.menu.Menu)3 MenuItem (com.extjs.gxt.ui.client.widget.menu.MenuItem)3 SeparatorMenuItem (com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem)3 MenuEvent (com.extjs.gxt.ui.client.event.MenuEvent)1 Button (com.extjs.gxt.ui.client.widget.button.Button)1 CheckMenuItem (com.extjs.gxt.ui.client.widget.menu.CheckMenuItem)1 SeparatorToolItem (com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem)1 UiHandler (com.google.gwt.uibinder.client.UiHandler)1 ApplicationLocale (org.activityinfo.i18n.shared.ApplicationLocale)1 NavigationEvent (org.activityinfo.ui.client.page.NavigationEvent)1