Common ACOP Features

Connection to a remote property

Each single value displayer can be connected to one remote connection point. The following code demonstrates how we can connect an ACOP bean to such point.

First we will create an instance of the bean (eg. AcopGauger)

AcopGauger bean = new AcopGauger();

To connect to a remote property we require ConnectionParameters, which describe the remote property

ConnectionParameters parameters = new ConnectionParameters("TINE", "context", "server", "device", "property", AccessMode.POLL, 1000);

These parameters describe a remote property context/server/device/property in the TINE control system. We will request a constant monitoring, therefore AccessMode.POLL was used. Polling rate is set to 1000 milliseconds, which means that the value on the bean will be updated every 1000 milliseconds. Parameters are then attached to the bean. Connection is created automatically.

try {
        bean.setConnectionParameters(parameters);
} catch (CommonException e) {
        e.printStackTrace();
} catch (PropertyVetoException e) {
        e.printStackTrace();
}

If no exception occured, the bean will show the remote value.

Here bean is one of the following ACOP Beans:

Converters

Each AcopDisplayer which displays a numeric value is able to use value converters Let's say that the incoming values are too large (large exponents) and have a large extent between minimum and maximum. We want to show values in a more readable form. Let's show the logarithm of the value. For this we will use a logarithmic converter with logarithm base 10:

LogarithmicConverter logConverter = new LogarithmicConverter(10);
try {
        bean.setConverter(logConverter);
} catch (PropertyVetoException e) {
        e.printStackTrace();
}

Instead of the real value x bean will now show log_10(x). Similarly we can shift the values to be comparable with some other property. We will use linear converter:

LinearConverter linConverter = new LinearConverter(5,4);
try {
        bean.setConverter(linConverter);
} catch (PropertyVetoException e) {
        e.printStackTrace();
}

Instead of the value x bean will now show 5 x + 4. We can even combine both converters into a single one.

try {
        ConverterChain chain = new ConverterChain(new Converter[]{logConverter, linConverter});
        bean.setConverter(chain);
} catch (PropertyVetoException e) {
        e.printStackTrace();
}

The bean will now show 5 (log_10(x)) + 4. We can also use a PotentialConverter, ExponentialConverter or MultiplierConverter.

Here bean is one of the following ACOP Beans:

Layout Orientation

We can determine how the title and value components should be layed out inside the bean. We have three different options: HORIZONTAL_LAYOUT, VERTICAL_LAYOUT and DYNAMIC_LAYOUT. To change the layout orientation to vertical layout orientation, we must write:

bean.setLayoutOrientation(bean.VERTICAL_LAYOUT);

where bean is one of the following beans:

Acop Bean Properties

Acop beans display values within context of additional parameters. These include values such as minimal value, maximal value, units, etc. They are important for value display and manipulation (setting value by slider for example).

These display parameters are generally set from two sources:

  • User can set them via code (like calling setMinimum(...) method) or by GUI customizer dialog.
  • TINE property information also contains these values. They are set to Acop bean when the connection is initialized.

At the moment design choice was made that last value set to Acop (either by user action or by TINE property) is used.

If this behavior is not desired by developer, the following things can be done to change the behavior:

  • Particular Acop bean instance can be protected, so user settings take precedence and they are never overwritten by TINE settings. Following line of code does this:
    UserSettingsProtection.setProtection(acopBean,DisplayerUtilities.COMMON_NUMERIC_DISPLAYER_PROPERTIES,true);             
    
  • Implement Converter and extend or implement method public void setCharacteristics(Map characteristics) in a way that removes the offending values from the map or replaces them with the right ones.
  • Vote for a different design policy, in which all Acop beans have enabled user setting protection.