control.suggestionsCellFactoryProperty().addListener((o, oldVal, newVal) -> { if (newVal != null) { suggestionList.setCellFactory(newVal); suggestionList.setCellFactory(control.getSuggestionsCellFactory());
@Override protected Node createUndecoratedEditor() { final VBox container = new VBox(); final ListView<String> listView = new ListView<>(strings); listView.setCellFactory(view -> new EnumCell(strings)); listView.setEditable(true); listView.setMaxHeight(USE_PREF_SIZE); listView.setPrefHeight(LIST_HEIGHT); final HBox controls = new HBox(SPACING); controls.setAlignment(Pos.CENTER); controls.getChildren().addAll( addButton(listView), removeButton(listView), populateButton(listView) ); container.setSpacing(SPACING); container.getChildren().addAll(listView, controls); hideShowBehaviour(container); return container; }
@Override protected void beforeParentInit() { xpathExpressionArea.setSyntaxHighlighter(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); initialiseVersionSelection(); expressionTitledPane.titleProperty().bind(xpathVersionUIProperty.map(v -> "XPath Expression (" + v + ")")); xpathResultListView.setCellFactory(v -> new XpathViolationListCell()); exportXpathToRuleButton.setOnAction(e -> showExportXPathToRuleWizard()); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .map(TextAwareNodeWrapper::getNode) .subscribe(parent::onNodeItemSelected); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) // Reevaluate XPath anytime the expression or the XPath version changes .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); }
@Override public void initialize(URL location, ResourceBundle resources) { BooleanBinding noSelection = fileListView.getSelectionModel().selectedItemProperty().isNull(); removeFileButton.disableProperty().bind(noSelection); moveItemUpButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(0))); // we can't just map the val because we need an ObservableNumberValue IntegerBinding lastIndexBinding = Bindings.createIntegerBinding(() -> fileListView.getItems().size() - 1, Val.wrap(fileListView.itemsProperty()).flatMap(LiveList::sizeOf)); moveItemDownButton.disableProperty().bind(noSelection.or(fileListView.getSelectionModel().selectedIndexProperty().isEqualTo(lastIndexBinding))); fileListView.setCellFactory(DesignerUtil.simpleListCellFactory(File::getName, File::getAbsolutePath)); selectFilesButton.setOnAction(e -> onSelectFileClicked()); removeFileButton.setOnAction(e -> onRemoveFileClicked()); moveItemUpButton.setOnAction(e -> moveUp()); moveItemDownButton.setOnAction(e -> moveDown()); }
lstProjectProblems.setCellFactory((ListView<Issue> param) -> new ListCell<Issue>() { @Override protected void updateItem(Issue item, boolean empty) {
public static <T> void setWaitingCellFactory(ListView<T> listView, T waitingValue, Function<T, String> itemToString) { Objects.requireNonNull(listView); Objects.requireNonNull(waitingValue); listView.setCellFactory(param -> new TextFieldListCell<T>() { @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); GseUtil.updateItem(this, item, empty, waitingValue, itemToString); } }); }
/** * Setup a list * * @param listView * the list view * @param items * the items * @param labelPropertyExtractor * the extractor * @return the list view * @since 2.3.0 */ public static <T> ListView<T> setupList(ListView<T> listView, ObservableList<T> items, Function<T, StringExpression> labelPropertyExtractor) { listView.setCellFactory(v -> new ListCell<T>() { @Override protected void updateItem(T item, boolean empty) { super.updateItem(item, empty); textProperty().unbind(); if (item != null && !empty) { textProperty().bind(labelPropertyExtractor.apply(item)); } else { setText(null); } } }); listView.setItems(items); return listView; } }
public class ListViewController { @FXML private ResourceBundle resources; @FXML private URL location; @FXML private ListView listView; private List<String> stringList = new ArrayList<>(5); private ObservableList observableList = FXCollections.observableArrayList(); public void setListView(){ stringList.add("String 1"); stringList.add("String 2"); stringList.add("String 3"); stringList.add("String 4"); observableList.setAll(stringList); listView.setItems(observableList); listView.setCellFactory( new Callback<ListView<String>, javafx.scene.control.ListCell<String>>() { @Override public ListCell<String> call(ListView<String> listView) { return new ListViewCell(); } }); } @FXML void initialize() { assert listView != null : "fx:id=\"listView\" was not injected: check your FXML file 'CustomList.fxml'."; setListView(); } }//ListViewController
/** * Set the selectedCallbackFuntion * * @param selectedCallbackFuntion the selectedCallbackFuntion to set */ @SuppressWarnings("rawtypes") public void setSelectedCallbackFuntion(Function<T, Boolean> selectedCallbackFuntion) { this.itemSelectedFunction = selectedCallbackFuntion; proposalListView.setCellFactory(param -> { final VLAutoCompleteListCell<T> cell = (VLAutoCompleteListCell<T>) ReflectionUIUtils.newInstance(proposalListCell); cell.setSelectedCallBack(t -> { final T item = (T) t.getItem(); proposalListView.getItems().remove(item); selectedCallbackFuntion.apply(item); return true; }); return cell; }); }
public void refresh() { // unless we do ALL of this - the custom cell rendering has problems in javafx // and starts duplicating the last row for some reason, spent a lot of time on this :( listView = new ListView(); listView.setItems(FXCollections.observableArrayList(units)); listView.setCellFactory(lv -> new FeatureOutlineCell()); scrollPane.setContent(listView); listView.getSelectionModel() .selectedIndexProperty() .addListener((o, prev, value) -> session.setSelectedScenario(value.intValue())); }
public TaskProgressViewSkin(TaskProgressView<T> monitor) { super(monitor); BorderPane borderPane = new BorderPane(); borderPane.getStyleClass().add("box"); // list view ListView<T> listView = new ListView<>(); listView.setPrefSize(500, 400); listView.setPlaceholder(new Label("No tasks running")); listView.setCellFactory(param -> new TaskCell()); listView.setFocusTraversable(false); Bindings.bindContent(listView.getItems(), monitor.getTasks()); borderPane.setCenter(listView); getChildren().add(listView); }
this.listView = new ListView<>(); this.listView.getStyleClass().add("efx-perspective-list"); //$NON-NLS-1$ this.listView.setCellFactory(PerspectiveCell::new); List<MPerspective> list = this.modelService.findElements(this.window, null, MPerspective.class, null); this.listView.setItems(
@Override protected void setupDialogControls() { cbSpeedMode.getItems().addAll(List.of(SpeedModeItem.values())); liSportSubtypes.setCellFactory(list -> new NameableListCell<>()); liEquipments.setCellFactory(list -> new NameableListCell<>()); setupBinding(); setupValidation(); updateSportSubtypeList(); updateEquipmentList(); // start Sport Subtype edit dialog on double clicks in list liSportSubtypes.setOnMouseClicked(event -> { if (event.getClickCount() > 1) { onEditSportSubtype(null); } }); // start Equipment edit dialog on double clicks in list liEquipments.setOnMouseClicked(event -> { if (event.getClickCount() > 1) { onEditEquipment(null); } }); }
public AutoCompletePopupSkin(AutoCompletePopup<T> control){ this.control = control; suggestionList = new ListView<>(control.getSuggestions()); suggestionList.getStyleClass().add(AutoCompletePopup.DEFAULT_STYLE_CLASS); suggestionList.getStylesheets().add(AutoCompletionBinding.class .getResource("autocompletion.css").toExternalForm()); //$NON-NLS-1$ /** * Here we bind the prefHeightProperty to the minimum height between the * max visible rows and the current items list. We also add an arbitrary * 5 number because when we have only one item we have the vertical * scrollBar showing for no reason. */ suggestionList.prefHeightProperty().bind( Bindings.min(control.visibleRowCountProperty(), Bindings.size(suggestionList.getItems())) .multiply(LIST_CELL_HEIGHT).add(18)); suggestionList.setCellFactory(TextFieldListCell.forListView(control.getConverter())); //Allowing the user to control ListView width. suggestionList.prefWidthProperty().bind(control.prefWidthProperty()); suggestionList.maxWidthProperty().bind(control.maxWidthProperty()); suggestionList.minWidthProperty().bind(control.minWidthProperty()); registerEventListener(); }
control.suggestionsCellFactoryProperty().addListener((o, oldVal, newVal) -> { if (newVal != null) { suggestionList.setCellFactory(newVal); suggestionList.setCellFactory(control.getSuggestionsCellFactory());
@Override protected void setupDialogControls() { // setup SportType list liSportTypes.setCellFactory(list -> new SportTypeListCell()); updateSportTypeList(); // start SportType edit dialog on double clicks in list liSportTypes.setOnMouseClicked(event -> { if (event.getClickCount() > 1) { onEditSportType(null); } }); // Edit and Delete buttons must be disabled when there is no selection in list final BooleanBinding selected = Bindings.isNull(liSportTypes.getSelectionModel().selectedItemProperty()); btEdit.disableProperty().bind(selected); btDelete.disableProperty().bind(selected); }
private void buildListViewTab(Tab tab) { GridPane grid = new GridPane(); grid.setPadding(new Insets(5, 5, 5, 5)); grid.setHgap(5); grid.setVgap(5); // create the listview final ListView<TestPerson> listView = new ListView<TestPerson>(); listView.setItems(data); // set the cell factory Callback<TestPerson, ObservableValue<Boolean>> getProperty = new Callback<TestPerson, ObservableValue<Boolean>>() { @Override public BooleanProperty call(TestPerson person) { // given a person, we return the property that represents // whether or not they are invited. We can then bind to this // bidirectionally. return person.telecommuterProperty(); } }; listView.setCellFactory(CheckBoxListCell.forListView(getProperty)); grid.add(listView, 0, 0); GridPane.setVgrow(listView, Priority.ALWAYS); GridPane.setHgrow(listView, Priority.ALWAYS); tab.setContent(grid); }
this.proposalList.setCellFactory((v) -> new SimpleListCell<ICompletionProposal>(label,graphic,css)); p.setCenter(this.proposalList); this.stage.getScene().setRoot(p);
container.setCellFactory(param -> { final ListCell<CompactListElement<E>> listCell = new ListCell<CompactListElement<E>>() { @Override
container.setCellFactory(param -> { final ListCell<DetailsListElement<E>> listCell = new ListCell<DetailsListElement<E>>() { @Override