Search in sources :

Example 21 with CornerRadii

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

the class TileSkin method initGraphics.

// ******************** Initialization ************************************
protected void initGraphics() {
    // Set initial size
    if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
        if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
            tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
        } else {
            tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }
    shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);
    notifyRegion = new NotifyRegion();
    enableNode(notifyRegion, false);
    pane = new Pane(notifyRegion);
    pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
    pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));
    getChildren().setAll(pane);
}
Also used : NotifyRegion(eu.hansolo.tilesfx.tools.NotifyRegion) 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) Pane(javafx.scene.layout.Pane) Border(javafx.scene.layout.Border) DropShadow(javafx.scene.effect.DropShadow)

Example 22 with CornerRadii

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

the class SmoothedChart method setSeriesColor.

public void setSeriesColor(final XYChart.Series<X, Y> SERIES, final Paint STROKE, final Paint FILL, final Paint LEGEND_SYMBOL_FILL) {
    Background symbolBackground = new Background(new BackgroundFill(STROKE, new CornerRadii(1024), Insets.EMPTY), new BackgroundFill(Color.WHITE, new CornerRadii(1024), new Insets(2)));
    setSeriesColor(SERIES, STROKE, FILL, symbolBackground, LEGEND_SYMBOL_FILL);
}
Also used : Insets(javafx.geometry.Insets) Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 23 with CornerRadii

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

the class PercentageTileSkin method initGraphics.

// ******************** Initialization ************************************
@Override
protected void initGraphics() {
    super.initGraphics();
    barColor = tile.getBarColor();
    barBackground = new Region();
    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor(), new CornerRadii(0.0, 0.0, 0.025, 0.025, true), Insets.EMPTY)));
    barClip = new Rectangle();
    bar = new Rectangle();
    bar.setFill(tile.getBarColor());
    bar.setStroke(null);
    bar.setClip(barClip);
    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());
    valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
    valueText.setFill(tile.getValueColor());
    Helper.enableNode(valueText, tile.isValueVisible());
    unitText = new Text(tile.getUnit());
    unitText.setFill(tile.getUnitColor());
    Helper.enableNode(unitText, !tile.getUnit().isEmpty());
    valueUnitFlow = new TextFlow(valueText, unitText);
    valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
    description = new Label(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    description.setWrapText(true);
    description.setTextFill(tile.getTextColor());
    Helper.enableNode(description, !tile.getDescription().isEmpty());
    percentageText = new Text();
    percentageText.setFill(tile.getBarColor());
    percentageUnitText = new Text("%");
    percentageUnitText.setFill(tile.getBarColor());
    maxValueRect = new Rectangle();
    maxValueRect.setFill(tile.getThresholdColor());
    maxValueText = new Text();
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText = new Text(tile.getUnit());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    getPane().getChildren().addAll(barBackground, bar, titleText, valueUnitFlow, description, percentageText, percentageUnitText, maxValueRect, maxValueText, maxValueUnitText);
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) Rectangle(javafx.scene.shape.Rectangle) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) CornerRadii(javafx.scene.layout.CornerRadii)

Example 24 with CornerRadii

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

the class PercentageTileSkin method redraw.

@Override
protected void redraw() {
    super.redraw();
    titleText.setText(tile.getTitle());
    unitText.setText(tile.getUnit());
    description.setText(tile.getDescription());
    description.setAlignment(tile.getDescriptionAlignment());
    percentageText.setText(String.format(locale, "%." + tile.getDecimals() + "f", tile.getValue() / range * 100));
    maxValueText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue()));
    maxValueUnitText.setText(tile.getUnit());
    resizeStaticText();
    barBackground.setBackground(new Background(new BackgroundFill(tile.getBarBackgroundColor().brighter().brighter(), new CornerRadii(0.0, 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, tile.getRoundedCorners() ? size * 0.025 : 0.0, false), Insets.EMPTY)));
    barColor = tile.getBarColor();
    if (sectionsVisible && !sections.isEmpty()) {
        setBarColor(tile.getValue());
    } else {
        bar.setFill(barColor);
    }
    titleText.setFill(tile.getTitleColor());
    unitText.setFill(tile.getUnitColor());
    description.setTextFill(tile.getDescriptionColor());
    maxValueText.setFill(tile.getBackgroundColor());
    maxValueUnitText.setFill(tile.getBackgroundColor());
    maxValueRect.setFill(Double.compare(tile.getCurrentValue(), maxValue) >= 0 ? barColor : tile.getThresholdColor());
    valueText.setFill(tile.getValueColor());
    unitText.setFill(tile.getUnitColor());
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Example 25 with CornerRadii

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

the class RadarChart method resize.

// ******************** Private Methods ***********************************
private void resize() {
    double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
    double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size = width < height ? width : height;
    if (size > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
        pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
        chartCanvas.setWidth(size);
        chartCanvas.setHeight(size);
        overlayCanvas.setWidth(size);
        overlayCanvas.setHeight(size);
        redraw();
    }
}
Also used : Background(javafx.scene.layout.Background) BackgroundFill(javafx.scene.layout.BackgroundFill) CornerRadii(javafx.scene.layout.CornerRadii)

Aggregations

CornerRadii (javafx.scene.layout.CornerRadii)25 Background (javafx.scene.layout.Background)20 BackgroundFill (javafx.scene.layout.BackgroundFill)20 Border (javafx.scene.layout.Border)9 BorderStroke (javafx.scene.layout.BorderStroke)9 BorderWidths (javafx.scene.layout.BorderWidths)9 Insets (javafx.geometry.Insets)7 Text (javafx.scene.text.Text)5 Label (javafx.scene.control.Label)4 DropShadow (javafx.scene.effect.DropShadow)3 Pane (javafx.scene.layout.Pane)3 Color (javafx.scene.paint.Color)3 Rectangle (javafx.scene.shape.Rectangle)2 TextFlow (javafx.scene.text.TextFlow)2 BlackCard (com.gianlu.pyxreborn.Models.BlackCard)1 JFXColorPicker (com.jfoenix.controls.JFXColorPicker)1 JFXToggleNode (com.jfoenix.controls.JFXToggleNode)1 ConicalGradient (eu.hansolo.medusa.tools.ConicalGradient)1 Tile (eu.hansolo.tilesfx.Tile)1 ChartData (eu.hansolo.tilesfx.chart.ChartData)1