Beispiel #1
0
  // ******************** 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();
  }
Beispiel #2
0
 // ******************** 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();
 }
Beispiel #3
0
  // ******************** 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());
  }