Search in sources :

Example 6 with BorderWidths

use of javafx.scene.layout.BorderWidths in project tilesfx by HanSolo.

the class SunburstChart method initGraphics.

// ******************** Initialization ************************************
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }
    segmentPane = new Pane();
    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);
    chartCtx = chartCanvas.getGraphicsContext2D();
    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
    getChildren().setAll(pane);
    prepareData();
}
Also used : Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) Canvas(javafx.scene.canvas.Canvas) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) Pane(javafx.scene.layout.Pane) Border(javafx.scene.layout.Border)

Example 7 with BorderWidths

use of javafx.scene.layout.BorderWidths in project tilesfx by HanSolo.

the class PlusMinusTileSkin method decrement.

private void decrement() {
    minusLabel.setTextFill(tile.getActiveColor());
    minusLabel.setBorder(new Border(new BorderStroke(tile.getActiveColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
    double newValue = clamp(minValue, maxValue, tile.getValue() - tile.getIncrement());
    tile.setValue(newValue);
}
Also used : BorderWidths(javafx.scene.layout.BorderWidths) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Example 8 with BorderWidths

use of javafx.scene.layout.BorderWidths in project tilesfx by HanSolo.

the class PlusMinusTileSkin method resize.

@Override
protected void resize() {
    super.resize();
    description.setPrefSize(width - size * 0.1, size * 0.43);
    description.relocate(size * 0.05, titleText.isVisible() ? height * 0.42 : height * 0.32);
    double buttonSize = size * 0.18;
    minusLabel.setFont(Fonts.latoBold(size * 0.2));
    minusLabel.setPrefSize(buttonSize, buttonSize);
    minusLabel.setMinSize(buttonSize, buttonSize);
    minusLabel.setMaxSize(buttonSize, buttonSize);
    // minusLabel.setPadding(new Insets(-0.055 * size, 0, 0, 0));
    minusLabel.setPadding(new Insets(-0.0625 * size, 0, 0, 0));
    minusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
    minusLabel.relocate(size * 0.05, height - size * 0.20 - buttonSize);
    plusLabel.setFont(Fonts.latoBold(size * 0.2));
    plusLabel.setPrefSize(buttonSize, buttonSize);
    plusLabel.setMinSize(buttonSize, buttonSize);
    plusLabel.setMaxSize(buttonSize, buttonSize);
    plusLabel.setPadding(new Insets(-0.05 * size, 0, 0, 0));
    plusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
    plusLabel.relocate(width - size * 0.05 - buttonSize, height - size * 0.20 - buttonSize);
    valueUnitFlow.setPrefWidth(width - size * 0.1);
    valueUnitFlow.relocate(size * 0.05, contentBounds.getY());
    valueUnitFlow.setMaxHeight(valueText.getFont().getSize());
    fractionLine.setStartX(width - 0.17 * size);
    fractionLine.setStartY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3);
    fractionLine.setEndX(width - 0.05 * size);
    fractionLine.setEndY(tile.getTitle().isEmpty() ? size * 0.2 : size * 0.3);
    fractionLine.setStroke(tile.getUnitColor());
    fractionLine.setStrokeWidth(size * 0.005);
    unitFlow.setTranslateY(-size * 0.005);
}
Also used : Insets(javafx.geometry.Insets) BorderWidths(javafx.scene.layout.BorderWidths) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Example 9 with BorderWidths

use of javafx.scene.layout.BorderWidths in project TestFX by TestFX.

the class BoundsQueryUtilsTest method setupRegion.

private static void setupRegion() {
    region = new Region();
    region.setMaxSize(0, 0);
    region.setBackground(new Background(new BackgroundFill(Color.RED, null, null)));
    // nodeBounds(), nodeBoundsInLocal()
    region.setPadding(new Insets(0, 0, 0, PADDING_LEFT));
    region.setBorder(new Border(new BorderStroke(Color.BLUE, BorderStrokeStyle.SOLID, null, // nodeBounds(), nodeBoundsInLocal()
    new BorderWidths(0, 0, 0, BORDER_LEFT))));
    // nodeBoundsInParent()
    StackPane.setMargin(region, new Insets(0, 0, 0, MARGIN_LEFT));
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) Region(javafx.scene.layout.Region) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 10 with BorderWidths

use of javafx.scene.layout.BorderWidths in project phoebus by ControlSystemStudio.

the class RegionBaseRepresentation method custom_border_changed.

private void custom_border_changed(final WidgetProperty<?> property, final Object old_value, final Object new_value) {
    final Integer width = border_width_prop.getValue();
    if (width <= 0)
        custom_border = null;
    else {
        final Color color = JFXUtil.convert(border_color_prop.getValue());
        final CornerRadii corners = computeCornerRadii();
        custom_border = new Border(new BorderStroke(color, solid, corners, new BorderWidths(width)));
    }
    dirty_border.mark();
    toolkit.scheduleUpdate(this);
}
Also used : BorderWidths(javafx.scene.layout.BorderWidths) WidgetColor(org.csstudio.display.builder.model.properties.WidgetColor) Color(javafx.scene.paint.Color) CommonWidgetProperties.propBorderColor(org.csstudio.display.builder.model.properties.CommonWidgetProperties.propBorderColor) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Aggregations

Border (javafx.scene.layout.Border)28 BorderStroke (javafx.scene.layout.BorderStroke)28 BorderWidths (javafx.scene.layout.BorderWidths)28 Background (javafx.scene.layout.Background)17 BackgroundFill (javafx.scene.layout.BackgroundFill)17 CornerRadii (javafx.scene.layout.CornerRadii)15 Insets (javafx.geometry.Insets)10 Text (javafx.scene.text.Text)6 ArrayList (java.util.ArrayList)4 HBox (javafx.scene.layout.HBox)4 Pane (javafx.scene.layout.Pane)4 Region (javafx.scene.layout.Region)3 StackPane (javafx.scene.layout.StackPane)3 VBox (javafx.scene.layout.VBox)3 Rectangle (javafx.scene.shape.Rectangle)3 List (java.util.List)2 ObservableList (javafx.collections.ObservableList)2 Color (javafx.scene.paint.Color)2 Line (javafx.scene.shape.Line)2 CommonWidgetProperties.propBorderColor (org.csstudio.display.builder.model.properties.CommonWidgetProperties.propBorderColor)2