List of usage examples for javafx.beans.binding StringBinding StringBinding
StringBinding
From source file:org.ihtsdo.otf.tcc.ddo.TimeReference.java
public SimpleObjectProperty<FastDateFormat> formatterProperty() { if (formatterProperty == null) { formatterProperty = new SimpleObjectProperty<>(this, "formatterProperty", getFormatter()); timeTextBinding = new StringBinding() { {/*from w ww . java 2 s.c o m*/ super.bind(timeProperty(), formatterProperty); } @Override protected String computeValue() { return TimeHelper.formatDate(timeProperty.get(), formatterProperty.get()); } }; } return formatterProperty; }
From source file:org.sleuthkit.autopsy.timeline.ui.listvew.ListTimeline.java
@FXML @NbBundle.Messages({ "# {0} - the number of events", "ListTimeline.eventCountLabel.text={0} events" }) void initialize() { assert eventCountLabel != null : "fx:id=\"eventCountLabel\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert table != null : "fx:id=\"table\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert idColumn != null : "fx:id=\"idColumn\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert dateTimeColumn != null : "fx:id=\"dateTimeColumn\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert descriptionColumn != null : "fx:id=\"descriptionColumn\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert typeColumn != null : "fx:id=\"typeColumn\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS assert knownColumn != null : "fx:id=\"knownColumn\" was not injected: check your FXML file 'ListViewPane.fxml'."; //NON-NLS scrollInrementComboBox.setButtonCell(new ChronoFieldListCell()); scrollInrementComboBox.setCellFactory(comboBox -> new ChronoFieldListCell()); scrollInrementComboBox.getItems().setAll(SCROLL_BY_UNITS); scrollInrementComboBox.getSelectionModel().select(ChronoField.YEAR); ActionUtils.configureButton(new ScrollToFirst(), firstButton); ActionUtils.configureButton(new ScrollToPrevious(), previousButton); ActionUtils.configureButton(new ScrollToNext(), nextButton); ActionUtils.configureButton(new ScrollToLast(), lastButton); //override default row with one that provides context menus table.setRowFactory(tableView -> new EventRow()); //remove idColumn (can be restored for debugging). table.getColumns().remove(idColumn); //// set up cell and cell-value factories for columns dateTimeColumn.setCellValueFactory(CELL_VALUE_FACTORY); dateTimeColumn.setCellFactory(col -> new TextEventTableCell( singleEvent -> TimeLineController.getZonedFormatter().print(singleEvent.getStartMillis()))); descriptionColumn.setCellValueFactory(CELL_VALUE_FACTORY); descriptionColumn.setCellFactory(//from w ww.j av a 2s .c o m col -> new TextEventTableCell(singleEvent -> singleEvent.getDescription(DescriptionLoD.FULL))); typeColumn.setCellValueFactory(CELL_VALUE_FACTORY); typeColumn.setCellFactory(col -> new EventTypeCell()); knownColumn.setCellValueFactory(CELL_VALUE_FACTORY); knownColumn.setCellFactory(col -> new TextEventTableCell(singleEvent -> singleEvent.getKnown().getName())); taggedColumn.setCellValueFactory(CELL_VALUE_FACTORY); taggedColumn.setCellFactory(col -> new TaggedCell()); hashHitColumn.setCellValueFactory(CELL_VALUE_FACTORY); hashHitColumn.setCellFactory(col -> new HashHitCell()); //bind event count label to number of items in the table eventCountLabel.textProperty().bind(new StringBinding() { { bind(table.getItems()); } @Override protected String computeValue() { return Bundle.ListTimeline_eventCountLabel_text(table.getItems().size()); } }); table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); table.getSelectionModel().getSelectedItems().addListener((Observable observable) -> { //keep the selectedEventsIDs in sync with the table's selection model, via getRepresentitiveEventID(). selectedEventIDs.setAll(table.getSelectionModel().getSelectedItems().stream().filter(Objects::nonNull) .map(CombinedEvent::getRepresentativeEventID).collect(Collectors.toSet())); }); }