UniVista Programmer's Guide



Intent | Structure | Participants | Sample Code | Known Uses


This class implements UniVista.support.VariableUI, among others, but it remains abstract. This forces the implementation of set/getValue, which is responsible for altering or reading the UI content.

Its purpose is to make UIs pluggable with UniVista Variables. It supplies a container (JPanel) and a label (JLabel), which are left to the disposal of any subclass, along with property altering methods specific to the label and container.

The container should be used as a place holder for all additional UI components, in addition to the label. It also uses a BorderLayout by default. If this is changed, then the property altering methods should be overridden since they are dependant on using a BorderLayout. The label should simply be used for the Variable names, and act as the targets for any tooltips which may be assigned.



Sample Code

One of the main features is the ability to listen to property changes. Below, a snippet is shown how a VariableBean registers with another component to listen for property changes. Note, 'listening' can be done via custom Events or by the generic PropertyChangeEvent, which allows inquiry of the property name.
The following code shows how to intercept and react to the labelPosition property. Note: If the Layout of panel changes, then the setLabelPosition should be re-implemented. For example, if the Layout was set to null, then setLabelPosition could accept a Rectangle indicating what bounds to use, rather than the String which represents a BorderLayout constant.
public void propertyChange(PropertyChangeEvent event) {
String property = event.getPropertyName();

if (property.equals("labelPosition")) {


Known Uses

Throughout UniVista, all presently functioning Variable UIs are actually subclasses of VariableDisplay.

VariableDisplays are registered with VariableBeans within the class UniVista.support.screens.VariableScreenObject. This is where the first code excerpt above was obtained. Currently, that is the only place that VariableDisplays register to listen for changes (it could also have been done in their customizers, but a different approach was used).

Contact the UniVista Team | Main Page | Table of Contents