org.opensourcephysics.controls
Interface XMLControl

All Superinterfaces:
Control, XMLProperty
All Known Implementing Classes:
XMLControlElement

public interface XMLControl
extends Control, XMLProperty

This defines methods for storing data in an xml control element.

Version:
1.0
Author:
Douglas Brown

Field Summary
 
Fields inherited from interface org.opensourcephysics.controls.Control
NOT_EDITABLE_BACKGROUND
 
Method Summary
 boolean failedToRead()
          Returns true if the most recent read operation failed.
 java.lang.Class<?> getObjectClass()
          Gets the class for which this stores data.
 java.lang.String getObjectClassName()
          Gets the name of the object class for which this element stores data.
 java.lang.String getPropertyType(java.lang.String name)
          Gets the type of the specified property.
 java.lang.Object loadObject(java.lang.Object obj)
          Loads an object with data from this XMLControl.
 void read(java.io.Reader reader)
          Reads the control from a Reader.
 java.lang.String read(java.lang.String name)
          Reads the control from an xml document with the specified name.
 void readXML(java.lang.String xml)
          Reads the control from an xml string.
 void saveObject(java.lang.Object obj)
          Saves an object's data in this XMLControl.
 java.lang.String toXML()
          Returns this control as an xml string.
 java.lang.String write(java.lang.String fileName)
          Writes the control as an xml document with the specified name.
 void write(java.io.Writer writer)
          Writes the control to a Writer.
 
Methods inherited from interface org.opensourcephysics.controls.Control
calculationDone, clearMessages, clearValues, getBoolean, getDouble, getInt, getObject, getPropertyNames, getString, print, println, println, setLockValues, setValue, setValue, setValue, setValue
 
Methods inherited from interface org.opensourcephysics.controls.XMLProperty
getChildControl, getChildControls, getLevel, getParentProperty, getPropertyClass, getPropertyContent, getPropertyName, getPropertyType, setValue
 

Method Detail

getPropertyType

java.lang.String getPropertyType(java.lang.String name)
Gets the type of the specified property.

Parameters:
name - the property name
Returns:
the type

getObjectClassName

java.lang.String getObjectClassName()
Gets the name of the object class for which this element stores data.

Returns:
the object class name

getObjectClass

java.lang.Class<?> getObjectClass()
Gets the class for which this stores data.

Returns:
the class

saveObject

void saveObject(java.lang.Object obj)
Saves an object's data in this XMLControl.

Parameters:
obj - the object to save.

loadObject

java.lang.Object loadObject(java.lang.Object obj)
Loads an object with data from this XMLControl.

Parameters:
obj - the object to load
Returns:
the loaded object

read

java.lang.String read(java.lang.String name)
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

void read(java.io.Reader reader)
Reads the control from a Reader.

Parameters:
reader - the Reader

readXML

void readXML(java.lang.String xml)
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

java.lang.String write(java.lang.String fileName)
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

void write(java.io.Writer writer)
Writes the control to a Writer.

Parameters:
writer - the Writer

toXML

java.lang.String toXML()
Returns this control as an xml string.

Returns:
the xml string