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;
}
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);
}
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();
}
Aggregations