if (sublistsProperty.get().size() == 1) { this.getSelectionModel() .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(this)); .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(item)));
@Override protected void beforeParentInit() { xpathAttributesListView.setPlaceholder(new Label("No available attributes")); EventStreams.valuesOf(scopeHierarchyTreeView.getSelectionModel().selectedItemProperty()) .filter(Objects::nonNull) .map(TreeItem::getValue) .filterMap(o -> o instanceof NameDeclaration, o -> (NameDeclaration) o) .filter(nd -> !Objects.equals(nd.getNode(), selectedNode)) .subscribe(declaration -> Platform.runLater(() -> parent.onNodeItemSelected(declaration.getNode(), true))); scopeHierarchyTreeView.setCellFactory(view -> new ScopeHierarchyTreeCell()); hideCommonAttributesProperty() .values() .distinct() .subscribe(show -> displayAttributes(selectedNode)); }
FlowHandler contentFlowHandler = (FlowHandler) context.getRegisteredObject("ContentFlowHandler"); sideList.propagateMouseEventsToParent(); sideList.getSelectionModel().selectedItemProperty().addListener((o, oldVal, newVal) -> { new Thread(()->{ Platform.runLater(()->{
setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); setFitToHeight(true); treeView.getSelectionModel().selectedItemProperty().addListener(observable -> { TreeItem selectedItem = treeView.getSelectionModel().getSelectedItem(); TreeItem temp = selectedItem;
@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.getSelectionModel().selectedItemProperty().addListener((ov, oldValue, newValue) -> { txtDescription.getChildren().clear(); if( newValue != null ) {
@Override protected void beforeParentInit() { treeViewWrapper = new TreeViewWrapper<>(astTreeView); astTreeView.setCellFactory(treeView -> new ASTTreeCell(parent)); initializeLanguageSelector(); // languageVersionProperty() must be initialized languageVersionProperty().values() .filterMap(Objects::nonNull, LanguageVersion::getLanguage) .distinct() .subscribe(this::updateSyntaxHighlighter); languageVersionProperty().values() .filter(Objects::nonNull) .map(LanguageVersion::getShortName) .map(lang -> "Source Code (" + lang + ")") .subscribe(editorTitledPane::setTitle); EventStreams.valuesOf(astTreeView.getSelectionModel().selectedItemProperty()) .filterMap(Objects::nonNull, TreeItem::getValue) .subscribe(parent::onNodeItemSelected); codeEditorArea.plainTextChanges() .filter(t -> !t.isIdentity()) .successionEnds(AST_REFRESH_DELAY) // Refresh the AST anytime the text, classloader, or language version changes .or(auxclasspathClassLoader.changes()) .or(languageVersionProperty().changes()) .subscribe(tick -> { // Discard the AST if the language version has changed tick.ifRight(c -> astTreeView.setRoot(null)); Platform.runLater(parent::refreshAST); }); codeEditorArea.setParagraphGraphicFactory(lineNumberFactory()); }
list.stream().filter( e -> e.isToBeRendered()).collect(Collectors.toList())) ); this.listView.getSelectionModel().selectedItemProperty().addListener((o, ol, ne) -> { if (this.selectionConsumer != null) { this.selectionConsumer.accept(ne);
@Override protected void drawStepContent() { super.drawStepContent(); listViewWidget.setItems(FXCollections.observableArrayList(menuItems)); if (defaultValue != null) { int idx = menuItems.indexOf(defaultValue); if (idx != -1) { listViewWidget.getSelectionModel().select(idx); listViewWidget.getFocusModel().focus(idx); listViewWidget.scrollTo(idx); } if (StringUtils.isBlank(defaultValue)) { setNextButtonEnabled(false); listViewWidget.getSelectionModel().selectedItemProperty() .addListener((observable, oldValue, newValue) -> { if (StringUtils.isBlank(newValue)) { setNextButtonEnabled(false); } else { setNextButtonEnabled(true); } }); } } this.addToContentPane(listViewWidget); }
treeView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<TreeItem<DisplayWorkflowClassesModel>>() { @Override public void changed(ObservableValue<? extends TreeItem<DisplayWorkflowClassesModel>> observable, copy.disableProperty().bind(treeView.getSelectionModel().selectedItemProperty().isNull()); contextMenu.getItems().add(copy); treeView.setContextMenu(contextMenu);
private void initTreeView() { final TreeItem<String> root = new TreeItem<String>("Empty User"); root.setGraphic(ViewUtilities.iconSetter(Material.PERSON, IconDim.SMALL)); this.treeView.setRoot(root); this.treeView.getSelectionModel().selectedItemProperty().addListener((v, oldValue, newValue) -> { if (newValue != null && this.treeView.getTreeItemLevel(newValue) == 2) { this.drawSavedGestureOnCanvas(newValue.getParent(), newValue.getParent().getChildren().indexOf(newValue)); } }); }
/** * Setup of the binding between the view model and the UI controls. */ private void setupBinding() { tfName.textProperty().bindBidirectional(sportTypeViewModel.name); cbRecordDistance.selectedProperty().bindBidirectional(sportTypeViewModel.recordDistance); cbSpeedMode.valueProperty().bindBidirectional(sportTypeViewModel.speedMode); cpColor.valueProperty().bindBidirectional(sportTypeViewModel.color); // the record distance mode can only be changed, when no exercises exists for // this sport type => disable checkbox, when such exercises were found Optional<Exercise> oExercise = document.getExerciseList().stream() .filter(exercise -> exercise.getSportType().getId() == sportTypeViewModel.id) .findFirst(); cbRecordDistance.setDisable(oExercise.isPresent()); // speed mode can only be configured when distance is being recorded cbSpeedMode.disableProperty().bind(cbRecordDistance.selectedProperty().not()); // Edit and Delete buttons must be disabled when there is no selection in the appropriate list final BooleanBinding sportSubtypeSelected = Bindings.isNull( liSportSubtypes.getSelectionModel().selectedItemProperty()); btSportSubtypeEdit.disableProperty().bind(sportSubtypeSelected); btSportSubtypeDelete.disableProperty().bind(sportSubtypeSelected); final BooleanBinding equipmentSelected = Bindings.isNull( liEquipments.getSelectionModel().selectedItemProperty()); btEquipmentEdit.disableProperty().bind(equipmentSelected); btEquipmentDelete.disableProperty().bind(equipmentSelected); }
if (sublistsProperty.get().size() == 1) { this.getSelectionModel() .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(this)); .selectedItemProperty() .addListener((o, oldVal, newVal) -> clearSelection(item)));
@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); }
testTree.getSelectionModel().selectedItemProperty() .addListener((ObservableValue obs, Object oldValue, Object newValue) -> { TreeItem<GenericModel<?>> selectedItem = (TreeItem<GenericModel<?>>) newValue;
/** * @{inheritedDoc} */ @Override public void postProcess() { super.postProcess(); AbstractTableStructure table = (AbstractTableStructure) processedElement(); if (table.getTableStructure() instanceof TreeTableView) { treeTableView = (TreeTableView) table.getTableStructure(); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); treeTableView.getSelectionModel().selectedItemProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> { LazyTreeItem item = (LazyTreeItem) newValue; selectedElementProperty().set(item.getValue()); }); } else if (table.getTableStructure() instanceof TreeView) { treeView = (TreeView) table.getTableStructure(); treeView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); treeView.getSelectionModel().selectedItemProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> { lastSelectedTreeItem = (LazyTreeItem) newValue; selectedElementProperty().set(lastSelectedTreeItem.getValue()); }); } }
btnLoad.disableProperty().bind(list.getSelectionModel().selectedItemProperty().isNull()); btnDelete.disableProperty().bind(list.getSelectionModel().selectedItemProperty().isNull());
listView.getSelectionModel().selectedItemProperty().addListener((ChangeListener<OperationData>) (observable, oldValue, newValue) -> { ((StandardListViewController) controller).setSelectedModel(newValue); });
tree.setRoot(constructTreeFromRoot()); tree.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { if (newValue!=null && !programmaticallySelect && newValue.getValue()!=null && newValue.getValue().getData()!=null){ dataEditor.edit(newValue.getValue().getData());