Search in sources :

Example 1 with BorderStroke

use of javafx.scene.layout.BorderStroke in project cryptomator by cryptomator.

the class DraggableListCell method createDropPositionBorder.

private Border createDropPositionBorder(double verticalCursorPosition) {
    boolean isUpperHalf = verticalCursorPosition < this.getHeight() / 2.0;
    final double topBorder = isUpperHalf ? DROP_LINE_WIDTH : 0.0;
    final double bottomBorder = !isUpperHalf ? DROP_LINE_WIDTH : 0.0;
    final BorderWidths borderWidths = new BorderWidths(topBorder, 0.0, bottomBorder, 0.0);
    final BorderStroke dragStroke = new BorderStroke(DROP_LINE_COLOR, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, borderWidths, Insets.EMPTY);
    final List<BorderStroke> strokes = new ArrayList<BorderStroke>(defaultBorderStrokes);
    strokes.add(0, dragStroke);
    return new Border(strokes, defaultBorderImages);
}
Also used : BorderWidths(javafx.scene.layout.BorderWidths) ArrayList(java.util.ArrayList) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 2 with BorderStroke

use of javafx.scene.layout.BorderStroke in project org.csstudio.display.builder by kasemir.

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());
        custom_border = new Border(new BorderStroke(color, solid, CornerRadii.EMPTY, 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) Border(javafx.scene.layout.Border)

Example 3 with BorderStroke

use of javafx.scene.layout.BorderStroke in project org.csstudio.display.builder by kasemir.

the class ArrayRepresentation method updateChanges.

@Override
public void updateChanges() {
    super.updateChanges();
    if (dirty_number.checkAndClear()) {
        final int diff = children.size() - numChildren;
        if (diff != 0) {
            isAddingRemoving = true;
            if (diff > 0)
                removeChildren(children, diff);
            else
                addChildren(children, -diff);
            isAddingRemoving = false;
        }
        arrangeChildren();
    }
    if (dirty_look.checkAndClear()) {
        if (height > 0)
            jfx_node.setPrefHeight(height);
        if (width > 0)
            jfx_node.setPrefWidth(width);
        Color color = JFXUtil.convert(model_widget.propForegroundColor().getValue());
        jfx_node.setBorder(new Border(new BorderStroke(color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT, new Insets(inset / 2))));
        color = JFXUtil.convert(model_widget.displayBackgroundColor().getValue());
        jfx_node.setBackground(new Background(new BackgroundFill(color, null, null)));
    }
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) Color(javafx.scene.paint.Color) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 4 with BorderStroke

use of javafx.scene.layout.BorderStroke in project org.csstudio.display.builder by kasemir.

the class GroupRepresentation method updateChanges.

@Override
public void updateChanges() {
    super.updateChanges();
    if (dirty_border.checkAndClear()) {
        if (model_widget.propTransparent().getValue()) {
            jfx_node.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, null, null)));
        } else {
            jfx_node.setBackground(new Background(new BackgroundFill(background_color, null, null)));
        }
        final WidgetFont font = model_widget.propFont().getValue();
        label.setFont(JFXUtil.convert(font));
        label.setText(model_widget.propName().getValue());
        final Style style = model_widget.propStyle().getValue();
        int x = model_widget.propX().getValue();
        int y = model_widget.propY().getValue();
        int width = model_widget.propWidth().getValue();
        int height = model_widget.propHeight().getValue();
        // Reset position and size as if style == Style.NONE.
        int[] insets = new int[4];
        System.arraycopy(model_widget.runtimePropInsets().getValue(), 0, insets, 0, insets.length);
        boolean hasChildren = !model_widget.runtimeChildren().getValue().isEmpty();
        if (hasChildren) {
            inner.relocate(-insets[0], -insets[1]);
            x += insets[0];
            y += insets[1];
            width -= insets[2];
            height -= insets[3];
        }
        switch(style) {
            case NONE:
                {
                    inset = 0;
                    insets[0] = 0;
                    insets[1] = 0;
                    insets[2] = 0;
                    insets[3] = 0;
                    // handle the totally invisible group
                    if (toolkit.isEditMode()) {
                        jfx_node.setBorder(new Border(new BorderStroke(foreground_color, EDTI_NONE_DASHED, CornerRadii.EMPTY, EDTI_NONE_BORDER)));
                    } else {
                        jfx_node.setBorder(null);
                    }
                    label.setVisible(false);
                    break;
                }
            case LINE:
                {
                    inset = 0;
                    insets[0] = BORDER_WIDTH;
                    insets[1] = BORDER_WIDTH;
                    insets[2] = 2 * insets[0];
                    insets[3] = 2 * insets[1];
                    jfx_node.setBorder(new Border(new BorderStroke(foreground_color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
                    label.setVisible(false);
                    break;
                }
            case TITLE:
                {
                    inset = 2 + (int) (1.2 * font.getSize());
                    insets[0] = BORDER_WIDTH;
                    insets[1] = inset + BORDER_WIDTH;
                    insets[2] = 2 * insets[0];
                    insets[3] = insets[0] + insets[1];
                    jfx_node.setBorder(new Border(new BorderStroke(foreground_color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT)));
                    label.setVisible(true);
                    label.relocate(0, BORDER_WIDTH);
                    label.setPadding(TITLE_PADDING);
                    label.setPrefSize(width + ((!firstUpdate && hasChildren) ? insets[2] : 0), inset);
                    label.setTextFill(background_color);
                    label.setBackground(new Background(new BackgroundFill(foreground_color, CornerRadii.EMPTY, Insets.EMPTY)));
                    break;
                }
            case GROUP:
            default:
                {
                    inset = 2 + (int) (1.2 * font.getSize());
                    insets[0] = inset;
                    insets[1] = inset;
                    insets[2] = 2 * insets[0];
                    insets[3] = 2 * insets[1];
                    jfx_node.setBorder(new Border(new BorderStroke(foreground_color, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, BorderWidths.DEFAULT, new Insets(inset / 2))));
                    label.setVisible(true);
                    label.relocate(inset, 0);
                    label.setPadding(TITLE_PADDING);
                    label.setPrefSize(Label.USE_COMPUTED_SIZE, Label.USE_COMPUTED_SIZE);
                    label.setTextFill(foreground_color);
                    label.setBackground(new Background(new BackgroundFill(background_color, CornerRadii.EMPTY, Insets.EMPTY)));
                    break;
                }
        }
        inner.relocate(insets[0], insets[1]);
        model_widget.runtimePropInsets().setValue(insets);
        if (firstUpdate) {
            firstUpdate = false;
        } else if (hasChildren) {
            x -= insets[0];
            y -= insets[1];
            width += insets[2];
            height += insets[3];
            model_widget.propX().setValue(x);
            model_widget.propY().setValue(y);
            model_widget.propWidth().setValue(width);
            model_widget.propHeight().setValue(height);
        }
        jfx_node.relocate(x, y);
        jfx_node.setPrefSize(width, height);
    }
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) WidgetFont(org.csstudio.display.builder.model.properties.WidgetFont) Style(org.csstudio.display.builder.model.widgets.GroupWidget.Style) BorderStrokeStyle(javafx.scene.layout.BorderStrokeStyle) BorderStroke(javafx.scene.layout.BorderStroke) Border(javafx.scene.layout.Border)

Example 5 with BorderStroke

use of javafx.scene.layout.BorderStroke in project blue by kunstmusik.

the class BSBGroupView method updateBorderColor.

private void updateBorderColor() {
    label.setBackground(new Background(new BackgroundFill(bsbGroup.getBorderColor(), new CornerRadii(4, 4, 0, 0, false), Insets.EMPTY)));
    resizePane.setBorder(new Border(new BorderStroke(bsbGroup.getBorderColor(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
}
Also used : Background(javafx.scene.layout.Background) BorderWidths(javafx.scene.layout.BorderWidths) BackgroundFill(javafx.scene.layout.BackgroundFill) BorderStroke(javafx.scene.layout.BorderStroke) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Aggregations

Border (javafx.scene.layout.Border)23 BorderStroke (javafx.scene.layout.BorderStroke)23 BorderWidths (javafx.scene.layout.BorderWidths)18 Background (javafx.scene.layout.Background)13 BackgroundFill (javafx.scene.layout.BackgroundFill)13 CornerRadii (javafx.scene.layout.CornerRadii)10 Insets (javafx.geometry.Insets)9 Text (javafx.scene.text.Text)5 ArrayList (java.util.ArrayList)4 Label (javafx.scene.control.Label)4 List (java.util.List)3 BorderStrokeStyle (javafx.scene.layout.BorderStrokeStyle)3 Color (javafx.scene.paint.Color)3 ZonedDateTime (java.time.ZonedDateTime)2 Optional (java.util.Optional)2 ObservableList (javafx.collections.ObservableList)2 MouseEvent (javafx.scene.input.MouseEvent)2 StackPane (javafx.scene.layout.StackPane)2 VBox (javafx.scene.layout.VBox)2 Rectangle (javafx.scene.shape.Rectangle)2