Esempio n. 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);
  }
  public Controller(View view) {
    this.root = view;
    root.fold.setOnAction(
        (value) ->
            root.dotBracket.setText((new Nussinov(root.sequence.getText())).getBracketNotation()));

    root.draw
        .disableProperty()
        .bind(
            Bindings.or(
                root.dotBracket.textProperty().isEmpty(), root.sequence.textProperty().isEmpty()));
    root.draw.setOnAction(
        (value) -> {
          if (root.sequence.getText().length() != root.dotBracket.getText().length())
            View.showErrorMessage("Sequence length not equal to Structure length!");
          else {
            if (root.animate.isSelected()) animateDrawing();
            else simpleDrawing();
          }
        });
  }