use of javafx.scene.layout.Region 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;
}
use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.
the class StepRepresentationSpin method drawStepContent.
@Override
protected void drawStepContent() {
super.drawStepContent();
Region spacerAbove = new Region();
VBox.setVgrow(spacerAbove, Priority.ALWAYS);
this.addToContentPane(spacerAbove);
ProgressIndicator progressIndicator = new ProgressIndicator();
this.addToContentPane(progressIndicator);
Region spacerBelow = new Region();
VBox.setVgrow(spacerBelow, Priority.ALWAYS);
this.addToContentPane(spacerBelow);
}
use of javafx.scene.layout.Region in project NMEAParser by tvesalainen.
the class ResizableCanvas method setParent.
private void setParent(ObservableValue<? extends Parent> observable, Parent oldValue, Parent newParent) {
if (newParent instanceof Region) {
Region region = (Region) newParent;
ReadOnlyDoubleProperty regionWidth = region.widthProperty();
ReadOnlyDoubleProperty regionHeight = region.heightProperty();
if (square) {
widthProperty().bind(new When(regionWidth.lessThanOrEqualTo(regionHeight)).then(regionWidth).otherwise(regionHeight));
heightProperty().bind(new When(regionHeight.lessThanOrEqualTo(regionWidth)).then(regionHeight).otherwise(regionWidth));
} else {
widthProperty().bind(regionWidth);
heightProperty().bind(regionHeight);
}
} else {
System.err.println(newParent + " not suitable for ResizableCanvas");
}
}
use of javafx.scene.layout.Region in project POL-POM-5 by PlayOnLinux.
the class LibraryPanel method setShortcutDTO.
public void setShortcutDTO(ShortcutDTO shortcutDTO) {
this.setTitle(shortcutDTO.getName());
this.getChildren().clear();
final VBox vBox = new VBox();
Label description = new Label(shortcutDTO.getDescription());
description.setWrapText(true);
final GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("grid");
try {
LOGGER.info("Reading shortcut: {}", shortcutDTO.getScript());
final Map<String, Object> shortcutProperties = objectMapper.readValue(shortcutDTO.getScript(), new TypeReference<Map<String, Object>>() {
});
int i = 0;
for (String shortcutKey : shortcutProperties.keySet()) {
final Label keyLabel = new Label(tr(unCamelize(shortcutKey)) + ":");
keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(keyLabel, VPos.TOP);
gridPane.add(keyLabel, 0, i);
final Label valueLabel = new Label(shortcutProperties.get(shortcutKey).toString());
valueLabel.setWrapText(true);
gridPane.add(valueLabel, 1, i);
i++;
}
} catch (IOException e) {
LOGGER.warn("Could not parse shortcut script JSON", e);
}
gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
Region spacer = new Region();
spacer.setPrefHeight(40);
HBox buttons = new HBox();
buttons.setAlignment(Pos.CENTER);
Button runButton = new Button(tr("Run"));
runButton.getStyleClass().addAll("shortcutButton", "runButton");
runButton.setOnMouseClicked(event -> onShortcutRun.accept(shortcutDTO));
Button stopButton = new Button(tr("Close"));
stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
stopButton.setOnMouseClicked(event -> onShortcutStop.accept(shortcutDTO));
Button uninstallButton = new Button(tr("Uninstall"));
uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
uninstallButton.setOnMouseClicked(event -> onShortcutUninstall.accept(shortcutDTO));
buttons.getChildren().addAll(runButton, stopButton, uninstallButton);
vBox.getChildren().addAll(description, gridPane, spacer, buttons);
this.setCenter(vBox);
}
use of javafx.scene.layout.Region in project fxexperience2 by EricCanull.
the class DerivationController method initialize.
@Override
public void initialize(URL url, ResourceBundle rb) {
gridPane.getChildren().addAll(baseColorPicker, desiredColorPicker);
GridPane.setConstraints(baseColorPicker, 1, 1);
baseColorPicker.setPrefWidth(120);
baseColorPicker.setMaxWidth(120);
GridPane.setConstraints(desiredColorPicker, 1, 6);
desiredColorPicker.setPrefWidth(120);
desiredColorPicker.setMaxWidth(120);
// FORWARD
forwardDerivationLabel.textProperty().bind(new StringBinding() {
{
bind(derivationSlider.valueProperty());
}
@Override
protected String computeValue() {
return String.format("%3.1f%%", derivationSlider.getValue());
}
});
Region derivedResultColor = new Region();
derivedResultColor.setPrefSize(50, 20);
derivedResultLabel.setGraphic(derivedResultColor);
derivedResultColor.styleProperty().bind(new StringBinding() {
{
bind(derivationSlider.valueProperty(), baseColorPicker.colorProperty());
}
@Override
protected String computeValue() {
return "-fx-border-color: black; -fx-background-color: derive(" + baseColorPicker.getWebColor() + ", " + derivationSlider.getValue() + "%);";
}
});
derivedResultLabel.textProperty().bind(new StringBinding() {
{
bind(derivationSlider.valueProperty(), baseColorPicker.colorProperty());
}
@Override
protected String computeValue() {
Color base = baseColorPicker.getColor();
double derivation = derivationSlider.getValue();
Color result = ColorEncoder.deriveColor(base, derivation / 100);
return getColorString(result);
}
});
// BACKWARD
reverseResultColor = new Region();
reverseResultColor.setPrefSize(50, 20);
reverseResultLabel.setGraphic(reverseResultColor);
ChangeListener<Color> updateReverse = (ObservableValue<? extends Color> ov, Color t, Color desiredColor) -> {
updateReverse();
};
baseColorPicker.colorProperty().addListener(updateReverse);
desiredColorPicker.colorProperty().addListener(updateReverse);
}
Aggregations