示例#1
0
  @FXML
  private void initialize() {
    securitiesMenu.disableProperty().bind(disabled);
    currenciesMenu.disableProperty().bind(disabled);
    closeMenuItem.disableProperty().bind(disabled);
    optionsMenuItem.disableProperty().bind(disabled);
    reportMenu.disableProperty().bind(disabled);
    transNumberListMenuItem.disableProperty().bind(disabled);
    importOfxMenuItem.disableProperty().bind(disabled);
    importQifMenuItem.disableProperty().bind(disabled);

    windowMenu
        .disableProperty()
        .bind(Bindings.or(disabled, RegisterStage.registerStageList().emptyProperty()));

    RegisterStage.registerStageList()
        .addListener(
            (ListChangeListener<RegisterStage>)
                c -> {
                  while (c.next()) {
                    if (c.wasAdded()) {
                      c.getAddedSubList().forEach(MenuBarController.this::addWindowMenuItem);
                    } else if (c.wasRemoved()) {
                      c.getAddedSubList().forEach(MenuBarController.this::removeWindowMenuItem);
                    }
                  }
                });

    ThemeManager.addKnownThemes(themesMenu);

    MessageBus.getInstance().registerListener(this, MessageChannel.SYSTEM);
  }
示例#2
0
 private void removeWindowMenuItem(final RegisterStage registerStage) {
   windowMenu
       .getItems()
       .stream()
       .filter(item -> item.getUserData() == registerStage)
       .forEach(item -> windowMenu.getItems().remove(item));
 }
示例#3
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    window = primaryStage;
    window.setTitle("The Title");

    // Edit menu
    Menu difficultyMenu = new Menu("Difficulty");

    ToggleGroup group = new ToggleGroup();
    RadioMenuItem easy = new RadioMenuItem("Easy");
    RadioMenuItem medium = new RadioMenuItem("Medium");
    RadioMenuItem hard = new RadioMenuItem("Hard");

    easy.setToggleGroup(group);
    medium.setToggleGroup(group);
    hard.setToggleGroup(group);

    hard.setSelected(false);
    hard.setOnAction(
        e -> {
          System.out.println("You selected hard");
        });

    difficultyMenu.getItems().addAll(easy, medium, hard);

    MenuBar menuBar = new MenuBar();
    menuBar.getMenus().addAll(difficultyMenu);

    BorderPane layout = new BorderPane();
    layout.setTop(menuBar);

    Scene scene = new Scene(layout, 500, 400);
    window.setScene(scene);
    window.show();
  }
示例#4
0
 private MenuBuilder(Menu menu) {
   this.items = menu.getItems();
   this.text = menu.getText();
   this.action = menu.getOnAction();
   menuObj = menu;
   ctxMenuObj = null;
 }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // GameChanger changer = new GameChanger();

    Menu m = new Menu();
    m.setText("Games");

    tglGames = new ToggleGroup();

    for (GameRuleDomainModel gr : GameRuleBLL.getRules()) {

      RadioMenuItem mi = new RadioMenuItem();
      String strRuleName = gr.getRULENAME();
      mi.setToggleGroup(tglGames);
      mi.setText(strRuleName);
      // mi.setOnAction(changer);

      if (gr.getDEFAULTGAME() == 1) {
        mi.setSelected(true);
      }
      m.getItems().add(mi);
    }

    mb.getMenus().add(0, m);
  }
  @SuppressWarnings("unchecked")
  @Override
  public void initialize(URL location, ResourceBundle resources) {

    CheckMenuItem item1 = new CheckMenuItem("5 card stud");
    item1
        .selectedProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                mainApp.setiGameType(1);
              }
            });

    mnuGame.getItems().add(item1);

    CheckMenuItem item2 = new CheckMenuItem("5 card draw");
    item2
        .selectedProperty()
        .addListener(
            new ChangeListener() {
              @Override
              public void changed(ObservableValue arg0, Object arg1, Object arg2) {
                mainApp.setiGameType(2);
              }
            });

    mnuGame.getItems().add(item2);
  }
示例#7
0
  @Override
  public Optional<Menu> getViewMenuItems() {
    Menu menu = null;

    if (stack instanceof Deck) {
      final Deck deck = (Deck) stack;
      if (menu == null) {
        menu = new Menu("Deck");
      }

      final MenuItem shuffle = new MenuItem("Shuffle");
      shuffle.setOnAction(
          (event) -> {
            deck.shuffle();
          });
      menu.getItems().add(shuffle);

      final Menu refresh = new Menu("Refresh from");
      context
          .getDiscards()
          .forEach(
              (target) -> {
                final MenuItem menuItem = new MenuItem(target.getName());
                menuItem.setOnAction(
                    (event) -> {
                      deck.shuffleAndRefresh(target);
                    });
                refresh.getItems().add(menuItem);
              });
      menu.getItems().add(refresh);
    }

    return Optional.ofNullable(menu);
  }
  public void initLibrarianLayout() {
    ObservableList<Menu> menuList = this.menubar.getMenus();
    menuList.clear();

    Menu checkoutMenu = new Menu("Checkout");
    MenuItem checkoutBookItem = new MenuItem("checkout book");
    checkoutBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(PUBLICATION_CHECKOUT);
          }
        });

    //        MenuItem recordItem = new MenuItem("checkout record");
    //        recordItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("checkout record");
    //            }
    //        });

    ObservableList<MenuItem> itemList = checkoutMenu.getItems();
    itemList.add(checkoutBookItem);
    //        itemList.add(recordItem);
    menuList.add(checkoutMenu);
    showContentView(PUBLICATION_CHECKOUT);
  }
示例#9
0
 private Menu createMenu() {
   Menu menu = new Menu();
   if (text != null) menu.setText(text);
   if (action != null) menu.setOnAction(action);
   menu.getItems().setAll(items);
   items = menu.getItems();
   return menu;
 }
示例#10
0
 @EventListener
 public void onWorkspaceLoaded(WorkspaceLoadedEvent e) {
   recent.getItems().clear();
   service
       .getRecentlyUsedWorkspaces()
       .stream()
       .map(WorkspaceMenuItem::new)
       .forEach(recent.getItems()::add);
 }
示例#11
0
  private void addWindowMenuItem(final RegisterStage registerStage) {
    final MenuItem menuItem = new MenuItem(registerStage.accountProperty().get().getName());
    menuItem.setUserData(registerStage);

    menuItem.setOnAction(
        event -> {
          final RegisterStage stage = (RegisterStage) menuItem.getUserData();
          stage.requestFocus();
        });

    registerStage.setOnHiding(event -> windowMenu.getItems().removeAll(menuItem));

    windowMenu.getItems().add(0, menuItem);
  }
示例#12
0
  /**
   * Diese Methode wird aufgerufen, wenn die Sprachauswahl geaendert wird. Sie geht über alle GUI
   * Elemente und holt den entsprechenden String aus dem Eigenschaften File.
   */
  protected void updateTexts() {
    Translator t = ServiceLocator.getServiceLocator().getTranslator();

    // The menu entries
    menuFile.setText(t.getString("program.menu.file"));
    menuFileLanguage.setText(t.getString("program.menu.file.language"));

    // Buttons
    btnStart.setText(t.getString("button.start"));
    btnClose.setText(t.getString("button.close"));

    // TextField Promt
    tfPort.setPromptText(t.getString("textfield.prompt.port"));
  }
  public MenuBarController(MenuBar in) {
    this.menuBar = in;

    initFileMenu();
    initEditMenu();
    initWindowMenu();
    initHelpMenu();

    fileMenu
        .getItems()
        .addAll(openTestMenuItem, openMenuItem, saveMenuItem, preferencesMenuItem, quitMenuItem);
    editMenu.getItems().addAll(deleteMenuItem);
    windowMenu.getItems().addAll(codeWindowMenuItem, leftWindowMenuItem, rightWindowMenuItem);
    helpMenu.getItems().addAll(aboutMenuItem);
    menuBar.getMenus().addAll(fileMenu, editMenu, windowMenu, helpMenu);
  }
示例#14
0
 private void writeClipMenuItemChildren(TreeItem<Clip> parentTreeItem, Menu parentMenu) {
   List<TreeItem<Clip>> children = parentTreeItem.getChildren();
   for (TreeItem<Clip> child : children) {
     if (child.getValue().isGroup()) {
       Menu menu = new Menu(child.getValue().getName());
       parentMenu.getItems().add(menu);
       writeClipMenuItemChildren(child, menu);
     } else {
       MenuItem menuItem = new MenuItem(child.getValue().getName());
       parentMenu.getItems().add(menuItem);
       menuItem.setOnAction(
           event -> {
             insertClip(child.getValue());
           });
     }
   }
 }
示例#15
0
 /**
  * Decide whether admin menu items should be shown.
  *
  * @param isAdmin
  */
 private void setAdminMenusVisible(boolean isAdmin) {
   if (isAdmin) {
     newUserMenuItem.setVisible(true);
     manageAllUsersMenuItem.setVisible(true);
     userMenuSeperator.setVisible(true);
     preferencesMenu.setVisible(true);
     // preferencesMenuItem.setVisible(true);
     preferencesMenuSeperator.setVisible(true);
   } else {
     newUserMenuItem.setVisible(false);
     manageAllUsersMenuItem.setVisible(false);
     userMenuSeperator.setVisible(false);
     preferencesMenu.setVisible(false);
     // preferencesMenuItem.setVisible(false);
     preferencesMenuSeperator.setVisible(false);
   }
 }
 /**
  * Determines which rule is selected in the Games menu.
  *
  * <p>Iterates through the menus in the menu bar looking for the Games menu. Once found it
  * iterates through the menu items under Games looking for radio buttons. For every radio menu
  * item it finds it checks if it's been selected. If a selected one is found strRuleName is set
  * and the whole nest is broken out of and strRuleName is returned.
  *
  * @return
  */
 public String getRuleName() {
   String strRuleName = null;
   for (Menu m : mb.getMenus()) {
     if (m.getText() == "Games") {
       for (MenuItem mi : m.getItems()) {
         if (mi.getClass().equals(RadioMenuItem.class)) {
           RadioMenuItem rmi = (RadioMenuItem) mi;
           if (rmi.isSelected() == true) {
             strRuleName = rmi.getText();
             break;
           }
         }
       }
     }
   }
   return strRuleName;
 }
示例#17
0
  private static void syncToggle() {
    final String last = preferences.get(LAST, Application.STYLESHEET_MODENA);

    for (final MenuItem menuItem : themesMenu.getItems()) {
      if (menuItem.getUserData() != null && menuItem.getUserData().equals(last)) {
        ((RadioMenuItem) menuItem).setSelected(true);
        break;
      }
    }
  }
示例#18
0
  public LogMenu(TLP tlp) {
    logMenu = new Menu("Log");

    MenuItem showItem = new MenuItem("Show Logfile");
    showItem.setOnAction(new ShowListener(tlp.getBorderPane(), tlp));

    MenuItem killsItem = new MenuItem("Kills");
    killsItem.setOnAction(new KillsListener(tlp.getBorderPane(), tlp));

    logMenu.getItems().addAll(showItem, killsItem);
  }
示例#19
0
 @Inject
 public WorkspaceMenu(RecentWorkspacesService service) {
   super(DefaultI18nContext.getInstance().i18n("_Workspace"));
   this.service = service;
   setId("workspaceMenu");
   MenuItem load = new MenuItem(DefaultI18nContext.getInstance().i18n("_Load"));
   load.setId("loadWorkspace");
   load.setOnAction(e -> loadWorkspace());
   MenuItem save = new MenuItem(DefaultI18nContext.getInstance().i18n("_Save"));
   save.setOnAction(e -> saveWorkspace());
   save.setId("saveWorkspace");
   recent = new Menu(DefaultI18nContext.getInstance().i18n("Recen_t"));
   recent.setId("recentWorkspace");
   service
       .getRecentlyUsedWorkspaces()
       .stream()
       .map(WorkspaceMenuItem::new)
       .forEach(recent.getItems()::add);
   getItems().addAll(load, save, new SeparatorMenuItem(), recent);
   eventStudio().addAnnotatedListeners(this);
 }
示例#20
0
  public void initMenus(IController controller, ITask task) {
    this.getItems().clear();
    Menu assignTaskMenu = new Menu("Назначить ресурс");
    MenuItem getPropertiesMenuItem = new MenuItem("Свойства");
    MenuItem removeTaskMenuItem = new MenuItem("Удалить задачу");

    getPropertiesMenuItem.setOnAction(
        event -> {
          controller.setSelectedTask(task);
          //                taskPaneController.openPropertiesTaskWindow(); // TODO: 25.11.2015
          // исправить
        });
    removeTaskMenuItem.setOnAction(event -> controller.handleRemoveTask(task));
    this.getItems()
        .addAll(assignTaskMenu, getPropertiesMenuItem, removeTaskMenuItem); // заполняем меню

    this.setOnShowing(
        event ->
            refreshResourceMenu(
                assignTaskMenu.getItems(), task, controller.getProject().getResourceList()));
  }
  public void initAdminLayout() {
    ObservableList<Menu> menus = menubar.getMenus();
    menus.clear();

    Menu menuMember = new Menu("Member");
    //        MenuItem addMemberItem = new MenuItem("add member");
    //        addMemberItem.setOnAction(new EventHandler<ActionEvent>() {
    //            @Override
    //            public void handle(ActionEvent event) {
    //                System.out.print("add member");
    //            }
    //        });
    MenuItem memberListItem = new MenuItem("member list");
    memberListItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(MEMBER_OVERVIEW);
          }
        });

    Menu menuBook = new Menu("Book");
    MenuItem allBookItem = new MenuItem("all publication");
    allBookItem.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            showContentView(ALL_PUBLICATION);
          }
        });

    menuBook.getItems().add(allBookItem);

    menuMember.getItems().add(memberListItem);
    //        menuMember.getItems().add(addMemberItem);

    menus.add(menuMember);
    menus.add(menuBook);
    showContentView(MEMBER_OVERVIEW);
  }
示例#22
0
  private MenuBar initMenu() {
    MenuBar bar = new MenuBar();
    bar.setPadding(new Insets(5));
    bar.setStyle("-fx-background-color: #3C4346;");

    Menu menuTasks = new Menu("Tasks");
    Menu menuPeople = new Menu("People");
    Menu menuShop = new Menu("Shop");

    MenuItem itemCashRegister = new MenuItem("Cash Register");
    MenuItem itemStocker = new MenuItem("Stocker");
    itemCashRegister.setOnAction(e -> checkoutWindow());
    itemStocker.setOnAction(e -> stockerWindow());

    MenuItem itemEmployees = new MenuItem("Employees");
    MenuItem itemCustomers = new MenuItem("Customers");
    MenuItem itemIceCream = new MenuItem("Ice Cream");
    itemIceCream.setOnAction(e -> IceCreamWindow());
    itemEmployees.setOnAction(e -> employeesWindow());
    itemCustomers.setOnAction(e -> customerWindow());

    MenuItem itemOverview = new MenuItem("Shop Overview");
    MenuItem itemEnd = new MenuItem("End Game");
    itemOverview.setOnAction(e -> shopoverviewWindow());
    itemEnd.setOnAction(e -> endGame());

    menuTasks.getItems().addAll(itemCashRegister, itemStocker, itemIceCream);
    menuPeople.getItems().addAll(itemEmployees, itemCustomers);
    menuShop.getItems().addAll(itemOverview, itemEnd);

    bar.getMenus().addAll(menuTasks, menuPeople, menuShop);

    return bar;
  }
示例#23
0
  @Override
  protected void addLeafToMenu(ShadowMenu sm, Menu m) {
    MenuItem item = new MenuItem(sm.getName());

    item.setOnAction(
        event -> {
          // ImageJFX.getThreadPool().submit(sm);

          //            context.inject(sm);
          threadService.run(sm);
        });
    m.getItems().add(item);
  }
  /*
   * sets up the functionality of the menubar
   */
  private void configureMenuBar() {

    fileMenu.getItems().addAll(fileNew, fileExit);

    menuBar.getMenus().addAll(fileMenu);

    this.setTop(menuBar);

    // sets up the user login
    fileNew.setOnAction(startNewAnalysis());

    // sets up the user exit
    fileExit.setOnAction(exitMenuClicked());
  }
示例#25
0
  public static void addKnownThemes(@NotNull final Menu menu) {
    Objects.requireNonNull(menu);

    themesMenu = menu;

    for (final String[] theme : KNOWN_THEMES) {
      final RadioMenuItem radioMenuItem = new RadioMenuItem(theme[0]);
      radioMenuItem.setUserData(theme[1]);
      radioMenuItem.setOnAction(themeHandler);
      radioMenuItem.setToggleGroup(toggleGroup);

      themesMenu.getItems().add(radioMenuItem);
    }

    Platform.runLater(ThemeManager::syncToggle);
  }
示例#26
0
  private void refreshList() {
    // If in offline mode
    if (connection == null) {
      searchWithScriptsMenu.setDisable(true);
    } else if (connection.getProperties() == null) {
      logger.warn("Connection's properties are null");
    } else if (connection.getProperties().getConfiguredProperties() == null) {
      logger.warn("Connection's configured properties are null");
    } else {
      final String directory =
          connection.getProperties().getConfiguredProperties().getSearchScripts();

      if (directory != null && !directory.isEmpty()) {
        scriptManager.addScripts(directory);
        onScriptListChange();
      }
    }
  }
  public MenuBarPrincipal() {
    Menu menuSistema = new Menu("Sistema");
    Menu menuCadastro = new Menu("Cadastro");
    Menu menuListar = new Menu("Listar");
    Menu menuAjuda = new Menu("Ajuda");

    MenuItem itemCadastrarRegra = new MenuItem("Cadastrar Regra...");
    itemCadastrarRegra.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent arg0) {
            try {
              TelaCadRegraController telaController =
                  new TelaCadRegraController(new TelaCadRegra());
              telaController.getView();
            } catch (SemVoosCadastradosException e) {
              Alert alertConf = new Alert(AlertType.ERROR);
              alertConf.setTitle("Sem Voos");
              alertConf.setHeaderText("Erro.");
              alertConf.setContentText(e.getMessage());
              alertConf.showAndWait();
            }
          }
        });

    MenuItem itemListarRegras = new MenuItem("Listar Regras...");
    itemListarRegras.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            Main.alterarTela(new TelaTabelaRegras());
          }
        });

    MenuItem itemInicio = new MenuItem("Inicio");
    itemInicio.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            Main.alterarTela(new TelaInicial());
          }
        });

    menuCadastro.getItems().addAll(itemCadastrarRegra);
    menuSistema.getItems().addAll(itemInicio);
    menuListar.getItems().addAll(itemListarRegras);

    getMenus().addAll(menuSistema, menuCadastro, menuListar, menuAjuda);
  }
示例#28
0
  private MenuBar createMenuBar() {
    MenuBar retval = new MenuBar();

    // create menus to put into menu bar
    Menu loginMenu = new Menu("Login");
    loginMenu.getItems().addAll(login());
    Menu custMenu = new Menu("Customer");
    custMenu.getItems().addAll(onlinePurchase(), retrieveCart(), reviewOrders(), exitApp());
    Menu adminMenu = new Menu("Administrator");
    adminMenu.getItems().addAll(maintainCatalogs(), maintainProducts());

    // add menus to menubar
    retval.getMenus().addAll(loginMenu, custMenu, adminMenu);
    return retval;
  }
  @FXML
  private void initialize() {

    if (Tela.usuarioAtivo.getGrad() == -1) {

      menuAluno.setDisable(true);
      menuProfessor.setDisable(true);

    } else if (Tela.usuarioAtivo.getGrad() == 0) {

      menuAluno.setDisable(true);
      menuCadastros.setDisable(true);
    } else {

      menuProfessor.setDisable(true);
      menuCadastros.setDisable(true);
    }
  }
  @Override
  public void postHandle(final FXComponentLayout layout) {

    layout.getRegisteredToolBar(ToolbarPosition.NORTH).addToCenter(new Button("WORKBENCH"));

    final JACPMenuBar menu = layout.getMenu();
    final Menu menuFile = new Menu("File");
    final Menu menuTests = new Menu("Tests");
    final Menu menuStyles = new Menu("Styles");
    menuFile.getItems().add(getHelpItem());
    // add style selection
    for (int i = 0; i < ApplicationLauncher.STYLES.length; i++) {
      menuStyles.getItems().add(getStyle(i));
    }

    menuTests.getItems().addAll(getTestMenuItems());
    menu.getMenus().addAll(menuFile, menuTests, menuStyles);
    // show windowButtons
    menu.registerWindowButtons();
  }