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);
}
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());
}
Aggregations