List of usage examples for javafx.beans.property SimpleStringProperty set
@Override public void set(String newValue)
From source file:de.ks.idnadrev.information.chart.ChartDataEditor.java
protected void onColumnsChanged(ListChangeListener.Change<? extends SimpleStringProperty> c) { while (c.next()) { List<? extends SimpleStringProperty> added = c.getAddedSubList(); List<? extends SimpleStringProperty> removed = c.getRemoved(); for (SimpleStringProperty column : added) { int columnIndex = columnHeaders.indexOf(column); addColumnConstraint();// w ww.j a v a2s . com TextField title = new TextField(); title.textProperty().bindBidirectional(column); title.getStyleClass().add("editorViewLabel"); MenuItem deleteColumnItem = new MenuItem(Localized.get("column.delete")); deleteColumnItem.setOnAction(e -> { columnHeaders.remove(column); }); title.setContextMenu(new ContextMenu(deleteColumnItem)); headers.add(title); dataContainer.add(title, columnIndex + COLUMN_OFFSET, 0); for (int i = 0; i < rows.size(); i++) { ChartRow chartRow = rows.get(i); SimpleStringProperty value = chartRow.getValue(columnIndex); TextField editor = createValueEditor(chartRow, i, columnIndex); editor.textProperty().bindBidirectional(value); } } for (SimpleStringProperty column : removed) { Optional<Integer> first = dataContainer.getChildren().stream() .filter(n -> GridPane.getRowIndex(n) == 0).map(n -> (TextField) n) .filter(t -> t.getText().equals(column.getValue())).map(t -> GridPane.getColumnIndex(t)) .findFirst(); if (first.isPresent()) { int columnIndex = first.get(); rows.forEach(r -> { SimpleStringProperty value = r.getValue(columnIndex); value.set(""); value.unbind(); }); List<Node> childrenToRemove = dataContainer.getChildren().stream() .filter(n -> GridPane.getColumnIndex(n) == columnIndex).collect(Collectors.toList()); dataContainer.getChildren().removeAll(childrenToRemove); dataContainer.getColumnConstraints().remove(dataContainer.getColumnConstraints().size() - 1); } } sortGridPane(); } }