Search in sources :

Example 41 with MenuEvent

use of javax.swing.event.MenuEvent in project triplea by triplea-game.

the class GameMenu method addNotificationSettings.

private void addNotificationSettings() {
    final JMenu notificationMenu = new JMenu();
    notificationMenu.setMnemonic(KeyEvent.VK_U);
    notificationMenu.setText("User Notifications");
    final JCheckBoxMenuItem showEndOfTurnReport = new JCheckBoxMenuItem("Show End of Turn Report");
    showEndOfTurnReport.setMnemonic(KeyEvent.VK_R);
    final JCheckBoxMenuItem showTriggeredNotifications = new JCheckBoxMenuItem("Show Triggered Notifications");
    showTriggeredNotifications.setMnemonic(KeyEvent.VK_T);
    final JCheckBoxMenuItem showTriggerChanceSuccessful = new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Successful");
    showTriggerChanceSuccessful.setMnemonic(KeyEvent.VK_S);
    final JCheckBoxMenuItem showTriggerChanceFailure = new JCheckBoxMenuItem("Show Trigger/Condition Chance Roll Failure");
    showTriggerChanceFailure.setMnemonic(KeyEvent.VK_F);
    notificationMenu.addMenuListener(new MenuListener() {

        @Override
        public void menuSelected(final MenuEvent e) {
            showEndOfTurnReport.setSelected(uiContext.getShowEndOfTurnReport());
            showTriggeredNotifications.setSelected(uiContext.getShowTriggeredNotifications());
            showTriggerChanceSuccessful.setSelected(uiContext.getShowTriggerChanceSuccessful());
            showTriggerChanceFailure.setSelected(uiContext.getShowTriggerChanceFailure());
        }

        @Override
        public void menuDeselected(final MenuEvent e) {
        }

        @Override
        public void menuCanceled(final MenuEvent e) {
        }
    });
    showEndOfTurnReport.addActionListener(e -> uiContext.setShowEndOfTurnReport(showEndOfTurnReport.isSelected()));
    showTriggeredNotifications.addActionListener(e -> uiContext.setShowTriggeredNotifications(showTriggeredNotifications.isSelected()));
    showTriggerChanceSuccessful.addActionListener(e -> uiContext.setShowTriggerChanceSuccessful(showTriggerChanceSuccessful.isSelected()));
    showTriggerChanceFailure.addActionListener(e -> uiContext.setShowTriggerChanceFailure(showTriggerChanceFailure.isSelected()));
    notificationMenu.add(showEndOfTurnReport);
    notificationMenu.add(showTriggeredNotifications);
    notificationMenu.add(showTriggerChanceSuccessful);
    notificationMenu.add(showTriggerChanceFailure);
    add(notificationMenu);
}
Also used : MenuListener(javax.swing.event.MenuListener) JMenu(javax.swing.JMenu) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) MenuEvent(javax.swing.event.MenuEvent)

Example 42 with MenuEvent

use of javax.swing.event.MenuEvent in project airavata by apache.

the class XBayaMenuItem method createFileMenu.

private void createFileMenu() {
    createOpenWorkflowMenuItem();
    createSaveWorkflowItem();
    createSaveAsWorkflowItem();
    createSaveAllWorkflowItem();
    createSaveWorkflowtoRegistryItem();
    createImportWorkflowItemFromFileSystem();
    createImportWorkflowItemFromRegistry();
    createExportJythonScriptItem();
    createExportBpelScriptItem();
    createSaveWorkflowImageItem();
    createExportODEScriptsItem();
    clearWorkflowItem = createClearWorkflowItem();
    newWorkflowTabItem = createNewWorkflowTabMenuItem();
    closeWorkflowItem = createCloseWorkflowTabItem();
    closeAllWorkflowItem = createCloseAllWorkflowTabItem();
    nextWorkflowTabItem = createNextWorkflowTabItem();
    urlItem = createURLRegistryItem();
    // createRegisterHostDesc();
    // createRegisterServiceDesc();
    // createRegisterApplicationDesc();
    xbayaMenuItem = new JMenu("XBaya");
    xbayaMenuItem.setMnemonic(KeyEvent.VK_X);
    // JMenu newMenu = new JMenu("New");
    // newMenu.add(newWorkflowTabItem);
    // newMenu.addSeparator();
    // 
    // newMenu.add(this.registerApplicationDesc);
    // newMenu.addSeparator();
    // JMenu regAddSubMenuItem = new JMenu("Registry additions");
    // newMenu.add(regAddSubMenuItem);
    // regAddSubMenuItem.add(this.registerHostDesc);
    // regAddSubMenuItem.add(this.registerServiceDesc);
    // 
    // xbayaMenuItem.add(newMenu);
    xbayaMenuItem.add(newWorkflowTabItem);
    // xbayaMenuItem.add(registerHostDesc);
    // xbayaMenuItem.add(this.registerServiceDesc);
    // xbayaMenuItem.add(registerApplicationDesc);
    xbayaMenuItem.add(importWorkflowItemFromRegistry);
    xbayaMenuItem.add(saveWorkflowtoRegistryItem);
    xbayaMenuItem.addSeparator();
    xbayaMenuItem.add(this.openWorkflowItem);
    xbayaMenuItem.addSeparator();
    xbayaMenuItem.add(clearWorkflowItem);
    xbayaMenuItem.add(closeWorkflowItem);
    xbayaMenuItem.add(closeAllWorkflowItem);
    // This menu item did not seem useful at all
    // xbayaMenuItem.add(this.nextWorkflowTabItem);
    xbayaMenuItem.addSeparator();
    xbayaMenuItem.add(this.saveWorkflowItem);
    xbayaMenuItem.add(this.saveAsWorkflowItem);
    xbayaMenuItem.add(this.saveAllWorkflowItem);
    // JMenu importMenu = new JMenu("Import");
    // importMenu.add(importWorkflowItemFromFileSystem);
    // importMenu.add(importWorkflowItemFromRegistry);
    // importMenu.addSeparator();
    // importMenu.add(urlItem);
    // JMenu exportMenu = new JMenu("Export");
    // exportMenu.add(saveWorkflowtoRegistryItem);
    // exportMenu.addSeparator();
    // exportMenu.add(exportJythonItem);
    // exportMenu.add(exportBpelItem);
    // exportMenu.add(exportODEScriptsItem);
    // exportMenu.addSeparator();
    // exportMenu.add(saveImageItem);
    // 
    // xbayaMenuItem.add(importMenu);
    // xbayaMenuItem.add(exportMenu);
    xbayaMenuItem.addSeparator();
    xbayaMenuItem.add(exitItem);
    xbayaMenuItem.addMenuListener(new MenuListener() {

        @Override
        public void menuSelected(MenuEvent e) {
            GraphCanvas graphCanvas = engine.getGUI().getGraphCanvas();
            saveAsWorkflowItem.setEnabled(isWorkflowTabPresent() && graphCanvas.getWorkflowFile() != null);
            saveWorkflowItem.setEnabled(isSaveShouldBeActive());
            saveAllWorkflowItem.setEnabled(engine.getGUI().getGraphCanvases().size() > 0);
            saveWorkflowtoRegistryItem.setEnabled(isWorkflowTabPresent());
            exportJythonItem.setEnabled(isWorkflowTabPresent());
            exportBpelItem.setEnabled(isWorkflowTabPresent());
            exportODEScriptsItem.setEnabled(isWorkflowTabPresent());
            saveImageItem.setEnabled(isWorkflowTabPresent());
        }

        @Override
        public void menuDeselected(MenuEvent e) {
        }

        @Override
        public void menuCanceled(MenuEvent e) {
        }
    });
    executionModeChanged(engine.getConfiguration());
}
Also used : MenuListener(javax.swing.event.MenuListener) GraphCanvas(org.apache.airavata.xbaya.ui.graph.GraphCanvas) JMenu(javax.swing.JMenu) MenuEvent(javax.swing.event.MenuEvent)

Aggregations

MenuEvent (javax.swing.event.MenuEvent)42 MenuListener (javax.swing.event.MenuListener)39 JMenu (javax.swing.JMenu)38 ActionEvent (java.awt.event.ActionEvent)23 JMenuItem (javax.swing.JMenuItem)23 ActionListener (java.awt.event.ActionListener)22 ItemEvent (java.awt.event.ItemEvent)18 ItemListener (java.awt.event.ItemListener)18 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)14 ButtonGroup (javax.swing.ButtonGroup)13 JMenuBar (javax.swing.JMenuBar)10 JPanel (javax.swing.JPanel)10 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)10 BorderLayout (java.awt.BorderLayout)9 HousePart (org.concord.energy3d.model.HousePart)9 Foundation (org.concord.energy3d.model.Foundation)8 JDialog (javax.swing.JDialog)7 JTextField (javax.swing.JTextField)6 BoxLayout (javax.swing.BoxLayout)5 JRadioButton (javax.swing.JRadioButton)5