Search in sources :

Example 26 with Region

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);
}
Also used : TranslateTransition(javafx.animation.TranslateTransition) Color(javafx.scene.paint.Color) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Pane(javafx.scene.layout.Pane)

Example 27 with Region

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();
}
Also used : LinearGradient(javafx.scene.paint.LinearGradient) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region)

Example 28 with Region

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);
}
Also used : IntStream(java.util.stream.IntStream) Orientation(javafx.geometry.Orientation) SkinBase(javafx.scene.control.SkinBase) HBox(javafx.scene.layout.HBox) VuMeter(eu.hansolo.enzo.vumeter.VuMeter) Section(eu.hansolo.enzo.common.Section) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) WeakEventHandler(javafx.event.WeakEventHandler) DoubleProperty(javafx.beans.property.DoubleProperty) Skin(javafx.scene.control.Skin) VBox(javafx.scene.layout.VBox) AnimationTimer(javafx.animation.AnimationTimer) Region(javafx.scene.layout.Region) ListChangeListener(javafx.collections.ListChangeListener) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) ObservableList(javafx.collections.ObservableList) HBox(javafx.scene.layout.HBox) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Section(eu.hansolo.enzo.common.Section)

Example 29 with Region

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);
}
Also used : HBox(javafx.scene.layout.HBox) Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region)

Example 30 with Region

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);
}
Also used : ProgressIndicator(javafx.scene.control.ProgressIndicator) Region(javafx.scene.layout.Region)

Aggregations

Region (javafx.scene.layout.Region)106 Text (javafx.scene.text.Text)25 VBox (javafx.scene.layout.VBox)22 Label (javafx.scene.control.Label)21 Pane (javafx.scene.layout.Pane)21 Button (javafx.scene.control.Button)18 InnerShadow (javafx.scene.effect.InnerShadow)17 Scene (javafx.scene.Scene)16 Node (javafx.scene.Node)15 Insets (javafx.geometry.Insets)14 HBox (javafx.scene.layout.HBox)14 DropShadow (javafx.scene.effect.DropShadow)13 ArrayList (java.util.ArrayList)12 StackPane (javafx.scene.layout.StackPane)12 Canvas (javafx.scene.canvas.Canvas)11 Color (javafx.scene.paint.Color)11 GridPane (javafx.scene.layout.GridPane)10 Group (javafx.scene.Group)9 Background (javafx.scene.layout.Background)8 BackgroundFill (javafx.scene.layout.BackgroundFill)8