Search in sources :

Example 11 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project jgnash by ccavanaugh.

the class AccountsViewController method initializeTreeTableView.

@SuppressWarnings("unchecked")
private void initializeTreeTableView() {
    // don't show the root
    treeTableView.setShowRoot(false);
    // required for editable columns
    treeTableView.setEditable(true);
    treeTableView.setTableMenuButtonVisible(true);
    treeTableView.setRowFactory(ttv -> getTreeTableRow());
    // force resize policy for better default appearance
    treeTableView.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
    // hide the horizontal scrollbar and prevent ghosting
    treeTableView.getStylesheets().addAll(StyleClass.HIDE_HORIZONTAL_CSS);
    final TreeTableColumn<Account, String> nameColumn = new TreeTableColumn<>(resources.getString("Column.Account"));
    nameColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue().getName()));
    final TreeTableColumn<Account, Integer> entriesColumn = new TreeTableColumn<>(resources.getString("Column.Entries"));
    entriesColumn.setCellValueFactory(param -> new SimpleIntegerProperty(param.getValue().getValue().getTransactionCount()).asObject());
    final TreeTableColumn<Account, BigDecimal> balanceColumn = new TreeTableColumn<>(resources.getString("Column.Balance"));
    balanceColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(AccountBalanceDisplayManager.convertToSelectedBalanceMode(param.getValue().getValue().getAccountType(), param.getValue().getValue().getTreeBalance())));
    balanceColumn.setCellFactory(cell -> new AccountCommodityFormatTreeTableCell());
    final TreeTableColumn<Account, BigDecimal> reconciledBalanceColumn = new TreeTableColumn<>(resources.getString("Column.ReconciledBalance"));
    reconciledBalanceColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(AccountBalanceDisplayManager.convertToSelectedBalanceMode(param.getValue().getValue().getAccountType(), param.getValue().getValue().getReconciledTreeBalance())));
    reconciledBalanceColumn.setCellFactory(cell -> new AccountCommodityFormatTreeTableCell());
    final TreeTableColumn<Account, String> currencyColumn = new TreeTableColumn<>(resources.getString("Column.Currency"));
    currencyColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue().getCurrencyNode().getSymbol()));
    final TreeTableColumn<Account, String> typeColumn = new TreeTableColumn<>(resources.getString("Column.Type"));
    typeColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue().getAccountType().toString()));
    final TreeTableColumn<Account, Integer> codeColumn = new TreeTableColumn<>(resources.getString("Column.Code"));
    codeColumn.setEditable(true);
    codeColumn.setCellValueFactory(param -> new SimpleIntegerProperty(param.getValue().getValue().getAccountCode()).asObject());
    codeColumn.setCellFactory(param -> new IntegerTreeTableCell<>());
    codeColumn.setOnEditCommit(event -> updateAccountCode(event.getRowValue().getValue(), event.getNewValue()));
    treeTableView.getColumns().addAll(nameColumn, codeColumn, entriesColumn, balanceColumn, reconciledBalanceColumn, currencyColumn, typeColumn);
    restoreColumnVisibility();
    installListeners();
}
Also used : RootAccount(jgnash.engine.RootAccount) Account(jgnash.engine.Account) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) BigDecimal(java.math.BigDecimal) TreeTableColumn(javafx.scene.control.TreeTableColumn) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 12 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project jgnash by ccavanaugh.

the class Options method createIntegerProperty.

private static SimpleIntegerProperty createIntegerProperty(final String name, final int defaultValue) {
    final SimpleIntegerProperty property = new SimpleIntegerProperty(null, name, p.getInt(name, defaultValue));
    property.addListener(integerChangeListener);
    return property;
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 13 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project VocabHunter by VocabHunter.

the class ProgressModel method updateWord.

public void updateWord(final WordState oldState, final WordState newState) {
    SimpleIntegerProperty oldValue = properties.get(oldState);
    SimpleIntegerProperty newValue = properties.get(newState);
    updateValue(oldValue, -1);
    updateValue(newValue, 1);
}
Also used : SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 14 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project cryptomator by cryptomator.

the class ChangePasswordController method initialize.

@Override
public void initialize() {
    BooleanBinding oldPasswordIsEmpty = oldPasswordField.textProperty().isEmpty();
    BooleanBinding newPasswordIsEmpty = newPasswordField.textProperty().isEmpty();
    BooleanBinding passwordsDiffer = newPasswordField.textProperty().isNotEqualTo(retypePasswordField.textProperty());
    changePasswordButton.disableProperty().bind(oldPasswordIsEmpty.or(newPasswordIsEmpty.or(passwordsDiffer)));
    passwordStrength.bind(EasyBind.map(newPasswordField.textProperty(), strengthRater::computeRate));
    passwordStrengthLevel0.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(0), strengthRater::getBackgroundWithStrengthColor));
    passwordStrengthLevel1.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(1), strengthRater::getBackgroundWithStrengthColor));
    passwordStrengthLevel2.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(2), strengthRater::getBackgroundWithStrengthColor));
    passwordStrengthLevel3.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(3), strengthRater::getBackgroundWithStrengthColor));
    passwordStrengthLevel4.backgroundProperty().bind(EasyBind.combine(passwordStrength, new SimpleIntegerProperty(4), strengthRater::getBackgroundWithStrengthColor));
    passwordStrengthLabel.textProperty().bind(EasyBind.map(passwordStrength, strengthRater::getStrengthDescription));
}
Also used : BooleanBinding(javafx.beans.binding.BooleanBinding) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty)

Example 15 with SimpleIntegerProperty

use of javafx.beans.property.SimpleIntegerProperty in project Retrospector by NonlinearFruit.

the class StatsTabController method updateFactoid.

private void updateFactoid() {
    // Selector Values
    String factoidType = factoidSelector.getValue();
    String category = categorySelector.getValue();
    // Colors
    int index = Arrays.asList(DataManager.getFactiodTypes()).indexOf(factoidType);
    chartAverageFactRating.setStyle("CHART_COLOR_1: " + colors[(index >= 0 ? colors.length - index : 0) % colors.length] + ";");
    chartNumOfFacts.setStyle("CHART_COLOR_1: " + colors[(index >= 0 ? colors.length - index : 0) % colors.length] + ";");
    // Data Mining - Vars
    final Integer threshold = 5;
    final Integer maxLabelLen = 13;
    Map<String, Integer> ratingFactsMap = new HashMap<>();
    Map<String, Integer> countReviewFactsMap = new HashMap<>();
    Map<String, Integer> numberFactsMap = new HashMap<>();
    InfoBlipAccumulator info = new InfoBlipAccumulator();
    // Data Mining - Calcs
    for (Media m : allMedia) {
        List<Factoid> factoids = new ArrayList<>(m.getFactoids());
        factoids.add(new Factoid("Title", m.getTitle()));
        factoids.add(new Factoid("Creator", m.getCreator()));
        factoids.add(new Factoid("Season", m.getSeasonId()));
        factoids.add(new Factoid("Episode", m.getEpisodeId()));
        factoids.add(new Factoid("Category", m.getCategory()));
        if (category.equals(m.getCategory()) || category.equals(universalCategory)) {
            boolean user = false;
            boolean fact = false;
            for (Review r : m.getReviews()) if (strooleans.stream().anyMatch(x -> x.getString().equalsIgnoreCase(r.getUser()) && x.isBoolean()))
                user = true;
            for (Factoid factiod : factoids) if (factiod.getTitle().equals(factoidType))
                fact = true;
            if (user && fact) {
                Set<String> contentTypes = new HashSet<>();
                info.accumulate(m);
                SimpleIntegerProperty rating = new SimpleIntegerProperty(0);
                SimpleIntegerProperty count = new SimpleIntegerProperty(0);
                for (Review r : m.getReviews()) if (strooleans.stream().anyMatch(x -> x.getString().equalsIgnoreCase(r.getUser()) && x.isBoolean())) {
                    rating.set(rating.get() + r.getRating().intValueExact());
                    count.set(count.get() + 1);
                    info.accumulate(r);
                }
                for (Factoid factoid : factoids) if (factoid.getTitle().equals(factoidType)) {
                    String f = factoid.getContent();
                    if (f.length() > maxLabelLen)
                        f = f.substring(0, maxLabelLen);
                    contentTypes.add(f);
                    numberFactsMap.put(f, numberFactsMap.getOrDefault(f, 0) + 1);
                    info.accumulate(factoid);
                }
                contentTypes.stream().forEach(content -> {
                    ratingFactsMap.put(content, ratingFactsMap.getOrDefault(content, 0) + rating.get());
                    countReviewFactsMap.put(content, countReviewFactsMap.getOrDefault(content, 0) + count.get());
                });
            }
        }
    }
    if (mediaContainer.getChildren().size() > 3)
        mediaContainer.getChildren().remove(2);
    mediaContainer.getChildren().add(2, info.getInfo());
    // Chart - # of Facts
    chartNumOfFacts.getData().clear();
    XYChart.Series<String, Number> dataNum = new XYChart.Series<>();
    dataNum.setName(factoidType);
    numberFactsMap.keySet().stream().sorted(new NaturalOrderComparator()).forEachOrdered(factoid -> {
        if (numberFactsMap.get(factoid) > 1)
            dataNum.getData().add(new XYChart.Data<>(factoid, numberFactsMap.get(factoid)));
    });
    if (dataNum.getData().size() < 1)
        dataNum.getData().add(new XYChart.Data<>("", 0));
    chartNumOfFacts.getData().add(dataNum);
    // Chart - Average Fact Rating
    chartAverageFactRating.getData().clear();
    XYChart.Series<String, Number> dataAve = new XYChart.Series<>();
    dataAve.setName(factoidType);
    ratingFactsMap.keySet().stream().sorted(new NaturalOrderComparator()).forEachOrdered(factoid -> {
        if (countReviewFactsMap.get(factoid) >= threshold)
            dataAve.getData().add(new XYChart.Data<>(factoid, ratingFactsMap.get(factoid) * 1.0 / countReviewFactsMap.get(factoid)));
    });
    if (dataAve.getData().size() < 1)
        dataAve.getData().add(new XYChart.Data<>("", 0));
    chartAverageFactRating.getData().add(dataAve);
}
Also used : Arrays(java.util.Arrays) Initializable(javafx.fxml.Initializable) ListView(javafx.scene.control.ListView) StackedBarChart(javafx.scene.chart.StackedBarChart) URL(java.net.URL) CheckBoxListCell(javafx.scene.control.cell.CheckBoxListCell) FXCollections(javafx.collections.FXCollections) HashMap(java.util.HashMap) Factoid(retrospector.model.Factoid) XYChart(javafx.scene.chart.XYChart) VBox(javafx.scene.layout.VBox) ArrayList(java.util.ArrayList) Media(retrospector.model.Media) HashSet(java.util.HashSet) LineChart(javafx.scene.chart.LineChart) ResourceBundle(java.util.ResourceBundle) Map(java.util.Map) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) NaturalOrderComparator(retrospector.util.NaturalOrderComparator) Circle(javafx.scene.shape.Circle) HBox(javafx.scene.layout.HBox) ObjectProperty(javafx.beans.property.ObjectProperty) Label(javafx.scene.control.Label) Review(retrospector.model.Review) Node(javafx.scene.Node) Set(java.util.Set) Rectangle(javafx.scene.shape.Rectangle) CategoryAxis(javafx.scene.chart.CategoryAxis) BarChart(javafx.scene.chart.BarChart) Collectors(java.util.stream.Collectors) ChoiceBox(javafx.scene.control.ChoiceBox) TAB(retrospector.fxml.CoreController.TAB) Platform(javafx.application.Platform) FXML(javafx.fxml.FXML) Text(javafx.scene.text.Text) PieChart(javafx.scene.chart.PieChart) Stroolean(retrospector.util.Stroolean) List(java.util.List) ChronoUnit(java.time.temporal.ChronoUnit) LocalDate(java.time.LocalDate) ObservableList(javafx.collections.ObservableList) NumberAxis(javafx.scene.chart.NumberAxis) DataManager(retrospector.model.DataManager) Shape(javafx.scene.shape.Shape) HashMap(java.util.HashMap) Media(retrospector.model.Media) ArrayList(java.util.ArrayList) Review(retrospector.model.Review) NaturalOrderComparator(retrospector.util.NaturalOrderComparator) XYChart(javafx.scene.chart.XYChart) Factoid(retrospector.model.Factoid) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) HashSet(java.util.HashSet)

Aggregations

SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)25 IntegerProperty (javafx.beans.property.IntegerProperty)9 PriceFeedService (bisq.core.provider.price.PriceFeedService)4 BSFormatter (bisq.desktop.util.BSFormatter)4 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)4 FXML (javafx.fxml.FXML)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3 Chunk (difflib.Chunk)3 Delta (difflib.Delta)3 TYPE (difflib.Delta.TYPE)3 IOException (java.io.IOException)3 StringProperty (javafx.beans.property.StringProperty)3 ObservableValue (javafx.beans.value.ObservableValue)3 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)3 ImageView (javafx.scene.image.ImageView)3 OfferBook (bisq.desktop.main.offer.offerbook.OfferBook)2 OfferBookListItem (bisq.desktop.main.offer.offerbook.OfferBookListItem)2 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)2 Binding (com.canoo.platform.core.functional.Binding)2