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_BACKGROUNDFields 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 TypeMethodDescriptionbooleanReturns 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.intgetPropertyType(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) voidReads the control from a Reader.Reads the control from an xml document with the specified name.voidReads the control from an xml string.voidsaveObject(Object obj) Saves an object's data in this XMLControl.voidsetBasepath(String basepath) toXML()Returns this control as an xml string.voidWrites 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, setValueMethods 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:
trueif 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
-