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
The base widget property class for all kinds of widget property.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WidgetPropertyCategoryprotected Tprotected Stringprotected ExecutionModeprotected Stringprotected Tprotected booleanprotected AbstractWidgetModel -
Constructor Summary
ConstructorsConstructorDescriptionAbstractWidgetProperty(String prop_id, String description, WidgetPropertyCategory category, T defaultValue) Widget Property Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd listener on property change event.abstract TcheckValue(Object value) Check if the requestNewValue is convertible or legal.booleanSubclass should override this method if it is configurable by rule.protected abstract PropertyDescriptorCreate theIPropertyDescriptorvoidfirePropertyChange(T oldValue, T newValue) final PropertyChangeListener[]final WidgetPropertyCategoryfinal Tfinal Stringfinal IPropertyDescriptorfinal StringbooleanbooleanIf the property should be saved to xml file.final booleanGet the formatted value to be displayed in property sheet.booleanSubclass should override this method if it only accept output expression.abstract TreadValueFromXML(org.jdom2.Element propElement) Read the property value from a XML element.voidvoidvoidsetCategory(WidgetPropertyCategory category) voidsetDefaultValue(T defaultValue) voidsetDescription(String description) voidsetExecutionMode(ExecutionMode executionMode) voidsetPropertyValue(Object value) Set property value and fire the listeners on the property.voidsetPropertyValue(Object value, boolean fire) Set the property value.voidSet property value and fire the listeners on the property.oldValue will be set as null.voidsetSavable(boolean isSavable) Set to true if the property should be saved to xml file.final booleansetVisibleInPropSheet(boolean visibleInPropSheet) voidsetWidgetModel(AbstractWidgetModel widgetModel) toString()toStringInRuleScript(T propValue) Convert to the property value string in the script generated by rule.abstract voidwriteToXML(org.jdom2.Element propElement) Write the property value into a XML element.
-
Field Details
-
prop_id
-
description
-
propertyValue
-
defaultValue
-
category
-
visibleInPropSheet
protected boolean visibleInPropSheet -
executionMode
-
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
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
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
-
getCategory
-
getDefaultValue
-
isDefaultValue
public boolean isDefaultValue() -
getDescription
-
getPropertyDescriptor
-
getPropertyID
-
getPropertyValue
-
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
-
removePropertyChangeListener
-
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
-
setDescription
-
setDefaultValue
-
setPropertyValue
Set property value and fire the listeners on the property. -
setPropertyValue_IgnoreOldValue
Set property value and fire the listeners on the property.oldValue will be set as null. -
setPropertyValue
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
Create theIPropertyDescriptor -
writeToXML
public abstract void writeToXML(org.jdom2.Element propElement) Write the property value into a XML element. -
readValueFromXML
Read the property value from a XML element.- Throws:
Exception
-
setWidgetModel
-
setExecutionMode
-
getExecutionMode
-
configurableByRule
public boolean configurableByRule()Subclass should override this method if it is configurable by rule. If this returns true, the methodtoStringInRuleScript(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
Convert to the property value string in the script generated by rule. -
toString
-