Class AbstractWidgetProperty<T>

java.lang.Object
org.csstudio.opibuilder.properties.AbstractWidgetProperty<T>
Direct Known Subclasses:
ActionsProperty, BooleanProperty, ColorMapProperty, ColorProperty, ComboProperty, ComplexDataProperty, DoubleProperty, FilePathProperty, FontProperty, IntegerProperty, MacrosProperty, MatrixProperty, PointListProperty, PVValueProperty, RulesProperty, ScriptProperty, StringListProperty, StringMapProperty, StringProperty, StringTableProperty, UnsavableListProperty

public abstract class AbstractWidgetProperty<T> extends Object
The base widget property class for all kinds of widget property.
  • Field Details

    • prop_id

      protected String prop_id
    • description

      protected String description
    • propertyValue

      protected T propertyValue
    • defaultValue

      protected T defaultValue
    • category

      protected WidgetPropertyCategory category
    • visibleInPropSheet

      protected boolean visibleInPropSheet
    • executionMode

      protected ExecutionMode executionMode
    • widgetModel

      protected AbstractWidgetModel widgetModel
  • Constructor Details

    • AbstractWidgetProperty

      public AbstractWidgetProperty(String prop_id, String description, WidgetPropertyCategory category, T defaultValue)
      Widget Property Constructor
      Parameters:
      prop_id - the property id which should be unique in a widget model.
      description - the description of the property, which will be shown as the property name in property sheet.
      category - the category of the widget.
      defaultValue - the default value when the widget is first created. It cannot be null.
  • Method Details

    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      Add listener on property change event. The listener will be removed when widget deactivated, so it is better to call this method in edit part during activating the widget to make sure the widget always have necessary listeners added.
      Parameters:
      listener - the listener which will be notified when property value changed.
    • checkValue

      public abstract T checkValue(Object value)
      Check if the requestNewValue is convertible or legal.
      Parameters:
      value - the value to be checked.
      Returns:
      The value after being checked. It might be coerced if the requestValue is illegal. return null if it is not convertible or illegal.
    • firePropertyChange

      public void firePropertyChange(T oldValue, T newValue)
    • getCategory

      public final WidgetPropertyCategory getCategory()
    • getDefaultValue

      public final T getDefaultValue()
    • isDefaultValue

      public boolean isDefaultValue()
    • getDescription

      public final String getDescription()
    • getPropertyDescriptor

      public final IPropertyDescriptor getPropertyDescriptor()
    • getPropertyID

      public final String getPropertyID()
    • getPropertyValue

      public T getPropertyValue()
    • getRawPropertyValue

      public T getRawPropertyValue()
      Returns:
      the raw property value that should not be treated or replaced by macros.
    • isVisibleInPropSheet

      public final boolean isVisibleInPropSheet()
      Get the formatted value to be displayed in property sheet.
    • removeAllPropertyChangeListeners

      public void removeAllPropertyChangeListeners()
    • getAllPropertyChangeListeners

      public final PropertyChangeListener[] getAllPropertyChangeListeners()
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
    • isSavable

      public boolean isSavable()
      If the property should be saved to xml file.
    • setSavable

      public void setSavable(boolean isSavable)
      Set to true if the property should be saved to xml file.
    • setCategory

      public void setCategory(WidgetPropertyCategory category)
    • setDescription

      public void setDescription(String description)
    • setDefaultValue

      public void setDefaultValue(T defaultValue)
    • setPropertyValue

      public void setPropertyValue(Object value)
      Set property value and fire the listeners on the property.
    • setPropertyValue_IgnoreOldValue

      public void setPropertyValue_IgnoreOldValue(Object value)
      Set property value and fire the listeners on the property.oldValue will be set as null.
    • setPropertyValue

      public void setPropertyValue(Object value, boolean fire)
      Set the property value.
      Parameters:
      value - the value to be set.
      fire - true if listeners should be fired regardless the old value. If false, only set the property value without firing listeners.
    • setVisibleInPropSheet

      public final boolean setVisibleInPropSheet(boolean visibleInPropSheet)
      Parameters:
      visibleInPropSheet -
      Returns:
      true if visibility changed.
    • createPropertyDescriptor

      protected abstract PropertyDescriptor createPropertyDescriptor()
    • writeToXML

      public abstract void writeToXML(org.jdom2.Element propElement)
      Write the property value into a XML element.
    • readValueFromXML

      public abstract T readValueFromXML(org.jdom2.Element propElement) throws Exception
      Read the property value from a XML element.
      Throws:
      Exception
    • setWidgetModel

      public void setWidgetModel(AbstractWidgetModel widgetModel)
    • setExecutionMode

      public void setExecutionMode(ExecutionMode executionMode)
    • getExecutionMode

      public ExecutionMode getExecutionMode()
    • configurableByRule

      public boolean configurableByRule()
      Subclass should override this method if it is configurable by rule. If this returns true, the method toStringInRuleScript(Object) should be properly overridden too.
      Returns:
      true if this property is configurable by rule.
    • onlyAcceptExpressionInRule

      public boolean onlyAcceptExpressionInRule()
      Subclass should override this method if it only accept output expression.
      Returns:
      true if this property only accept output expression.
    • toStringInRuleScript

      public String toStringInRuleScript(T propValue)
      Convert to the property value string in the script generated by rule.
    • toString

      public String toString()
      Overrides:
      toString in class Object