Search in sources :

Example 6 with SimpleStringProperty

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;
    });
}
Also used : LocalDateTime(java.time.LocalDateTime) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) TableColumn(javafx.scene.control.TableColumn) LocalDate(java.time.LocalDate) BigDecimal(java.math.BigDecimal) Transaction(jgnash.engine.Transaction) InvestmentTransaction(jgnash.engine.InvestmentTransaction)

Example 7 with SimpleStringProperty

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("");
        }
    });
}
Also used : Button(javafx.scene.control.Button) Node(javafx.scene.Node) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) File(java.io.File) FXML(javafx.fxml.FXML)

Example 8 with SimpleStringProperty

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"));
        }
    });
}
Also used : CellDataFeatures(javafx.scene.control.TableColumn.CellDataFeatures) ObservableValue(javafx.beans.value.ObservableValue) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Map(java.util.Map) HashMap(java.util.HashMap) FXML(javafx.fxml.FXML)

Example 9 with SimpleStringProperty

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();
}
Also used : Random(java.util.Random) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Scene(javafx.scene.Scene) TableColumn(javafx.scene.control.TableColumn) MergedTableView(com.kyj.fx.voeditor.visual.component.grid.MergedTableView)

Example 10 with SimpleStringProperty

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;
}
Also used : SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty)

Aggregations

SimpleStringProperty (javafx.beans.property.SimpleStringProperty)40 StringProperty (javafx.beans.property.StringProperty)14 TableColumn (javafx.scene.control.TableColumn)12 FXML (javafx.fxml.FXML)9 BigDecimal (java.math.BigDecimal)7 Button (javafx.scene.control.Button)7 IOException (java.io.IOException)5 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)5 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)5 ObservableValue (javafx.beans.value.ObservableValue)5 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 List (java.util.List)4 Map (java.util.Map)4 Label (javafx.scene.control.Label)4 CellDataFeatures (javafx.scene.control.TableColumn.CellDataFeatures)4 ImageView (javafx.scene.image.ImageView)4 Test (org.testng.annotations.Test)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3