public GaugeFigure() { super(); transparent = true; scale.setScaleLineVisible(false); scale.setTickLabelSide(LabelSide.Secondary); ramp.setRampWidth(10); valueLabel = new Label(); valueLabel.setFont(DEFAULT_LABEL_FONT); needle = new Needle(); needle.setFill(true); needle.setOutline(false); needleCenter = new NeedleCenter(); needleCenter.setOutline(false); setLayoutManager(new GaugeLayout()); add(ramp, GaugeLayout.RAMP); add(scale, GaugeLayout.SCALE); add(valueLabel, GaugeLayout.VALUE_LABEL); add(needle, GaugeLayout.NEEDLE); add(needleCenter, GaugeLayout.NEEDLE_CENTER); addFigureListener( new FigureListener() { public void figureMoved(IFigure source) { ramp.setDirty(true); revalidate(); } }); }
public MeterFigure() { super(); // TODO, remove this if clip is supported by RAP if (SWT.getPlatform().startsWith("rap")) // $NON-NLS-1$ ramp.setVisible(false); setTransparent(false); scale.setScaleLineVisible(false); ((RoundScale) scale).setStartAngle(180 - SPACE_ANGLE); ((RoundScale) scale).setEndAngle(SPACE_ANGLE); ramp.setRampWidth(12); setLoColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW)); setHiColor(XYGraphMediaFactory.getInstance().getColor(XYGraphMediaFactory.COLOR_YELLOW)); valueLabel = new Label(); valueLabel.setFont(DEFAULT_LABEL_FONT); needle = new Needle(); needle.setFill(true); needle.setOutline(false); // needleCenter = new Ellipse(); // needleCenter.setOutline(false); setLayoutManager(new XMeterLayout()); add(ramp, XMeterLayout.RAMP); add(scale, XMeterLayout.SCALE); add(needle, XMeterLayout.NEEDLE); // add(needleCenter, XMeterLayout.NEEDLE_CENTER); add(valueLabel, XMeterLayout.VALUE_LABEL); addFigureListener( new FigureListener() { public void figureMoved(IFigure source) { ramp.setDirty(true); revalidate(); } }); }