|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensourcephysics.controls.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 |
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 |
propNames
|
protected java.util.ArrayList |
props
|
protected boolean |
readFailed
|
protected java.lang.Class |
theClass
|
protected boolean |
valid
|
protected java.lang.String |
version
|
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. |
java.util.List |
getObjects(java.lang.Class type)
Returns a list of objects of a specified class within this control. |
java.util.List |
getObjects(java.lang.Class 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 |
getPropertyContent()
Gets the property content of this control. |
java.lang.String |
getPropertyName()
Gets the property name. |
java.util.Collection |
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. |
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 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 counts
protected java.lang.Object object
protected XMLProperty parent
protected int level
protected java.util.ArrayList propNames
protected java.util.ArrayList 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 Control
lock
- booleanpublic void setValue(java.lang.String name, boolean value)
setValue
in interface Control
name
- the namevalue
- the boolean valuepublic void setValue(java.lang.String name, double value)
setValue
in interface Control
name
- the namevalue
- the double valuepublic void setValue(java.lang.String name, int value)
setValue
in interface Control
name
- the namevalue
- the int valuepublic void setValue(java.lang.String name, java.lang.Object obj)
setValue
in interface Control
name
- the nameobj
- the objectpublic boolean getBoolean(java.lang.String name)
getBoolean
in interface Control
name
- the name
public double getDouble(java.lang.String name)
getDouble
in interface Control
name
- the name
public int getInt(java.lang.String name)
getInt
in interface Control
name
- the name
public java.lang.String getString(java.lang.String name)
getString
in interface Control
name
- the name
public java.lang.Object getObject(java.lang.String name)
getObject
in interface Control
name
- the name
public java.util.Collection getPropertyNames()
getPropertyNames
in interface Control
public java.lang.String getPropertyType(java.lang.String name)
getPropertyType
in interface XMLControl
name
- the property name
public void setPassword(java.lang.String pass)
pass
- the password or phrasepublic java.lang.String getPassword()
public void setDecryptPolicy(int policy)
public java.lang.String read(java.lang.String name)
read
in interface XMLControl
name
- the name
public void readXML(java.lang.String xml)
readXML
in interface XMLControl
xml
- the xml stringpublic void read(java.io.Reader in)
read
in interface XMLControl
in
- the Readerpublic boolean failedToRead()
failedToRead
in interface XMLControl
true
if the most recent read operation failedpublic java.lang.String write(java.lang.String fileName)
write
in interface XMLControl
fileName
- the file name
public void write(java.io.Writer out)
write
in interface XMLControl
out
- the Writerpublic void writeDocType(java.io.Writer out)
out
- the Writerpublic java.lang.String toXML()
toXML
in interface XMLControl
public 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 XMLControl
Class
of the objectpublic java.lang.String getObjectClassName()
getObjectClassName
in interface XMLControl
public void saveObject(java.lang.Object obj)
saveObject
in interface XMLControl
obj
- the object to save.public java.lang.Object loadObject(java.lang.Object obj)
loadObject
in interface XMLControl
obj
- 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 Control
public void println(java.lang.String s)
println
in interface Control
s
- the stringpublic void println()
println
in interface Control
public void print(java.lang.String s)
print
in interface Control
s
- the stringpublic void clearMessages()
clearMessages
in interface Control
public void calculationDone(java.lang.String s)
calculationDone
in interface Control
s
- the stringpublic java.lang.String getPropertyName()
getPropertyName
in interface XMLProperty
public java.lang.String getPropertyType()
getPropertyType
in interface XMLProperty
public java.lang.Class getPropertyClass()
getPropertyClass
in interface XMLProperty
public XMLProperty getParentProperty()
getParentProperty
in interface XMLProperty
public int getLevel()
getLevel
in interface XMLProperty
public java.util.List getPropertyContent()
getPropertyContent
in interface XMLProperty
public XMLControl getChildControl(java.lang.String name)
getChildControl
in interface XMLProperty
name
- the property name
public XMLControl[] getChildControls()
getChildControls
in interface XMLProperty
public XMLControlElement getRootControl()
public java.lang.String addNumbering(java.lang.String name)
name
- the name
public void setValue(java.lang.String stringValue)
setValue
in interface XMLProperty
stringValue
- the string value of a primitive or string propertypublic java.lang.String toString()
public java.util.List getObjects(java.lang.Class type)
type
- the Class
public java.util.List getObjects(java.lang.Class type, boolean useChooser)
type
- the ClassuseChooser
- true to allow user to choose
public java.lang.Object clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |