Search in sources :

Example 21 with Observable

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

the class ShortcutEditingPanelSkin method createKeyAttributeList.

private KeyAttributeList createKeyAttributeList() {
    final KeyAttributeList keyAttributeList = new KeyAttributeList();
    keyAttributeList.setEditable(true);
    keyAttributeList.setOnChange(environment -> {
        // update shortcut if a part of the environment list has changed
        shortcutProperties.replace("environment", environment);
        try {
            final ShortcutDTO shortcut = getControl().getShortcut();
            final String json = new ObjectMapper().writeValueAsString(shortcutProperties);
            getControl().setShortcut(new ShortcutDTO.Builder(shortcut).withScript(json).build());
        } catch (JsonProcessingException e) {
            LOGGER.error("Creating new shortcut String failed.", e);
        }
    });
    this.environmentAttributes.addListener((Observable invalidated) -> keyAttributeList.setAttributeMap(this.environmentAttributes));
    keyAttributeList.setAttributeMap(this.environmentAttributes);
    return keyAttributeList;
}
Also used : KeyAttributeList(org.phoenicis.javafx.components.common.control.KeyAttributeList) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ShortcutDTO(org.phoenicis.library.dto.ShortcutDTO) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Observable(javafx.beans.Observable)

Example 22 with Observable

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

the class IconsListElementSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final VBox container = new VBox(createMiniature(), createLabel());
    container.getStyleClass().add("iconListElement");
    container.widthProperty().addListener((observable, oldValue, newValue) -> container.setClip(new Rectangle(container.getWidth(), container.getHeight())));
    container.heightProperty().addListener((observable, oldValue, newValue) -> container.setClip(new Rectangle(container.getWidth(), container.getHeight())));
    // update the selected pseudo class according to the selected state of the component
    getControl().selectedProperty().addListener((Observable invalidation) -> container.pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected()));
    // adopt the selected state during initialisation
    container.pseudoClassStateChanged(SELECTED_PSEUDO_CLASS, getControl().isSelected());
    getChildren().addAll(container);
}
Also used : Rectangle(javafx.scene.shape.Rectangle) VBox(javafx.scene.layout.VBox) Observable(javafx.beans.Observable)

Example 23 with Observable

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

the class ApplicationInformationPanelSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    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));
    final VBox container = new VBox(appDescription, installers, scriptGrid, miniaturesPaneWrapper);
    getChildren().add(container);
    // ensure that the content of the details panel changes when the to be shown application changes
    getControl().applicationProperty().addListener((Observable invalidation) -> updateApplication());
    // initialise the content of the details panel correct
    updateApplication();
}
Also used : Button(javafx.scene.control.Button) OperatingSystem(org.phoenicis.entities.OperatingSystem) javafx.scene.layout(javafx.scene.layout) MappedList(org.phoenicis.javafx.collections.MappedList) FXCollections(javafx.collections.FXCollections) DoubleProperty(javafx.beans.property.DoubleProperty) Bindings(javafx.beans.binding.Bindings) InvalidationListener(javafx.beans.InvalidationListener) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog) ScrollPane(javafx.scene.control.ScrollPane) URI(java.net.URI) Tooltip(javafx.scene.control.Tooltip) SkinBase(org.phoenicis.javafx.components.common.skin.SkinBase) WebView(javafx.scene.web.WebView) Label(javafx.scene.control.Label) Value(org.graalvm.polyglot.Value) FilteredList(javafx.collections.transformation.FilteredList) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) Observable(javafx.beans.Observable) ApplicationInformationPanel(org.phoenicis.javafx.components.application.control.ApplicationInformationPanel) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) Platform(javafx.application.Platform) Installer(org.phoenicis.scripts.Installer) ImageView(javafx.scene.image.ImageView) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) OperatingSystemFetcher(org.phoenicis.tools.system.OperatingSystemFetcher) ObservableList(javafx.collections.ObservableList) Image(javafx.scene.image.Image) ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) ScrollPane(javafx.scene.control.ScrollPane) Label(javafx.scene.control.Label) WebView(javafx.scene.web.WebView) 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