UniVista Programmer's Guide

UniVista.beaninfo

SimpleVariableDisplayBeanInfo


Intent | Structure | Participants | Sample Code | Known Uses

Intent

The majority of the default display beans in UniVista extend SimpleVariableDisplay, hence their display beans' beaninfos will extend this class.  It is not abstract, since it extends VariableDisplayBeanInfo, but it should never be used directly.  The display beans implemented in UniVista use a more specific subclass to describe their properties.  Following this model commits the subclass to use its associated methods and properties which are thought to be helpful on behalf of the [default] Variable display beans.

Structure

Participants

Sample Code

The following code shows how one of the methods are implemented to define additional properties to VariableDisplay.
public PropertyDescriptor[] getPropertyDescriptors() {

    PropertyDescriptor alignText = new
       PropertyDescriptor("horizontalTextAlignment",
                            beanClass);

    alignText.setDisplayName("Horizontal Text
                                Alignment");
    alignText.setBound(true);
    alignText.setShortDescription("Justify the
                displayed text to right,
                center or left.");
 
    alignText.setPropertyEditorClass(
UniVista.editors.HorizontalTextAlignmentEditor.class);
 
    PropertyDescriptor superpd[] =
                super.getPropertyDescriptors();
    PropertyDescriptor pd[] = new
            PropertyDescriptor[superpd.length + 1];
    // copy super's property descriptors
    for(int i = 0; i < superpd.length; ++i)
        pd[i] = superpd[i];
 
    pd[pd.length - 1] = alignText;
    return pd;
//...

Known Uses

This class is not intended to be instanciated directly.  Any invocation on the methods, including the constructor, should be done from a subclass.  This makes sense since any inheriter would also have the same properties, etc. and thus reimplementation isn't necessary.  Besides, no specific class, or Variable in this case, is bound.  Think of this class as yet another SimpleBeanInfo, as supplied by the Java beans API.

The methods are only called from the subclasses ComplexVariableDisplayBeanInfo, FloatVariableDisplayBeanInfo, LongVariableDisplayBeanInfo, ShortVariableDisplayBeanInfo, and StringVariableDisplayBeanInfo.

The new properties defined by this class are



Contact the UniVista Team | Main Page | Table of Contents