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();
}
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;
}
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);
}
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));
}
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);
}
Aggregations