use of javafx.beans.property.SimpleStringProperty in project jgnash by ccavanaugh.
the class InvestmentRegisterTableController method buildTable.
@Override
protected void buildTable() {
final String[] columnNames = RegisterFactory.getColumnNames(accountProperty().get().getAccountType());
final TableColumn<Transaction, LocalDate> dateColumn = new TableColumn<>(columnNames[0]);
dateColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getLocalDate()));
dateColumn.setCellFactory(cell -> new TransactionDateTableCell());
tableView.getColumns().add(dateColumn);
final TableColumn<Transaction, LocalDateTime> dateTimeColumn = new TableColumn<>(columnNames[1]);
dateTimeColumn.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getTimestamp()));
dateTimeColumn.setCellFactory(cell -> new TransactionDateTimeTableCell());
tableView.getColumns().add(dateTimeColumn);
final TableColumn<Transaction, String> typeColumn = new TableColumn<>(columnNames[2]);
typeColumn.setCellValueFactory(param -> new TransactionTypeWrapper(param.getValue()));
typeColumn.setCellFactory(cell -> new TransactionStringTableCell());
tableView.getColumns().add(typeColumn);
final TableColumn<Transaction, String> investmentColumn = new TableColumn<>(columnNames[3]);
investmentColumn.setCellValueFactory(param -> new TransactionSymbolWrapper(param.getValue()));
investmentColumn.setCellFactory(cell -> new TransactionStringTableCell());
tableView.getColumns().add(investmentColumn);
final TableColumn<Transaction, String> memoColumn = new TableColumn<>(columnNames[4]);
memoColumn.setCellValueFactory(param -> new MemoWrapper(param.getValue()));
memoColumn.setCellFactory(cell -> new TransactionStringTableCell());
tableView.getColumns().add(memoColumn);
final TableColumn<Transaction, String> reconciledColumn = new TableColumn<>(columnNames[5]);
reconciledColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getReconciled(account.getValue()).toString()));
reconciledColumn.setCellFactory(cell -> new TransactionStringTableCell());
tableView.getColumns().add(reconciledColumn);
final TableColumn<Transaction, BigDecimal> quantityColumn = new TableColumn<>(columnNames[6]);
quantityColumn.setCellValueFactory(param -> new QuantityProperty(param.getValue()));
quantityColumn.setCellFactory(cell -> new InvestmentTransactionQuantityTableCell());
tableView.getColumns().add(quantityColumn);
final TableColumn<Transaction, BigDecimal> priceColumn = new TableColumn<>(columnNames[7]);
priceColumn.setCellValueFactory(param -> new PriceProperty(param.getValue()));
priceColumn.setCellFactory(cell -> new TransactionCommodityFormatTableCell(CommodityFormat.getShortNumberFormat(account.get().getCurrencyNode())));
tableView.getColumns().add(priceColumn);
final TableColumn<Transaction, BigDecimal> netColumn = new TableColumn<>(columnNames[8]);
netColumn.setCellValueFactory(param -> new AmountProperty(param.getValue()));
netColumn.setCellFactory(cell -> new TransactionCommodityFormatTableCell(CommodityFormat.getShortNumberFormat(account.get().getCurrencyNode())));
tableView.getColumns().add(netColumn);
tableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
tableViewManager.setColumnFormatFactory(param -> {
if (param == netColumn) {
return CommodityFormat.getFullNumberFormat(accountProperty().getValue().getCurrencyNode());
} else if (param == quantityColumn) {
return getQuantityColumnFormat();
} else if (param == priceColumn) {
return CommodityFormat.getShortNumberFormat(accountProperty().getValue().getCurrencyNode());
} else if (param == dateColumn) {
return DateUtils.getShortDateFormatter().toFormat();
} else if (param == dateTimeColumn) {
return DateUtils.getShortDateTimeFormatter().toFormat();
}
return null;
});
}
use of javafx.beans.property.SimpleStringProperty in project Gargoyle by callakrsos.
the class ButtonStyleViewComposite method initialize.
@FXML
public void initialize() {
loadButtonStyles();
colSkinName.setCellValueFactory(param -> {
return new SimpleStringProperty(param.getValue().getName());
});
tbSkins.getSelectionModel().selectedItemProperty().addListener((oba, o, n) -> {
File selectedItem = n;
if (selectedItem != null && selectedItem.exists()) {
String readFile = FileUtil.readFile(selectedItem, true, null);
txtStyle.setText(readFile);
try {
List<Node> findAllByNodes = FxUtil.findAllByNodes(borPreview, node -> node instanceof Button);
String className = String.format("%s", selectedItem.getName().replaceAll(".css", ""));
LOGGER.debug("{}", className);
findAllByNodes.forEach(btn -> {
btn.getStyleClass().add("button");
btn.getStyleClass().add(className);
});
borPreview.getStylesheets().clear();
borPreview.getStylesheets().add(selectedItem.toURI().toURL().toExternalForm());
borPreview.applyCss();
} catch (Exception e) {
e.printStackTrace();
}
} else {
txtStyle.setText("");
}
});
}
use of javafx.beans.property.SimpleStringProperty in project Gargoyle by callakrsos.
the class ColumnExample3Con method initialize.
@FXML
public void initialize() {
tableView.setEditable(true);
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드1");
hashMap.put("commCodeNm", "데이터 1");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드1");
hashMap.put("commCodeNm", "데이터 223492342309842402394823049238420942384029343809248420934809428409238409238423094823049");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드3");
hashMap.put("commCodeNm", "데이터 3");
tableView.getItems().add(hashMap);
}
{
Map<String, String> hashMap = new HashMap<String, String>();
hashMap.put("commCode", "코드4");
hashMap.put("commCodeNm", "데이터 4");
tableView.getItems().add(hashMap);
}
colCode.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> param) {
return new SimpleStringProperty(param.getValue().get("commCode"));
}
});
colCodeNm.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Map<String, String>, String>, ObservableValue<String>>() {
@Override
public ObservableValue<String> call(CellDataFeatures<Map<String, String>, String> param) {
return new SimpleStringProperty(param.getValue().get("commCodeNm"));
}
});
}
use of javafx.beans.property.SimpleStringProperty in project Gargoyle by callakrsos.
the class MergedTableViewExam method start.
/**
* @inheritDoc
*/
@Override
public void start(Stage primaryStage) throws Exception {
MergedTableView<String> root = new MergedTableView<>();
TableColumn<String, String> e = new TableColumn<>("sample");
e.setCellValueFactory(param -> {
String value = param.getValue();
return new SimpleStringProperty(value);
});
e.setCellFactory(MergedTextFieldTableCell.forTableColumn());
root.getColumns().add(e);
Random random = new Random(10);
for (int i = 0; i < 100; i++) {
root.getItems().add(String.valueOf(random.nextInt(10)));
}
//
primaryStage.setScene(new Scene(root));
primaryStage.show();
}
use of javafx.beans.property.SimpleStringProperty in project fx2048 by brunoborges.
the class Board method restoreSession.
/*
Once we have confirmation
*/
public boolean restoreSession(Map<Location, Tile> gameGrid) {
timerPause.stop();
restoreGame.set(false);
doClearGame();
timer.stop();
StringProperty sTime = new SimpleStringProperty("");
int score = sessionManager.restoreSession(gameGrid, sTime);
if (score >= 0) {
gameScoreProperty.set(score);
// check tiles>=2048
gameWonProperty.set(false);
gameGrid.forEach((l, t) -> {
if (t != null && t.getValue() >= GameManager.FINAL_VALUE_TO_WIN) {
gameWonProperty.removeListener(wonListener);
gameWonProperty.set(true);
gameWonProperty.addListener(wonListener);
}
});
if (!sTime.get().isEmpty()) {
time = LocalTime.now().minusNanos(new Long(sTime.get()));
}
timer.play();
return true;
}
// not session found, restart again
doResetGame();
return false;
}
Aggregations