use of org.phoenicis.javafx.components.common.control.KeyAttributeList in project POL-POM-5 by PlayOnLinux.
the class ShortcutInformationPanelSkin method createKeyAttributeList.
private KeyAttributeList createKeyAttributeList() {
final KeyAttributeList keyAttributeList = new KeyAttributeList();
this.environmentAttributes.addListener((Observable invalidated) -> keyAttributeList.setAttributeMap(this.environmentAttributes));
keyAttributeList.setAttributeMap(this.environmentAttributes);
return keyAttributeList;
}
use of org.phoenicis.javafx.components.common.control.KeyAttributeList 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 org.phoenicis.javafx.components.common.control.KeyAttributeList in project POL-POM-5 by PlayOnLinux.
the class ShortcutEditingPanelSkin method initialise.
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
final Label descriptionLabel = new Label();
descriptionLabel.textProperty().bind(description);
descriptionLabel.setWrapText(true);
final GridPane propertiesGrid = createPropertiesGrid();
final Label environmentLabel = new Label(tr("Environment"));
environmentLabel.getStyleClass().add("sectionTitle");
environmentLabel.setWrapText(true);
final KeyAttributeList environmentAttributeList = createKeyAttributeList();
final Region spacer = new Region();
spacer.getStyleClass().add("detailsButtonSpacer");
final Button saveButton = new Button(tr("Save"));
saveButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutChanged()).ifPresent(onShortcutChanged -> onShortcutChanged.accept(getControl().getShortcut())));
final VBox container = new VBox(descriptionLabel, propertiesGrid, environmentLabel, environmentAttributeList, spacer, saveButton);
getChildren().setAll(container);
}
use of org.phoenicis.javafx.components.common.control.KeyAttributeList in project POL-POM-5 by PlayOnLinux.
the class ShortcutInformationPanelSkin method initialise.
/**
* {@inheritDoc}
*/
@Override
public void initialise() {
final GridPane controlButtons = createControlButtons();
if (getControl().getJavaFxSettingsManager().isAdvancedMode()) {
final Label descriptionLabel = new Label();
descriptionLabel.textProperty().bind(description);
descriptionLabel.setWrapText(true);
final GridPane propertiesGrid = createPropertiesGrid();
final Label environmentLabel = new Label(tr("Environment"));
environmentLabel.getStyleClass().add("sectionTitle");
environmentLabel.setWrapText(true);
final KeyAttributeList environmentAttributeList = createKeyAttributeList();
final Region spacer = new Region();
spacer.getStyleClass().add("detailsButtonSpacer");
final VBox container = new VBox(descriptionLabel, propertiesGrid, environmentLabel, environmentAttributeList, spacer, controlButtons);
getChildren().setAll(container);
} else {
final VBox container = new VBox(controlButtons);
getChildren().setAll(container);
}
}
Aggregations