javafx.scene.shape.FillRule Java Examples
The following examples show how to use
javafx.scene.shape.FillRule.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RadialMenuItem.java From RadialFx with GNU Lesser General Public License v3.0 | 6 votes |
protected void redraw() { if (graphic.get() != null) { graphicContainer.getChildren().setAll(graphic.get()); } else { graphicContainer.getChildren().clear(); } path.setFill(backgroundVisible.get() ? (mouseOn && backgroundMouseOnFill.get() != null ? backgroundMouseOnFill .get() : backgroundFill.get()) : null); path.setStroke(strokeVisible.get() ? (mouseOn && strokeMouseOnFill.get() != null ? strokeMouseOnFill.get() : strokeFill.get()) : null); path.setFillRule(FillRule.EVEN_ODD); computeCoordinates(); updateCoordinates(); }
Example #2
Source File: ShapeConverter.java From Enzo with Apache License 2.0 | 6 votes |
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) { final Path PATH = new Path(); PATH.setFillRule(FillRule.EVEN_ODD); while (!PATH_LIST.isEmpty()) { if ("M".equals(READER.read())) { PATH.getElements().add(new MoveTo(READER.nextX(), READER.nextY())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new LineTo(READER.nextX(), READER.nextY())); } else if ("C".equals(READER.read())) { PATH.getElements().add(new CubicCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("Q".equals(READER.read())) { PATH.getElements().add(new QuadCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY())); } else if ("H".equals(READER.read())) { PATH.getElements().add(new HLineTo(READER.nextX())); } else if ("L".equals(READER.read())) { PATH.getElements().add(new VLineTo(READER.nextY())); } else if ("A".equals(READER.read())) { PATH.getElements().add(new ArcTo(READER.nextX(), READER.nextY(), 0, READER.nextX(), READER.nextY(), false, false)); } else if ("Z".equals(READER.read())) { PATH.getElements().add(new ClosePath()); } } return PATH; }
Example #3
Source File: Path.java From charts with Apache License 2.0 | 6 votes |
public void draw(final GraphicsContext CTX, final boolean FILL, final boolean STROKE) { PathIterator pi = getPathIterator(new Affine()); CTX.setFillRule(WindingRule.WIND_EVEN_ODD == pi.getWindingRule() ? FillRule.EVEN_ODD : FillRule.NON_ZERO); CTX.beginPath(); double[] seg = new double[6]; int segType; while(!pi.isDone()) { segType = pi.currentSegment(seg); switch (segType) { case PathIterator.MOVE_TO : CTX.moveTo(seg[0], seg[1]); break; case PathIterator.LINE_TO : CTX.lineTo(seg[0], seg[1]); break; case PathIterator.QUAD_TO : CTX.quadraticCurveTo(seg[0], seg[1], seg[2], seg[3]);break; case PathIterator.BEZIER_TO: CTX.bezierCurveTo(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);break; case PathIterator.CLOSE : CTX.closePath();break; default : break; } pi.next(); } if (FILL) { CTX.setFill(fill); CTX.fill(); } if (STROKE) { CTX.setStroke(stroke); CTX.stroke(); } }
Example #4
Source File: ErrorDataSetRenderer.java From chart-fx with Apache License 2.0 | 5 votes |
/** * @param gc the graphics context from the Canvas parent * @param localCachedPoints reference to local cached data point object */ protected void drawErrorSurface(final GraphicsContext gc, final CachedDataPoints localCachedPoints) { final long start = ProcessingProfiler.getTimeStamp(); DefaultRenderColorScheme.setFillScheme(gc, localCachedPoints.defaultStyle, localCachedPoints.dataSetIndex + localCachedPoints.dataSetStyleIndex); final int nDataCount = localCachedPoints.actualDataCount; final int nPolygoneEdges = 2 * nDataCount; final double[] xValuesSurface = DoubleArrayCache.getInstance().getArrayExact(nPolygoneEdges); final double[] yValuesSurface = DoubleArrayCache.getInstance().getArrayExact(nPolygoneEdges); final int xend = nPolygoneEdges - 1; for (int i = 0; i < nDataCount; i++) { xValuesSurface[i] = localCachedPoints.xValues[i]; yValuesSurface[i] = localCachedPoints.errorYNeg[i]; xValuesSurface[xend - i] = localCachedPoints.xValues[i]; yValuesSurface[xend - i] = localCachedPoints.errorYPos[i]; } // swap y coordinates at mid-point if (nDataCount > 4) { final double yTmp = yValuesSurface[nDataCount - 1]; yValuesSurface[nDataCount - 1] = yValuesSurface[xend - nDataCount + 1]; yValuesSurface[xend - nDataCount + 1] = yTmp; } gc.setFillRule(FillRule.EVEN_ODD); gc.fillPolygon(xValuesSurface, yValuesSurface, nPolygoneEdges); drawPolyLine(gc, localCachedPoints); drawBars(gc, localCachedPoints); drawMarker(gc, localCachedPoints); drawBubbles(gc, localCachedPoints); DoubleArrayCache.getInstance().add(xValuesSurface); DoubleArrayCache.getInstance().add(yValuesSurface); ProcessingProfiler.getTimeDiff(start); }
Example #5
Source File: BatterySkin.java From Medusa with Apache License 2.0 | 5 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } batteryBackground = new Path(); batteryBackground.setFillRule(FillRule.EVEN_ODD); batteryBackground.setStroke(null); battery = new Path(); battery.setFillRule(FillRule.EVEN_ODD); battery.setStroke(null); valueText = new Text(String.format(locale, "%.0f%%", gauge.getCurrentValue())); valueText.setVisible(gauge.isValueVisible()); valueText.setManaged(gauge.isValueVisible()); // Add all nodes pane = new Pane(); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); pane.getChildren().setAll(batteryBackground, battery, valueText); getChildren().setAll(pane); }
Example #6
Source File: SplitFlapSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void resize() { width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (getSkinnable().isKeepAspect()) { if (aspectRatio * width > height) { width = 1 / (aspectRatio / height); } else if (1 / (aspectRatio / height) > width) { height = aspectRatio * width; } } if (width > 0 && height > 0) { // Autocenter the control //getSkinnable().setTranslateX((getSkinnable().getWidth() - width) * 0.5); //getSkinnable().setTranslateY((getSkinnable().getHeight() - height) * 0.5); flapHeight = 0.49206349206349204 * height; fixtureRight.setPrefSize(0.0476190476 * height, 0.164021164021164 * height); fixtureRight.setTranslateX(width - 0.0476190476 * height); fixtureRight.setTranslateY(0.41798941798941797 * height); fixtureLeft.setPrefSize(0.0476190476 * height, 0.164021164021164 * height); fixtureLeft.setTranslateY(0.41798941798941797 * height); if (width > height && width > 0 && height > 0) { final Path UPPER = new Path(); UPPER.setFillRule(FillRule.EVEN_ODD); UPPER.getElements().add(new MoveTo(width, 0.0)); UPPER.getElements().add(new LineTo(width, 0.4074074074074074 * height)); UPPER.getElements().add(new LineTo(width - 0.0582010582 * height, 0.4074074074074074 * height)); UPPER.getElements().add(new LineTo(width - 0.0582010582 * height, 0.49206349206349204 * height)); UPPER.getElements().add(new LineTo(0.0582010582 * height, 0.49206349206349204 * height)); UPPER.getElements().add(new LineTo(0.0582010582 * height, 0.4074074074074074 * height)); UPPER.getElements().add(new LineTo(0.0, 0.4074074074074074 * height)); UPPER.getElements().add(new LineTo(0.0, 0.0)); UPPER.getElements().add(new LineTo(width, 0.0)); UPPER.getElements().add(new ClosePath()); final String UPPER_SVG = ShapeConverter.shapeToSvgString(UPPER); final Path LOWER = new Path(); LOWER.setFillRule(FillRule.EVEN_ODD); LOWER.getElements().add(new MoveTo(width, height)); LOWER.getElements().add(new LineTo(width, 0.5925925925925926 * height)); LOWER.getElements().add(new LineTo(width - 0.0582010582 * height, 0.5925925925925926 * height)); LOWER.getElements().add(new LineTo(width - 0.0582010582 * height, 0.5079365079365079 * height)); LOWER.getElements().add(new LineTo(0.0582010582 * height, 0.5079365079365079 * height)); LOWER.getElements().add(new LineTo(0.0582010582 * height, 0.5925925925925926 * height)); LOWER.getElements().add(new LineTo(0.0, 0.5925925925925926 * height)); LOWER.getElements().add(new LineTo(0.0, height)); LOWER.getElements().add(new LineTo(width, height)); LOWER.getElements().add(new ClosePath()); final String LOWER_SVG = ShapeConverter.shapeToSvgString(LOWER); upperBackground.setStyle(new StringBuilder("-fx-shape:").append("\"").append(UPPER_SVG).append("\";").toString()); lowerBackground.setStyle(new StringBuilder("-fx-shape:").append("\"").append(LOWER_SVG).append("\";").toString()); flap.setStyle(new StringBuilder("-fx-shape:").append("\"").append(UPPER_SVG).append("\";").toString()); } upperBackground.setPrefSize(width, flapHeight); lowerBackground.setPrefSize(width, flapHeight); lowerBackground.setTranslateY(0.5079365079365079 * height); //font = Font.font("Bebas Neue", height * 0.9); font = Font.font("Droid Sans Mono", height * 0.75); upperBackgroundText.setWidth(width); upperBackgroundText.setHeight(flapHeight); lowerBackgroundText.setWidth(width); lowerBackgroundText.setHeight(flapHeight); lowerBackgroundText.setTranslateY(0.5079365079365079 * height); flap.setPrefSize(width, flapHeight); rotateFlap.setPivotY(height * 0.5); flapTextFront.setWidth(width); flapTextFront.setHeight(flapHeight); flapTextBack.setWidth(width); flapTextBack.setHeight(flapHeight); ctxUpperBackgroundText.setFont(font); ctxLowerBackgroundText.setFont(font); ctxTextFront.setFont(font); ctxTextBack.setFont(font); refreshTextCtx(); innerShadow.setOffsetY(-0.01 * flapHeight); innerShadow.setRadius(0.01 * flapHeight); innerHighlight.setOffsetY(0.01 * flapHeight); innerHighlight.setRadius(0.01 * flapHeight); reversedInnerShadow.setOffsetY(-0.01 * 0.4920634921 * height); reversedInnerShadow.setRadius(0.01 * 0.4920634921 * height); reversedInnerHighlight.setOffsetY(0.01 * 0.4920634921 * height); reversedInnerHighlight.setRadius(0.01 * 0.4920634921 * height); } }
Example #7
Source File: Shape2Geometry.java From gef with Eclipse Public License 2.0 | 4 votes |
/** * Converts the given JavaFX {@link Path} to a * {@link org.eclipse.gef.geometry.planar.Path}. * * @param path * The JavaFX {@link Path} to convert. * @return The newly created {@link org.eclipse.gef.geometry.planar.Path} * that describes the given {@link Path}. */ public static final org.eclipse.gef.geometry.planar.Path toPath( Path path) { ObservableList<PathElement> elements = path.getElements(); org.eclipse.gef.geometry.planar.Path.Segment[] segments = new org.eclipse.gef.geometry.planar.Path.Segment[elements .size()]; for (int i = 0; i < segments.length; i++) { PathElement element = elements.get(i); if (element instanceof MoveTo) { MoveTo moveTo = (MoveTo) element; segments[i] = new Segment(Segment.MOVE_TO, new Point(moveTo.getX(), moveTo.getY())); } else if (element instanceof LineTo) { LineTo lineTo = (LineTo) element; segments[i] = new Segment(Segment.LINE_TO, new Point(lineTo.getX(), lineTo.getY())); } else if (element instanceof QuadCurveTo) { QuadCurveTo quadTo = (QuadCurveTo) element; segments[i] = new Segment(Segment.QUAD_TO, new Point(quadTo.getControlX(), quadTo.getControlY()), new Point(quadTo.getX(), quadTo.getY())); } else if (element instanceof CubicCurveTo) { CubicCurveTo cubicTo = (CubicCurveTo) element; segments[i] = new Segment(Segment.CUBIC_TO, new Point(cubicTo.getControlX1(), cubicTo.getControlY1()), new Point(cubicTo.getControlX2(), cubicTo.getControlY2()), new Point(cubicTo.getX(), cubicTo.getY())); } else if (element instanceof ClosePath) { segments[i] = new Segment(Segment.CLOSE); } } int windingRule = path.getFillRule() == FillRule.EVEN_ODD ? org.eclipse.gef.geometry.planar.Path.WIND_EVEN_ODD : org.eclipse.gef.geometry.planar.Path.WIND_NON_ZERO; return new org.eclipse.gef.geometry.planar.Path(windingRule, segments); }
Example #8
Source File: TileClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } minuteTickMarks = new Path(); minuteTickMarks.setFillRule(FillRule.EVEN_ODD); minuteTickMarks.setFill(null); minuteTickMarks.setStroke(clock.getMinuteColor()); minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hourTickMarks = new Path(); hourTickMarks.setFillRule(FillRule.EVEN_ODD); hourTickMarks.setFill(null); hourTickMarks.setStroke(clock.getHourColor()); hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(clock.getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setTextOrigin(VPos.TOP); Helper.enableNode(title, clock.isTitleVisible()); amPmText = new Text(clock.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM"); dateText = new Text(""); Helper.enableNode(dateText, clock.isDateVisible()); text = new Text(""); Helper.enableNode(text, clock.isTextVisible()); pane = new Pane(hourTickMarks, minuteTickMarks, title, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY))); getChildren().setAll(pane); }
Example #9
Source File: PlainClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.0148448); knob.setStroke(null); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example #10
Source File: IndicatorSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange); barBackground.setType(ArcType.OPEN); barBackground.setStroke(gauge.getBarBackgroundColor()); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.BUTT); barBackground.setFill(null); sectionLayer = new Pane(); sectionLayer.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY))); bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, 0); bar.setType(ArcType.OPEN); bar.setStroke(gauge.getBarColor()); bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); bar.setStrokeLineCap(StrokeLineCap.BUTT); bar.setFill(null); //bar.setMouseTransparent(sectionsAlwaysVisible ? true : false); bar.setVisible(!sectionsAlwaysVisible); needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleCubicCurveTo5 = new CubicCurveTo(); needleCubicCurveTo6 = new CubicCurveTo(); needleCubicCurveTo7 = new CubicCurveTo(); needleClosePath8 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleCubicCurveTo6, needleCubicCurveTo7, needleClosePath8); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setPickOnBounds(false); needle.setStrokeType(StrokeType.INSIDE); needle.setStrokeWidth(1); needle.setStroke(gauge.getBackgroundPaint()); needleTooltip = new Tooltip(String.format(locale, formatString, gauge.getValue())); needleTooltip.setTextAlignment(TextAlignment.CENTER); Tooltip.install(needle, needleTooltip); minValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue())); minValueText.setFill(gauge.getTitleColor()); Helper.enableNode(minValueText, gauge.getTickLabelsVisible()); maxValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue())); maxValueText.setFill(gauge.getTitleColor()); Helper.enableNode(maxValueText, gauge.getTickLabelsVisible()); titleText = new Text(gauge.getTitle()); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); if (!sections.isEmpty() && sectionsVisible && !sectionsAlwaysVisible) { barTooltip = new Tooltip(); barTooltip.setTextAlignment(TextAlignment.CENTER); Tooltip.install(bar, barTooltip); } pane = new Pane(barBackground, sectionLayer, bar, needle, minValueText, maxValueText, titleText); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #11
Source File: IndustrialClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); centerDot = new Circle(); centerDot.setFill(Color.WHITE); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupMinute, shadowGroupHour, shadowGroupSecond, centerDot); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example #12
Source File: TinySkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, ANGLE_RANGE * 0.5 + 90, -ANGLE_RANGE); barBackground.setType(ArcType.OPEN); barBackground.setStroke(gauge.getBarBackgroundColor()); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.BUTT); barBackground.setFill(null); sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionCtx = sectionCanvas.getGraphicsContext2D(); needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleCubicCurveTo5 = new CubicCurveTo(); needleClosePath6 = new ClosePath(); needleMoveTo7 = new MoveTo(); needleCubicCurveTo8 = new CubicCurveTo(); needleCubicCurveTo9 = new CubicCurveTo(); needleCubicCurveTo10 = new CubicCurveTo(); needleCubicCurveTo11 = new CubicCurveTo(); needleClosePath12 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleCubicCurveTo5, needleClosePath6, needleMoveTo7, needleCubicCurveTo8, needleCubicCurveTo9, needleCubicCurveTo10, needleCubicCurveTo11, needleClosePath12); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setStrokeType(StrokeType.INSIDE); needle.setStrokeWidth(1); needle.setStroke(gauge.getBackgroundPaint()); needleTooltip = new Tooltip(String.format(locale, formatString, gauge.getValue())); needleTooltip.setTextAlignment(TextAlignment.CENTER); Tooltip.install(needle, needleTooltip); pane = new Pane(barBackground, sectionCanvas, needle); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example #13
Source File: LcdClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } mainInnerShadow0 = new InnerShadow(); mainInnerShadow0.setOffsetX(0.0); mainInnerShadow0.setOffsetY(0.0); mainInnerShadow0.setRadius(3.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow0.setColor(Color.rgb(255, 255, 255, 0.5)); mainInnerShadow0.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1 = new InnerShadow(); mainInnerShadow1.setOffsetX(0.0); mainInnerShadow1.setOffsetY(1.0); mainInnerShadow1.setRadius(2.0 / 132.0 * PREFERRED_WIDTH); mainInnerShadow1.setColor(Color.rgb(0, 0, 0, 0.65)); mainInnerShadow1.setBlurType(BlurType.TWO_PASS_BOX); mainInnerShadow1.setInput(mainInnerShadow0); crystalClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT); crystalClip.setArcWidth(5); crystalClip.setArcHeight(5); crystalImage = Helper.createNoiseImage(PREFERRED_WIDTH, PREFERRED_HEIGHT, DARK_NOISE_COLOR, BRIGHT_NOISE_COLOR, 8); crystalOverlay = new ImageView(crystalImage); crystalOverlay.setClip(crystalClip); boolean crystalEnabled = clock.isLcdCrystalEnabled(); crystalOverlay.setManaged(crystalEnabled); crystalOverlay.setVisible(crystalEnabled); boolean secondsVisible = clock.isSecondsVisible(); backgroundTimeText = new Text(""); backgroundTimeText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundTimeText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText = new Text(""); backgroundSecondText.setFill(clock.getLcdDesign().lcdBackgroundColor); backgroundSecondText.setOpacity((LcdFont.LCD == clock.getLcdFont() || LcdFont.ELEKTRA == clock.getLcdFont()) ? 1 : 0); backgroundSecondText.setManaged(secondsVisible); backgroundSecondText.setVisible(secondsVisible); timeText = new Text(""); timeText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText = new Text(""); secondText.setFill(clock.getLcdDesign().lcdForegroundColor); secondText.setManaged(secondsVisible); secondText.setVisible(secondsVisible); title = new Text(clock.getTitle()); title.setFill(clock.getLcdDesign().lcdForegroundColor); boolean titleVisible = clock.isTitleVisible(); title.setManaged(titleVisible); title.setVisible(titleVisible); dateText = new Text(dateFormat.format(clock.getTime())); dateText.setFill(clock.getLcdDesign().lcdForegroundColor); boolean dateVisible = clock.isDateVisible(); dateText.setManaged(dateVisible); dateText.setVisible(dateVisible); dayOfWeekText = new Text(""); dayOfWeekText.setFill(clock.getLcdDesign().lcdForegroundColor); dayOfWeekText.setManaged(dateVisible); dayOfWeekText.setVisible(dateVisible); alarm = new Path(); alarm.setFillRule(FillRule.EVEN_ODD); alarm.setStroke(null); boolean alarmVisible = clock.getAlarms().size() > 0; alarm.setManaged(alarmVisible); alarm.setVisible(alarmVisible); shadowGroup = new Group(); shadowGroup.setEffect(clock.getShadowsEnabled() ? FOREGROUND_SHADOW : null); shadowGroup.getChildren().setAll(timeText, secondText, title, dateText, dayOfWeekText, alarm); pane = new Pane(); pane.setEffect(clock.getShadowsEnabled() ? mainInnerShadow1 : null); pane.getChildren().setAll(crystalOverlay, backgroundTimeText, backgroundSecondText, shadowGroup); getChildren().setAll(pane); }
Example #14
Source File: LevelSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } tube = new Path(); tube.setFillRule(FillRule.EVEN_ODD); tube.setStroke(null); Tooltip.install(tube, barTooltip); tubeTop = new Ellipse(); tubeTop.setStroke(Color.rgb(255, 255, 255, 0.5)); tubeTop.setStrokeType(StrokeType.INSIDE); tubeTop.setStrokeWidth(1); tubeBottom = new Ellipse(); tubeBottom.setStroke(null); fluidUpperLeft = new CubicCurveTo(0.21794871794871795 * PREFERRED_WIDTH, 0.24444444444444444 * PREFERRED_HEIGHT, 0.0, 0.18888888888888888 * PREFERRED_HEIGHT, 0.0, 0.12222222222222222 * PREFERRED_HEIGHT); fluidUpperCenter = new CubicCurveTo(PREFERRED_WIDTH, 0.18888888888888888 * PREFERRED_HEIGHT, 0.782051282051282 * PREFERRED_WIDTH, 0.24444444444444444 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH, 0.24444444444444444 * PREFERRED_HEIGHT); fluidUpperRight = new CubicCurveTo(PREFERRED_WIDTH, 0.7111111111111111 * PREFERRED_HEIGHT, PREFERRED_WIDTH, 0.12222222222222222 * PREFERRED_HEIGHT, PREFERRED_WIDTH, 0.12222222222222222 * PREFERRED_HEIGHT); fluidBody = new Path(); fluidBody.getElements().add(new MoveTo(0.0, 0.7111111111111111 * PREFERRED_HEIGHT)); fluidBody.getElements().add(new CubicCurveTo(0.0, 0.7777777777777778 * PREFERRED_HEIGHT, 0.21794871794871795 * PREFERRED_WIDTH, 0.8333333333333334 * PREFERRED_HEIGHT, 0.5 * PREFERRED_WIDTH, 0.8333333333333334 * PREFERRED_HEIGHT)); fluidBody.getElements().add(new CubicCurveTo(0.782051282051282 * PREFERRED_WIDTH, 0.8333333333333334 * PREFERRED_HEIGHT, PREFERRED_WIDTH, 0.7777777777777778 * PREFERRED_HEIGHT, PREFERRED_WIDTH, 0.7111111111111111 * PREFERRED_HEIGHT)); fluidBody.getElements().add(fluidUpperRight); fluidBody.getElements().add(fluidUpperCenter); fluidBody.getElements().add(fluidUpperLeft); fluidBody.getElements().add(new CubicCurveTo(0.0, 0.12222222222222222 * PREFERRED_HEIGHT, 0.0, 0.7111111111111111 * PREFERRED_HEIGHT, 0.0, 0.7111111111111111 * PREFERRED_HEIGHT)); fluidBody.getElements().add(new ClosePath()); fluidBody.setFillRule(FillRule.EVEN_ODD); fluidBody.setStroke(null); fluidTop = new Ellipse(); fluidTop.setStroke(null); valueText = new Text(String.format(locale, formatString, gauge.getCurrentValue())); valueText.setMouseTransparent(true); Helper.enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); // Add all nodes pane = new Pane(tubeBottom, fluidBody, fluidTop, tube, tubeTop, valueText, titleText); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #15
Source File: KpiSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange); barBackground.setType(ArcType.OPEN); barBackground.setStroke(gauge.getBarColor()); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.BUTT); barBackground.setFill(null); thresholdBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, -angleRange * 0.5 + 90, 0); thresholdBar.setType(ArcType.OPEN); thresholdBar.setStroke(gauge.getThresholdColor()); thresholdBar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); thresholdBar.setStrokeLineCap(StrokeLineCap.BUTT); thresholdBar.setFill(null); needleRotate = new Rotate((gauge.getValue() - oldValue - minValue) * angleStep); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setStrokeWidth(0); needle.setStroke(Color.TRANSPARENT); titleText = new Text(gauge.getTitle()); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue())); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); minValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue())); minValueText.setFill(gauge.getTitleColor()); maxValueText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue())); maxValueText.setFill(gauge.getTitleColor()); thresholdText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold())); thresholdText.setFill(gauge.getTitleColor()); Helper.enableNode(thresholdText, Double.compare(gauge.getThreshold(), gauge.getMinValue()) != 0 && Double.compare(gauge.getThreshold(), gauge.getMaxValue()) != 0); pane = new Pane(barBackground, thresholdBar, needle, titleText, valueText, minValueText, maxValueText, thresholdText); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }
Example #16
Source File: SimpleGaugeSkin.java From Enzo with Apache License 2.0 | 4 votes |
private void initGraphics() { Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans" sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); measuredRangeCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); measuredRangeCanvas.setManaged(getSkinnable().isMeasuredRangeVisible()); measuredRangeCanvas.setVisible(getSkinnable().isMeasuredRangeVisible()); measuredRangeCtx = measuredRangeCanvas.getGraphicsContext2D(); if (getSkinnable().getValue() < getSkinnable().getMinValue()) getSkinnable().setValue(getSkinnable().getMinValue()); if (getSkinnable().getValue() > getSkinnable().getMaxValue()) getSkinnable().setValue(getSkinnable().getMaxValue()); needleRotate = new Rotate(180 - getSkinnable().getStartAngle()); if (getSkinnable().getMinValue() < 0) { needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() - getSkinnable().getMinValue()) * angleStep); } else { //needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue() + getSkinnable().getMinValue()) * angleStep); } angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue()); needleRotate.setAngle(needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.getStyleClass().setAll("needle"); needle.getTransforms().setAll(needleRotate); value = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinValue()) + getSkinnable().getUnit()); value.setMouseTransparent(true); value.setTextOrigin(VPos.CENTER); value.getStyleClass().setAll("value"); title = new Text(getSkinnable().getTitle()); title.setTextOrigin(VPos.CENTER); title.getStyleClass().setAll("title"); // Add all nodes pane = new Pane(); pane.getStyleClass().add("simple-gauge"); pane.getChildren().setAll(sectionsCanvas, measuredRangeCanvas, needle, value, title); getChildren().setAll(pane); resize(); }
Example #17
Source File: PearClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Path(); hour.setFillRule(FillRule.EVEN_ODD); hour.setStroke(null); hour.getTransforms().setAll(hourRotate); minute = new Path(); minute.setFillRule(FillRule.EVEN_ODD); minute.setStroke(null); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.getTransforms().setAll(secondRotate); second.setVisible(clock.isSecondsVisible()); second.setManaged(clock.isSecondsVisible()); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); dateText = new Text(""); dateText.setVisible(clock.isDateVisible()); dateText.setManaged(clock.isDateVisible()); dateNumber = new Text(""); dateNumber.setVisible(clock.isDateVisible()); dateNumber.setManaged(clock.isDateVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, dateText, dateNumber, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example #18
Source File: TimerControlTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); currentValueListener = o -> { if (tile.isRunning()) { return; } // Update time only if clock is not already running updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId()))); }; timeListener = o -> updateTime(tile.getTime()); dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale()); sectionMap = new HashMap<>(tile.getTimeSections().size()); for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); } minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sectionsPane = new Pane(); sectionsPane.getChildren().addAll(sectionMap.values()); Helper.enableNode(sectionsPane, tile.getSectionsVisible()); minuteTickMarks = new Path(); minuteTickMarks.setFillRule(FillRule.EVEN_ODD); minuteTickMarks.setFill(null); minuteTickMarks.setStroke(tile.getMinuteColor()); minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hourTickMarks = new Path(); hourTickMarks.setFillRule(FillRule.EVEN_ODD); hourTickMarks.setFill(null); hourTickMarks.setStroke(tile.getHourColor()); hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(tile.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(tile.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(tile.getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(tile.isSecondsVisible()); second.setManaged(tile.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null); titleText = new Text(""); titleText.setTextOrigin(VPos.TOP); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM"); dateText = new Text(""); Helper.enableNode(dateText, tile.isDateVisible()); text = new Text(""); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); }
Example #19
Source File: ErrorDataSetRenderer.java From chart-fx with Apache License 2.0 | 4 votes |
/** * NaN compatible algorithm * * @param gc the graphics context from the Canvas parent * @param localCachedPoints reference to local cached data point object */ protected void drawErrorSurfaceNaNCompatible(final GraphicsContext gc, final CachedDataPoints localCachedPoints) { final long start = ProcessingProfiler.getTimeStamp(); DefaultRenderColorScheme.setFillScheme(gc, localCachedPoints.defaultStyle, localCachedPoints.dataSetIndex + localCachedPoints.dataSetStyleIndex); gc.setFillRule(FillRule.EVEN_ODD); final int nDataCount = localCachedPoints.actualDataCount; final int nPolygoneEdges = 2 * nDataCount; final double[] xValuesSurface = DoubleArrayCache.getInstance().getArrayExact(nPolygoneEdges); final double[] yValuesSurface = DoubleArrayCache.getInstance().getArrayExact(nPolygoneEdges); final int xend = nPolygoneEdges - 1; int count = 0; for (int i = 0; i < nDataCount; i++) { final double x = localCachedPoints.xValues[i]; final double yen = localCachedPoints.errorYNeg[i]; final double yep = localCachedPoints.errorYPos[i]; if (Double.isFinite(yen) && Double.isFinite(yep)) { xValuesSurface[count] = x; yValuesSurface[count] = yep; xValuesSurface[xend - count] = x; yValuesSurface[xend - count] = yen; count++; } else if (count != 0) { // remove zeros and plot intermediate segment compactVector(xValuesSurface, count); compactVector(yValuesSurface, count); gc.fillPolygon(xValuesSurface, yValuesSurface, 2 * count); count = 0; } } if (count > 0) { // swap y coordinates at mid-point // remove zeros and plot intermediate segment compactVector(xValuesSurface, count); compactVector(yValuesSurface, count); if (count > 4) { final double yTmp = yValuesSurface[count - 1]; yValuesSurface[count - 1] = yValuesSurface[count]; yValuesSurface[count] = yTmp; } gc.fillPolygon(xValuesSurface, yValuesSurface, 2 * count); } drawPolyLine(gc, localCachedPoints); drawBars(gc, localCachedPoints); drawMarker(gc, localCachedPoints); drawBubbles(gc, localCachedPoints); DoubleArrayCache.getInstance().add(xValuesSurface); DoubleArrayCache.getInstance().add(yValuesSurface); ProcessingProfiler.getTimeDiff(start); }
Example #20
Source File: GaugeTileSkin.java From OEE-Designer with MIT License | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); if (tile.isAutoScale()) tile.calcAutoScale(); oldValue = tile.getValue(); sectionMap = new HashMap<>(sections.size()); for(Section section : sections) { sectionMap.put(section, new Arc()); } barColor = tile.getBarColor(); thresholdColor = tile.getThresholdColor(); barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange); barBackground.setType(ArcType.OPEN); barBackground.setStroke(barColor); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.BUTT); barBackground.setFill(null); thresholdBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, -angleRange * 0.5 + 90, 0); thresholdBar.setType(ArcType.OPEN); thresholdBar.setStroke(tile.getThresholdColor()); thresholdBar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); thresholdBar.setStrokeLineCap(StrokeLineCap.BUTT); thresholdBar.setFill(null); Helper.enableNode(thresholdBar, !tile.getSectionsVisible()); sectionPane = new Pane(); Helper.enableNode(sectionPane, tile.getSectionsVisible()); if (sectionsVisible) { drawSections(); } alertIcon = new Path(); alertIcon.setFillRule(FillRule.EVEN_ODD); alertIcon.setFill(Color.YELLOW); alertIcon.setStroke(null); Helper.enableNode(alertIcon, tile.isAlert()); alertTooltip = new Tooltip(tile.getAlertMessage()); Tooltip.install(alertIcon, alertTooltip); needleRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needleRectRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needleRect = new Rectangle(); needleRect.setFill(tile.getBackgroundColor()); needleRect.getTransforms().setAll(needleRectRotate); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(tile.getNeedleColor()); needle.setStrokeWidth(0); needle.setStroke(Color.TRANSPARENT); titleText = new Text(tile.getTitle()); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); valueText = new Text(String.format(locale, formatString, tile.getCurrentValue())); valueText.setFill(tile.getValueColor()); valueText.setTextOrigin(VPos.BASELINE); Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); unitText.setTextOrigin(VPos.BASELINE); Helper.enableNode(unitText, tile.isValueVisible() && !tile.isAlert()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.CENTER); minValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMinValue())); minValueText.setFill(tile.getTitleColor()); maxValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue())); maxValueText.setFill(tile.getTitleColor()); thresholdRect = new Rectangle(); thresholdRect.setFill(sectionsVisible ? Color.TRANSPARENT : tile.getValue() > tile.getThreshold() ? tile.getThresholdColor() : Tile.GRAY); Helper.enableNode(thresholdRect, tile.isThresholdVisible()); thresholdText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getThreshold())); thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : Tile.GRAY); Helper.enableNode(thresholdText, tile.isThresholdVisible()); getPane().getChildren().addAll(barBackground, thresholdBar, sectionPane, alertIcon, needleRect, needle, titleText, valueUnitFlow, minValueText, maxValueText, thresholdRect, thresholdText); }
Example #21
Source File: TimerControlTileSkin.java From OEE-Designer with MIT License | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); currentValueListener = o -> { if (tile.isRunning()) { return; } // Update time only if clock is not already running updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId()))); }; timeListener = o -> updateTime(tile.getTime()); dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale()); sectionMap = new HashMap<>(tile.getTimeSections().size()); for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); } minuteRotate = new Rotate(); hourRotate = new Rotate(); secondRotate = new Rotate(); sectionsPane = new Pane(); sectionsPane.getChildren().addAll(sectionMap.values()); Helper.enableNode(sectionsPane, tile.getSectionsVisible()); minuteTickMarks = new Path(); minuteTickMarks.setFillRule(FillRule.EVEN_ODD); minuteTickMarks.setFill(null); minuteTickMarks.setStroke(tile.getMinuteColor()); minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hourTickMarks = new Path(); hourTickMarks.setFillRule(FillRule.EVEN_ODD); hourTickMarks.setFill(null); hourTickMarks.setStroke(tile.getHourColor()); hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(tile.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(tile.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Rectangle(1, 96); second.setArcHeight(1); second.setArcWidth(1); second.setStroke(tile.getSecondColor()); second.getTransforms().setAll(secondRotate); second.setVisible(tile.isSecondsVisible()); second.setManaged(tile.isSecondsVisible()); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(Color.web("#282a3280")); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second, knob); shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null); titleText = new Text(""); titleText.setTextOrigin(VPos.TOP); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM"); dateText = new Text(""); Helper.enableNode(dateText, tile.isDateVisible()); text = new Text(""); Helper.enableNode(text, tile.isTextVisible()); getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond); }
Example #22
Source File: GaugeTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); if (tile.isAutoScale()) tile.calcAutoScale(); oldValue = tile.getValue(); sectionMap = new HashMap<>(sections.size()); for(Section section : sections) { sectionMap.put(section, new Arc()); } barColor = tile.getBarColor(); thresholdColor = tile.getThresholdColor(); barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange); barBackground.setType(ArcType.OPEN); barBackground.setStroke(barColor); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.BUTT); barBackground.setFill(null); thresholdBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, -angleRange * 0.5 + 90, 0); thresholdBar.setType(ArcType.OPEN); thresholdBar.setStroke(tile.getThresholdColor()); thresholdBar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); thresholdBar.setStrokeLineCap(StrokeLineCap.BUTT); thresholdBar.setFill(null); Helper.enableNode(thresholdBar, !tile.getSectionsVisible()); sectionPane = new Pane(); Helper.enableNode(sectionPane, tile.getSectionsVisible()); if (sectionsVisible) { drawSections(); } alertIcon = new Path(); alertIcon.setFillRule(FillRule.EVEN_ODD); alertIcon.setFill(Color.YELLOW); alertIcon.setStroke(null); Helper.enableNode(alertIcon, tile.isAlert()); alertTooltip = new Tooltip(tile.getAlertMessage()); Tooltip.install(alertIcon, alertTooltip); needleRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needleRectRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needleRect = new Rectangle(); needleRect.setFill(tile.getBackgroundColor()); needleRect.getTransforms().setAll(needleRectRotate); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(tile.getNeedleColor()); needle.setStrokeWidth(0); needle.setStroke(Color.TRANSPARENT); titleText = new Text(tile.getTitle()); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); valueText = new Text(String.format(locale, formatString, tile.getCurrentValue())); valueText.setFill(tile.getValueColor()); valueText.setTextOrigin(VPos.BASELINE); Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert()); upperUnitText = new Text(""); upperUnitText.setFill(tile.getUnitColor()); Helper.enableNode(upperUnitText, !tile.getUnit().isEmpty()); fractionLine = new Line(); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); unitFlow = new VBox(upperUnitText, unitText); unitFlow.setAlignment(Pos.CENTER_RIGHT); valueUnitFlow = new HBox(valueText, unitFlow); valueUnitFlow.setAlignment(Pos.CENTER); valueUnitFlow.setMouseTransparent(true); minValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMinValue())); minValueText.setFill(tile.getTitleColor()); maxValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue())); maxValueText.setFill(tile.getTitleColor()); thresholdRect = new Rectangle(); thresholdRect.setFill(sectionsVisible ? Color.TRANSPARENT : tile.getValue() > tile.getThreshold() ? tile.getThresholdColor() : Tile.GRAY); Helper.enableNode(thresholdRect, tile.isThresholdVisible()); thresholdText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getThreshold())); thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : Tile.GRAY); Helper.enableNode(thresholdText, tile.isThresholdVisible()); getPane().getChildren().addAll(barBackground, thresholdBar, sectionPane, alertIcon, needleRect, needle, titleText, valueUnitFlow, fractionLine, minValueText, maxValueText, thresholdRect, thresholdText); }
Example #23
Source File: Gauge2TileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { super.initGraphics(); angleRange = tile.getAngleRange(); angleStep = tile.getAngleStep(); if (tile.isAutoScale()) tile.calcAutoScale(); oldValue = tile.getValue(); barBackgroundColor = tile.getBarBackgroundColor(); gradientLookup = new GradientLookup(tile.getGradientStops()); knob = new Circle(); barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, -angleRange); barBackground.setType(ArcType.OPEN); barBackground.setStroke(barBackgroundColor); barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); barBackground.setStrokeLineCap(StrokeLineCap.ROUND); barBackground.setFill(null); bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.696, PREFERRED_WIDTH * 0.275, PREFERRED_WIDTH * 0.275, angleRange * 0.5 + 90, 0); bar.setType(ArcType.OPEN); bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2); bar.setStrokeLineCap(StrokeLineCap.ROUND); bar.setFill(null); barBounds = new Rectangle(); createConicalGradient(); needleRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needleRectRotate = new Rotate((tile.getValue() - oldValue - minValue) * angleStep); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(tile.getNeedleColor()); needle.setStrokeWidth(0); needle.setStroke(Color.TRANSPARENT); titleText = new Text(tile.getTitle()); titleText.setFill(tile.getTitleColor()); Helper.enableNode(titleText, !tile.getTitle().isEmpty()); valueText = new Text(String.format(locale, formatString, tile.getCurrentValue())); valueText.setFill(tile.getValueColor()); Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert()); unitText = new Text(tile.getUnit()); unitText.setFill(tile.getUnitColor()); Helper.enableNode(unitText, !tile.getUnit().isEmpty()); valueUnitFlow = new TextFlow(valueText, unitText); valueUnitFlow.setTextAlignment(TextAlignment.CENTER); minValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMinValue())); minValueText.setFill(tile.getTitleColor()); minValueText.setTextOrigin(VPos.CENTER); maxValueText = new Text(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", tile.getMaxValue())); maxValueText.setFill(tile.getTitleColor()); maxValueText.setTextOrigin(VPos.CENTER); text = new Text(tile.getText()); text.setTextOrigin(VPos.TOP); text.setFill(tile.getTextColor()); getPane().getChildren().addAll(knob, barBackground, bar, needle, titleText, valueUnitFlow, minValueText, maxValueText, text); }
Example #24
Source File: SimpleSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); needleRotate = new Rotate(180 - START_ANGLE); angleStep = ANGLE_RANGE / (gauge.getRange()); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle)); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleLineTo6 = new LineTo(); needleCubicCurveTo7 = new CubicCurveTo(); needleClosePath8 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleLineTo6, needleCubicCurveTo7, needleClosePath8); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.setFill(gauge.getNeedleColor()); needle.setStroke(gauge.getBorderPaint()); needle.setStrokeLineCap(StrokeLineCap.ROUND); needle.setStrokeLineJoin(StrokeLineJoin.BEVEL); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit()); valueText.setMouseTransparent(true); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); enableNode(titleText, !gauge.getTitle().isEmpty()); subTitleText = new Text(gauge.getSubTitle()); subTitleText.setTextOrigin(VPos.CENTER); subTitleText.setFill(gauge.getSubTitleColor()); enableNode(subTitleText, !gauge.getSubTitle().isEmpty()); // Add all nodes pane = new Pane(sectionsCanvas, needle, valueText, titleText, subTitleText); getChildren().setAll(pane); }
Example #25
Source File: CustomPlainAmpSkin.java From medusademo with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D(); ledCanvas = new Canvas(); led = ledCanvas.getGraphicsContext2D(); thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")"); thresholdTooltip.setTextAlignment(TextAlignment.CENTER); threshold = new Path(); Helper.enableNode(threshold, gauge.isThresholdVisible()); Tooltip.install(threshold, thresholdTooltip); average = new Path(); Helper.enableNode(average, gauge.isAverageVisible()); markerPane = new Pane(); needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleCubicCurveTo6 = new CubicCurveTo(); needleClosePath7 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); needle.getStyleClass().add("needle"); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroup = new Group(needle); shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null); shadowGroup.getStyleClass().add("shadow-group"); unitText = new Text(gauge.getUnit()); unitText.setMouseTransparent(true); unitText.setTextOrigin(VPos.CENTER); unitText.getStyleClass().add("unit"); lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT); lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT); lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT); lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.66 * PREFERRED_HEIGHT); lcd.getStyleClass().add("lcd"); Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible()); lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue())); lcdText.setAlignment(Pos.CENTER_RIGHT); lcdText.setVisible(gauge.isValueVisible()); lcdText.getStyleClass().add("lcd-foreground"); // Set initial value angleStep = ANGLE_RANGE / gauge.getRange(); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; targetAngle = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle); needleRotate.setAngle(targetAngle); // Add all nodes pane = new Pane(); pane.getChildren().setAll(ticksAndSectionsCanvas, markerPane, ledCanvas, unitText, lcd, lcdText, shadowGroup); pane.getStyleClass().add("background-pane"); getChildren().setAll(pane); }
Example #26
Source File: PlainAmpSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D(); ledCanvas = new Canvas(); led = ledCanvas.getGraphicsContext2D(); thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")"); thresholdTooltip.setTextAlignment(TextAlignment.CENTER); threshold = new Path(); Helper.enableNode(threshold, gauge.isThresholdVisible()); Tooltip.install(threshold, thresholdTooltip); average = new Path(); Helper.enableNode(average, gauge.isAverageVisible()); markerPane = new Pane(); needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleCubicCurveTo6 = new CubicCurveTo(); needleClosePath7 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroup = new Group(needle); shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null); unitText = new Text(gauge.getUnit()); unitText.setMouseTransparent(true); unitText.setTextOrigin(VPos.CENTER); lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT); lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT); lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT); lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.66 * PREFERRED_HEIGHT); Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible()); lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue())); lcdText.setAlignment(Pos.CENTER_RIGHT); lcdText.setVisible(gauge.isValueVisible()); // Set initial value angleStep = ANGLE_RANGE / gauge.getRange(); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; targetAngle = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle); needleRotate.setAngle(targetAngle); // Add all nodes pane = new Pane(); pane.getChildren().setAll(ticksAndSectionsCanvas, markerPane, ledCanvas, unitText, lcd, lcdText, shadowGroup); getChildren().setAll(pane); }
Example #27
Source File: DBClockSkin.java From Medusa with Apache License 2.0 | 4 votes |
@Override protected void initGraphics() { // Set initial size if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 || Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) { if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) { clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight()); } else { clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } sectionsAndAreasCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsAndAreasCtx = sectionsAndAreasCanvas.getGraphicsContext2D(); tickCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); tickCtx = tickCanvas.getGraphicsContext2D(); alarmPane = new Pane(); hour = new Rectangle(3, 60); hour.setArcHeight(3); hour.setArcWidth(3); hour.setStroke(null); hour.setFill(clock.getHourColor()); hour.getTransforms().setAll(hourRotate); minute = new Rectangle(3, 96); minute.setArcHeight(3); minute.setArcWidth(3); minute.setStroke(null); minute.setFill(clock.getMinuteColor()); minute.getTransforms().setAll(minuteRotate); second = new Path(); second.setFillRule(FillRule.EVEN_ODD); second.setStroke(null); second.setFill(clock.getSecondColor()); second.getTransforms().setAll(secondRotate); enableNode(second, clock.isSecondsVisible()); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5); knob.setStroke(null); knob.setFill(clock.getKnobColor()); knob.setEffect(dropShadow); shadowGroupHour = new Group(hour); shadowGroupMinute = new Group(minute); shadowGroupSecond = new Group(second); shadowGroupHour.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupMinute.setEffect(clock.getShadowsEnabled() ? dropShadow : null); shadowGroupSecond.setEffect(clock.getShadowsEnabled() ? dropShadow : null); title = new Text(""); title.setVisible(clock.isTitleVisible()); title.setManaged(clock.isTitleVisible()); text = new Text(""); text.setVisible(clock.isTextVisible()); text.setManaged(clock.isTextVisible()); pane = new Pane(sectionsAndAreasCanvas, tickCanvas, alarmPane, title, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond, knob); pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY))); getChildren().setAll(pane); }
Example #28
Source File: SectionSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } ring = new Path(); ring.setFillRule(FillRule.EVEN_ODD); ring.setStroke(null); ring.setFill(Gauge.DARK_COLOR); ring.setEffect(new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.35), 1, 0, 0, 1)); sectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); sectionsCtx = sectionsCanvas.getGraphicsContext2D(); mask = new Circle(); mask.setStroke(null); mask.setFill(gauge.getBackgroundPaint()); knob = new Circle(); knob.setStroke(null); knob.setFill(gauge.getKnobColor()); angleStep = ANGLE_RANGE / (gauge.getRange()); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(Helper.clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle)); needle = new Path(); needle.setFillRule(FillRule.EVEN_ODD); needle.setStroke(null); needle.getTransforms().setAll(needleRotate); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getMinValue()) + gauge.getUnit()); valueText.setMouseTransparent(true); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); // Add all nodes pane = new Pane(ring, sectionsCanvas, mask, knob, needle, valueText, titleText); getChildren().setAll(pane); }
Example #29
Source File: AmpSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT); ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D(); ledCanvas = new Canvas(); led = ledCanvas.getGraphicsContext2D(); thresholdTooltip = new Tooltip("Threshold\n(" + String.format(locale, formatString, gauge.getThreshold()) + ")"); thresholdTooltip.setTextAlignment(TextAlignment.CENTER); threshold = new Path(); Helper.enableNode(threshold, gauge.isThresholdVisible()); Tooltip.install(threshold, thresholdTooltip); average = new Path(); Helper.enableNode(average, gauge.isAverageVisible()); markerPane = new Pane(); needleRotate = new Rotate(180 - START_ANGLE); needleRotate.setAngle(needleRotate.getAngle() + (gauge.getValue() - oldValue - gauge.getMinValue()) * angleStep); needleMoveTo1 = new MoveTo(); needleCubicCurveTo2 = new CubicCurveTo(); needleCubicCurveTo3 = new CubicCurveTo(); needleCubicCurveTo4 = new CubicCurveTo(); needleLineTo5 = new LineTo(); needleCubicCurveTo6 = new CubicCurveTo(); needleClosePath7 = new ClosePath(); needle = new Path(needleMoveTo1, needleCubicCurveTo2, needleCubicCurveTo3, needleCubicCurveTo4, needleLineTo5, needleCubicCurveTo6, needleClosePath7); needle.setFillRule(FillRule.EVEN_ODD); needle.getTransforms().setAll(needleRotate); dropShadow = new DropShadow(); dropShadow.setColor(Color.rgb(0, 0, 0, 0.25)); dropShadow.setBlurType(BlurType.TWO_PASS_BOX); dropShadow.setRadius(0.015 * PREFERRED_WIDTH); dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH); shadowGroup = new Group(needle); shadowGroup.setEffect(gauge.isShadowsEnabled() ? dropShadow : null); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); unitText = new Text(gauge.getUnit()); unitText.setMouseTransparent(true); unitText.setTextOrigin(VPos.CENTER); lcd = new Rectangle(0.3 * PREFERRED_WIDTH, 0.1 * PREFERRED_HEIGHT); lcd.setArcWidth(0.0125 * PREFERRED_HEIGHT); lcd.setArcHeight(0.0125 * PREFERRED_HEIGHT); lcd.relocate((PREFERRED_WIDTH - lcd.getWidth()) * 0.5, 0.44 * PREFERRED_HEIGHT); Helper.enableNode(lcd, gauge.isLcdVisible() && gauge.isValueVisible()); lcdText = new Label(String.format(locale, "%." + gauge.getDecimals() + "f", gauge.getValue())); lcdText.setAlignment(Pos.CENTER_RIGHT); lcdText.setVisible(gauge.isValueVisible()); // Set initial value angleStep = ANGLE_RANGE / gauge.getRange(); double targetAngle = 180 - START_ANGLE + (gauge.getValue() - gauge.getMinValue()) * angleStep; targetAngle = clamp(180 - START_ANGLE, 180 - START_ANGLE + ANGLE_RANGE, targetAngle); needleRotate.setAngle(targetAngle); lightEffect = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(255, 255, 255, 0.65), 2, 0.0, 0.0, 2.0); foreground = new SVGPath(); foreground.setContent("M 26 26.5 C 26 20.2432 26.2432 20 32.5 20 L 277.5 20 C 283.7568 20 284 20.2432 284 26.5 L 284 143.5 C 284 149.7568 283.7568 150 277.5 150 L 32.5 150 C 26.2432 150 26 149.7568 26 143.5 L 26 26.5 ZM 0 6.7241 L 0 253.2758 C 0 260 0 260 6.75 260 L 303.25 260 C 310 260 310 260 310 253.2758 L 310 6.7241 C 310 0 310 0 303.25 0 L 6.75 0 C 0 0 0 0 0 6.7241 Z"); foreground.setEffect(lightEffect); // Add all nodes pane = new Pane(); pane.getChildren().setAll(ticksAndSectionsCanvas, markerPane, ledCanvas, unitText, lcd, lcdText, shadowGroup, foreground, titleText); getChildren().setAll(pane); }
Example #30
Source File: DashboardSkin.java From Medusa with Apache License 2.0 | 4 votes |
private void initGraphics() { // Set initial size if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 || Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) { if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) { gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight()); } else { gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } } unitText = new Text(gauge.getUnit()); unitText.setTextOrigin(VPos.CENTER); unitText.setFill(gauge.getUnitColor()); Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); titleText = new Text(gauge.getTitle()); titleText.setTextOrigin(VPos.CENTER); titleText.setFill(gauge.getTitleColor()); Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue())); valueText.setTextOrigin(VPos.CENTER); valueText.setFill(gauge.getValueColor()); Helper.enableNode(valueText, gauge.isValueVisible()); minValue = gauge.getMinValue(); minText = new Text(String.format(locale, otherFormatString, minValue)); minText.setTextOrigin(VPos.CENTER); minText.setFill(gauge.getValueColor()); maxText = new Text(String.format(locale, otherFormatString, gauge.getMaxValue())); maxText.setTextOrigin(VPos.CENTER); maxText.setFill(gauge.getValueColor()); boolean tickLabelsVisible = gauge.getTickLabelsVisible(); Helper.enableNode(minText, tickLabelsVisible); Helper.enableNode(maxText, tickLabelsVisible); innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.3), 30.0, 0.0, 0.0, 10.0); barBackgroundStart = new MoveTo(0, 0.675 * PREFERRED_HEIGHT); barBackgroundOuterArc = new ArcTo(0.675 * PREFERRED_HEIGHT, 0.675 * PREFERRED_HEIGHT, 0, PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT, true, true); barBackgroundLineToInnerArc = new LineTo(0.72222 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT); barBackgroundInnerArc = new ArcTo(0.3 * PREFERRED_HEIGHT, 0.3 * PREFERRED_HEIGHT, 0, 0.27778 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT, false, false); barBackground = new Path(); barBackground.setFillRule(FillRule.EVEN_ODD); barBackground.getElements().add(barBackgroundStart); barBackground.getElements().add(barBackgroundOuterArc); barBackground.getElements().add(barBackgroundLineToInnerArc); barBackground.getElements().add(barBackgroundInnerArc); barBackground.getElements().add(new ClosePath()); barBackground.setFill(gauge.getBarBackgroundColor()); barBackground.setStroke(gauge.getBorderPaint()); barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null); dataBarStart = new MoveTo(0, 0.675 * PREFERRED_HEIGHT); dataBarOuterArc = new ArcTo(0.675 * PREFERRED_HEIGHT, 0.675 * PREFERRED_HEIGHT, 0, 0, 0, false, true); dataBarLineToInnerArc = new LineTo(0.27778 * PREFERRED_WIDTH, 0.675 * PREFERRED_HEIGHT); dataBarInnerArc = new ArcTo(0.3 * PREFERRED_HEIGHT, 0.3 * PREFERRED_HEIGHT, 0, 0, 0, false, false); dataBar = new Path(); dataBar.setFillRule(FillRule.EVEN_ODD); dataBar.getElements().add(dataBarStart); dataBar.getElements().add(dataBarOuterArc); dataBar.getElements().add(dataBarLineToInnerArc); dataBar.getElements().add(dataBarInnerArc); dataBar.getElements().add(new ClosePath()); dataBar.setFill(gauge.getBarColor()); dataBar.setStroke(gauge.getBorderPaint()); dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null); threshold = new Line(); threshold.setStrokeLineCap(StrokeLineCap.BUTT); Helper.enableNode(threshold, gauge.isThresholdVisible()); thresholdText = new Text(String.format(locale, formatString, gauge.getThreshold())); Helper.enableNode(thresholdText, gauge.isThresholdVisible()); pane = new Pane(unitText, titleText, valueText, minText, maxText, barBackground, dataBar, threshold, thresholdText); pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth())))); pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY))); getChildren().setAll(pane); }