Пример #1
0
  @FXML
  private void initialize() {

    final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
    if (engine != null) {
      accountSeparatorTextField.setText(engine.getAccountSeparator());

      accountSeparatorTextField
          .textProperty()
          .addListener(
              (observable, oldValue, newValue) -> {
                if (newValue != null && newValue.length() > 0) {
                  engine.setAccountSeparator(newValue);
                }
              });
    } else {
      accountSeparatorTextField.setDisable(true);
    }

    useAccountingTermsCheckBox
        .selectedProperty()
        .bindBidirectional(Options.useAccountingTermsProperty());

    switch (AccountBalanceDisplayManager.getDisplayMode()) {
      case NONE:
        noAccountsRadioButton.setSelected(true);
        break;
      case REVERSE_CREDIT:
        creditAccountsRadioButton.setSelected(true);
        break;
      case REVERSE_INCOME_EXPENSE:
        incomeExpenseAccountsRadioButton.setSelected(true);
        break;
    }

    noAccountsRadioButton
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue) {
                AccountBalanceDisplayManager.setDisplayMode(AccountBalanceDisplayMode.NONE);
              }
            });

    creditAccountsRadioButton
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue) {
                AccountBalanceDisplayManager.setDisplayMode(
                    AccountBalanceDisplayMode.REVERSE_CREDIT);
              }
            });

    incomeExpenseAccountsRadioButton
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue) {
                AccountBalanceDisplayManager.setDisplayMode(
                    AccountBalanceDisplayMode.REVERSE_INCOME_EXPENSE);
              }
            });
  }