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);
}
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);
}
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);
}
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());
}
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();
}
}
Aggregations