Search in sources :

Example 6 with Observable

use of javafx.beans.Observable in project POL-POM-5 by PlayOnLinux.

the class ContainersFeaturePanelSkin method createContainerInformationDetailsPanel.

private DetailsPanel createContainerInformationDetailsPanel(ContainerInformation action) {
    final ContainerDTO container = action.getContainer();
    final ContainerInformationPanel containerInformationPanel = new ContainerInformationPanel();
    containerInformationPanel.setContainer(container);
    containerInformationPanel.enginesManagerProperty().bind(getControl().enginesManagerProperty());
    containerInformationPanel.verbsManagerProperty().bind(getControl().verbsManagerProperty());
    containerInformationPanel.engineToolsManagerProperty().bind(getControl().engineToolsManagerProperty());
    containerInformationPanel.setOnDeleteContainer(getControl()::deleteContainer);
    containerInformationPanel.setOnChangeEngineVersion(getControl()::changeEngineVersion);
    containerInformationPanel.setOnOpenFileBrowser(getControl()::openFileBrowser);
    getControl().getEngineSettings().addListener((Observable invalidation) -> updateEngineSettings(containerInformationPanel));
    getControl().getVerbs().addListener((Observable invalidation) -> updateVerbs(containerInformationPanel));
    getControl().getEngineTools().addListener((Observable invalidation) -> updateEngineTools(containerInformationPanel));
    updateEngineSettings(containerInformationPanel);
    updateVerbs(containerInformationPanel);
    updateEngineTools(containerInformationPanel);
    final DetailsPanel containerDetailsPanel = new DetailsPanel();
    containerDetailsPanel.setTitle(container.getName());
    containerDetailsPanel.setContent(containerInformationPanel);
    containerDetailsPanel.setOnClose(getControl()::closeDetailsPanel);
    containerDetailsPanel.prefWidthProperty().bind(getControl().widthProperty().divide(3));
    return containerDetailsPanel;
}
Also used : ContainerInformationPanel(org.phoenicis.javafx.components.container.control.ContainerInformationPanel) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO) OpenDetailsPanel(org.phoenicis.javafx.components.common.panelstates.OpenDetailsPanel) DetailsPanel(org.phoenicis.javafx.components.common.control.DetailsPanel) Observable(javafx.beans.Observable)

Example 7 with Observable

use of javafx.beans.Observable in project POL-POM-5 by PlayOnLinux.

the class KeyAttributeListSkin method initialise.

@Override
public void initialise() {
    final TableView<KeyAttributeList.KeyAttributePair> table = createTable();
    final Button addButton = new Button(tr("Add"));
    addButton.setOnAction(event -> {
        getControl().getKeyAttributes().add(new KeyAttributeList.KeyAttributePair("key", "new value"));
        Optional.ofNullable(getControl().getOnChange()).ifPresent(consumer -> consumer.accept(getControl().getAttributeMap()));
    });
    final Button removeButton = new Button(tr("Remove"));
    removeButton.setOnAction(event -> {
        final List<KeyAttributeList.KeyAttributePair> selectedItems = table.getSelectionModel().getSelectedItems();
        getControl().getKeyAttributes().removeAll(selectedItems);
        Optional.ofNullable(getControl().getOnChange()).ifPresent(consumer -> consumer.accept(getControl().getAttributeMap()));
    });
    final HBox buttonContainer = new HBox(addButton, removeButton);
    buttonContainer.setAlignment(Pos.CENTER_RIGHT);
    getControl().onChangeProperty().addListener((Observable invalidation) -> updateChildren(table, buttonContainer));
    updateChildren(table, buttonContainer);
}
Also used : HBox(javafx.scene.layout.HBox) KeyAttributeList(org.phoenicis.javafx.components.common.control.KeyAttributeList) Observable(javafx.beans.Observable)

Example 8 with Observable

use of javafx.beans.Observable in project POL-POM-5 by PlayOnLinux.

the class SidebarGroupSkin method initialise.

/**
 * {@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);
}
Also used : Label(javafx.scene.control.Label) VBox(javafx.scene.layout.VBox) Observable(javafx.beans.Observable)

Example 9 with Observable

use of javafx.beans.Observable in project POL-POM-5 by PlayOnLinux.

the class EngineInformationPanelSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane informationContentPane = new GridPane();
    informationContentPane.getStyleClass().add("grid");
    engineUserData.addListener((Observable invalidation) -> updateUserData(informationContentPane));
    updateUserData(informationContentPane);
    final HBox buttonBox = createEngineButtons();
    final Region informationContentSpacer = new Region();
    informationContentSpacer.getStyleClass().add("engineSpacer");
    final Region buttonBoxSpacer = new Region();
    buttonBoxSpacer.getStyleClass().add("engineSpacer");
    final VBox container = new VBox(informationContentPane, informationContentSpacer, buttonBox, buttonBoxSpacer);
    getChildren().add(container);
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Observable(javafx.beans.Observable)

Example 10 with Observable

use of javafx.beans.Observable in project POL-POM-5 by PlayOnLinux.

the class IconsListElementSkin method createMiniature.

/**
 * Creates a region with the miniature of the list element
 *
 * @return A region with the miniature of the list element
 */
private Region createMiniature() {
    final Region miniature = new Region();
    miniature.getStyleClass().add("iconListMiniatureImage");
    miniature.styleProperty().bind(Bindings.createStringBinding(() -> String.format("-fx-background-image: url(\"%s\");", getControl().getMiniatureUri().toString()), getControl().miniatureUriProperty()));
    final Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(getControl().titleProperty());
    Tooltip.install(miniature, tooltip);
    // set a gray filter for this element if it is not enabled
    getControl().enabledProperty().addListener((Observable invalidation) -> updateEnabled(miniature));
    // adopt the enable status during initialisation
    updateEnabled(miniature);
    return miniature;
}
Also used : Tooltip(javafx.scene.control.Tooltip) Region(javafx.scene.layout.Region) Observable(javafx.beans.Observable)

Aggregations

Observable (javafx.beans.Observable)23 InvalidationListener (javafx.beans.InvalidationListener)7 VBox (javafx.scene.layout.VBox)7 Image (javafx.scene.image.Image)4 HBox (javafx.scene.layout.HBox)4 Text (javafx.scene.text.Text)4 Bindings (javafx.beans.binding.Bindings)3 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)3 ObservableList (javafx.collections.ObservableList)3 ActionEvent (javafx.event.ActionEvent)3 Button (javafx.scene.control.Button)3 Label (javafx.scene.control.Label)3 ImageView (javafx.scene.image.ImageView)3 GridPane (javafx.scene.layout.GridPane)3 MediaFile (com.negativevr.media_library.files.MediaFile)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 KeyFrame (javafx.animation.KeyFrame)2 KeyValue (javafx.animation.KeyValue)2