Class WidgetProperty<T>
- java.lang.Object
-
- org.csstudio.display.builder.model.properties.PropertyChangeHandler<T>
-
- org.csstudio.display.builder.model.WidgetProperty<T>
-
- Type Parameters:
T
- Type of the property's value
- Direct Known Subclasses:
org.csstudio.display.builder.model.RuntimeWidgetProperty
,org.csstudio.display.builder.model.StructuredWidgetProperty
public abstract class WidgetProperty<T> extends org.csstudio.display.builder.model.properties.PropertyChangeHandler<T>
Base class for all widget properties.The property name identifies a property inside the model. A separate description, which can be localized, is meant for user interfaces that present the property to humans.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description WidgetProperty<T>
clone()
org.csstudio.display.builder.model.WidgetPropertyCategory
getCategory()
T
getDefaultValue()
java.lang.String
getDescription()
java.lang.String
getName()
java.lang.String
getPath()
Get full path to propertyT
getValue()
Widget
getWidget()
boolean
isDefaultValue()
boolean
isReadonly()
boolean
isUsingWidgetClass()
abstract void
readFromXML(org.csstudio.display.builder.model.persist.ModelReader model_reader, org.w3c.dom.Element property_xml)
Read value from persisted XMLvoid
setValue(T value)
abstract void
setValueFromObject(java.lang.Object value)
Set value from Object.java.lang.String
toString()
void
useWidgetClass(boolean use_class)
abstract void
writeToXML(org.csstudio.display.builder.model.persist.ModelWriter model_writer, javax.xml.stream.XMLStreamWriter writer)
Persist value to XML
-
-
-
Method Detail
-
clone
public WidgetProperty<T> clone()
-
getWidget
public Widget getWidget()
- Returns:
- Widget that has this property
-
getCategory
public org.csstudio.display.builder.model.WidgetPropertyCategory getCategory()
- Returns:
WidgetPropertyCategory
of this property
-
getName
public java.lang.String getName()
- Returns:
- Name that identifies the property within the model API
-
getPath
public java.lang.String getPath()
Get full path to propertyA widget property 'visible' might be the basic widget's 'visible' property, or the 'visible' property of an element in a structure within an array, like ImageWidget's 'color_bar.visible'.
The path is seldom needed, so properties do not carry a 'parent' reference for fast determination of the path. Instead, the path is determined at runtime by searching down from the top-level widget properties.
- Returns:
- The full path to property.
-
getDescription
public java.lang.String getDescription()
- Returns:
- Human-readable description of the property
-
isReadonly
public boolean isReadonly()
- Returns:
true
if this property prohibits write access
-
getDefaultValue
public T getDefaultValue()
- Returns:
- Default value of the property
-
getValue
public T getValue()
- Returns:
- Current value of the property
-
isDefaultValue
public boolean isDefaultValue()
- Returns:
true
if current value matches the default value
-
useWidgetClass
public void useWidgetClass(boolean use_class)
- Parameters:
use_class
- Should value of this property follow the suggestion from the class support?
-
isUsingWidgetClass
public boolean isUsingWidgetClass()
- Returns:
- Is value of this property following the suggestion from the class support?
-
setValue
public void setValue(T value)
- Parameters:
value
- New value of the property
-
setValueFromObject
public abstract void setValueFromObject(java.lang.Object value) throws java.lang.Exception
Set value from Object.Type-safe access via
setValue()
is preferred,Helper for implementing Runtime properties but if property type is not known, this method allows setting the property value from an Object.- Parameters:
value
- New value of the property- Throws:
java.lang.Exception
- if value type is not applicable to this property
-
writeToXML
public abstract void writeToXML(org.csstudio.display.builder.model.persist.ModelWriter model_writer, javax.xml.stream.XMLStreamWriter writer) throws java.lang.Exception
Persist value to XMLWriter will be positioned inside the property. Implementation needs to write the property's value.
- Parameters:
model_writer
-ModelWriter
writer
- Stream writer- Throws:
java.lang.Exception
- on error
-
readFromXML
public abstract void readFromXML(org.csstudio.display.builder.model.persist.ModelReader model_reader, org.w3c.dom.Element property_xml) throws java.lang.Exception
Read value from persisted XML- Parameters:
model_reader
-ModelReader
property_xml
- XML element- Throws:
java.lang.Exception
- on error
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- Debug representation
-
-