public class XMLBeans extends XMLBasicSerialization
Modifier and Type | Field and Description |
---|---|
static int |
DATATYPE_LAYOUT
the data that is about to be read/written contains a complete layout
|
static int |
DATATYPE_USERCOMPONENTS
the data that is about to be read/written contains user-components, i.e.,
Metabeans
|
static 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 int |
INDEX_BEANINSTANCES
the index in the Vector, where the BeanInstances are stored
(Instances and Connections are stored in a Vector and then serialized)
|
protected Hashtable |
m_BeanConnectionRelation
the relation between Bean and connection, MetaBean BeanConnections
are stored under the reference of the MetaBean, regular connections
are stored under REGULAR_CONNECTION.
|
protected BeanContextSupport |
m_BeanContextSupport
the beancontext to use for loading from XML and the beancontext is
null in the bean
|
protected Vector |
m_BeanInstances
keeps track of the BeanInstances read so far, used for the BeanConnections
|
protected Vector |
m_BeanInstancesID
keeps track of the BeanInstances read so far, used for the BeanConnections
|
protected JComponent |
m_BeanLayout
the component that manages the layout of the beans
|
protected MetaBean |
m_CurrentMetaBean
the current MetaBean (for the BeanConnections)
|
protected int |
m_DataType
the type of data that is be read/written
|
protected boolean |
m_IgnoreBeanConnections
whether to ignore the BeanConnection
|
protected static String |
REGULAR_CONNECTION
the identifier for regular BeanConnections
|
static String |
VAL_ANIMATEDICONPATH
the value of the animatedIconPath property
|
static String |
VAL_ASSOCIATEDCONNECTIONS
the value of the associatedConnections property
|
static String |
VAL_BEAN
the value of the bean property
|
static String |
VAL_BEANCONTEXT
the value of the beanContext property
|
static String |
VAL_BLUE
the value of the blue property
|
static String |
VAL_COLOR
the value of the color property
|
static String |
VAL_CUSTOM_NAME
the value of the customName property
|
static String |
VAL_DIR
the value of the dir property
|
static String |
VAL_EVENTNAME
the value of the eventname property
|
static String |
VAL_FILE
the value of the file property
|
static String |
VAL_FONT
the value of the font property
|
static String |
VAL_GREEN
the value of the green property
|
static String |
VAL_HEIGHT
the value of the height property
|
static String |
VAL_HIDDEN
the value of the hidden property
|
static String |
VAL_ICONPATH
the value of the iconpath property
|
static String |
VAL_ID
the value of the id property
|
static String |
VAL_INPUTS
the value of the input property
|
static String |
VAL_INPUTSID
the value of the input id property
|
static String |
VAL_LOADER
the value of the loader property
|
static String |
VAL_LOCATION
the value of the location property
|
static String |
VAL_NAME
the value of the value property
|
static String |
VAL_OPTIONS
the value of the options property
|
static String |
VAL_ORIGINALCOORDS
the value of the originalCoords property
|
static String |
VAL_OUTPUTS
the value of the outputs id property
|
static String |
VAL_OUTPUTSID
the value of the outputs property
|
static String |
VAL_PREFIX
the value of the prefix property
|
static String |
VAL_RED
the value of the red property
|
static String |
VAL_RELATIONNAMEFORFILENAME
the value of the relationNameForFilename property (Saver)
|
static String |
VAL_RELATIVE_PATH |
static String |
VAL_SAVER
the value of the saver property
|
static String |
VAL_SIZE
the value of the size property
|
static String |
VAL_SOURCEID
the value of the source property
|
static String |
VAL_STYLE
the value of the style property
|
static String |
VAL_SUBFLOW
the value of the subFlow property
|
static String |
VAL_TARGETID
the value of the target property
|
static String |
VAL_TEXT
the value of the text property
|
static String |
VAL_WIDTH
the value of the width property
|
static String |
VAL_X
the value of the x property
|
static String |
VAL_Y
the value of the y property
|
VAL_CELLS, VAL_KEY, VAL_MAPPING, VAL_VALUE
ATT_ARRAY, ATT_ARRAY_DEFAULT, ATT_CLASS, ATT_NAME, ATT_NULL, ATT_NULL_DEFAULT, ATT_PRIMITIVE, ATT_PRIMITIVE_DEFAULT, ATT_VERSION, DEBUG, DOCTYPE, m_ClassnameOverride, m_CurrentNode, m_CustomMethods, m_Document, m_Properties, ROOT_NODE, TAG_OBJECT, VAL_NO, VAL_ROOT, VAL_YES
Constructor and 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
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBeanConnectionRelation(MetaBean meta,
String connection)
adds the given connection-relation for the specified MetaBean (or null in
case of regular connections)
|
protected void |
addBeanInstances(Vector list)
traverses over all BeanInstances (or MetaBeans) and stores them in a vector
(recurses into MetaBeans, since the sub-BeanInstances are not visible)
|
void |
clear()
generates internally a new XML document and clears also the IgnoreList and
the mappings for the Read/Write-Methods
|
protected BeanConnection |
createBeanConnection(int sourcePos,
int targetPos,
String event,
boolean hidden)
generates a connection based on the given parameters
|
protected Vector |
getBeanConnectionRelation(MetaBean meta)
returns the relation for the given MetaBean, for the regular connections,
null has to be used
|
protected Vector |
getBeanInstancesForIDs(Vector ids)
returns a vector with references to BeanInstances according to the IDs
in the given Vector.
|
int |
getDataType()
returns the type of data that is to be read/written
|
protected Vector |
getIDsForBeanInstances(Vector beans)
returns the IDs for the given BeanInstances, i.e., the stored IDs
in m_BeanInstancesID, based on m_BeanInstances
|
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.
|
protected Object |
readPostProcess(Object o)
additional post-processing can happen in derived classes after reading
from XML.
|
protected Document |
readPreProcess(Document document)
additional pre-processing can happen in derived classes before the
actual reading from XML (working on the raw XML).
|
Object |
readSaver(Element node)
builds the Saver from the given DOM node.
|
protected void |
rebuildBeanConnections(Vector deserialized,
Object key)
rebuilds all the connections for a certain key in the hashtable.
|
protected void |
removeUserToolBarBeans(Vector metabeans)
removes the given meta beans from the layout, since they're only listed
in the user toolbar
|
protected void |
setBeanConnection(BeanConnection conn,
Vector list)
puts the given BeanConnection onto the next null in the given Vector,
or at the end of the list, if no null is found.
|
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.
|
protected void |
writePostProcess(Object o)
enables derived classes to add other properties to the DOM tree, e.g.
|
protected Object |
writePreProcess(Object o)
enables derived classes to due some pre-processing on the objects, that's
about to be serialized.
|
Element |
writeSaver(Element parent,
Object o,
String name)
adds the given Saver to a DOM structure.
|
getRevision, readCollection, readCostMatrixOld, readDefaultListModel, readMap, readMatrix, readMatrixOld, writeCollection, writeCostMatrixOld, writeDefaultListModel, writeMap, writeMatrix, writeMatrixOld
addElement, addElement, addElement, booleanToString, determineClass, determineDescriptor, fromXML, getArrayDimensions, getDescriptorByName, getDescriptors, getPath, getPrimitive, getVersion, invokeReadFromXML, invokeWriteToXML, isPrimitiveArray, main, overrideClassname, overrideClassname, read, read, read, read, readBooleanFromXML, readByteFromXML, readCharFromXML, readDoubleFromXML, readFloatFromXML, readFromXML, readFromXML, readIntFromXML, readLongFromXML, readShortFromXML, stringToBoolean, toXML, trace, write, write, write, write, writeBooleanToXML, writeByteToXML, writeCharToXML, writeDoubleToXML, writeFloatToXML, writeIntToXML, writeLongToXML, writeShortToXML, writeToXML
public static final String VAL_ID
public static final String VAL_X
public static final String VAL_Y
public static final String VAL_BEAN
public static final String VAL_CUSTOM_NAME
public static final String VAL_SOURCEID
public static final String VAL_TARGETID
public static final String VAL_EVENTNAME
public static final String VAL_HIDDEN
public static final String VAL_FILE
public static final String VAL_DIR
public static final String VAL_PREFIX
public static final String VAL_RELATIVE_PATH
public static final String VAL_OPTIONS
public static final String VAL_SAVER
public static final String VAL_LOADER
public static final String VAL_TEXT
public static final String VAL_BEANCONTEXT
public static final String VAL_WIDTH
public static final String VAL_HEIGHT
public static final String VAL_RED
public static final String VAL_GREEN
public static final String VAL_BLUE
public static final String VAL_NAME
public static final String VAL_STYLE
public static final String VAL_LOCATION
public static final String VAL_SIZE
public static final String VAL_COLOR
public static final String VAL_FONT
public static final String VAL_ICONPATH
public static final String VAL_ANIMATEDICONPATH
public static final String VAL_ASSOCIATEDCONNECTIONS
public static final String VAL_INPUTS
public static final String VAL_INPUTSID
public static final String VAL_OUTPUTS
public static final String VAL_OUTPUTSID
public static final String VAL_SUBFLOW
public static final String VAL_ORIGINALCOORDS
public static final String VAL_RELATIONNAMEFORFILENAME
public static final int INDEX_BEANINSTANCES
public static final int INDEX_BEANCONNECTIONS
protected JComponent m_BeanLayout
protected Vector m_BeanInstances
protected Vector m_BeanInstancesID
protected boolean m_IgnoreBeanConnections
protected MetaBean m_CurrentMetaBean
protected static final String REGULAR_CONNECTION
protected Hashtable m_BeanConnectionRelation
REGULAR_CONNECTION
public static final int DATATYPE_LAYOUT
m_DataType
,
Constant Field Valuespublic static final int DATATYPE_USERCOMPONENTS
m_DataType
,
Constant Field Valuesprotected int m_DataType
DATATYPE_LAYOUT
,
DATATYPE_USERCOMPONENTS
protected BeanContextSupport m_BeanContextSupport
public XMLBeans(JComponent layout, BeanContextSupport context) throws Exception
layout
- the component that manages the layoutcontext
- the bean context support to useException
- if initialization failspublic XMLBeans(JComponent layout, BeanContextSupport context, int datatype) throws Exception
layout
- the component that manages the layoutcontext
- the bean context support to usedatatype
- the type of data to read/writeException
- if initialization failspublic void setDataType(int value)
value
- the type of datam_DataType
public int getDataType()
m_DataType
public void clear() throws Exception
clear
in class XMLBasicSerialization
Exception
- if something goes wrongprotected void addBeanInstances(Vector list)
list
- the BeanInstances/MetaBeans to traverseprotected Object writePreProcess(Object o) throws Exception
writePreProcess
in class XMLSerialization
o
- the object that is serialized into XMLException
- if post-processing failsprotected void writePostProcess(Object o) throws Exception
writePostProcess
in class XMLSerialization
o
- the object that is serialized into XMLException
- if post-processing failsprotected Document readPreProcess(Document document) throws Exception
readPreProcess
in class XMLSerialization
document
- the document to pre-processException
- if post-processing failsm_BeanInstances
protected void setBeanConnection(BeanConnection conn, Vector list)
conn
- the connection to add to the listlist
- the list to add the BeanConnection toprotected BeanConnection createBeanConnection(int sourcePos, int targetPos, String event, boolean hidden) throws Exception
sourcePos
- the source position in the m_BeanInstances vectortargetPos
- the target position in the m_BeanInstances vectorevent
- the name of the event, i.e., the connectionhidden
- true if the connection is hiddenException
- if something goes wrongprotected void rebuildBeanConnections(Vector deserialized, Object key) throws Exception
deserialized
- the deserialized knowledgeflowkey
- the key of the hashtable to rebuild all connections forException
- if something goes wrongprotected void removeUserToolBarBeans(Vector metabeans)
metabeans
- the list of MetaBeans in the user toolbarprotected Object readPostProcess(Object o) throws Exception
readPostProcess
in class XMLSerialization
o
- the object to perform some additional processing onException
- if post-processing failsprotected Vector getBeanConnectionRelation(MetaBean meta)
meta
- the MetaBean (or null for regular connections) to retrieve
the connections forREGULAR_CONNECTION
protected void addBeanConnectionRelation(MetaBean meta, String connection)
meta
- the MetaBean (or null for regular connections) to add
the relationship forconnection
- the connection relation to addpublic Element writeColor(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readColor(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeDimension(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readDimension(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeFont(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readFont(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writePoint(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readPoint(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeColorUIResource(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readColorUIResource(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeFontUIResource(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readFontUIResource(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeBeanInstance(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readBeanInstance(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeBeanConnection(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readBeanConnection(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeBeanLoader(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Element writeBeanSaver(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Element writeLoader(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readLoader(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeSaver(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readSaver(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failspublic Element writeBeanVisual(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failspublic Object readBeanVisual(Element node) throws Exception
node
- the associated XML nodeException
- if instantiation failsprotected Vector getIDsForBeanInstances(Vector beans)
beans
- the beans to retrieve the IDs form_BeanInstances
,
m_BeanInstancesID
public Element writeMetaBean(Element parent, Object o, String name) throws Exception
parent
- the parent of this object, e.g. the class this object is a member ofo
- the Object to describe in XMLname
- the name of the objectException
- if the DOM creation failsprotected Vector getBeanInstancesForIDs(Vector ids)
ids
- contains the IDs of the BeanInstancesm_BeanInstances
,
m_BeanInstancesID
Copyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.