Package weka.gui.beans.xml

# Class XMLBeans

java.lang.Object
weka.core.xml.XMLSerialization
weka.core.xml.XMLBasicSerialization
weka.gui.beans.xml.XMLBeans

All Implemented Interfaces:
  `RevisionHandler`

public class XMLBeans extends XMLBasicSerialization
This class serializes and deserializes a KnowledgeFlow setup to and fro XML.

Version:
  $Revision: 7411 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DATATYPE_LAYOUT`
the data that is about to be read/written contains a complete layout
`static final int`
`DATATYPE_USERCOMPONENTS`
the data that is about to be read/written contains user-components, i.e., Metabeans
`static final int`
`INDEX_BEANCONNECTIONS`
the index in the Vector, where the BeanConnections are stored (Instances and Connections are stored in a Vector and then serialized)
`static final int`
`INDEX_BEANINSTANCES`
the index in the Vector, where the BeanInstances are stored (Instances and Connections are stored in a Vector and then serialized)
`static final String`
`VAL_ANIMATEDICONPATH`
the value of the animatedIconPath property
`static final String`
`VAL_ASSOCIATEDCONNECTIONS`
the value of the associatedConnections property
`static final String`
`VAL_BEAN`
the value of the bean property
`static final String`
`VAL_BEANCONTEXT`
the value of the beanContext property
`static final String`
`VAL_BLUE`
the value of the blue property
`static final String`
`VAL_COLOR`
the value of the color property
`static final String`
`VAL_CUSTOM_NAME`
the value of the customName property
`static final String`
`VAL_DIR`
the value of the dir property
`static final String`
`VAL_EVENTNAME`
the value of the eventname property
`static final String`
`VAL_FILE`
the value of the file property
`static final String`
`VAL_FONT`
the value of the font property
`static final String`
`VAL_GREEN`
the value of the green property
`static final String`
`VAL_HEIGHT`
the value of the height property
`static final String`
`VAL_HIDDEN`
the value of the hidden property
`static final String`
`VAL_ICONPATH`
the value of the iconpath property
`static final String`
`VAL_ID`
the value of the id property
`static final String`
`VAL_INPUTS`
the value of the input property
`static final String`
`VAL_INPUTSID`
the value of the input id property
`static final String`
`VAL_LOADER`
the value of the loader property
`static final String`
`VAL_LOCATION`
the value of the location property
`static final String`
`VAL_NAME`
the value of the value property
`static final String`
`VAL_OPTIONS`
the value of the options property
`static final String`
`VAL_ORIGINALCOORDS`
the value of the originalCoords property
`static final String`
`VAL_OUTPUTS`
the value of the outputs id property
`static final String`
`VAL_OUTPUTSID`
the value of the outputs property
`static final String`
`VAL_PREFIX`
the value of the prefix property
`static final String`
`VAL_RED`
the value of the red property
`static final String`
`VAL_RELATIONNAMEFORFILENAME`
the value of the relationNameForFilename property (Saver)
`static final String`
`VAL_RELATIVE_PATH`
`static final String`
`VAL_SAVER`
the value of the saver property
`static final String`
`VAL_SIZE`
the value of the size property
`static final String`
`VAL_SOURCEID`
the value of the source property
`static final String`
`VAL_STYLE`
the value of the style property
`static final String`
`VAL_SUBFLOW`
the value of the subFlow property
`static final String`
`VAL_TARGETID`
the value of the target property
`static final String`
`VAL_TEXT`
the value of the text property
`static final String`
`VAL_WIDTH`
the value of the width property
`static final String`
`VAL_X`
the value of the x property
`static final String`
`VAL_Y`
the value of the y property

### Fields inherited from class weka.core.xml.XMLBasicSerialization

`VAL_CELLS, VAL_KEY, VAL_MAPPING, VAL_VALUE`

### Fields inherited from class weka.core.xml.XMLSerialization

`ATT_ARRAY, ATT_ARRAY_DEFAULT, ATT_CLASS, ATT_NAME, ATT_NULL, ATT_NULL_DEFAULT, ATT_PRIMITIVE, ATT_PRIMITIVE_DEFAULT, ATT_VERSION, DOCTYPE, ROOT_NODE, TAG_OBJECT, VAL_NO, VAL_ROOT, VAL_YES`

## Constructor Summary

Constructors
Constructor
Description
`XMLBeans(JComponent layout, BeanContextSupport context)`
initializes the serialization for layouts
`XMLBeans(JComponent layout, BeanContextSupport context, int datatype)`
initializes the serialization for different types of data

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods
`int`
`getDataType()`
returns the type of data that is to be read/written
`Object`
`readBeanConnection(Element node)`
builds the BeanConnection from the given DOM node.
`Object`
`readBeanInstance(Element node)`
builds the BeanInstance from the given DOM node.
`Object`
`readBeanVisual(Element node)`
builds the BeanVisual from the given DOM node.
`Object`
`readColor(Element node)`
builds the Color from the given DOM node.
`Object`
`readColorUIResource(Element node)`
builds the ColorUIResource from the given DOM node.
`Object`
`readDimension(Element node)`
builds the Dimension from the given DOM node.
`Object`
`readFont(Element node)`
builds the Font from the given DOM node.
`Object`
`readFontUIResource(Element node)`
builds the FontUIResource from the given DOM node.
`Object`
`readLoader(Element node)`
builds the Loader from the given DOM node.
`Object`
`readMetaBean(Element node)`
builds the MetaBean from the given DOM node.
`Object`
`readPoint(Element node)`
builds the Point from the given DOM node.
`Object`
`readSaver(Element node)`
builds the Saver from the given DOM node.
`void`
`setDataType(int value)`
sets what kind of data is to be read/written
`Element`
`writeBeanConnection(Element parent, Object o, String name)`
adds the given BeanConncetion to a DOM structure.
`Element`
`writeBeanInstance(Element parent, Object o, String name)`
adds the given BeanInstance to a DOM structure.
`Element`
`writeBeanLoader(Element parent, Object o, String name)`
adds the given Loader (a bean) to a DOM structure.
`Element`
`writeBeanSaver(Element parent, Object o, String name)`
adds the given Saver (a bean) to a DOM structure.
`Element`
`writeBeanVisual(Element parent, Object o, String name)`
adds the given BeanVisual to a DOM structure.
`Element`
`writeColor(Element parent, Object o, String name)`
adds the given Color to a DOM structure.
`Element`
`writeColorUIResource(Element parent, Object o, String name)`
adds the given ColorUIResource to a DOM structure.
`Element`
`writeDimension(Element parent, Object o, String name)`
adds the given Dimension to a DOM structure.
`Element`
`writeFont(Element parent, Object o, String name)`
adds the given Font to a DOM structure.
`Element`
`writeFontUIResource(Element parent, Object o, String name)`
adds the given FontUIResource to a DOM structure.
`Element`
`writeLoader(Element parent, Object o, String name)`
adds the given Loader to a DOM structure.
`Element`
`writeMetaBean(Element parent, Object o, String name)`
adds the given MetaBean to a DOM structure.
`Element`
`writePoint(Element parent, Object o, String name)`
adds the given Point to a DOM structure.
`Element`
`writeSaver(Element parent, Object o, String name)`
adds the given Saver to a DOM structure.

### Methods inherited from class weka.core.xml.XMLBasicSerialization

`getRevision, readCollection, readCostMatrixOld, readDefaultListModel, readMap, readMatrix, readMatrixOld, writeCollection, writeCostMatrixOld, writeDefaultListModel, writeMap, writeMatrix, writeMatrixOld`

### Methods inherited from class weka.core.xml.XMLSerialization

`fromXML, getVersion, main, read, read, read, read, readBooleanFromXML, readByteFromXML, readCharFromXML, readDoubleFromXML, readFloatFromXML, readFromXML, readFromXML, readIntFromXML, readLongFromXML, readShortFromXML, toXML, write, write, write, write, writeToXML`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### VAL_ID

public static final String VAL_ID
the value of the id property

See Also:
  - Constant Field Values

### VAL_X

public static final String VAL_X
the value of the x property

See Also:
  - Constant Field Values

### VAL_Y

public static final String VAL_Y
the value of the y property

See Also:
  - Constant Field Values

### VAL_BEAN

public static final String VAL_BEAN
the value of the bean property

See Also:
  - Constant Field Values

### VAL_CUSTOM_NAME

public static final String VAL_CUSTOM_NAME
the value of the customName property

See Also:
  - Constant Field Values

### VAL_SOURCEID

public static final String VAL_SOURCEID
the value of the source property

See Also:
  - Constant Field Values

### VAL_TARGETID

public static final String VAL_TARGETID
the value of the target property

See Also:
  - Constant Field Values

### VAL_EVENTNAME

public static final String VAL_EVENTNAME
the value of the eventname property

See Also:
  - Constant Field Values

### VAL_HIDDEN

public static final String VAL_HIDDEN
the value of the hidden property

See Also:
  - Constant Field Values

### VAL_FILE

public static final String VAL_FILE
the value of the file property

See Also:
  - Constant Field Values

### VAL_DIR

public static final String VAL_DIR
the value of the dir property

See Also:
  - Constant Field Values

### VAL_PREFIX

public static final String VAL_PREFIX
the value of the prefix property

See Also:
  - Constant Field Values

### VAL_RELATIVE_PATH

public static final String VAL_RELATIVE_PATH

See Also:
  - Constant Field Values

### VAL_OPTIONS

public static final String VAL_OPTIONS
the value of the options property

See Also:
  - Constant Field Values

### VAL_SAVER

public static final String VAL_SAVER
the value of the saver property

See Also:
  - Constant Field Values

### VAL_LOADER

public static final String VAL_LOADER
the value of the loader property

See Also:
  - Constant Field Values

### VAL_TEXT

public static final String VAL_TEXT
the value of the text property

See Also:
  - Constant Field Values

### VAL_BEANCONTEXT

public static final String VAL_BEANCONTEXT
the value of the beanContext property

See Also:
  - Constant Field Values

### VAL_WIDTH

public static final String VAL_WIDTH
the value of the width property

See Also:
  - Constant Field Values

### VAL_HEIGHT

public static final String VAL_HEIGHT
the value of the height property

See Also:
  - Constant Field Values

### VAL_RED

public static final String VAL_RED
the value of the red property

See Also:
  - Constant Field Values

### VAL_GREEN

public static final String VAL_GREEN
the value of the green property

See Also:
  - Constant Field Values

### VAL_BLUE

public static final String VAL_BLUE
the value of the blue property

See Also:
  - Constant Field Values

### VAL_NAME

public static final String VAL_NAME
the value of the value property

See Also:
  - Constant Field Values

### VAL_STYLE

public static final String VAL_STYLE
the value of the style property

See Also:
  - Constant Field Values

### VAL_LOCATION

public static final String VAL_LOCATION
the value of the location property

See Also:
  - Constant Field Values

### VAL_SIZE

public static final String VAL_SIZE
the value of the size property

See Also:
  - Constant Field Values

### VAL_COLOR

public static final String VAL_COLOR
the value of the color property

See Also:
  - Constant Field Values

### VAL_FONT

public static final String VAL_FONT
the value of the font property

See Also:
  - Constant Field Values

### VAL_ICONPATH

public static final String VAL_ICONPATH
the value of the iconpath property

See Also:
  - Constant Field Values

### VAL_ANIMATEDICONPATH

public static final String VAL_ANIMATEDICONPATH
the value of the animatedIconPath property

See Also:
  - Constant Field Values

### VAL_ASSOCIATEDCONNECTIONS

public static final String VAL_ASSOCIATEDCONNECTIONS
the value of the associatedConnections property

See Also:
  - Constant Field Values

### VAL_INPUTS

public static final String VAL_INPUTS
the value of the input property

See Also:
  - Constant Field Values

### VAL_INPUTSID

public static final String VAL_INPUTSID
the value of the input id property

See Also:
  - Constant Field Values

### VAL_OUTPUTS

public static final String VAL_OUTPUTS
the value of the outputs id property

See Also:
  - Constant Field Values

### VAL_OUTPUTSID

public static final String VAL_OUTPUTSID
the value of the outputs property

See Also:
  - Constant Field Values

### VAL_SUBFLOW

public static final String VAL_SUBFLOW
the value of the subFlow property

See Also:
  - Constant Field Values

### VAL_ORIGINALCOORDS

public static final String VAL_ORIGINALCOORDS
the value of the originalCoords property

See Also:
  - Constant Field Values

### VAL_RELATIONNAMEFORFILENAME

public static final String VAL_RELATIONNAMEFORFILENAME
the value of the relationNameForFilename property (Saver)

See Also:
  - Constant Field Values

### INDEX_BEANINSTANCES

public static final int INDEX_BEANINSTANCES
the index in the Vector, where the BeanInstances are stored (Instances and Connections are stored in a Vector and then serialized)

See Also:
  - Constant Field Values

### INDEX_BEANCONNECTIONS

public static final int INDEX_BEANCONNECTIONS
the index in the Vector, where the BeanConnections are stored (Instances and Connections are stored in a Vector and then serialized)

See Also:
  - Constant Field Values

### DATATYPE_LAYOUT

public static final int DATATYPE_LAYOUT
the data that is about to be read/written contains a complete layout

See Also:
  - `m_DataType`
  - Constant Field Values

### DATATYPE_USERCOMPONENTS

public static final int DATATYPE_USERCOMPONENTS
the data that is about to be read/written contains user-components, i.e., Metabeans

See Also:
  - `m_DataType`
  - Constant Field Values

## Constructor Details

### XMLBeans

public XMLBeans(JComponent layout, BeanContextSupport context) throws Exception
initializes the serialization for layouts

Parameters:
  `layout` - the component that manages the layout
  `context` - the bean context support to use
Throws:
  `Exception` - if initialization fails

### XMLBeans

public XMLBeans(JComponent layout, BeanContextSupport context, int datatype) throws Exception
initializes the serialization for different types of data

Parameters:
  `layout` - the component that manages the layout
  `context` - the bean context support to use
  `datatype` - the type of data to read/write
Throws:
  `Exception` - if initialization fails

## Method Details

### setDataType

public void setDataType(int value)
sets what kind of data is to be read/written

Parameters:
  `value` - the type of data
See Also:
  - `m_DataType`

### getDataType

public int getDataType()
returns the type of data that is to be read/written

Returns:
  the type of data
See Also:
  - `m_DataType`

### clear

public void clear() throws Exception
generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods

Overrides:
  `clear` in class `XMLBasicSerialization`
Throws:
  `Exception` - if something goes wrong

### writeColor

public Element writeColor(Element parent, Object o, String name) throws Exception
adds the given Color to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readColor

public Object readColor(Element node) throws Exception
builds the Color from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeDimension

public Element writeDimension(Element parent, Object o, String name) throws Exception
adds the given Dimension to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readDimension

public Object readDimension(Element node) throws Exception
builds the Dimension from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeFont

public Element writeFont(Element parent, Object o, String name) throws Exception
adds the given Font to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readFont

public Object readFont(Element node) throws Exception
builds the Font from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writePoint

public Element writePoint(Element parent, Object o, String name) throws Exception
adds the given Point to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readPoint

public Object readPoint(Element node) throws Exception
builds the Point from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeColorUIResource

public Element writeColorUIResource(Element parent, Object o, String name) throws Exception
adds the given ColorUIResource to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readColorUIResource

public Object readColorUIResource(Element node) throws Exception
builds the ColorUIResource from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeFontUIResource

public Element writeFontUIResource(Element parent, Object o, String name) throws Exception
adds the given FontUIResource to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readFontUIResource

public Object readFontUIResource(Element node) throws Exception
builds the FontUIResource from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeBeanInstance

public Element writeBeanInstance(Element parent, Object o, String name) throws Exception
adds the given BeanInstance to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readBeanInstance

public Object readBeanInstance(Element node) throws Exception
builds the BeanInstance from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeBeanConnection

public Element writeBeanConnection(Element parent, Object o, String name) throws Exception
adds the given BeanConncetion to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readBeanConnection

public Object readBeanConnection(Element node) throws Exception
builds the BeanConnection from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeBeanLoader

public Element writeBeanLoader(Element parent, Object o, String name) throws Exception
adds the given Loader (a bean) to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### writeBeanSaver

public Element writeBeanSaver(Element parent, Object o, String name) throws Exception
adds the given Saver (a bean) to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### writeLoader

public Element writeLoader(Element parent, Object o, String name) throws Exception
adds the given Loader to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readLoader

public Object readLoader(Element node) throws Exception
builds the Loader from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeSaver

public Element writeSaver(Element parent, Object o, String name) throws Exception
adds the given Saver to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readSaver

public Object readSaver(Element node) throws Exception
builds the Saver from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeBeanVisual

public Element writeBeanVisual(Element parent, Object o, String name) throws Exception
adds the given BeanVisual to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readBeanVisual

public Object readBeanVisual(Element node) throws Exception
builds the BeanVisual from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails

### writeMetaBean

public Element writeMetaBean(Element parent, Object o, String name) throws Exception
adds the given MetaBean to a DOM structure.

Parameters:
  `parent` - the parent of this object, e.g. the class this object is a member of
  `o` - the Object to describe in XML
  `name` - the name of the object
Returns:
  the node that was created
Throws:
  `Exception` - if the DOM creation fails

### readMetaBean

public Object readMetaBean(Element node) throws Exception
builds the MetaBean from the given DOM node.

Parameters:
  `node` - the associated XML node
Returns:
  the instance created from the XML description
Throws:
  `Exception` - if instantiation fails