@Override protected Menu createContextMenu(final int colIndex) { Menu menu = super.createContextMenu(colIndex); if (menu != null && enableGroupingMenu && cm.isGroupable(colIndex)) { MenuItem groupBy = new MenuItem(GXT.MESSAGES.groupingView_groupByText()); groupBy.setIcon(getImages().getGroupBy()); groupBy.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { onGroupByClick(ce, colIndex); } }); menu.add(new SeparatorMenuItem()); menu.add(groupBy); } if (menu != null && enableGroupingMenu && enableGrouping && enableNoGroups) { final CheckMenuItem showInGroups = new CheckMenuItem(GXT.MESSAGES.groupingView_showGroupsText()); showInGroups.setChecked(true); showInGroups.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { onShowGroupsClick(ce, showInGroups.isChecked()); } }); menu.add(showInGroups); } return menu; }
private void addActionMenu() { Button button = new Button("Action"); Menu menu = new Menu(); if (settings.containsKey(SettingType.twitterClientId) && !Utils.isEmptyString(settings.get(SettingType.twitterClientId)) && user != null) { menu.add( actionMenuItem( "Enable Facebook", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.facebook)); } if (settings.containsKey(SettingType.facebookAPIKey) && !Utils.isEmptyString(settings.get(SettingType.facebookAPIKey))) { menu.add( actionMenuItem( "Enable Twitter", AbstractImagePrototype.create(Icons.INSTANCE.connection()), Action.twitter)); } menu.add( actionMenuItem( "Enable Instant Message (XMPP)", AbstractImagePrototype.create(Icons.INSTANCE.list_items()), Action.xmpp)); button.setMenu(menu); add(button); }
private void addFileMenu() { Button fileButton = new Button("File"); Menu fileMenu = new Menu(); fileMenu.add(newDataPoint()); fileMenu.add(newFolder()); fileMenu.add(uploadFile()); fileButton.setMenu(fileMenu); add(fileButton); }
public IngestTypeFilter(BrowseFilterPanel browseFilterPanel) { super(browseFilterPanel); setText(HarvesterUI.CONSTANTS.ingestTypes()); Menu rangeMenu = new Menu(); rangeMenu.add(createCheckedCountryList()); rangeMenu.add(new SeparatorMenuItem()); rangeMenu.add(createCountryList()); setMenu(rangeMenu); }
private void addNavigateMenu() { Button button = new Button("Navigate"); Menu menu = new Menu(); menu.add( actionMenuItem( "Toggle Expansion", AbstractImagePrototype.create(Icons.INSTANCE.expand()), Action.expand)); button.setMenu(menu); add(button); }
public Menu getListMenu() { Menu m = new Menu(); MenuItem item = new MenuItem(); item.setText("Remove"); item.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { selected.remove((DataListItem) ce.getSource()); } }); m.add(item); return m; }
private void addAdminMenu() { Button button = new Button("Admin"); Menu menu = new Menu(); menu.add( urlMenuItem( "Run System Maintenance Service", AbstractImagePrototype.create(Icons.INSTANCE.expand()), "http://" + com.google.gwt.user.client.Window.Location.getHostName() + "/cron/SystemMaint")); button.setMenu(menu); add(button); }
private void addOptionsMenu() { Button button = new Button("Options"); Menu menu = new Menu(); CheckBox saveToNowCheckBox = new CheckBox(); menu.add(saveToNowCheckBox); saveToNowCheckBox.setBoxLabel("Save with Current Time"); saveToNowCheckBox.setValue(true); // autoSaveCheckBox.setBoxLabel("Auto-Save when a number is entered"); // autoSaveCheckBox.setValue(true); // menu.add(autoSaveCheckBox); button.setMenu(menu); add(button); }
private ContentPanel createMulti() { ContentPanel panel = new SamplePanel(); panel.setHeading("Multi Columns"); ToolBar toolBar = new ToolBar(); panel.setTopComponent(toolBar); ButtonGroup group = new ButtonGroup(2); group.setHeading("Clipboard"); Button btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); Menu menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); group = new ButtonGroup(2); group.setHeading("Other Bugus Actions"); btn = new Button("Cool", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); toolBar.add(group); return panel; }
@Override public void handleEvent(final MessageBoxEvent be) { final Button btn = be.getButtonClicked(); try { if (btn.getText().equals("Yes")) { acceptConnection(r, true); scrollMenu.remove(m); } else if (btn.getText().equals("No")) { scrollMenu.remove(m); acceptConnection(r, false); } } catch (NimbitsException ex) { FeedbackHelper.showError(ex); } }
/** Show this button's menu (if it has one). */ public void showMenu() { if (menu != null) { menu.show(getElement(), menuAlign); ButtonEvent be = new ButtonEvent(this); be.setMenu(menu); fireEvent(Events.MenuShow, be); } }
/** Hide this button's menu (if it has one). */ public void hideMenu() { if (menu != null) { menu.hide(); ButtonEvent be = new ButtonEvent(this); be.setMenu(menu); fireEvent(Events.MenuHide, be); } }
public void _add() { int armStatus = ArmWrapper.FAILED; try { ArmWrapper.startTransaction( this, "com.base.myproject.client.ui.BaseMenuBar", "_add", new Object[] {}); Button item1 = new Button("Button w/ Menu"); item1.setIconStyle("icon-menu-show"); Menu menu = new Menu(); CheckMenuItem menuItem = new CheckMenuItem("I Like Cats"); menuItem.setChecked(true); menu.add(menuItem); menuItem = new CheckMenuItem("I Like Dogs"); menu.add(menuItem); item1.setMenu(menu); MenuItem menuitem2 = new MenuItem(); menuitem2.setText("menuitem2"); menuitem2.addSelectionListener( new SelectionListener() { @Override public void componentSelected(ComponentEvent ce) { // TODO Auto-generated method stub } public void handleEvent(BaseEvent be) { // TODO Auto-generated method stub // System.out.println("++"); HTML homeText = new HTML("Tab you have selected is Home."); // BaseTabPanel.getInstance().addTab("zgw2", homeText); // BaseTabPanel.getInstance().addTab("zgw3", new BasePanel()); BaseTabPanel.getInstance().addTab("zgw4", new TestBusi()); } }); menu.add(menuitem2); basemenubar.add(item1); armStatus = ArmWrapper.GOOD; // basemenubar.add(menuitem2); } finally { ArmWrapper.stopTransaction("com.base.myproject.client.ui.BaseMenuBar", "_add", armStatus); } }
public static Menu getRootContextMenu() { if (rootContextMenu == null) { rootContextMenu = new Menu(); AddFolderMenuAction addFolderAction = new AddFolderMenuAction(treePanel); MenuItem addFolder = new MenuItem(); addFolder.setText(addFolderAction.getTitle()); addFolder.setIcon(addFolderAction.getImage()); addFolder.addSelectionListener(addFolderAction); rootContextMenu.add(addFolder); MenuItem shareProject = new MenuItem(); shareProject.setText(shareProjectMenuAction.getTitle()); shareProject.setIcon(shareProjectMenuAction.getImage()); shareProject.addSelectionListener(shareProjectMenuAction); shareProject.setEnabled(shareProjectMenuAction.isEnabled()); rootContextMenu.add(shareProject); } return rootContextMenu; }
private void addHelpMenu() { Button button = new Button("Help"); Menu menu = new Menu(); menu.add( urlMenuItem( "Forum", AbstractImagePrototype.create(Icons.INSTANCE.Help()), "http://groups.google.com/group/nimbits")); menu.add( urlMenuItem( "nimbits.com", AbstractImagePrototype.create(Icons.INSTANCE.Home()), "http://www.nimbits.com")); button.setMenu(menu); add(button); }
public static Menu getFolderContextMenu() { if (folderContextMenu == null) { folderContextMenu = new Menu(); folderContextMenu.add(pasteMenuItem); MenuItem folderRename = new MenuItem(); folderRename.setText("Rename Folder"); folderRename.setIcon(LayerResources.ICONS.editFolder()); folderRename.addSelectionListener(new ShowFolderRenameAction(treePanel)); folderContextMenu.add(folderRename); MenuItem createViewportFolderMenu = new MenuItem(); createViewportFolderMenu.setText("Create Viewport"); createViewportFolderMenu.setIcon(BasicWidgetResources.ICONS.viewport()); createViewportFolderMenu.addSelectionListener(new CreateFolderViewportAction(treePanel)); folderContextMenu.add(createViewportFolderMenu); } return folderContextMenu; }
/** * Sets the button's menu. * * @param menu the menu */ public void setMenu(Menu menu) { this.menu = menu; menu.addListener( Events.Hide, new Listener<ComponentEvent>() { public void handleEvent(ComponentEvent be) { focus(); } }); }
public static Menu getMultiSelectionMenu(boolean isOnlyLayers) { if (multipleSelectionContextMenu == null) { multipleSelectionContextMenu = new Menu(); DeleteElementsMenuAction deleteElementsMenuAction = new DeleteElementsMenuAction(treePanel); MenuItem deleteElements = new MenuItem(); deleteElements.setText(deleteElementsMenuAction.getTitle()); deleteElements.setIcon(deleteElementsMenuAction.getImage()); deleteElements.addSelectionListener(deleteElementsMenuAction); multipleSelectionContextMenu.add(deleteElements); copyMultiLayers = new MenuItem("Copy Layers"); copyMultiLayers.setIcon(LayerResources.ICONS.copy()); copyMultiLayers.addSelectionListener( new CopyLayerAction(treePanel, pasteAction, pasteMenuItem)); } if (isOnlyLayers) { multipleSelectionContextMenu.add(copyMultiLayers); } else if (multipleSelectionContextMenu.getItems().contains(copyMultiLayers)) { multipleSelectionContextMenu.remove(copyMultiLayers); } return multipleSelectionContextMenu; }
@Override public void onSuccess(final List<ConnectionRequest> result) { try { if (result.isEmpty()) { connectionRequest.setVisible(false); } else { final Menu scrollMenu = new Menu(); scrollMenu.setMaxHeight(MAX_HEIGHT); for (final ConnectionRequest r : result) { MenuItem m = acceptConnectionMenuItem(scrollMenu, r); scrollMenu.add(m); } connectionRequest.setMenu(scrollMenu); connectionCount = result.size(); connectionRequest.setText("Requests(" + connectionCount + ')'); } } catch (NimbitsException ex) { FeedbackHelper.showError(ex); } }
public void reGetIngestTypes() { TreeStore<FilterAttribute> saveChecked = new TreeStore<FilterAttribute>(); saveChecked.add(checkedIngestTypeListStore.getModels(), false); Menu rangeMenu = new Menu(); rangeMenu.add(createCheckedCountryList()); rangeMenu.add(new SeparatorMenuItem()); rangeMenu.add(createCountryList()); setMenu(rangeMenu); for (FilterAttribute FilterAttribute : ingestTypeListStore.getModels()) { for (FilterAttribute savedAttribute : saveChecked.getModels()) { if (FilterAttribute.getValue().equals(savedAttribute.getValue())) { ingestTypeListStore.remove(FilterAttribute); checkedIngestTypeListStore.add(FilterAttribute, false); checkedIngestTypeList.setChecked(FilterAttribute, true); } } } // associatedAttribute.setRangeInfo(""); // browseFilterPanel.getAttributesListStore().update(associatedAttribute); }
private ContentPanel createStandard() { ContentPanel panel = new SamplePanel(); panel.setHeading("Standard"); ToolBar toolBar = new ToolBar(); Button btn = new Button("Cool", IconHelper.createStyle("add16")); toolBar.add(btn); Menu menu = new Menu(); menu.add(new MenuItem("Ribbons are cool")); btn.setMenu(menu); toolBar.add(new SeparatorToolItem()); btn = new Button("Cut", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); toolBar.add(btn); btn = new Button("Copy", IconHelper.createStyle("add16")); toolBar.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); toolBar.add(btn); menu = new Menu(); menu.add(new MenuItem("Ribbons are cool")); btn.setMenu(menu); toolBar.add(new SeparatorToolItem()); ToggleButton toggleBtn = new ToggleButton("Format"); toggleBtn.toggle(true); toolBar.add(toggleBtn); panel.setTopComponent(toolBar); return panel; }
protected void onClick(ComponentEvent ce) { ce.preventDefault(); focus(); hideToolTip(); if (!disabled) { ButtonEvent be = new ButtonEvent(this); if (!fireEvent(Events.BeforeSelect, be)) { return; } if (menu != null && !menu.isVisible()) { showMenu(); } fireEvent(Events.Select, be); } }
public void onModuleLoad() { GXT.setDefaultTheme(Theme.GRAY, true); Window gridWindow = createGridWindow(); Window accordionWindow = createAccordionWindow(); Window statisticWindow = createStatisticWindow(); Window geolocationWindow = createGeolocationWindow(); Window prezioWindow = createPrezioWindow(); Window videoWindow = createVideoWindow(); // Dispatcher dispatcher = Dispatcher.get(); // dispatcher.dispatch(AppEvents.Login); // desktop.getDesktop().hide(); // desktop.getShortcuts().noti // desktop.getDesktop().setEnabled(false); // desktop.getDesktop().hide(); // GXT.hideLoadingPanel("loading"); // desktop.getDesktop().setEnabled(true); // desktop.getDesktop().show(); // desktop.getDesktop().setZIndex(10); // desktop.getTaskBar().setVisible(false); Window w = getEmptyWindow(); desktop.addWindow(w); w.show(); w.maximize(); LoginDialog login = new LoginDialog(w); w.setZIndex(1); login.show(); login.focus(); login.setVisible(true); desktop.addWindow(prezioWindow); prezioWindow.show(); prezioWindow.maximize(); prezioWindow.focus(); // login.setZIndex(15); SelectionListener<MenuEvent> menuListener = new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent me) { itemSelected(me); } }; SelectionListener<ComponentEvent> shortcutListener = new SelectionListener<ComponentEvent>() { @Override public void componentSelected(ComponentEvent ce) { itemSelected(ce); } }; Shortcut s1 = new Shortcut(); s1.setText("Messages Window"); s1.setId("grid-win-shortcut"); s1.setData("window", gridWindow); s1.addSelectionListener(shortcutListener); desktop.addShortcut(s1); Shortcut s2 = new Shortcut(); s2.setText("Contact list"); s2.setId("acc-win-shortcut"); s2.setData("window", accordionWindow); s2.addSelectionListener(shortcutListener); desktop.addShortcut(s2); Shortcut s3 = new Shortcut(); s3.setText("Statistics"); s3.setId("stat-win-shortcut"); s3.setData("window", statisticWindow); s3.addSelectionListener(shortcutListener); desktop.addShortcut(s3); TaskBar taskBar = desktop.getTaskBar(); StartMenu menu = taskBar.getStartMenu(); menu.setHeading("Eurecom Presentation!"); menu.setIconStyle("user"); MenuItem menuItem = new MenuItem("Messages Window"); menuItem.setData("window", gridWindow); menuItem.setIcon(IconHelper.createStyle("icon-grid")); menuItem.addSelectionListener(menuListener); menu.add(menuItem); menuItem = new MenuItem("Archives Window"); menuItem.setIcon(IconHelper.createStyle("tabs")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", createTabWindow()); menu.add(menuItem); menuItem = new MenuItem("Contact list"); menuItem.setIcon(IconHelper.createStyle("accordion")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", accordionWindow); menu.add(menuItem); menuItem = new MenuItem("Statistic window"); menuItem.setIcon(IconHelper.createStyle("icon-statistic")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", statisticWindow); menu.add(menuItem); menuItem = new MenuItem("Geolocation window"); menuItem.setIcon(IconHelper.createStyle("icon-geo")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", geolocationWindow); menu.add(menuItem); menuItem = new MenuItem("Last messages"); menuItem.setIcon(IconHelper.createStyle("icon-sms-menu")); Menu sub = new Menu(); for (int i = 0; i < 3; i++) { MenuItem item = new MenuItem("Message " + (i + 1)); item.setData("window", createBogusWindow(i)); item.setIcon(IconHelper.createStyle("icon-sms")); item.addSelectionListener(menuListener); sub.add(item); } MenuItem item = new MenuItem("Received mms"); item.setIcon(IconHelper.createStyle("icon-video")); item.addSelectionListener(menuListener); item.setData("window", videoWindow); sub.add(item); item = new MenuItem("Presentation window"); item.setIcon(IconHelper.createStyle("icon-ppt")); item.addSelectionListener(menuListener); item.setData("window", prezioWindow); sub.add(item); menuItem.setSubMenu(sub); menu.add(menuItem); // tools MenuItem tool = new MenuItem("Settings"); tool.setIcon(IconHelper.createStyle("settings")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Settings' tool was clicked"); } }); menu.addTool(tool); menu.addToolSeperator(); tool = new MenuItem("Logout"); tool.setIcon(IconHelper.createStyle("logout")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Logout' tool was clicked"); } }); menu.addTool(tool); }
public static Menu getLayerContextMenu() { if (layerContextMenu == null) { layerContextMenu = new Menu(); // add zoom to max extent MenuItem zoomToMaxExtend = new MenuItem(); zoomToMaxExtend.setText("Zoom to layer extend"); zoomToMaxExtend.setIcon(LayerResources.ICONS.zoomToMaxExtend()); zoomToMaxExtend.addSelectionListener(new ZoomToLayerExtentAction(treePanel)); layerContextMenu.add(zoomToMaxExtend); MenuItem exportMenuItem = new MenuItem(); exportMenuItem.setText("Export"); exportMenuItem.setSubMenu(new GPExportMenu(treePanel)); layerContextMenu.add(exportMenuItem); MenuItem cqlFilterMenuItem = new MenuItem(); cqlFilterMenuItem.setText("CQL Filter"); cqlFilterMenuItem.setSubMenu(new GPCQLFilterMenu(treePanel)); layerContextMenu.add(cqlFilterMenuItem); MenuItem timeFilterMenuItem = new MenuItem(); timeFilterMenuItem.setText("TIME Filter"); timeFilterMenuItem.setSubMenu(new GPTimeFilterMenu(treePanel)); layerContextMenu.add(timeFilterMenuItem); MenuItem layerProperties = new MenuItem(); layerProperties.setText("Layer Properties"); layerProperties.setIcon(LayerResources.ICONS.layerProperties()); layerProperties.addSelectionListener(new ShowLayerPropertiesAction(treePanel)); MenuItem copyMenuItem = new MenuItem("Copy Layer"); copyMenuItem.setIcon(LayerResources.ICONS.copy()); copyMenuItem.addSelectionListener(new CopyLayerAction(treePanel, pasteAction, pasteMenuItem)); layerContextMenu.add(copyMenuItem); MenuItem createViewportLayerMenu = new MenuItem(); createViewportLayerMenu.setText("Create Viewport"); createViewportLayerMenu.setIcon(BasicWidgetResources.ICONS.viewport()); createViewportLayerMenu.addSelectionListener(new CreateLayerViewportAction(treePanel)); layerContextMenu.add(createViewportLayerMenu); // TODO ADD EditWFS dynamically EditWFSAction editFeatureAction = new EditWFSAction(treePanel); MenuItem editFeature = new MenuItem(); editFeature.setText(editFeatureAction.getTitle()); editFeature.setIcon(editFeatureAction.getImage()); editFeature.addSelectionListener(editFeatureAction); layerContextMenu.add(editFeature); refreshTimeComboBox = new ComboBox() { @Override protected void onSelect(ModelData model, int index) { super.onSelect(model, index); refreshTimeComboBox.clearSelections(); layerContextMenu.hide(); } }; refreshTimeComboBox.setEmptyText("Refresh Time"); ListStore<LayerRefreshTimeValue> store = new ListStore<LayerRefreshTimeValue>(); store.add(LayerRefreshTimeValue.getLayerRefreshTimeList()); refreshTimeComboBox.setStore(store); refreshTimeComboBox.setEditable(Boolean.FALSE); refreshTimeComboBox.setForceSelection(Boolean.TRUE); refreshTimeComboBox.setTypeAhead(Boolean.FALSE); refreshTimeComboBox.setUseQueryCache(Boolean.FALSE); refreshTimeComboBox.setDisplayField(LayerRefreshTimeValue.REFRESH_TIME_KEY); // refreshMenuItem.setIcon(LayerResources.ICONS.layerRefresh()); refreshTimeComboBox.addSelectionChangedListener(new RefreshLayerAction(treePanel)); layerContextMenu.add(refreshTimeComboBox); layerContextMenu.add(layerProperties); } return layerContextMenu; }
public LayoutContainer getRightSide() { RowLayout layout = new RowLayout(); // layout.setMargin(0); // layout.setSpacing(0); ButtonBar south = new ButtonBar(); south.setAlignment(HorizontalAlignment.RIGHT); final Button complete = new Button( "Complete Split", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { onClose(); } }); south.add(complete); complete.setEnabled(false); LayoutContainer container = new LayoutContainer(); container.setLayout(layout); container.setLayoutOnChange(true); final DataList moveList = new DataList(); final ListBox listBox = new ListBox(); listBox.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { moveList.removeAll(); ArrayList<String> list = parentToChildList.get(listBox.getValue(listBox.getSelectedIndex())); if (list == null) return; Iterator<String> iterator = list.listIterator(); while (iterator.hasNext()) { // FIXME: look at this, i just fix this and dont know if it's right. CS String nodeID = iterator.next(); Taxon cur = TaxonomyCache.impl.getTaxon(nodeID); DataListItem li = new DataListItem(cur.getFullName()); li.setData("nodeID", nodeID); li.setData("node", cur); moveList.add(li); } layout(); } }); Menu m = new Menu(); MenuItem item = new MenuItem(); item.setText("Remove"); item.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { DataListItem item = (DataListItem) ce.getSource(); ArrayList<String> list = parentToChildList.get(listBox.getValue(listBox.getSelectedIndex())); if (list != null) list.remove(item.getData("nodeID")); moveList.remove(item); children.add(item); layout(); } }); m.add(item); moveList.setContextMenu(m); VerticalPanel table = new VerticalPanel(); table.add(new HTML("Current Taxonomic Group: ")); table.add(listBox); listBox.setWidth("100%"); listBox.setEnabled(false); final ButtonBar bar = new ButtonBar(); bar.setAlignment(HorizontalAlignment.RIGHT); final Button addChild = new Button( "Add Child", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { List<DataListItem> sel = children.getSelectedItems(); if (sel == null) return; ArrayList<String> list = parentToChildList.get(listBox.getValue(listBox.getSelectedIndex())); for (DataListItem selected : sel) { children.remove(selected); String nodeID = selected.getData("nodeID"); if (!list.contains(nodeID)) { list.add(nodeID); DataListItem item = new DataListItem(selected.getText()); item.setData("nodeID", nodeID); item.setData("node", selected.getData("node")); moveList.add(item); } } layout(); } }); addChild.setEnabled(false); bar.add(addChild); bar.add( new Button( "Create New Taxon", new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { TaxonomyCache.impl.fetchTaxon( currentNode.getParentId(), false, new GenericCallback<Taxon>() { public void onFailure(Throwable caught) { WindowUtils.errorAlert( "Error", "Could not " + "find parent level to attach new taxonomic concept to."); } public void onSuccess(Taxon result) { complete.setEnabled(true); final CreateNewTaxonPanel panel = new CreateNewTaxonPanel(result); panel.addListener( Events.StateChange, new Listener<BaseEvent>() { public void handleEvent(BaseEvent be) { Taxon newNode = (Taxon) be.getSource(); parentToChildList.put( newNode.getId() + "", new ArrayList<String>()); listBox.addItem(newNode.getFullName(), newNode.getId() + ""); listBox.setSelectedIndex(listBox.getItemCount() - 1); listBox.setEnabled(true); moveList.removeAll(); addChild.setEnabled(true); } }); panel.show(); } }); } })); container.add(table, new RowData(1d, 25)); container.add(bar, new RowData(1d, 25)); container.add(new HTML("Children to add to new taxon:"), new RowData(1d, 25)); container.add(moveList, new RowData(1d, 1d)); container.add(south, new RowData(1d, 25)); return container; }
private MenuBar createMenuBar() { Menu fileMenu = new Menu(); final MenuItem newDocumentMenuItem = new MenuItem(AppConstants.INSTANCE.newDocumentMenuItem()); fileMenu.add(newDocumentMenuItem); final MenuItem openUrlItem = new MenuItem(AppConstants.INSTANCE.openUrlMenuItem()); fileMenu.add(openUrlItem); final MenuItem openLocalMenuItem = new MenuItem(AppConstants.INSTANCE.openLocalMenuItem()); fileMenu.add(openLocalMenuItem); final MenuItem openRssFeedItem = new MenuItem(AppConstants.INSTANCE.openRssFeedMenuItem()); fileMenu.add(openRssFeedItem); exportAsSvgMenuItem = new MenuItem(AppConstants.INSTANCE.exportAsSvgMenuItem()); fileMenu.add(exportAsSvgMenuItem); MenuItem recentDocumentsItem = new MenuItem(AppConstants.INSTANCE.recentDocumentsMenuItem()); recentDocsMenu = new Menu(); recentDocumentsItem.setSubMenu(recentDocsMenu); fileMenu.add(recentDocumentsItem); Menu windowMenu = new Menu(); resetViewItem = new MenuItem(AppConstants.INSTANCE.resetViewMenuItem()); windowMenu.add(resetViewItem); windowMenu.add(new SeparatorMenuItem()); tileWindowsItem = new MenuItem(AppConstants.INSTANCE.tileWindowsMenuItem()); windowMenu.add(tileWindowsItem); stackWindowsItem = new MenuItem(AppConstants.INSTANCE.stackWindowsMenuItem()); windowMenu.add(stackWindowsItem); windowMenu.add(new SeparatorMenuItem()); closeWindowItem = new MenuItem(AppConstants.INSTANCE.closeWindowMenuItem()); windowMenu.add(closeWindowItem); Menu toolsMenu = new Menu(); final MenuItem inspectorMenuItem = new MenuItem(AppConstants.INSTANCE.inspectorMenuItem()); toolsMenu.add(inspectorMenuItem); Menu aboutMenu = new Menu(); final MenuItem aboutItem = new MenuItem(AppConstants.INSTANCE.aboutMenuItem()); aboutMenu.add(aboutItem); MenuBar menuBar = new MenuBar(); menuBar.setBorders(true); menuBar.setStyleAttribute("borderTop", "none"); menuBar.add(new MenuBarItem(AppConstants.INSTANCE.fileMenu(), fileMenu)); menuBar.add(new MenuBarItem(AppConstants.INSTANCE.windowMenu(), windowMenu)); menuBar.add(new MenuBarItem(AppConstants.INSTANCE.toolsMenu(), toolsMenu)); menuBar.add(new MenuBarItem(AppConstants.INSTANCE.aboutMenu(), aboutMenu)); dispatcher = new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent me) { MenuItem item = (MenuItem) me.getItem(); if (item == newDocumentMenuItem) { newDocument(); } else if (item == openUrlItem) { openUrl(); } else if (item == openLocalMenuItem) { openLocal(); } else if (item == openRssFeedItem) { openRssFeed(); } else if (item == exportAsSvgMenuItem) { exportAsSvg(); } else if (item == resetViewItem) { resetView(); } else if (item == tileWindowsItem) { tileWindows(); } else if (item == stackWindowsItem) { stackWindows(); } else if (item == closeWindowItem) { closeWindow(activeWindow); } else if (item == inspectorMenuItem) { inspector(); } else if (item == aboutItem) { about(); } } }; newDocumentMenuItem.addSelectionListener(dispatcher); openUrlItem.addSelectionListener(dispatcher); openLocalMenuItem.addSelectionListener(dispatcher); openRssFeedItem.addSelectionListener(dispatcher); exportAsSvgMenuItem.addSelectionListener(dispatcher); resetViewItem.addSelectionListener(dispatcher); tileWindowsItem.addSelectionListener(dispatcher); stackWindowsItem.addSelectionListener(dispatcher); closeWindowItem.addSelectionListener(dispatcher); inspectorMenuItem.addSelectionListener(dispatcher); aboutItem.addSelectionListener(dispatcher); return menuBar; }
private ContentPanel createMixed() { ContentPanel panel = new SamplePanel(); panel.setHeading("Mix and match icon sizes"); ToolBar toolBar = new ToolBar(); panel.setTopComponent(toolBar); ButtonGroup group = new ButtonGroup(3); group.setHeading("Clipboard"); toolBar.add(group); Button btn = new Button("Paste", Resources.ICONS.add32()); btn.addStyleName("x-btn-as-arrow"); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); TableData data = new TableData(); data.setRowspan(3); group.add(btn, data); btn = new Button("Format", Resources.ICONS.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); Menu menu = new Menu(); menu.add(new MenuItem("Cool")); btn.setMenu(menu); group.add(btn, data); btn = new Button("Copy", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); group = new ButtonGroup(3); group.setHeading("Clipboard"); toolBar.add(group); btn = new Button("Paste", Resources.ICONS.add32()); btn.addStyleName("x-btn-as-arrow"); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); data = new TableData(); data.setRowspan(3); group.add(btn, data); btn = new Button("Format", Resources.ICONS.add32()); btn.setScale(ButtonScale.LARGE); btn.setIconAlign(IconAlign.TOP); btn.setArrowAlign(ButtonArrowAlign.BOTTOM); menu = new Menu(); menu.add(new MenuItem("Cool")); btn.setMenu(menu); group.add(btn, data); btn = new Button("Copy", IconHelper.createStyle("add16")); menu = new Menu(); menu.add(new MenuItem("Copy me")); btn.setMenu(menu); group.add(btn); btn = new Button("Cut", IconHelper.createStyle("add16")); group.add(btn); btn = new Button("Paste", IconHelper.createStyle("add16")); group.add(btn); return panel; }
public SVGWindow addWindow(OMSVGSVGElement svg, ILoadRequest request) { String title = request.getTitle(); SVGModel model = SVGModel.newInstance(svg, title); SVGWindow window = new SVGWindow(model); window.setHeading(title); svgWindows.add(window); // To be notified when a window is activated in order to // keep track of the active window window.addListener( Events.Activate, new Listener<WindowEvent>() { @Override public void handleEvent(WindowEvent we) { SVGWindow svgWindow = (SVGWindow) we.getWindow(); GWT.log("VectomaticApp2.Activate(" + svgWindow.getHeading() + ")"); if (activeWindow != svgWindow) { if (activeWindow != null) { activeWindow.deactivate(); fireEvent(new DeactivateWindowEvent(activeWindow)); } activeWindow = svgWindow; activeWindow.activate(); fireEvent(new ActivateWindowEvent(activeWindow)); } } }); window.addListener( Events.BeforeHide, new Listener<WindowEvent>() { @Override public void handleEvent(WindowEvent we) { SVGWindow svgWindow = (SVGWindow) we.getWindow(); svgWindow.getSvgModel().getSelectionModel().deselectAll(); GWT.log("VectomaticApp2.BeforeHide(" + svgWindow.getHeading() + ")"); svgWindow.removeAllListeners(); svgWindow.deactivate(); fireEvent(new DeactivateWindowEvent(svgWindow)); svgWindows.remove(svgWindow); activeWindow = null; update(); } }); // Update the recent docs menu if (!(request instanceof NewDocRequest)) { List<Component> recentDocs = recentDocsMenu.getItems(); boolean alreadyInRecentDocs = false; for (Component item : recentDocs) { RecentDocMenuItem menuItem = (RecentDocMenuItem) item; if (request.equals(menuItem.getRequest())) { alreadyInRecentDocs = true; break; } } if (!alreadyInRecentDocs) { if (recentDocs.size() >= 8) { Component oldestItem = recentDocs.get(0); oldestItem.removeAllListeners(); recentDocsMenu.remove(oldestItem); } RecentDocMenuItem recentDocItem = new RecentDocMenuItem(request); recentDocsMenu.add(recentDocItem); } } int windowBarHeight = getWindowBarHeight(); windowY += windowBarHeight; window.setPagePosition(windowX, windowY); windowX += windowBarHeight; // window.show(); viewport.add(window); window.setVisible(true); update(); return window; }
public void onModuleLoad() { SelectionListener<MenuEvent> menuListener = new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent me) { itemSelected(me); } }; SelectionListener<ComponentEvent> shortcutListener = new SelectionListener<ComponentEvent>() { @Override public void componentSelected(ComponentEvent ce) { itemSelected(ce); } }; Window chesseWindows = createCheeseWindows(); Window configuratorWindows = createConfiguratorWindows(); Shortcut s1 = new Shortcut(); s1.setText("3DappsTest"); s1.setId("grid-win-shortcut"); s1.setData("window", chesseWindows); s1.addSelectionListener(shortcutListener); desktop.addShortcut(s1); Shortcut s2 = new Shortcut(); s2.setText("Zweiter Test 3D app"); s2.setId("acc-win-shortcut"); s2.setData("window", configuratorWindows); s2.addSelectionListener(shortcutListener); desktop.addShortcut(s2); TaskBar taskBar = desktop.getTaskBar(); StartMenu menu = taskBar.getStartMenu(); menu.setHeading("Charly TestUser"); menu.setIconStyle("user"); MenuItem menuItem = new MenuItem("3DappsTest"); menuItem.setData("window", chesseWindows); menuItem.setIcon(IconHelper.createStyle("icon-grid")); menuItem.addSelectionListener(menuListener); menu.add(menuItem); menuItem = new MenuItem("Tab Window"); menuItem.setIcon(IconHelper.createStyle("tabs")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", createTabWindow()); menu.add(menuItem); menuItem = new MenuItem("Zweiter Test 3Dapp"); menuItem.setIcon(IconHelper.createStyle("accordion")); menuItem.addSelectionListener(menuListener); menuItem.setData("window", configuratorWindows); menu.add(menuItem); menuItem = new MenuItem("Bogus Submenu"); menuItem.setIcon(IconHelper.createStyle("bogus")); Menu sub = new Menu(); for (int i = 0; i < 5; i++) { MenuItem item = new MenuItem("Bogus Window " + (i + 1)); item.setData("window", createBogusWindow(i)); item.addSelectionListener(menuListener); sub.add(item); } menuItem.setSubMenu(sub); menu.add(menuItem); // tools MenuItem tool = new MenuItem("Settings"); tool.setIcon(IconHelper.createStyle("settings")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Settings' tool was clicked"); } }); menu.addTool(tool); menu.addToolSeperator(); tool = new MenuItem("Logout"); tool.setIcon(IconHelper.createStyle("logout")); tool.addSelectionListener( new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { Info.display("Event", "The 'Logout' tool was clicked"); } }); menu.addTool(tool); }