|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.controls.XMLControlElement
public class XMLControlElement
This is a basic xml control for storing data.
| Field Summary | |
|---|---|
static int |
ALWAYS_DECRYPT
|
boolean |
canWrite
|
protected java.lang.String |
className
|
static int |
compactArraySize
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
counts
|
protected java.lang.String |
doctype
|
protected static java.lang.String |
encoding
|
protected java.io.BufferedReader |
input
|
protected int |
level
|
protected java.lang.String |
name
|
static int |
NEVER_DECRYPT
|
protected java.lang.Object |
object
|
protected java.io.BufferedWriter |
output
|
protected XMLProperty |
parent
|
static int |
PASSWORD_DECRYPT
|
protected java.util.ArrayList<java.lang.String> |
propNames
|
protected java.util.ArrayList<XMLProperty> |
props
|
protected boolean |
readFailed
|
protected java.lang.Class<?> |
theClass
|
protected boolean |
valid
|
protected java.lang.String |
version
|
| Fields inherited from interface org.opensourcephysics.controls.Control |
|---|
NOT_EDITABLE_BACKGROUND |
| Constructor Summary | |
|---|---|
XMLControlElement()
Constructs an empty control for the Object class. |
|
XMLControlElement(java.lang.Class<?> type)
Constructs an empty control for the specified class. |
|
XMLControlElement(java.lang.Object obj)
Constructs and loads a control with the specified object. |
|
XMLControlElement(java.lang.String input)
Constructs a control and reads the specified input. |
|
XMLControlElement(XMLControl control)
Constructs a copy of the specified XMLControl. |
|
XMLControlElement(XMLProperty parent)
Constructs a control with the specified parent. |
|
| Method Summary | ||
|---|---|---|
java.lang.String |
addNumbering(java.lang.String name)
Appends numbering to a specified name. |
|
void |
calculationDone(java.lang.String s)
Method required by the Control interface. |
|
void |
clearMessages()
Method required by the Control interface. |
|
void |
clearValues()
Clears all properties. |
|
java.lang.Object |
clone()
Returns a copy of this control. |
|
boolean |
failedToRead()
Returns true if the most recent read operation failed. |
|
boolean |
getBoolean(java.lang.String name)
Gets the boolean value of the specified named property. |
|
XMLControl |
getChildControl(java.lang.String name)
Gets the named XMLControl child of this property. |
|
XMLControl[] |
getChildControls()
Gets the XMLControl children of this property. |
|
java.lang.String |
getDoctype()
Gets the doctype. |
|
double |
getDouble(java.lang.String name)
Gets the double value of the specified named property. |
|
int |
getInt(java.lang.String name)
Gets the int value of the specified named property. |
|
int |
getLevel()
Gets the level of this property relative to the root. |
|
java.lang.Object |
getObject(java.lang.String name)
Gets the object value of the specified named property. |
|
java.lang.Class<?> |
getObjectClass()
Gets the class of the object for which this element stores data. |
|
java.lang.String |
getObjectClassName()
Gets the name of the object class for which this element stores data. |
|
|
getObjects(java.lang.Class<T> type)
Returns a list of objects of a specified class within this control. |
|
|
getObjects(java.lang.Class<T> type,
boolean useChooser)
Returns a list of objects of a specified class within this control. |
|
XMLProperty |
getParentProperty()
Gets the immediate parent property, if any. |
|
java.lang.String |
getPassword()
Gets the password. |
|
java.lang.Class<?> |
getPropertyClass()
Gets the property class. |
|
java.util.List<java.lang.Object> |
getPropertyContent()
Gets the property content of this control. |
|
java.lang.String |
getPropertyName()
Gets the property name. |
|
java.util.Collection<java.lang.String> |
getPropertyNames()
Gets the set of property names. |
|
java.lang.String |
getPropertyType()
Gets the property type. |
|
java.lang.String |
getPropertyType(java.lang.String name)
Gets the type of the specified property. |
|
XMLControlElement |
getRootControl()
Gets the root control. |
|
java.lang.String |
getString(java.lang.String name)
Gets the string value of the specified named property. |
|
java.lang.String |
getVersion()
Gets the version. |
|
boolean |
isValid()
Gets the valid property. |
|
java.lang.Object |
loadObject(java.lang.Object obj)
Loads an object with data from this element. |
|
java.lang.Object |
loadObject(java.lang.Object obj,
boolean autoImport)
Loads an object with data from this element. |
|
java.lang.Object |
loadObject(java.lang.Object obj,
boolean autoImport,
boolean importAll)
Loads an object with data from this element. |
|
void |
print(java.lang.String s)
Method required by the Control interface. |
|
void |
println()
Method required by the Control interface. |
|
void |
println(java.lang.String s)
Method required by the Control interface. |
|
void |
read(java.io.Reader in)
Reads the control from a Reader. |
|
java.lang.String |
read(java.lang.String name)
Reads data into this control from a named source. |
|
java.lang.String |
readForClass(java.lang.String name,
java.lang.Class<?> type)
Reads data into this control from a named source if the source specifies the same class as the current className. |
|
void |
readXML(java.lang.String xml)
Reads the control from an xml string. |
|
boolean |
readXMLForClass(java.lang.String xml,
java.lang.Class<?> type)
Reads this control from an xml string if the xml specifies the same class as the current className. |
|
void |
saveObject(java.lang.Object obj)
Saves an object's data in this element. |
|
void |
setDecryptPolicy(int policy)
Sets the verify password flag. |
|
void |
setDoctype(java.lang.String name)
Sets the doctype. |
|
void |
setLockValues(boolean lock)
Locks the control's interface. |
|
void |
setObjectClass(java.lang.Class<?> type)
Sets the class of the object for which this element stores data. |
|
void |
setPassword(java.lang.String pass)
Sets the password. |
|
void |
setValid(boolean valid)
Sets the valid property. |
|
void |
setValue(java.lang.String stringValue)
This does nothing since the property type is "object". |
|
void |
setValue(java.lang.String name,
boolean value)
Sets a property with the specified name and boolean value. |
|
void |
setValue(java.lang.String name,
double value)
Sets a property with the specified name and double value. |
|
void |
setValue(java.lang.String name,
int value)
Sets a property with the specified name and int value. |
|
void |
setValue(java.lang.String name,
java.lang.Object obj)
Sets a property with the specified name and object value. |
|
void |
setVersion(java.lang.String vers)
Sets the version. |
|
java.lang.String |
toString()
Returns the string xml representation. |
|
java.lang.String |
toXML()
Returns this control as an xml string. |
|
java.lang.String |
write(java.lang.String fileName)
Writes this control as an xml file with the specified name. |
|
void |
write(java.io.Writer out)
Writes this control to a Writer. |
|
void |
writeDocType(java.io.Writer out)
Writes the DTD to a Writer. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int ALWAYS_DECRYPT
public static final int PASSWORD_DECRYPT
public static final int NEVER_DECRYPT
public static int compactArraySize
protected static java.lang.String encoding
protected java.lang.String className
protected java.lang.Class<?> theClass
protected java.lang.String name
protected java.util.Map<java.lang.String,java.lang.Integer> counts
protected java.lang.Object object
protected XMLProperty parent
protected int level
protected java.util.ArrayList<java.lang.String> propNames
protected java.util.ArrayList<XMLProperty> props
protected java.io.BufferedReader input
protected java.io.BufferedWriter output
public boolean canWrite
protected boolean valid
protected boolean readFailed
protected java.lang.String version
protected java.lang.String doctype
| Constructor Detail |
|---|
public XMLControlElement()
public XMLControlElement(java.lang.Class<?> type)
type - the class.public XMLControlElement(java.lang.Object obj)
obj - the object.public XMLControlElement(XMLProperty parent)
parent - the parent.public XMLControlElement(java.lang.String input)
input - the input stringpublic XMLControlElement(XMLControl control)
control - the XMLControl to copy.| Method Detail |
|---|
public void setLockValues(boolean lock)
setLockValues in interface Controllock - boolean
public void setValue(java.lang.String name,
boolean value)
setValue in interface Controlname - the namevalue - the boolean value
public void setValue(java.lang.String name,
double value)
setValue in interface Controlname - the namevalue - the double value
public void setValue(java.lang.String name,
int value)
setValue in interface Controlname - the namevalue - the int value
public void setValue(java.lang.String name,
java.lang.Object obj)
setValue in interface Controlname - the nameobj - the objectpublic boolean getBoolean(java.lang.String name)
getBoolean in interface Controlname - the name
public double getDouble(java.lang.String name)
getDouble in interface Controlname - the name
public int getInt(java.lang.String name)
getInt in interface Controlname - the name
public java.lang.String getString(java.lang.String name)
getString in interface Controlname - the name
public java.lang.Object getObject(java.lang.String name)
getObject in interface Controlname - the name
public java.util.Collection<java.lang.String> getPropertyNames()
getPropertyNames in interface Controlpublic java.lang.String getPropertyType(java.lang.String name)
getPropertyType in interface XMLControlname - the property name
public void setPassword(java.lang.String pass)
pass - the password or phrasepublic java.lang.String getPassword()
public void setDecryptPolicy(int policy)
true - to require password verification for file decryptionpublic java.lang.String read(java.lang.String name)
read in interface XMLControlname - the name
public void readXML(java.lang.String xml)
readXML in interface XMLControlxml - the xml stringpublic void read(java.io.Reader in)
read in interface XMLControlin - the Reader
public java.lang.String readForClass(java.lang.String name,
java.lang.Class<?> type)
name - the nametype - the class
public boolean readXMLForClass(java.lang.String xml,
java.lang.Class<?> type)
xml - the xml stringtype - the class
public boolean failedToRead()
failedToRead in interface XMLControltrue if the most recent read operation failedpublic java.lang.String write(java.lang.String fileName)
write in interface XMLControlfileName - the file name
public void write(java.io.Writer out)
write in interface XMLControlout - the Writerpublic void writeDocType(java.io.Writer out)
out - the Writerpublic java.lang.String toXML()
toXML in interface XMLControlpublic void setValid(boolean valid)
valid - true to write the DTD and DocTypepublic boolean isValid()
true if this is validpublic void setVersion(java.lang.String vers)
vers - the version datapublic java.lang.String getVersion()
public void setDoctype(java.lang.String name)
name - the doctype resource namepublic java.lang.String getDoctype()
public void setObjectClass(java.lang.Class<?> type)
type - the Class of the objectpublic java.lang.Class<?> getObjectClass()
getObjectClass in interface XMLControlClass of the objectpublic java.lang.String getObjectClassName()
getObjectClassName in interface XMLControlpublic void saveObject(java.lang.Object obj)
saveObject in interface XMLControlobj - the object to save.public java.lang.Object loadObject(java.lang.Object obj)
loadObject in interface XMLControlobj - the object to load
public java.lang.Object loadObject(java.lang.Object obj,
boolean autoImport)
obj - the object to loadautoImport - true to automatically import data from mismatched classes
public java.lang.Object loadObject(java.lang.Object obj,
boolean autoImport,
boolean importAll)
obj - the object to loadautoImport - true to automatically import data from mismatched classesimportAll - true to import all importable data
public void clearValues()
clearValues in interface Controlpublic void println(java.lang.String s)
println in interface Controls - the stringpublic void println()
println in interface Controlpublic void print(java.lang.String s)
print in interface Controls - the stringpublic void clearMessages()
clearMessages in interface Controlpublic void calculationDone(java.lang.String s)
calculationDone in interface Controls - the stringpublic java.lang.String getPropertyName()
getPropertyName in interface XMLPropertypublic java.lang.String getPropertyType()
getPropertyType in interface XMLPropertypublic java.lang.Class<?> getPropertyClass()
getPropertyClass in interface XMLPropertypublic XMLProperty getParentProperty()
getParentProperty in interface XMLPropertypublic int getLevel()
getLevel in interface XMLPropertypublic java.util.List<java.lang.Object> getPropertyContent()
getPropertyContent in interface XMLPropertypublic XMLControl getChildControl(java.lang.String name)
getChildControl in interface XMLPropertyname - the property name
public XMLControl[] getChildControls()
getChildControls in interface XMLPropertypublic XMLControlElement getRootControl()
public java.lang.String addNumbering(java.lang.String name)
name - the name
public void setValue(java.lang.String stringValue)
setValue in interface XMLPropertystringValue - the string value of a primitive or string propertypublic java.lang.String toString()
toString in class java.lang.Objectpublic <T> java.util.List<T> getObjects(java.lang.Class<T> type)
type - the Class
public <T> java.util.List<T> getObjects(java.lang.Class<T> type,
boolean useChooser)
type - the ClassuseChooser - true to allow user to choose
public java.lang.Object clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||