Package org.opensourcephysics.controls
Interface XMLControl
- All Superinterfaces:
Control
,XMLProperty
- All Known Implementing Classes:
XMLControlElement
This defines methods for storing data in an xml control element.
- Version:
- 1.0
- Author:
- Douglas Brown
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensourcephysics.controls.XMLProperty
XMLProperty.WrappedArray
-
Field Summary
Fields inherited from interface org.opensourcephysics.controls.Control
NOT_EDITABLE_BACKGROUND
Fields inherited from interface org.opensourcephysics.controls.XMLProperty
TYPE_ARRAY, TYPE_BOOLEAN, TYPE_COLLECTION, TYPE_DOUBLE, TYPE_INT, TYPE_OBJECT, TYPE_STRING, TYPE_UNKNOWN, TYPE_WRAPPED_ARRAY, types
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the most recent read operation failed.Class<?>
Gets the class for which this stores data.Gets the name of the object class for which this element stores data.int
getPropertyType
(String name) Gets the type of the specified property.loadObject
(Object obj) Loads an object with data from this XMLControl.loadObject
(Object obj, Object data) void
Reads the control from a Reader.Reads the control from an xml document with the specified name.void
Reads the control from an xml string.void
saveObject
(Object obj) Saves an object's data in this XMLControl.void
setBasepath
(String basepath) toXML()
Returns this control as an xml string.void
Writes the control to a Writer.Writes the control as an xml document with the specified name.Methods inherited from interface org.opensourcephysics.controls.Control
calculationDone, clearMessages, clearValues, getBoolean, getDouble, getInt, getObject, getPropertyNames, getPropertyNamesRaw, getString, print, println, println, setLockValues, setValue, setValue, setValue, setValue, setValue
Methods inherited from interface org.opensourcephysics.controls.XMLProperty
getChildControl, getChildControls, getLevel, getParentProperty, getPropertyClass, getPropertyContent, getPropertyName, getPropertyType, setValue
-
Method Details
-
getPropertyType
Gets the type of the specified property.- Parameters:
name
- the property name- Returns:
- the type
-
getObjectClassName
String getObjectClassName()Gets the name of the object class for which this element stores data.- Returns:
- the object class name
-
getObjectClass
Class<?> getObjectClass()Gets the class for which this stores data.- Returns:
- the class
-
saveObject
Saves an object's data in this XMLControl.- Parameters:
obj
- the object to save.
-
loadObject
Loads an object with data from this XMLControl.- Parameters:
obj
- the object to load- Returns:
- the loaded object
-
read
Reads the control from an xml document with the specified name.- Parameters:
name
- the name- Returns:
- the full name of the opened document or null if failed
-
read
Reads the control from a Reader.- Parameters:
reader
- the Reader
-
readXML
Reads the control from an xml string.- Parameters:
xml
- the xml string
-
failedToRead
boolean failedToRead()Returns true if the most recent read operation failed.- Returns:
true
if the most recent read operation failed
-
write
Writes the control as an xml document with the specified name.- Parameters:
fileName
- the file name- Returns:
- the full name of the saved document or null if failed
-
write
Writes the control to a Writer.- Parameters:
writer
- the Writer
-
toXML
String toXML()Returns this control as an xml string.- Returns:
- the xml string
-
getBasepath
String getBasepath() -
setBasepath
-
getPropsRaw
List<XMLProperty> getPropsRaw() -
loadObject
-