use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.
the class IconSwitchSkin method initGraphics.
private void initGraphics() {
// "OpenSans"
Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.5 * PREFERRED_HEIGHT));
font = Font.font("Open Sans", 0.5 * PREFERRED_HEIGHT);
background = new Region();
background.getStyleClass().setAll("background");
background.setStyle("-switch-color: " + Util.colorToCss((Color) getSkinnable().getSwitchColor()) + ";");
symbol = getSkinnable().getSymbol();
symbol.setMouseTransparent(true);
text = new Label(getSkinnable().getText());
text.setTextAlignment(TextAlignment.CENTER);
text.setAlignment(Pos.CENTER);
text.setTextFill(getSkinnable().getSymbolColor());
text.setFont(font);
thumb = new Region();
thumb.getStyleClass().setAll("thumb");
thumb.setStyle("-thumb-color: " + Util.colorToCss((Color) getSkinnable().getThumbColor()) + ";");
thumb.setMouseTransparent(true);
pane = new Pane(background, symbol, text, thumb);
pane.getStyleClass().setAll("icon-switch");
moveToDeselected = new TranslateTransition(Duration.millis(180), thumb);
moveToSelected = new TranslateTransition(Duration.millis(180), thumb);
// Add all nodes
getChildren().setAll(pane);
}
use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.
the class SplitFlapSkin method initGraphics.
private void initGraphics() {
fixtureRight = new Region();
fixtureRight.getStyleClass().setAll(getSkinnable().isDarkFixture() ? "fixture-dark" : "fixture");
fixtureRight.setOpacity(getSkinnable().isWithFixture() ? 1 : 0);
fixtureLeft = new Region();
fixtureLeft.getStyleClass().setAll(getSkinnable().isDarkFixture() ? "fixture-dark" : "fixture");
fixtureLeft.setOpacity(getSkinnable().isWithFixture() ? 1 : 0);
innerShadow = new InnerShadow();
innerShadow.setOffsetY(-0.01 * flapHeight);
innerShadow.setRadius(0.01 * flapHeight);
innerShadow.setColor(Color.rgb(0, 0, 0, 0.65));
innerShadow.setBlurType(BlurType.TWO_PASS_BOX);
innerHighlight = new InnerShadow();
innerHighlight.setOffsetY(0.01 * flapHeight);
innerHighlight.setRadius(0.01 * flapHeight);
innerHighlight.setColor(Color.rgb(255, 255, 255, 0.65));
innerHighlight.setBlurType(BlurType.TWO_PASS_BOX);
innerHighlight.setInput(innerShadow);
reversedInnerShadow = new InnerShadow();
reversedInnerShadow.setOffsetY(-0.01 * 0.4920634921 * height);
reversedInnerShadow.setRadius(0.01 * 0.4920634921 * height);
reversedInnerShadow.setColor(Color.rgb(0, 0, 0, 0.65));
reversedInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
reversedInnerHighlight = new InnerShadow();
reversedInnerHighlight.setOffsetY(0.01 * 0.4920634921 * height);
reversedInnerHighlight.setRadius(0.01 * 0.4920634921 * height);
reversedInnerHighlight.setColor(Color.rgb(255, 255, 255, 0.65));
reversedInnerHighlight.setBlurType(BlurType.TWO_PASS_BOX);
reversedInnerHighlight.setInput(innerShadow);
getSkinnable().setStyle("-flap-base: " + Util.colorToCss(getSkinnable().getFlapColor()) + ";");
upperBackground = new Region();
upperBackground.setEffect(innerHighlight);
font = Fonts.bebasNeue(PREFERRED_HEIGHT);
upperTextFill = new LinearGradient(0, 0, 0, flapHeight, false, CycleMethod.NO_CYCLE, new Stop(0.0, getSkinnable().getTextColor()), new Stop(1.0, getSkinnable().getTextColor().darker()));
upperBackgroundText = new Canvas();
ctxUpperBackgroundText = upperBackgroundText.getGraphicsContext2D();
ctxUpperBackgroundText.setTextBaseline(VPos.CENTER);
ctxUpperBackgroundText.setTextAlign(TextAlignment.CENTER);
lowerBackground = new Region();
lowerBackground.setEffect(innerHighlight);
lowerTextFill = new LinearGradient(0, 0.5079365079365079 * PREFERRED_HEIGHT, 0, 0.5079365079365079 * PREFERRED_HEIGHT + flapHeight, false, CycleMethod.NO_CYCLE, new Stop(0.0, getSkinnable().getTextColor().darker()), new Stop(1.0, getSkinnable().getTextColor()));
lowerBackgroundText = new Canvas();
ctxLowerBackgroundText = lowerBackgroundText.getGraphicsContext2D();
ctxLowerBackgroundText.setTextBaseline(VPos.CENTER);
ctxLowerBackgroundText.setTextAlign(TextAlignment.CENTER);
flap = new Region();
flap.setEffect(innerHighlight);
flap.getTransforms().add(rotateFlap);
flapTextFront = new Canvas();
flapTextFront.getTransforms().add(rotateFlap);
ctxTextFront = flapTextFront.getGraphicsContext2D();
ctxTextFront.setTextBaseline(VPos.CENTER);
ctxTextFront.setTextAlign(TextAlignment.CENTER);
flapTextBack = new Canvas();
flapTextBack.getTransforms().add(rotateFlap);
flapTextBack.setOpacity(0);
ctxTextBack = flapTextBack.getGraphicsContext2D();
ctxTextBack.setTextBaseline(VPos.CENTER);
ctxTextBack.setTextAlign(TextAlignment.CENTER);
// Set the appropriate style class for the flaps
if (getSkinnable().isWithFixture()) {
upperBackground.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "upper-square" : "upper");
lowerBackground.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "lower-square" : "lower");
flap.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "upper-square" : "upper");
} else {
upperBackground.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "upper-no-fixture-square" : "upper-no-fixture");
lowerBackground.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "lower-no-fixture-square" : "lower-no-fixture");
flap.getStyleClass().setAll(getSkinnable().isSquareFlaps() ? "upper-no-fixture-square" : "upper-no-fixture");
}
pane.getChildren().setAll(fixtureRight, fixtureLeft, upperBackground, lowerBackground, upperBackgroundText, lowerBackgroundText, flap, flapTextFront, flapTextBack);
getChildren().setAll(pane);
resize();
}
use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.
the class VuMeterSkin method initGraphics.
private void initGraphics() {
hBox = new HBox();
hBox.getStyleClass().setAll("vu-meter");
hBox.setSpacing(getSkinnable().getLedSpacing());
vBox = new VBox();
vBox.getStyleClass().setAll("vu-meter");
vBox.setSpacing(getSkinnable().getLedSpacing());
leds = FXCollections.observableArrayList();
for (int i = 0; i < getSkinnable().getNoOfLeds(); i++) {
Region led = new Region();
led.setOnMouseClicked(new WeakEventHandler<>(event -> active = !active));
led.setOnMouseEntered(new WeakEventHandler<>(event -> handleMouseEvent(event)));
if (getSkinnable().getSections().isEmpty()) {
led.getStyleClass().setAll("led");
} else {
for (Section section : getSkinnable().getSections()) {
if (section.contains(i * stepSize.doubleValue())) {
led.getStyleClass().setAll("led", section.getStyleClass());
}
}
}
leds.add(led);
}
if (Orientation.HORIZONTAL == getSkinnable().getOrientation()) {
vBox.setManaged(false);
vBox.setVisible(false);
hBox.getChildren().setAll(leds);
peakLedIndex = 0;
} else {
hBox.setManaged(false);
hBox.setVisible(false);
FXCollections.reverse(leds);
vBox.getChildren().setAll(leds);
peakLedIndex = leds.size() - 1;
}
// Add all nodes
getChildren().setAll(hBox, vBox);
}
use of javafx.scene.layout.Region in project POL-POM-5 by PhoenicisOrg.
the class DetailsView method populateHeader.
/**
* Populate the header with a label for the title of this details view and a close button
*/
private void populateHeader() {
this.titleLabel = new Label();
this.titleLabel.getStyleClass().add("descriptionTitle");
this.titleLabel.setAlignment(Pos.CENTER_LEFT);
this.titleLabel.setWrapText(true);
this.closeButton = new Button();
this.closeButton.getStyleClass().add("closeIcon");
this.closeButton.setOnAction(event -> onClose.run());
this.closeButton.setAlignment(Pos.CENTER_RIGHT);
Region filler = new Region();
HBox headerBox = new HBox();
headerBox.getChildren().setAll(titleLabel, filler, closeButton);
HBox.setHgrow(filler, Priority.ALWAYS);
this.setTop(headerBox);
}
use of javafx.scene.layout.Region in project POL-POM-5 by PhoenicisOrg.
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);
}
Aggregations