use of com.extjs.gxt.ui.client.widget.menu.MenuItem 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);
}
use of com.extjs.gxt.ui.client.widget.menu.MenuItem 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(), "?");
}
use of com.extjs.gxt.ui.client.widget.menu.MenuItem in project activityinfo by bedatadriven.
the class LastSyncStatus method createMenu.
public void createMenu() {
MenuItem syncNow = new MenuItem(I18N.CONSTANTS.syncNow(), new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
eventBus.fireEvent(SyncRequestEvent.INSTANCE);
}
});
this.contextMenu = new Menu();
contextMenu.add(syncNow);
}
use of com.extjs.gxt.ui.client.widget.menu.MenuItem 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);
}
use of com.extjs.gxt.ui.client.widget.menu.MenuItem 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);
}
Aggregations