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
Modifier and TypeFieldDescriptionprotected WidgetPropertyCategory
protected T
protected String
protected ExecutionMode
protected String
protected T
protected boolean
protected AbstractWidgetModel
-
Constructor Summary
ConstructorDescriptionAbstractWidgetProperty
(String prop_id, String description, WidgetPropertyCategory category, T defaultValue) Widget Property Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add listener on property change event.abstract T
checkValue
(Object value) Check if the requestNewValue is convertible or legal.boolean
Subclass should override this method if it is configurable by rule.protected abstract PropertyDescriptor
Create theIPropertyDescriptor
void
firePropertyChange
(T oldValue, T newValue) final PropertyChangeListener[]
final WidgetPropertyCategory
final T
final String
final IPropertyDescriptor
final String
boolean
boolean
If the property should be saved to xml file.final boolean
Get the formatted value to be displayed in property sheet.boolean
Subclass should override this method if it only accept output expression.abstract T
readValueFromXML
(org.jdom2.Element propElement) Read the property value from a XML element.void
void
void
setCategory
(WidgetPropertyCategory category) void
setDefaultValue
(T defaultValue) void
setDescription
(String description) void
setExecutionMode
(ExecutionMode executionMode) void
setPropertyValue
(Object value) Set property value and fire the listeners on the property.void
setPropertyValue
(Object value, boolean fire) Set the property value.void
Set property value and fire the listeners on the property.oldValue will be set as null.void
setSavable
(boolean isSavable) Set to true if the property should be saved to xml file.final boolean
setVisibleInPropSheet
(boolean visibleInPropSheet) void
setWidgetModel
(AbstractWidgetModel widgetModel) toString()
toStringInRuleScript
(T propValue) Convert to the property value string in the script generated by rule.abstract void
writeToXML
(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
-