Search in sources :

Example 11 with Region

use of javafx.scene.layout.Region in project jphp by jphp-compiler.

the class UXNode method setAnchorFlags.

@Setter
public void setAnchorFlags(ArrayMemory value) {
    Parent parent = getWrappedObject().getParent();
    Bounds parentBounds = parent == null ? null : parent.getLayoutBounds();
    if (parent == null) {
        return;
    }
    Effect effect = getWrappedObject().getEffect();
    getWrappedObject().setEffect(null);
    Bounds bounds = getBoundsInParent();
    Border border = parent instanceof Region ? ((Region) parent).getBorder() : null;
    Insets borderInsets = border == null ? Insets.EMPTY : border.getInsets();
    if (value.containsKey("left")) {
        boolean left = value.valueOfIndex("left").toBoolean();
        if (left) {
            setLeftAnchor(DoubleMemory.valueOf(bounds.getMinX() - borderInsets.getLeft()));
        } else {
            setLeftAnchor(Memory.NULL);
        }
    }
    if (value.containsKey("top")) {
        boolean top = value.valueOfIndex("top").toBoolean();
        if (top) {
            setTopAnchor(DoubleMemory.valueOf(bounds.getMinY() - borderInsets.getTop()));
        } else {
            setTopAnchor(Memory.NULL);
        }
    }
    if (value.containsKey("right")) {
        boolean right = value.valueOfIndex("right").toBoolean();
        if (right) {
            setRightAnchor(DoubleMemory.valueOf(parentBounds.getWidth() - bounds.getMaxX() - borderInsets.getRight()));
        } else {
            setRightAnchor(Memory.NULL);
        }
    }
    if (value.containsKey("bottom")) {
        boolean bottom = value.valueOfIndex("bottom").toBoolean();
        if (bottom) {
            setBottomAnchor(DoubleMemory.valueOf(parentBounds.getHeight() - bounds.getMaxY() - borderInsets.getBottom()));
        } else {
            setBottomAnchor(Memory.NULL);
        }
    }
    getWrappedObject().setEffect(effect);
}
Also used : Insets(javafx.geometry.Insets) Bounds(javafx.geometry.Bounds) Region(javafx.scene.layout.Region) Effect(javafx.scene.effect.Effect) Border(javafx.scene.layout.Border)

Example 12 with Region

use of javafx.scene.layout.Region in project Gargoyle by callakrsos.

the class SvnChagnedCodeComposite method createContextMenu.

/**
	 * 차트 위치를 복구하는 기능을 처리.
	 *
	 * @작성자 : KYJ
	 * @작성일 : 2016. 7. 20.
	 * @param e
	 */
//	public void sceneOnKeyPressed(KeyEvent e) {
//		if (e.getCode() == KeyCode.ESCAPE) {
//
//			setRight(null);
//			e.consume();
//		}
//	}
/**
	 * @작성자 : KYJ
	 * @작성일 : 2016. 7. 20.
	 */
private void createContextMenu() {
    MenuItem miViewHistory = new MenuItem("View History");
    miViewHistory.setOnAction(ev -> {
        Node ownerNode = contextMenu.getOwnerNode();
        System.out.println(ownerNode);
        Node center = getCenter();
        if ((ownerNode != null && ownerNode instanceof Region) && (center != null && center == piChartChagendCode)) {
            Data userData = (Data) contextMenu.getUserData();
            if (userData != null) {
                String relativePath = userData.getName();
                ListView<GargoyleSVNLogEntryPath> createHistoryListView = supplier.createHistoryListView(relativePath);
                FxUtil.showPopOver(ownerNode, createHistoryListView);
            }
        }
    });
    contextMenu = new ContextMenu(miViewHistory);
}
Also used : Node(javafx.scene.Node) Region(javafx.scene.layout.Region) MenuItem(javafx.scene.control.MenuItem) Data(javafx.scene.chart.PieChart.Data) ContextMenu(javafx.scene.control.ContextMenu)

Example 13 with Region

use of javafx.scene.layout.Region in project gs-ui-javafx by graphstream.

the class DefaultApplication method setAliasing.

public static void setAliasing(boolean antialias) {
    if (antialias != antiAliasing) {
        antiAliasing = antialias;
        view.getScene().setRoot(new Region());
        Scene newScene;
        if (antiAliasing)
            newScene = new Scene(view, 800, 600, true, SceneAntialiasing.BALANCED);
        else
            newScene = new Scene(view, 800, 600, true, SceneAntialiasing.DISABLED);
        stage.setScene(newScene);
    }
}
Also used : Region(javafx.scene.layout.Region) Scene(javafx.scene.Scene)

Example 14 with Region

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

the class ClockSkin method initGraphics.

private void initGraphics() {
    pane = new Pane();
    background = new Region();
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        background.getStyleClass().setAll("background-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        background.getStyleClass().setAll("background-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        background.getStyleClass().setAll("background-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        background.getStyleClass().setAll("background-bosch");
    }
    logoLayer = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx = logoLayer.getGraphicsContext2D();
    String majorTickStyleClass;
    String minorTickStyleClass;
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        majorTickStyleClass = "major-tick-ios6";
        minorTickStyleClass = "minor-tick-ios6";
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        majorTickStyleClass = "major-tick-db";
        minorTickStyleClass = "minor-tick-db";
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        majorTickStyleClass = "major-tick-bosch";
        minorTickStyleClass = "minor-tick-bosch";
    } else {
        majorTickStyleClass = "major-tick-braun";
        minorTickStyleClass = "minor-tick-braun";
    }
    int tickLabelCounter = 1;
    for (double angle = 0; angle < 360; angle += 6) {
        Region tick = new Region();
        if (angle % 30 == 0) {
            tick.getStyleClass().setAll(majorTickStyleClass);
            Text tickLabel = new Text(Integer.toString(tickLabelCounter));
            tickLabel.getStyleClass().setAll("tick-label-braun");
            tickLabels.add(tickLabel);
            tickLabelCounter++;
        } else {
            tick.getStyleClass().setAll(minorTickStyleClass);
        }
        ticks.add(tick);
    }
    DropShadow dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.65));
    dropShadow.setRadius(1.5);
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setOffsetY(1);
    tickMarkGroup = new Group();
    tickMarkGroup.setEffect(dropShadow);
    tickMarkGroup.getChildren().setAll(ticks);
    tickLabelGroup = new Group();
    tickLabelGroup.setEffect(dropShadow);
    tickLabelGroup.getChildren().setAll(tickLabels);
    tickLabelGroup.setOpacity(Clock.Design.BRAUN == getSkinnable().getDesign() ? 1 : 0);
    minutePointer = new Region();
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        minutePointer.getStyleClass().setAll("hour-pointer-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        minutePointer.getStyleClass().setAll("hour-pointer-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        minutePointer.getStyleClass().setAll("hour-pointer-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        minutePointer.getStyleClass().setAll("hour-pointer-bosch");
    }
    minutePointer.getTransforms().setAll(minuteRotate);
    minutePointerFlour = new Region();
    minutePointerFlour.getStyleClass().setAll("hour-pointer-braun-flour");
    if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        minutePointerFlour.setOpacity(1);
    } else {
        minutePointerFlour.setOpacity(0);
    }
    minutePointerFlour.getTransforms().setAll(minuteRotate);
    hourPointer = new Region();
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        hourPointer.getStyleClass().setAll("minute-pointer-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        hourPointer.getStyleClass().setAll("minute-pointer-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        hourPointer.getStyleClass().setAll("minute-pointer-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        hourPointer.getStyleClass().setAll("minute-pointer-bosch");
    }
    hourPointer.getTransforms().setAll(hourRotate);
    hourPointerFlour = new Region();
    hourPointerFlour.getStyleClass().setAll("minute-pointer-braun-flour");
    if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        hourPointerFlour.setOpacity(1);
    } else {
        hourPointerFlour.setOpacity(0);
    }
    hourPointerFlour.getTransforms().setAll(hourRotate);
    DropShadow pointerShadow = new DropShadow();
    pointerShadow.setColor(Color.rgb(0, 0, 0, 0.45));
    pointerShadow.setRadius(12);
    pointerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    pointerShadow.setOffsetY(6);
    pointerGroup = new Group();
    pointerGroup.setEffect(pointerShadow);
    pointerGroup.getChildren().setAll(hourPointerFlour, hourPointer, minutePointerFlour, minutePointer);
    secondPointer = new Region();
    secondPointer.setOpacity(1);
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        secondPointer.getStyleClass().setAll("second-pointer-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        secondPointer.getStyleClass().setAll("second-pointer-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        secondPointer.getStyleClass().setAll("second-pointer-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        secondPointer.setOpacity(0);
    }
    secondPointer.getTransforms().setAll(secondRotate);
    InnerShadow secondPointerInnerShadow = new InnerShadow();
    secondPointerInnerShadow.setColor(Color.rgb(0, 0, 0, 0.3));
    secondPointerInnerShadow.setRadius(1);
    secondPointerInnerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    secondPointerInnerShadow.setOffsetY(-1);
    InnerShadow secondPointerInnerHighlight = new InnerShadow();
    secondPointerInnerHighlight.setColor(Color.rgb(255, 255, 255, 0.3));
    secondPointerInnerHighlight.setRadius(1);
    secondPointerInnerHighlight.setBlurType(BlurType.TWO_PASS_BOX);
    secondPointerInnerHighlight.setOffsetY(1);
    secondPointerInnerHighlight.setInput(secondPointerInnerShadow);
    DropShadow secondPointerShadow = new DropShadow();
    secondPointerShadow.setColor(Color.rgb(0, 0, 0, 0.45));
    secondPointerShadow.setRadius(12);
    secondPointerShadow.setBlurType(BlurType.TWO_PASS_BOX);
    secondPointerShadow.setOffsetY(6);
    secondPointerShadow.setInput(secondPointerInnerHighlight);
    secondPointerGroup = new Group();
    secondPointerGroup.setEffect(secondPointerShadow);
    secondPointerGroup.getChildren().setAll(secondPointer);
    secondPointerGroup.setOpacity(getSkinnable().isSecondPointerVisible() ? 1 : 0);
    centerKnob = new Region();
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        centerKnob.getStyleClass().setAll("center-knob-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        centerKnob.getStyleClass().setAll("center-knob-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        centerKnob.getStyleClass().setAll("center-knob-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        centerKnob.getStyleClass().setAll("center-knob-bosch");
    }
    foreground = new Region();
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        foreground.getStyleClass().setAll("foreground-ios6");
    } else if (Clock.Design.DB == getSkinnable().getDesign()) {
        foreground.getStyleClass().setAll("foreground-db");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        foreground.getStyleClass().setAll("foreground-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        foreground.getStyleClass().setAll("foreground-bosch");
    }
    foreground.setOpacity(getSkinnable().isHighlightVisible() ? 1 : 0);
    pane.getChildren().setAll(background, logoLayer, tickMarkGroup, tickLabelGroup, pointerGroup, secondPointerGroup, centerKnob, foreground);
    getChildren().setAll(pane);
    updateDesign();
}
Also used : Group(javafx.scene.Group) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 15 with Region

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

the class ClockSkin method updateDesign.

private void updateDesign() {
    boolean wasRunning = getSkinnable().isRunning();
    if (wasRunning) {
        getSkinnable().setRunning(false);
    }
    // Set day or night mode
    nightDayStyleClass = getSkinnable().isNightMode() ? "night-mode" : "day-mode";
    // Set Styles for each component
    if (Clock.Design.IOS6 == getSkinnable().getDesign()) {
        background.getStyleClass().setAll(nightDayStyleClass, "background-ios6");
        int index = 0;
        for (double angle = 0; angle < 360; angle += 6) {
            Region tick = ticks.get(index);
            if (angle % 30 == 0) {
                tick.getStyleClass().setAll(nightDayStyleClass, "major-tick-ios6");
            } else {
                tick.getStyleClass().setAll(nightDayStyleClass, "minor-tick-ios6");
            }
            ticks.add(tick);
            index++;
        }
        minutePointer.getStyleClass().setAll(nightDayStyleClass, "hour-pointer-ios6");
        hourPointer.getStyleClass().setAll(nightDayStyleClass, "minute-pointer-ios6");
        secondPointer.getStyleClass().setAll(nightDayStyleClass, "second-pointer-ios6");
        centerKnob.getStyleClass().setAll(nightDayStyleClass, "center-knob-ios6");
        foreground.getStyleClass().setAll(nightDayStyleClass, "foreground-ios6");
    } else if (Clock.Design.BRAUN == getSkinnable().getDesign()) {
        nightDayStyleClass = getSkinnable().isNightMode() ? "night-mode-braun" : "day-mode-braun";
        background.getStyleClass().setAll(nightDayStyleClass, "background-braun");
        int index = 0;
        for (double angle = 0; angle < 360; angle += 6) {
            if (angle % 30 == 0) {
                ticks.get(index).getStyleClass().setAll(nightDayStyleClass, "major-tick-braun");
            } else {
                ticks.get(index).getStyleClass().setAll(nightDayStyleClass, "minor-tick-braun");
            }
            index++;
        }
        for (index = 0; index < 12; index++) {
            tickLabels.get(index).getStyleClass().setAll(nightDayStyleClass, "tick-label-braun");
        }
        minutePointer.getStyleClass().setAll(nightDayStyleClass, "hour-pointer-braun");
        hourPointer.getStyleClass().setAll(nightDayStyleClass, "minute-pointer-braun");
        secondPointer.getStyleClass().setAll(nightDayStyleClass, "second-pointer-braun");
        centerKnob.getStyleClass().setAll(nightDayStyleClass, "center-knob-braun");
        foreground.getStyleClass().setAll(nightDayStyleClass, "foreground-braun");
    } else if (Clock.Design.BOSCH == getSkinnable().getDesign()) {
        nightDayStyleClass = getSkinnable().isNightMode() ? "night-mode-bosch" : "day-mode-bosch";
        background.getStyleClass().setAll(nightDayStyleClass, "background-bosch");
        int index = 0;
        for (double angle = 0; angle < 360; angle += 6) {
            Region tick = ticks.get(index);
            if (angle % 30 == 0) {
                tick.getStyleClass().setAll(nightDayStyleClass, "major-tick-bosch");
            } else {
                tick.getStyleClass().setAll(nightDayStyleClass, "minor-tick-bosch");
            }
            ticks.add(tick);
            index++;
        }
        minutePointer.getStyleClass().setAll(nightDayStyleClass, "hour-pointer-bosch");
        hourPointer.getStyleClass().setAll(nightDayStyleClass, "minute-pointer-bosch");
        secondPointer.getStyleClass().setAll(nightDayStyleClass, "second-pointer-bosch");
        centerKnob.getStyleClass().setAll(nightDayStyleClass, "center-knob-bosch");
        foreground.getStyleClass().setAll(nightDayStyleClass, "foreground-bosch");
    } else {
        background.getStyleClass().setAll(nightDayStyleClass, "background-db");
        int index = 0;
        for (double angle = 0; angle < 360; angle += 6) {
            Region tick = ticks.get(index);
            if (angle % 30 == 0) {
                tick.getStyleClass().setAll(nightDayStyleClass, "major-tick-db");
            } else {
                tick.getStyleClass().setAll(nightDayStyleClass, "minor-tick-db");
            }
            ticks.add(tick);
            index++;
        }
        minutePointer.getStyleClass().setAll(nightDayStyleClass, "hour-pointer-db");
        hourPointer.getStyleClass().setAll(nightDayStyleClass, "minute-pointer-db");
        secondPointer.getStyleClass().setAll(nightDayStyleClass, "second-pointer-db");
        centerKnob.getStyleClass().setAll(nightDayStyleClass, "center-knob-db");
        foreground.getStyleClass().setAll(nightDayStyleClass, "foreground-db");
    }
    tickLabelGroup.setOpacity(Clock.Design.BRAUN == getSkinnable().getDesign() ? 1 : 0);
    foreground.setOpacity(getSkinnable().isHighlightVisible() ? 1 : 0);
    resize();
    if (wasRunning) {
        getSkinnable().setRunning(true);
    }
}
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