@Override public void menuSelected (MenuEvent e) { SheetStub stub = StubsController.getCurrentStub(); boolean isIdle = (stub != null) && (stub.getCurrentStep() == null); for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); // Adjust the status for each step if (menuItem instanceof StepItem) { StepItem item = (StepItem) menuItem; item.displayState(stub, isIdle); } } }
/** * check file menu */ public void menuSelected(MenuEvent e) { JMenu source = (JMenu) e.getSource(); if((source != null) && "File".equals(source.getText())) { // close menu item only active, if something is selected. getMainMenu().getCloseMenuItem().setEnabled(tree.getSelectionPath() != null); getMainMenu().getCloseToolBarButton().setEnabled(tree.getSelectionPath() != null); } }
/** MenuListener method overriding. */ @Override public final void menuSelected(MenuEvent event) { MainDesktopPane desktop = mainWindow.getDesktop(); marsNavigatorItem.setSelected(desktop.isToolWindowOpen(NavigatorWindow.NAME)); searchToolItem.setSelected(desktop.isToolWindowOpen(SearchWindow.NAME)); timeToolItem.setSelected(desktop.isToolWindowOpen(TimeWindow.NAME)); monitorToolItem.setSelected(desktop.isToolWindowOpen(MonitorWindow.NAME)); missionToolItem.setSelected(desktop.isToolWindowOpen(MissionWindow.NAME)); settlementToolItem.setSelected(desktop.isToolWindowOpen(SettlementWindow.NAME)); scienceToolItem.setSelected(desktop.isToolWindowOpen(ScienceWindow.NAME)); resupplyToolItem.setSelected(desktop.isToolWindowOpen(ResupplyWindow.NAME)); //marsViewerItem.setSelected(desktop.isToolWindowOpen(MarsViewer.NAME)); showUnitBarItem.setSelected(desktop.getMainWindow().getUnitToolBar().isVisible()); showToolBarItem.setSelected(desktop.getMainWindow().getToolToolBar().isVisible()); musicVolumeItem.setValue(Math.round(desktop.getSoundPlayer().getMusicVolume() * 10F)); musicVolumeItem.setEnabled(!desktop.getSoundPlayer().isMusicMute()); effectVolumeItem.setValue(Math.round(desktop.getSoundPlayer().getEffectVolume() * 10F)); effectVolumeItem.setEnabled(!desktop.getSoundPlayer().isSoundMute()); musicMuteItem.setSelected(desktop.getSoundPlayer().isMusicMute()); effectMuteItem.setSelected(desktop.getSoundPlayer().isSoundMute()); }
public void menuSelected(MenuEvent event) { // Remove all previous items while (getItemCount() > 2) remove(2); int windowsAdded = 0; // Create a menu item for each window for (Frame window : Frame.getFrames()) { if (window.isVisible()) { FrameMenuItem newItem = new FrameMenuItem(window, this); add(newItem); windowsAdded++; } } // Disable the Close all button if we only have the main window closeAllMenuItem.setEnabled(windowsAdded > 1); }
/** * Populate the sub-menus if needed. * ${@inheritDoc}. */ public void menuSelected(final MenuEvent arg0) { if (getSubElements().length > 0) { return; } synchronized (this) { if (loadSubMenus == null) { loadSubMenus = new SubMenuLoader(false); Future<?> submited = SUBMENULOADEREXECUTOR.submit(loadSubMenus); this.loadSubMenusFuture = submited; add(isLoadingMenuItem); } } }
public void menuSelected(MenuEvent e) { TabsMenu.this.removeAll(); ExploreNodeAction exploreAction = new ExploreNodeAction(cliGuiCtx); JMenuItem exploreSelectedNode = new JMenuItem(exploreAction); exploreSelectedNode.setMnemonic(KeyEvent.VK_E); if ((exploreAction.getSelectedNode() == null) || exploreAction.getSelectedNode().isLeaf()) { exploreSelectedNode.setEnabled(false); } add(exploreSelectedNode); addSeparator(); JTabbedPane tabs = cliGuiCtx.getTabs(); for (int i=0; i < tabs.getTabCount(); i++) { GoToTabAction action = new GoToTabAction(i, tabs.getTitleAt(i)); JMenuItem item = new JMenuItem(action); item.setToolTipText(tabs.getToolTipTextAt(i)); add(item); } }
@Override public void menuSelected (MenuEvent e) { Sheet sheet = SheetsController.getCurrentSheet(); boolean isIdle = (sheet != null) && (sheet.getCurrentStep() == null); for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); // Adjust the status for each step if (menuItem instanceof StepItem) { StepItem item = (StepItem) menuItem; item.displayState(sheet, isIdle); } } }
public void menuSelected(MenuEvent ev) { Object[] values; try { values = lookup.getFieldValues(tmpl, index, field.getName()); } catch (Throwable t) { failure(t); return; } if (values == null) { addNone(menu); return; } for (int i = 0; i < values.length; i++) { JMenuItem item = new JMenuItem(values[i].toString()); item.addActionListener( wrap(new Value(index, field, values[i]))); menu.add(item); } }
@Override public void menuSelected(MenuEvent e) { if (menu.getItemCount() > 0) { // already built before return; } Set<Figure> set = figure.getPredecessorSet(); if (successors) { set = figure.getSuccessorSet(); } boolean first = true; for (Figure f : set) { if (f == figure) { continue; } if (first) { first = false; } else { menu.addSeparator(); } Action go = diagramScene.createGotoAction(f); menu.add(go); JMenu preds = new JMenu("Nodes Above"); preds.addMenuListener(new NeighborMenuListener(preds, f, false)); menu.add(preds); JMenu succs = new JMenu("Nodes Below"); succs.addMenuListener(new NeighborMenuListener(succs, f, true)); menu.add(succs); } if (menu.getItemCount() == 0) { menu.add("(none)"); } }
@Override public void menuSelected(MenuEvent e) { if (menu.getItemCount() > 0) { // already built before return; } build(menu.getPopupMenu(), figure, FigureWidget.this, successors, diagramScene); }
public void menuDeselected(MenuEvent e) { JMenu wm = (JMenu) e.getSource(); // Cleans Windows if not visible if(wm.getText().matches("Windows") || wm.getText().matches("Window")) { wm.removeAll(); System.gc(); } /* When user first imports menu item the background is set to another color to catch user attention. * After user interaction will set the background color back. */ if(wm.getText().matches("My Layer Sessions")) { JMenu selectSessionMenu = (JMenu) wm; try { JMenuItem selectSessionMenuChild = (JMenuItem) selectSessionMenu.getMenuComponent(0); Color currentColor = selectSessionMenu.getBackground(); Color defaultColor = selectSessionMenuChild.getBackground(); if(currentColor.getRed() + currentColor.getGreen() + currentColor.getBlue() == 586) { selectSessionMenu.setBackground(defaultColor); selectSessionMenu.revalidate(); } } catch (Exception ex) { //don't do anything if menu component and cannot be cast as a JMenuItem //(eg if it is a separator bar) } } }
@Override public void menuSelected (MenuEvent e) { boolean enabled = StubsController.getCurrentStub() != null; for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); // Beware of separators (for which returned menuItem is null) if (menuItem != null) { menuItem.setEnabled(enabled); } } }
@Override public void menuSelected (MenuEvent e) { // Clean up the whole menu menu.removeAll(); // Rebuild the whole list of menu items on the fly buildItems(); }
/** * Feed a menu with the dynamic content of this NameSet. * * @param menu the menu to be fed, if null it is allocated by this method * @param itemListener the listener to be called on item selection * @return the menu properly dynamized */ public JMenu feedMenu (JMenu menu, final ActionListener itemListener) { final JMenu finalMenu = (menu != null) ? menu : new JMenu(setName); MenuListener menuListener = new AbstractMenuListener() { @Override public void menuSelected (MenuEvent e) { // Clean up the whole menu finalMenu.removeAll(); // Rebuild the whole list of menu items on the fly synchronized (NameSet.this) { for (String f : names) { JMenuItem menuItem = new JMenuItem(f); menuItem.addActionListener(itemListener); finalMenu.add(menuItem); } } } }; // Listener to menu selection, to modify content on-the-fly finalMenu.addMenuListener(menuListener); return finalMenu; }
/** * This method is called when menu is deselected. It clears selected index * in the selectionModel of the menu parent. * * @param e The MenuEvent. */ public void menuDeselected(MenuEvent e) { JMenu menu = (JMenu) menuItem; if (menu.getParent() != null) { if (menu.isTopLevelMenu()) ((JMenuBar) menu.getParent()).getSelectionModel().clearSelection(); else ((JPopupMenu) menu.getParent()).getSelectionModel().clearSelection(); } }
/** * This method is called when menu is selected. It sets selected index * in the selectionModel of the menu parent. * * @param e The MenuEvent. */ public void menuSelected(MenuEvent e) { JMenu menu = (JMenu) menuItem; if (menu.isTopLevelMenu()) ((JMenuBar) menu.getParent()).setSelected(menu); else ((JPopupMenu) menu.getParent()).setSelected(menu); }
/** MenuListener method overriding. */ @Override public final void menuSelected(MenuEvent event) { //MainDesktopPane desktop = mainWindow.getDesktop(); //notificationItem.setSelected(desktop.getMainWindow().getNotification()); //volumeItem.setValue(Math.round(desktop.getSoundPlayer().getVolume() * 10F)); //volumeItem.setEnabled(!desktop.getSoundPlayer().isMute()); //muteItem.setSelected(desktop.getSoundPlayer().isMute()); }
@Override public void menuSelected(MenuEvent e) { if (e.getSource() == menu.srlStreams) { ArrayList<String> popoutStreams = new ArrayList<>(); for (Channel channel : channels.getPopoutChannels().keySet()) { popoutStreams.add(channel.getStreamName()); } menu.updateSrlStreams(channels.getActiveTab().getStreamName(), popoutStreams); } else if (e.getSource() == menu.view) { menu.updateCount(highlightedMessages.getNewCount(), highlightedMessages.getDisplayedCount(), ignoredMessages.getNewCount(), ignoredMessages.getDisplayedCount()); } }
@Override public void menuSelected(final MenuEvent e) { // Clear the menu removeAll(); // get all project files RawDataFile[] openFiles = MZmineCore.getProjectManager() .getCurrentProject().getDataFiles(); List<RawDataFile> visualizedFiles = Arrays.asList(visualizer .getRawDataFiles()); menuItemFiles = new Hashtable<JMenuItem, RawDataFile>(); for (final RawDataFile file : openFiles) { // if file is not part of plot, skip it if (!visualizedFiles.contains(file)) continue; // add a menu item for file JMenuItem newItem = new JMenuItem(file.getName()); // Handle item selection. newItem.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent event) { if (file != null) { visualizer.exportChromatogram(file); } } }); menuItemFiles.put(newItem, file); add(newItem); } }
/** * @see javax.swing.event.MenuListener#menuSelected(javax.swing.event.MenuEvent) */ public void menuSelected(MenuEvent event) { // Clear the menu removeAll(); // get all project files RawDataFile[] openFiles = MZmineCore.getProjectManager() .getCurrentProject().getDataFiles(); List<RawDataFile> visualizedFiles = Arrays.asList(visualizer .getRawDataFiles()); menuItemFiles = new Hashtable<JMenuItem, RawDataFile>(); for (RawDataFile file : openFiles) { // if file is not part of plot, skip it if (!visualizedFiles.contains(file)) continue; // add a menu item for file JMenuItem newItem = new JMenuItem(file.getName()); newItem.addActionListener(this); menuItemFiles.put(newItem, file); add(newItem); } }
/** * @see javax.swing.event.MenuListener#menuSelected(javax.swing.event.MenuEvent) */ public void menuSelected(MenuEvent event) { // remove all menu items removeAll(); // get all project files RawDataFile[] openFiles = MZmineCore.getProjectManager() .getCurrentProject().getDataFiles(); List<RawDataFile> visualizedFiles = Arrays.asList(visualizer .getRawDataFiles()); menuItemFiles = new Hashtable<JMenuItem, RawDataFile>(); for (RawDataFile file : openFiles) { // if this file is already added, skip it if (visualizedFiles.contains(file)) continue; // add a menu item for each file JMenuItem newItem = new JMenuItem(file.getName()); newItem.addActionListener(this); menuItemFiles.put(newItem, file); add(newItem); } }
public void menuSelected(MenuEvent e) { boolean b = HGVKit.getCurrentView() != null; for (int i = 0; i < getMenuComponentCount(); i++) { Component c = getMenuComponent(i); if (/* b == true && */c instanceof JMenuItem) { Action a = ((JMenuItem) c).getAction(); if (a != null) b = a.isEnabled(); } c.setEnabled(b); } }
@Override public void menuSelected(MenuEvent evt) { updateActions(); updateLogSourceMenuActions(); if (evt.getSource() == mAboutMenu) { mAboutMenu.getAction().actionPerformed(new ActionEvent(ChartView.this, ActionEvent.ACTION_PERFORMED, "")); } }
@Override public void menuSelected(MenuEvent arg0) { if (!RenderManager.isGood()) { return; } ArrayList<Integer> windowIDs = RenderManager.inst().getOpenWindowIDs(); for (int id : windowIDs) { String windowName = RenderManager.inst().getWindowName(id); this.add(new WindowSelector(id, windowName)); } }
@Override public void menuSelected(MenuEvent me) { if (me.getSource() == menuEdit) { //Update Undo and Redu MenuItems to include the action description. updateEditMenu(); } }
@Override public void menuSelected(MenuEvent event) { JMenu menu = (JMenu)event.getSource(); if(menu == editMenu) { currentChildFrame.updateEditMenu(editMenu); } }
public void menuSelected(MenuEvent e) { int tabIndex = paneTab.getSelectedIndex(); if(tabIndex >= 0 && !((EmCalcPanel)vectorTabs.get(tabIndex)).isLoaded()) { menuitemOpenXML.setEnabled(true); menuitemSaveXML.setEnabled(true); menuitemReload.setEnabled(false); } if(tabIndex >= 0 && ((EmCalcPanel)vectorTabs.get(tabIndex)).isLoaded()) menuitemReload.setEnabled(true); else if(vectorTabs.size() == 1) menuitemCloseAll.setEnabled(false); }
public void menuSelected(MenuEvent event) { Object eventSource = event.getSource(); for (Menu menu : Menu.values()) { if (eventSource == menu.menu) menu.update(); } }
public void menuDeselected(MenuEvent e) { event = "deselected"; src = e.getSource(); if (debugOut) { System.out.println(event); } }
public void menuSelected(MenuEvent e) { event = "selected"; src = e.getSource(); if (debugOut) { System.out.println(event); } }
@Override public void menuSelected (MenuEvent e) { boolean enabled = SheetsController.getCurrentSheet() != null; for (int i = 0; i < menu.getItemCount(); i++) { JMenuItem menuItem = menu.getItem(i); // Beware of separators (for which returned menuItem is null) if (menuItem != null) { menuItem.setEnabled(enabled); } } }