Ejemplo n.º 1
0
  public static RegisterStage getRegisterStage(@NotNull final Account account) {

    // look for an existing stage first
    for (final RegisterStage registerStage : registerStageListProperty) {
      if (registerStage.accountProperty.get().equals(account)) {
        registerStage.requestFocus();
        return registerStage;
      }
    }

    return new RegisterStage(account);
  }
Ejemplo n.º 2
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);
  }