@Override public void initialize(URL location, ResourceBundle resources) { Bindings.bindContent( log.getChildren(), ui.outputMessages() ); } }
/** * Bind a JavaFX observable list to an Eclipse DB observable list * * @param fxObs * the fx observable * @param dbObs * the eclipse db observable * @param initialSync * the initial sync direction * @param <E> * the list type */ public static <E> void bind(ObservableList<E> fxObs, IObservableList dbObs, InitialSync initialSync) { ObservableList<E> dbList = adapt(dbObs); if (initialSync == InitialSync.FX_TO_DB) { Bindings.bindContent(dbList, fxObs); } else { Bindings.bindContentBidirectional(fxObs, dbList); } }
private void prepareTree(ProjectProperty project) { requireNonNull(project); events.notify(new ProjectLoaded(project)); Bindings.bindContent(ui.getSelectedTreeItems(), hierarchy.getSelectionModel().getSelectedItems()); hierarchy.setCellFactory(view -> new DocumentPropertyCell(projectTreeComponent)); hierarchy.getSelectionModel().setSelectionMode(SINGLE); populateTree(project); }
@Override public void initialize(URL location, ResourceBundle resources) { Bindings.bindContent(issues, issueComponent.getIssues());
/** * Binds this ThemeManager to the given ObservableList * * @param destination The to be managed observable list with stylesheet locations */ public void bindStylesheets(ObservableList<String> destination) { Bindings.bindContent(destination, this.stylesheets); }
@Override public void initialize() { LOG.info("Displaying direct messages."); Bindings.bindContent(conversationsTabPane.getTabs(), conversationsManaged); }
/** * Creates a container for all the tool buttons * * @return A container containing all the tool buttons */ private FlowPane createToolButtonContainer() { final FlowPane toolsContentPane = new FlowPane(); toolsContentPane.getStyleClass().add("grid"); Bindings.bindContent(toolsContentPane.getChildren(), toolButtons); return toolsContentPane; } }
private TabPane createEngineVersion() { final TabPane availableEngines = new TabPane(); availableEngines.getStyleClass().add("rightPane"); availableEngines.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); Bindings.bindContent(availableEngines.getTabs(), this.engineSubCategoryTabs); return availableEngines; }
private void pathChangedHandler(Observable o) { if (this.currentItem != null) { Bindings.unbindContent(this.elements, this.currentItem.getChildren()); } this.elements.clear(); this.currentItem = getSkinnable().getDir(); if (this.currentItem != null) { Bindings.bindContent(this.elements, this.currentItem.getChildren()); } }
/** * {@inheritDoc} */ @Override public void initialise() { final ObservableList<ToggleButton> mappedToggleButtons = new MappedList<>(getControl().getElements(), this::convertToToggleButton); final ObservableList<ToggleButton> allToggleButton = createAllButton() .map(FXCollections::singletonObservableList) .orElse(FXCollections.emptyObservableList()); final ConcatenatedList<ToggleButton> adhocToggleButtons = ConcatenatedList.create(allToggleButton, mappedToggleButtons); Bindings.bindContent(toggleGroup.getToggles(), adhocToggleButtons); SidebarGroup<ToggleButton> sidebarGroup = new SidebarGroup<>(getControl().titleProperty(), adhocToggleButtons); getChildren().addAll(sidebarGroup); }
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); }
/** * {@inheritDoc} */ @Override public void initialise() { final Label title = createTitleLabel(); // ensure that the title label is only shown when it contains a nonempty string title.textProperty().addListener((Observable invalidation) -> updateTitleLabelVisibility(title)); // ensure that the title label is correctly shown during initialisation updateTitleLabelVisibility(title); VBox container = new VBox(); container.getStyleClass().add("sidebarInside"); Bindings.bindContent(container.getChildren(), components); getChildren().addAll(container); }
/** * Create a lazy tree item * * @param value * the domain value * @param listCreator * the creator */ public LazyTreeItem(T value, Function<TreeItem<T>, List<TreeItem<T>>> listCreator) { super(value); getChildren().add(new TreeItem<>()); expandedProperty().addListener((o) -> { if (isExpanded()) { if (!this.hasLoaded) { List<TreeItem<T>> list = listCreator.apply(this); if( list instanceof ObservableList<?> ) { getChildren().clear(); Bindings.bindContent(getChildren(), (ObservableList<TreeItem<T>>)list); } else { getChildren().setAll(list); } } } }); } }
/** * Create a lazy tree item * * @param value * the domain value * @param listCreator * the creator */ public LazyTreeItem(T value, Function<TreeItem<T>, List<TreeItem<T>>> listCreator) { super(value); getChildren().add(new TreeItem<>()); expandedProperty().addListener((o) -> { if (isExpanded()) { if (!this.hasLoaded) { List<TreeItem<T>> list = listCreator.apply(this); if( list instanceof ObservableList<?> ) { getChildren().clear(); Bindings.bindContent(getChildren(), (ObservableList<TreeItem<T>>)list); } else { getChildren().setAll(list); } } } }); } }
public Navigator( CellListManager<T, C> cellListManager, CellPositioner<T, C> positioner, OrientationHelper orientation, ObjectProperty<Gravity> gravity, SizeTracker sizeTracker) { this.cellListManager = cellListManager; this.cells = cellListManager.getLazyCellList(); this.positioner = positioner; this.orientation = orientation; this.gravity = gravity; this.sizeTracker = sizeTracker; this.itemsSubscription = LiveList.observeQuasiChanges(cellListManager.getLazyCellList(), this::itemsChanged); Bindings.bindContent(getChildren(), cellListManager.getNodes()); // When gravity changes, we must redo our layout: gravity.addListener((prop, oldVal, newVal) -> requestLayout()); }
/** * Create a new skin * * @param control * the control */ public StyledLabelSkin(StyledLabel control) { super(control); this.b = new HBox(10); this.l = new Label(); this.l.getStyleClass().clear(); Bindings.bindContent(this.l.getStyleClass(), control.getStyleClass()); this.b.getChildren().add(this.l); control.styledStringProperty().addListener(this::styleStringChanged); control.graphicProperty().addListener(this::graphicChanged); if( control.getGraphic() != null ) { this.l.setGraphic(control.getGraphic()); } getChildren().add(this.b); rebuildControl(); }
/** * Create a new skin * * @param control * the control */ public StyledLabelSkin(StyledLabel control) { super(control); this.b = new HBox(); this.l = new Label(); this.l.getStyleClass().clear(); Bindings.bindContent(this.l.getStyleClass(), control.getStyleClass()); this.b.getChildren().add(this.l); control.styledStringProperty().addListener(this::styleStringChanged); control.graphicProperty().addListener(this::graphicChanged); if( control.getGraphic() != null ) { this.l.setGraphic(control.getGraphic()); } getChildren().add(this.b); rebuildControl(); }
/** * {@inheritDoc} */ @Override protected Node createContent() { final WebView appDescription = new WebView(); appDescription.getEngine().userStyleSheetLocationProperty().bind(getControl().webEngineStylesheetProperty()); VBox.setVgrow(appDescription, Priority.ALWAYS); getControl().applicationProperty().addListener((Observable invalidation) -> updateDescription(appDescription)); updateDescription(appDescription); final Label installers = new Label(tr("Installers")); installers.getStyleClass().add("descriptionTitle"); final GridPane scriptGrid = new GridPane(); filteredScripts.addListener((InvalidationListener) change -> updateScripts(scriptGrid)); getControl().showScriptSourceProperty().addListener((Observable invalidation) -> updateScripts(scriptGrid)); updateScripts(scriptGrid); final HBox miniaturesPane = new HBox(); miniaturesPane.getStyleClass().add("appPanelMiniaturesPane"); Bindings.bindContent(miniaturesPane.getChildren(), miniatures); final ScrollPane miniaturesPaneWrapper = new ScrollPane(miniaturesPane); miniaturesPaneWrapper.getStyleClass().add("appPanelMiniaturesPaneWrapper"); miniatureHeight.bind(miniaturesPaneWrapper.heightProperty().multiply(0.8)); return new VBox(appDescription, installers, scriptGrid, miniaturesPaneWrapper); }
/** * Creates the {@link FlowPane} which contains the icons of the icons list * * @param container The scroll pane container which will contain the {@link FlowPane} * @return The new {@link FlowPane} */ private FlowPane createContent(final ScrollPane container) { final FlowPane content = new FlowPane(); content.prefWidthProperty().bind(container.widthProperty()); content.setPrefHeight(0); Bindings.bindContent(content.getChildren(), mappedElements); // ensure that updates to the selected element property are automatically reflected in the view getControl().selectedElementProperty().addListener((observable, oldValue, newValue) -> { // deselect the old element updateOldSelection(oldValue); // select the new element updateNewSelection(newValue); }); // initialise selection at startup updateNewSelection(getControl().getSelectedElement()); return content; }
}); Bindings.bindContent(container.getItems(), mappedElements);