Search in sources :

Example 21 with Region

use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.

the class LcdClockSkin method initGraphics.

private void initGraphics() {
    main = new Region();
    main.getStyleClass().setAll("main");
    main.setOpacity(getSkinnable().isBackgroundVisible() ? 1 : 0);
    mainInnerShadow0 = new InnerShadow();
    mainInnerShadow0.setOffsetX(0.0);
    mainInnerShadow0.setOffsetY(0.0);
    mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow0.setColor(Color.web("0xffffff80"));
    mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1 = new InnerShadow();
    mainInnerShadow1.setOffsetX(0.0);
    mainInnerShadow1.setOffsetY(1.0);
    mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH);
    mainInnerShadow1.setColor(Color.web("0x000000a6"));
    mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    mainInnerShadow1.setInput(mainInnerShadow0);
    main.setEffect(getSkinnable().isMainInnerShadowVisible() ? mainInnerShadow1 : null);
    crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
    crystalClip.setArcWidth(5);
    crystalClip.setArcHeight(5);
    crystalImage = createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8);
    crystalOverlay = new ImageView(crystalImage);
    crystalOverlay.setClip(this.crystalClip);
    crystalOverlay.setOpacity(getSkinnable().isCrystalOverlayVisible() ? 1 : 0);
    alarm = new Region();
    alarm.getStyleClass().setAll("alarm");
    alarm.setOpacity(getSkinnable().getAlarms().isEmpty() || allAlarmsInactive() ? 0 : 1);
    backgroundTimeText = new Text("");
    backgroundTimeText.getStyleClass().setAll("fg-trsp");
    backgroundTimeText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0);
    timeText = new Text("");
    timeText.getStyleClass().setAll("fg");
    backgroundSecondText = new Text("");
    backgroundSecondText.getStyleClass().setAll("fg-trsp");
    backgroundSecondText.setOpacity((LcdClock.LcdFont.LCD == getSkinnable().getTimeFont() || LcdClock.LcdFont.ELEKTRA == getSkinnable().getTimeFont()) ? 1 : 0);
    secondText = new Text("");
    secondText.getStyleClass().setAll("fg");
    title = new Text(getSkinnable().getTitle());
    title.getStyleClass().setAll("fg");
    dateText = new Text(getSkinnable().getTime().getMonthValue() + "/" + getSkinnable().getTime().getDayOfMonth() + "/" + getSkinnable().getTime().getYear());
    dateText.getStyleClass().setAll("fg");
    dayOfWeekText = new Text("");
    dayOfWeekText.getStyleClass().setAll("fg");
    shadowGroup = new Group();
    shadowGroup.setEffect(getSkinnable().isForegroundShadowVisible() ? FOREGROUND_SHADOW : null);
    shadowGroup.getChildren().setAll(alarm, timeText, secondText, title, dateText, dayOfWeekText);
    pane = new Pane();
    pane.getChildren().setAll(main, crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup);
    getChildren().setAll(pane);
    resize();
    updateLcd();
}
Also used : Group(javafx.scene.Group) InnerShadow(javafx.scene.effect.InnerShadow) Rectangle(javafx.scene.shape.Rectangle) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) ImageView(javafx.scene.image.ImageView) Pane(javafx.scene.layout.Pane)

Example 22 with Region

use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.

the class LedSkin method initGraphics.

private void initGraphics() {
    frame = new Region();
    frame.setOpacity(getSkinnable().isFrameVisible() ? 1 : 0);
    led = new Region();
    led.setStyle("-led-color: " + colorToCss((Color) getSkinnable().getLedColor()) + ";");
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, (Color) getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    highlight = new Region();
    // Set the appropriate style classes
    changeStyle();
    getChildren().setAll(frame, led, highlight);
}
Also used : InnerShadow(javafx.scene.effect.InnerShadow) Color(javafx.scene.paint.Color) Region(javafx.scene.layout.Region) DropShadow(javafx.scene.effect.DropShadow)

Example 23 with Region

use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.

the class SixteenSegmentSkin method initGraphics.

private void initGraphics() {
    segmentA1 = new Region();
    segmentA1.getStyleClass().setAll("a1");
    segmentMap.put(SixteenSegment.Segment.A1, segmentA1);
    segmentA2 = new Region();
    segmentA2.getStyleClass().setAll("a2");
    segmentMap.put(SixteenSegment.Segment.A2, segmentA2);
    segmentB = new Region();
    segmentB.getStyleClass().setAll("b");
    segmentMap.put(SixteenSegment.Segment.B, segmentB);
    segmentC = new Region();
    segmentC.getStyleClass().setAll("c");
    segmentMap.put(SixteenSegment.Segment.C, segmentC);
    segmentD2 = new Region();
    segmentD2.getStyleClass().setAll("d2");
    segmentMap.put(SixteenSegment.Segment.D2, segmentD2);
    segmentD1 = new Region();
    segmentD1.getStyleClass().setAll("d1");
    segmentMap.put(SixteenSegment.Segment.D1, segmentD1);
    segmentE = new Region();
    segmentE.getStyleClass().setAll("e");
    segmentMap.put(SixteenSegment.Segment.E, segmentE);
    segmentF = new Region();
    segmentF.getStyleClass().setAll("f");
    segmentMap.put(SixteenSegment.Segment.F, segmentF);
    segmentG = new Region();
    segmentG.getStyleClass().setAll("g");
    segmentMap.put(SixteenSegment.Segment.G, segmentG);
    segmentH = new Region();
    segmentH.getStyleClass().setAll("h");
    segmentMap.put(SixteenSegment.Segment.H, segmentH);
    segmentI = new Region();
    segmentI.getStyleClass().setAll("i");
    segmentMap.put(SixteenSegment.Segment.I, segmentI);
    segmentL = new Region();
    segmentL.getStyleClass().setAll("l");
    segmentMap.put(SixteenSegment.Segment.L, segmentL);
    segmentM = new Region();
    segmentM.getStyleClass().setAll("m");
    segmentMap.put(SixteenSegment.Segment.M, segmentM);
    segmentN = new Region();
    segmentN.getStyleClass().setAll("n");
    segmentMap.put(SixteenSegment.Segment.N, segmentN);
    segmentP = new Region();
    segmentP.getStyleClass().setAll("p");
    segmentMap.put(SixteenSegment.Segment.P, segmentP);
    segmentK = new Region();
    segmentK.getStyleClass().setAll("k");
    segmentMap.put(SixteenSegment.Segment.K, segmentK);
    segmentDot = new Region();
    segmentDot.getStyleClass().setAll("dot");
    segmentMap.put(SixteenSegment.Segment.DOT, segmentDot);
    pane.getChildren().setAll(segmentA1, segmentA2, segmentB, segmentC, segmentD2, segmentD1, segmentE, segmentF, segmentG, segmentH, segmentI, segmentL, segmentM, segmentN, segmentP, segmentK, segmentDot);
    getChildren().setAll(pane);
    resize();
    update();
}
Also used : Region(javafx.scene.layout.Region)

Example 24 with Region

use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.

the class MatrixSegmentSkin method resize.

private void resize() {
    width = getSkinnable().getWidth();
    height = getSkinnable().getHeight();
    size = width < height ? width : height;
    if (aspectRatio * width > height) {
        width = 1 / (aspectRatio / height);
    } else if (1 / (aspectRatio / height) > width) {
        height = aspectRatio * width;
    }
    if (width > 0 && height > 0) {
        pane.setMaxSize(width, height);
        // resize the background
        background.setPrefSize(width, height);
        backgroundInnerShadow.setRadius(0.0025 * size);
        backgroundInnerHighlight.setRadius(0.0025 * size);
        dotInnerShadow.setRadius(0.025 * width);
        glow.setRadius(0.032 * width);
        // resize the dots
        double dotWidth = 0.13548387096774195 * width;
        double dotHeight = 0.0967741935483871 * height;
        for (Region dot : dotMap.values()) {
            dot.setPrefSize(dotWidth, dotHeight);
        }
        d57.setTranslateX(0.832258064516129 * width);
        d57.setTranslateY(0.880184331797235 * height);
        d47.setTranslateX(0.632258064516129 * width);
        d47.setTranslateY(0.880184331797235 * height);
        d37.setTranslateX(0.432258064516129 * width);
        d37.setTranslateY(0.880184331797235 * height);
        d27.setTranslateX(0.23225806451612904 * width);
        d27.setTranslateY(0.880184331797235 * height);
        d17.setTranslateX(0.03225806451612903 * width);
        d17.setTranslateY(0.880184331797235 * height);
        d56.setTranslateX(0.832258064516129 * width);
        d56.setTranslateY(0.7373271889400922 * height);
        d46.setTranslateX(0.632258064516129 * width);
        d46.setTranslateY(0.7373271889400922 * height);
        d36.setTranslateX(0.432258064516129 * width);
        d36.setTranslateY(0.7373271889400922 * height);
        d26.setTranslateX(0.23225806451612904 * width);
        d26.setTranslateY(0.7373271889400922 * height);
        d16.setTranslateX(0.03225806451612903 * width);
        d16.setTranslateY(0.7373271889400922 * height);
        d55.setTranslateX(0.832258064516129 * width);
        d55.setTranslateY(0.5944700460829493 * height);
        d45.setTranslateX(0.632258064516129 * width);
        d45.setTranslateY(0.5944700460829493 * height);
        d35.setTranslateX(0.432258064516129 * width);
        d35.setTranslateY(0.5944700460829493 * height);
        d25.setTranslateX(0.23225806451612904 * width);
        d25.setTranslateY(0.5944700460829493 * height);
        d15.setTranslateX(0.03225806451612903 * width);
        d15.setTranslateY(0.5944700460829493 * height);
        d54.setTranslateX(0.832258064516129 * width);
        d54.setTranslateY(0.45161290322580644 * height);
        d44.setTranslateX(0.632258064516129 * width);
        d44.setTranslateY(0.45161290322580644 * height);
        d34.setTranslateX(0.432258064516129 * width);
        d34.setTranslateY(0.45161290322580644 * height);
        d24.setTranslateX(0.23225806451612904 * width);
        d24.setTranslateY(0.45161290322580644 * height);
        d14.setTranslateX(0.03225806451612903 * width);
        d14.setTranslateY(0.45161290322580644 * height);
        d53.setTranslateX(0.832258064516129 * width);
        d53.setTranslateY(0.3087557603686636 * height);
        d43.setTranslateX(0.632258064516129 * width);
        d43.setTranslateY(0.3087557603686636 * height);
        d33.setTranslateX(0.432258064516129 * width);
        d33.setTranslateY(0.3087557603686636 * height);
        d23.setTranslateX(0.23225806451612904 * width);
        d23.setTranslateY(0.3087557603686636 * height);
        d13.setTranslateX(0.03225806451612903 * width);
        d13.setTranslateY(0.3087557603686636 * height);
        d52.setTranslateX(0.832258064516129 * width);
        d52.setTranslateY(0.16589861751152074 * height);
        d42.setTranslateX(0.632258064516129 * width);
        d42.setTranslateY(0.16589861751152074 * height);
        d32.setTranslateX(0.432258064516129 * width);
        d32.setTranslateY(0.16589861751152074 * height);
        d22.setTranslateX(0.23225806451612904 * width);
        d22.setTranslateY(0.16589861751152074 * height);
        d12.setTranslateX(0.03225806451612903 * width);
        d12.setTranslateY(0.16589861751152074 * height);
        d51.setTranslateX(0.832258064516129 * width);
        d51.setTranslateY(0.02304147465437788 * height);
        d41.setTranslateX(0.632258064516129 * width);
        d41.setTranslateY(0.02304147465437788 * height);
        d31.setTranslateX(0.432258064516129 * width);
        d31.setTranslateY(0.02304147465437788 * height);
        d21.setTranslateX(0.23225806451612904 * width);
        d21.setTranslateY(0.02304147465437788 * height);
        d11.setTranslateX(0.03225806451612903 * width);
        d11.setTranslateY(0.02304147465437788 * height);
        // resize the highlights
        double highlightWidth = 0.07741935483870968 * width;
        double highlightHeight = 0.03456221198156682 * height;
        for (Region highlight : highlights) {
            highlight.setPrefSize(highlightWidth, highlightHeight);
        }
        d57h.setTranslateX(0.8612903225806452 * width);
        d57h.setTranslateY(0.8894009216589862 * height);
        d47h.setTranslateX(0.6612903225806451 * width);
        d47h.setTranslateY(0.8894009216589862 * height);
        d37h.setTranslateX(0.4612903225806452 * width);
        d37h.setTranslateY(0.8894009216589862 * height);
        d27h.setTranslateX(0.26129032258064516 * width);
        d27h.setTranslateY(0.8894009216589862 * height);
        d17h.setTranslateX(0.06129032258064516 * width);
        d17h.setTranslateY(0.8894009216589862 * height);
        d56h.setTranslateX(0.8612903225806452 * width);
        d56h.setTranslateY(0.7465437788018433 * height);
        d46h.setTranslateX(0.6612903225806451 * width);
        d46h.setTranslateY(0.7465437788018433 * height);
        d36h.setTranslateX(0.4612903225806452 * width);
        d36h.setTranslateY(0.7465437788018433 * height);
        d26h.setTranslateX(0.26129032258064516 * width);
        d26h.setTranslateY(0.7465437788018433 * height);
        d16h.setTranslateX(0.06129032258064516 * width);
        d16h.setTranslateY(0.7465437788018433 * height);
        d55h.setTranslateX(0.8612903225806452 * width);
        d55h.setTranslateY(0.6036866359447005 * height);
        d45h.setTranslateX(0.6612903225806451 * width);
        d45h.setTranslateY(0.6036866359447005 * height);
        d35h.setTranslateX(0.4612903225806452 * width);
        d35h.setTranslateY(0.6036866359447005 * height);
        d25h.setTranslateX(0.26129032258064516 * width);
        d25h.setTranslateY(0.6036866359447005 * height);
        d15h.setTranslateX(0.06129032258064516 * width);
        d15h.setTranslateY(0.6036866359447005 * height);
        d54h.setTranslateX(0.8612903225806452 * width);
        d54h.setTranslateY(0.4608294930875576 * height);
        d44h.setTranslateX(0.6612903225806451 * width);
        d44h.setTranslateY(0.4608294930875576 * height);
        d34h.setTranslateX(0.4612903225806452 * width);
        d34h.setTranslateY(0.4608294930875576 * height);
        d24h.setTranslateX(0.26129032258064516 * width);
        d24h.setTranslateY(0.4608294930875576 * height);
        d14h.setTranslateX(0.06129032258064516 * width);
        d14h.setTranslateY(0.4608294930875576 * height);
        d53h.setTranslateX(0.8612903225806452 * width);
        d53h.setTranslateY(0.31797235023041476 * height);
        d43h.setTranslateX(0.6612903225806451 * width);
        d43h.setTranslateY(0.31797235023041476 * height);
        d33h.setTranslateX(0.4612903225806452 * width);
        d33h.setTranslateY(0.31797235023041476 * height);
        d23h.setTranslateX(0.26129032258064516 * width);
        d23h.setTranslateY(0.31797235023041476 * height);
        d13h.setTranslateX(0.06129032258064516 * width);
        d13h.setTranslateY(0.31797235023041476 * height);
        d52h.setTranslateX(0.8612903225806452 * width);
        d52h.setTranslateY(0.17511520737327188 * height);
        d42h.setTranslateX(0.6612903225806451 * width);
        d42h.setTranslateY(0.17511520737327188 * height);
        d32h.setTranslateX(0.4612903225806452 * width);
        d32h.setTranslateY(0.17511520737327188 * height);
        d22h.setTranslateX(0.26129032258064516 * width);
        d22h.setTranslateY(0.17511520737327188 * height);
        d12h.setTranslateX(0.06129032258064516 * width);
        d12h.setTranslateY(0.17511520737327188 * height);
        d51h.setTranslateX(0.8612903225806452 * width);
        d51h.setTranslateY(0.03225806451612903 * height);
        d41h.setTranslateX(0.6612903225806451 * width);
        d41h.setTranslateY(0.03225806451612903 * height);
        d31h.setTranslateX(0.4612903225806452 * width);
        d31h.setTranslateY(0.03225806451612903 * height);
        d21h.setTranslateX(0.26129032258064516 * width);
        d21h.setTranslateY(0.03225806451612903 * height);
        d11h.setTranslateX(0.06129032258064516 * width);
        d11h.setTranslateY(0.03225806451612903 * height);
    }
}
Also used : Region(javafx.scene.layout.Region)

Example 25 with Region

use of javafx.scene.layout.Region in project Board-Instrumentation-Framework by intel.

the class SevenSegmentSkin method initGraphics.

private void initGraphics() {
    segmentA = new Region();
    segmentA.getStyleClass().setAll("a");
    segmentMap.put(SevenSegment.Segment.A, segmentA);
    segmentB = new Region();
    segmentB.getStyleClass().setAll("b");
    segmentMap.put(SevenSegment.Segment.B, segmentB);
    segmentC = new Region();
    segmentC.getStyleClass().setAll("c");
    segmentMap.put(SevenSegment.Segment.C, segmentC);
    segmentD = new Region();
    segmentD.getStyleClass().setAll("d");
    segmentMap.put(SevenSegment.Segment.D, segmentD);
    segmentE = new Region();
    segmentE.getStyleClass().setAll("e");
    segmentMap.put(SevenSegment.Segment.E, segmentE);
    segmentF = new Region();
    segmentF.getStyleClass().setAll("f");
    segmentMap.put(SevenSegment.Segment.F, segmentF);
    segmentG = new Region();
    segmentG.getStyleClass().setAll("g");
    segmentMap.put(SevenSegment.Segment.G, segmentG);
    segmentDot = new Region();
    segmentDot.getStyleClass().setAll("dot");
    segmentMap.put(SevenSegment.Segment.DOT, segmentDot);
    pane.getChildren().setAll(segmentA, segmentB, segmentC, segmentD, segmentE, segmentF, segmentG, segmentDot);
    getChildren().setAll(pane);
    resize();
    update();
}
Also used : 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