// ******************** Constructors ************************************** public LcdSkin(Gauge gauge) { super(gauge); width = PREFERRED_WIDTH; height = PREFERRED_HEIGHT; valueOffsetLeft = 0.0; valueOffsetRight = 0.0; digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); valueFormatString = new StringBuilder("%.") .append(Integer.toString(gauge.getDecimals())) .append("f") .toString(); otherFormatString = new StringBuilder("%.") .append(Integer.toString(gauge.getTickLabelDecimals())) .append("f") .toString(); sections = gauge.getSections(); sectionColorMap = new HashMap<>(sections.size()); updateSectionColors(); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); init(); initGraphics(); registerListeners(); }
// ******************** Constructors ************************************** public LinearSkin(Gauge gauge) { super(gauge); if (gauge.isAutoScale()) gauge.calcAutoScale(); orientation = gauge.getOrientation(); formatString = new StringBuilder("%.") .append(Integer.toString(gauge.getDecimals())) .append("f") .toString(); tickLabelFormatString = new StringBuilder("%.") .append(Integer.toString(gauge.getTickLabelDecimals())) .append("f") .toString(); sections = gauge.getSections(); areas = gauge.getAreas(); if (Orientation.VERTICAL == orientation) { preferredWidth = 140; preferredHeight = 350; } else { preferredWidth = 350; preferredHeight = 140; } gauge.setPrefSize(preferredWidth, preferredHeight); init(); initGraphics(); registerListeners(); }
@Override public void start(Stage stage) { Pane pane = new Pane(bigGauge, smallGauge); pane.setBackground( new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY))); bigGauge.relocate(0, 0); smallGauge.relocate(0, 230); Scene scene = new Scene(pane); stage.setScene(scene); stage.show(); timer.start(); // Calculate number of nodes calcNoOfNodes(pane); System.out.println(noOfNodes + " Nodes in SceneGraph"); }
// ******************** Constructors ************************************** public IndicatorSkin(Gauge gauge) { super(gauge); if (gauge.isAutoScale()) gauge.calcAutoScale(); angleRange = Helper.clamp(90.0, 180.0, gauge.getAngleRange()); startAngle = getStartAngle(); oldValue = gauge.getValue(); minValue = gauge.getMinValue(); range = gauge.getRange(); angleStep = angleRange / range; colorGradientEnabled = gauge.isGradientBarEnabled(); noOfGradientStops = gauge.getGradientBarStops().size(); sectionsAlwaysVisible = gauge.getSectionsAlwaysVisible(); sectionsVisible = gauge.getSectionsVisible(); sections = gauge.getSections(); formatString = new StringBuilder("%.") .append(Integer.toString(gauge.getDecimals())) .append("f") .toString(); locale = gauge.getLocale(); barColor = gauge.getBarColor(); initGraphics(); registerListeners(); rotateNeedle(gauge.getCurrentValue()); }