예제 #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();
  }
예제 #2
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());
  }