ACOP Gauger

AcopGauger

Description

AcopGauger is a displayer which can show a single double value. The gauger can only present read only values.

The gauger consists of a round-shaped gauge meter with user defined minimum and maximum values. The needle of the meter will show the updated value on the linear or logarithmic scale and will notify the user of a possible out of bounds state through a change of the color.

Code examples

The following lines show an example how to use the features of the AcopGauger.

Common features

For features shared with other ACOP Beans see this page.

Value bounds and notifications

We can also adjust the scale of the gauger suitable for displaying logarithms

gauger.setLogarithmicScale();

or reset back to linear scale

gauger.setLinearScale();

The minimum and maximum values of the gauger scale can be simply defined with the appropriate setter methods

gauger.setMaximum(90);
gauger.setMinimum(5.2);

When the value received from the 3rd party exceeds the set value bounds (minimum/maximum), the marker of the gauger may change color whenever the received value is out of these bounds

gauger.setOutOfBoundsColor(Color.YELLOW);

We can define another set of bounds - the warning bounds

gauger.setLowWarningLimit(1);
gauger.setHighWarningLimit(99);

and the color of the marker, when these limits are passed

gauger.setWarningColor(Color.ORANGE);

What happens if the remotely received value is larger than the maximum displayed scale on the gauger? We can set a value policy to handle such cases appropriately. We want for the scale to adjust itself (to enlarge) when the value is out of bounds.

RangedValuePolicy rescalingPolicy = new RescalingValuePolicy();
gauger.setValuePolicy(rescalingPolicy);

or we want the scale to maintain its range but shift the bounds so that the new value lies between them

RangedValuePolicy shiftPolicy = new ShiftValuePolicy();
gauger.setValuePolicy(shiftPolicy);

Other properties

Other properties of the gauger can also simply be adjusted by calling the appropriate setter methods. These properties include background/foreground color, title etc.:

gauger.setBackground(Color.RED);
gauger.setForeground(Color.GREEN);

Complete source code for examples

See the complete source code used in this examples.