Class XMLBeans

  • All Implemented Interfaces:
    RevisionHandler

    public class XMLBeans
    extends XMLBasicSerialization
    This class serializes and deserializes a KnowledgeFlow setup to and fro XML.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • XMLBeans

        public XMLBeans​(JComponent layout,
                        BeanContextSupport context,
                        int tab)
                 throws Exception
        initializes the serialization for layouts
        Parameters:
        layout - the component that manages the layout
        context - the bean context support to use
        tab - the index of the vector of bean instances or connections to use (this corresponds to a visible tab in the main KnowledgeFlow UI)
        Throws:
        Exception - if initialization fails
      • XMLBeans

        public XMLBeans​(JComponent layout,
                        BeanContextSupport context,
                        int datatype,
                        int tab)
                 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 Detail

      • 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.
        Overrides:
        writeColor in class XMLBasicSerialization
        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
        See Also:
        Color
      • 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