Search in sources :

Example 16 with Region

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

the class TButtonSkin method initGraphics.

private void initGraphics() {
    frame = new Region();
    frame.getStyleClass().setAll("frame");
    off = new Region();
    off.getStyleClass().setAll("off");
    offInnerShadow = new InnerShadow();
    offInnerShadow.setOffsetX(0);
    offInnerShadow.setOffsetY(-5.0 / 144.0 * PREFERRED_SIZE);
    offInnerShadow.setRadius(2.0 / 144.0 * PREFERRED_SIZE);
    offInnerShadow.setColor(Color.web("0x00000080"));
    offInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    offInnerShadow1 = new InnerShadow();
    offInnerShadow1.setOffsetX(0.0);
    offInnerShadow1.setOffsetY(0.0);
    offInnerShadow1.setRadius(3.0 / 144.0 * PREFERRED_SIZE);
    offInnerShadow1.setColor(Color.web("0x0000004d"));
    offInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    offInnerShadow1.setInput(offInnerShadow);
    offDropShadow = new DropShadow();
    offDropShadow.setOffsetX(0);
    offDropShadow.setOffsetY(10.0 / 144.0 * PREFERRED_SIZE);
    offDropShadow.setRadius(10.0 / 144.0 * PREFERRED_SIZE);
    offDropShadow.setColor(Color.web("0x000000bf"));
    offDropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    offDropShadow.setInput(offInnerShadow1);
    off.setEffect(offDropShadow);
    off.setVisible(!getSkinnable().isSelected());
    ledOff = new Region();
    ledOff.getStyleClass().setAll("off-led");
    ledOff.setMouseTransparent(true);
    ledOff.setVisible(!getSkinnable().isSelected());
    ledOffInnerShadow = new InnerShadow();
    ledOffInnerShadow.setOffsetX(0);
    ledOffInnerShadow.setOffsetY(2.0 / 144.0 * PREFERRED_SIZE);
    ledOffInnerShadow.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    ledOffInnerShadow.setColor(Color.web("0x0000004d"));
    ledOffInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    ledOffInnerShadow1 = new InnerShadow();
    ledOffInnerShadow1.setOffsetX(0);
    ledOffInnerShadow1.setOffsetY(-2.0);
    ledOffInnerShadow1.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    ledOffInnerShadow1.setColor(Color.web("0xffffffa6"));
    ledOffInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    ledOffInnerShadow1.setInput(ledOffInnerShadow);
    ledOff.setEffect(ledOffInnerShadow1);
    on = new Region();
    on.getStyleClass().setAll("on");
    onInnerShadow = new InnerShadow();
    onInnerShadow.setOffsetX(0);
    onInnerShadow.setOffsetY(-2.0 / 144.0 * PREFERRED_SIZE);
    onInnerShadow.setRadius(2.0 / 144.0 * PREFERRED_SIZE);
    onInnerShadow.setColor(Color.web("0x00000080"));
    onInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    onInnerShadow1 = new InnerShadow();
    onInnerShadow1.setOffsetX(0);
    onInnerShadow1.setOffsetY(5.0 / 144.0 * PREFERRED_SIZE);
    onInnerShadow1.setRadius(2.0 / 144.0 * PREFERRED_SIZE);
    onInnerShadow1.setColor(Color.web("0x90909080"));
    onInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    onInnerShadow1.setInput(onInnerShadow);
    onDropShadow = new DropShadow();
    onDropShadow.setOffsetX(0);
    onDropShadow.setOffsetY(1.0);
    onDropShadow.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    onDropShadow.setColor(Color.web("0x000000bf"));
    onDropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    onDropShadow.setInput(onInnerShadow1);
    on.setEffect(onDropShadow);
    on.setVisible(getSkinnable().isSelected());
    ledOn = new Region();
    ledOn.getStyleClass().setAll("on-led");
    ledOn.setMouseTransparent(true);
    ledOn.setVisible(getSkinnable().isSelected());
    ledOnInnerShadow = new InnerShadow();
    ledOnInnerShadow.setOffsetX(1.4142135623730951);
    ledOnInnerShadow.setOffsetY(1.414213562373095);
    ledOnInnerShadow.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    ledOnInnerShadow.setColor(getSkinnable().getLedColor().darker().darker().darker());
    ledOnInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    ledOnInnerShadow1 = new InnerShadow();
    ledOnInnerShadow1.setOffsetX(-2.457456132866976);
    ledOnInnerShadow1.setOffsetY(-1.7207293090531375);
    ledOnInnerShadow1.setRadius(2.0 / 144.0 * PREFERRED_SIZE);
    ledOnInnerShadow1.setColor(getSkinnable().getLedColor().darker());
    ledOnInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    ledOnInnerShadow1.setInput(ledOnInnerShadow);
    ledOnGlow = new DropShadow();
    ledOnGlow.setOffsetX(0.0);
    ledOnGlow.setOffsetY(0.0);
    ledOnGlow.setRadius(9.0 / 144.0 * PREFERRED_SIZE);
    ledOnGlow.setColor(getSkinnable().getLedColor());
    ledOnGlow.setBlurType(BlurType.TWO_PASS_BOX);
    ledOnGlow.setInput(ledOnInnerShadow1);
    ledOn.setEffect(ledOnGlow);
    // "OpenSans"
    Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (28.0 / 144.0 * PREFERRED_SIZE));
    font = Font.font("Open Sans", FontWeight.BOLD, FontPosture.REGULAR, 28.0 / 144.0 * PREFERRED_SIZE);
    text = new Text(getSkinnable().getText());
    text.setFont(font);
    text.setTextOrigin(VPos.TOP);
    text.getStyleClass().add("text");
    text.setMouseTransparent(true);
    textInnerShadow = new InnerShadow();
    textInnerShadow.setOffsetX(0);
    textInnerShadow.setOffsetY(-1.0 / 144.0 * PREFERRED_SIZE);
    textInnerShadow.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    textInnerShadow.setColor(Color.web("0x90909080"));
    textInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    textInnerShadow1 = new InnerShadow();
    textInnerShadow1.setOffsetX(0);
    textInnerShadow1.setOffsetY(1.0 / 144.0 * PREFERRED_SIZE);
    textInnerShadow1.setRadius(1.0 / 144.0 * PREFERRED_SIZE);
    textInnerShadow1.setColor(Color.web("0x00000080"));
    textInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX);
    textInnerShadow1.setInput(textInnerShadow);
    text.setEffect(textInnerShadow1);
    pane.getChildren().setAll(frame, off, ledOff, on, ledOn, text);
    getChildren().setAll(pane);
    resize();
}
Also used : InnerShadow(javafx.scene.effect.InnerShadow) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) DropShadow(javafx.scene.effect.DropShadow)

Example 17 with Region

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

the class Symbol method initGraphics.

private void initGraphics() {
    symbolRegion = new Region();
    symbolRegion.setId(symbolType.get().STYLE_CLASS);
    // symbolRegion.setStyle("-symbol-color: " + getColor().toString().replace("0x", "#") + ";");
    pane = new Pane();
    pane.getStyleClass().add("symbol");
    pane.setStyle("-symbol-color: " + getColor().toString().replace("0x", "#") + ";");
    pane.getChildren().addAll(symbolRegion);
    getChildren().add(pane);
}
Also used : Region(javafx.scene.layout.Region) Pane(javafx.scene.layout.Pane)

Example 18 with Region

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

the class PushButtonSkin method initGraphics.

private void initGraphics() {
    frame = new Region();
    frame.getStyleClass().setAll("frame");
    outerBorder = new Region();
    outerBorder.getStyleClass().setAll("outer-border");
    innerBorder = new Region();
    innerBorder.getStyleClass().setAll("inner-border");
    body = new Region();
    body.getStyleClass().setAll("body");
    body.setMouseTransparent(true);
    text = new Text("Push");
    text.setTextOrigin(VPos.CENTER);
    text.setMouseTransparent(true);
    text.getStyleClass().setAll("text");
    pane.getChildren().setAll(frame, outerBorder, innerBorder, body, text);
    getChildren().setAll(pane);
    resize();
}
Also used : Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text)

Example 19 with Region

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

the class RectangularGaugeSkin method initGraphics.

private void initGraphics() {
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    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, getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrame = new Region();
    ledFrame.getStyleClass().setAll("led-frame");
    ledMain = new Region();
    ledMain.getStyleClass().setAll("led-main");
    ledMain.setStyle("-led-color: " + (colorToCss(getSkinnable().getLedColor())) + ";");
    ledHl = new Region();
    ledHl.getStyleClass().setAll("led-hl");
    needle = new Region();
    needle.getStyleClass().setAll(RectangularGauge.STYLE_CLASS_NEEDLE_STANDARD);
    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - oldValue - getSkinnable().getMinValue()) * angleStep);
    needle.getTransforms().setAll(needleRotate);
    needleHighlight = new Region();
    needleHighlight.setMouseTransparent(true);
    needleHighlight.getStyleClass().setAll("needle-highlight");
    needleHighlight.getTransforms().setAll(needleRotate);
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    shadowGroup = new Group(needle, needleHighlight);
    shadowGroup.setEffect(getSkinnable().isDropShadowEnabled() ? dropShadow : null);
    titleText = new Text(getSkinnable().getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.getStyleClass().setAll("unit");
    lcdText = new Label(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    lcdText.getStyleClass().setAll("lcd-text");
    // Set initial value
    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = 180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep;
    targetAngle = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    needleRotate.setAngle(targetAngle);
    lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0d, 0d, 2d);
    foreground = new Region();
    foreground.getStyleClass().setAll("foreground");
    foreground.setEffect(lightEffect);
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(ticksAndSectionsCanvas, ledFrame, ledMain, ledHl, unitText, lcdText, shadowGroup, foreground, titleText);
    getChildren().setAll(pane);
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 20 with Region

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

the class HeatControlSkin method initGraphics.

private void initGraphics() {
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), PREFERRED_HEIGHT * 0.1, 0, 0, 0);
    Color color = gradientLookup.getColorAt(getSkinnable().getValue() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue()));
    background = new Circle(0.5 * PREFERRED_WIDTH, 0.5 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH);
    background.setFill(new LinearGradient(0, 0, 0, PREFERRED_HEIGHT, false, CycleMethod.NO_CYCLE, new Stop(0, color.deriveColor(0, 1, 0.8, 1)), new Stop(1, color.deriveColor(0, 1, 0.6, 1))));
    background.setEffect(innerShadow);
    ticksCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksCanvas.setMouseTransparent(true);
    ticks = ticksCanvas.getGraphicsContext2D();
    targetIndicator = new Region();
    targetIndicator.getStyleClass().setAll("target-indicator");
    targetIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep);
    targetIndicator.getTransforms().setAll(targetIndicatorRotate);
    targetExceeded = false;
    targetIndicator.setVisible(getSkinnable().isTargetEnabled());
    valueIndicator = new Region();
    valueIndicator.getStyleClass().setAll("value-indicator");
    valueIndicatorRotate = new Rotate(180 - getSkinnable().getStartAngle());
    valueIndicatorRotate.setAngle(valueIndicatorRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep);
    valueIndicator.getTransforms().setAll(valueIndicatorRotate);
    infoText = new Text(getSkinnable().getInfoText().toUpperCase());
    infoText.setTextOrigin(VPos.CENTER);
    infoText.setFont(Fonts.robotoMedium(0.06 * PREFERRED_HEIGHT));
    infoText.setMouseTransparent(true);
    infoText.getStyleClass().setAll("info-text");
    value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.setFont(Fonts.robotoBold(0.32 * PREFERRED_HEIGHT));
    value.setMouseTransparent(true);
    value.getStyleClass().setAll("value");
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background, ticksCanvas, valueIndicator, targetIndicator, infoText, value);
    getChildren().setAll(pane);
}
Also used : Circle(javafx.scene.shape.Circle) LinearGradient(javafx.scene.paint.LinearGradient) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Stop(javafx.scene.paint.Stop) Color(javafx.scene.paint.Color) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane)

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