ini.trakem2.persistence
Class TMLHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by ini.trakem2.persistence.TMLHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class TMLHandler
extends org.xml.sax.helpers.DefaultHandler

Creates the project objects from an XML file (TrakEM2 Markup Language Handler).


Constructor Summary
TMLHandler(java.lang.String path, FSLoader loader)
           
 
Method Summary
 void characters(char[] c, int start, int length)
           
 void endElement(java.lang.String namespace_URI, java.lang.String local_name, java.lang.String qualified_name)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
 java.lang.Object[] getProjectData(boolean open_displays)
          returns 4 objects packed in an array:
 boolean isUnreadable()
           
 void notationDeclaration(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 void skippedEntity(java.lang.String name)
           
 void startElement(java.lang.String namespace_URI, java.lang.String local_name, java.lang.String qualified_name, org.xml.sax.Attributes attributes)
           
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startPrefixMapping, unparsedEntityDecl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TMLHandler

public TMLHandler(java.lang.String path,
                  FSLoader loader)
Parameters:
path - The XML file that contains the project data in XML format.
loader - The FSLoader for the project. Expects the path with '/' as folder separator char.
Method Detail

isUnreadable

public boolean isUnreadable()

getProjectData

public java.lang.Object[] getProjectData(boolean open_displays)
returns 4 objects packed in an array:
         [0] = root TemplateThing
         [1] = root ProjectThing (contains Project instance)
         [2] = root LayerThing (contains the top-level LayerSet)
         [3] = expanded states of all ProjectThing objects
         

Also, triggers the reconstruction of links and assignment of Displayable objects to their layer.


startElement

public void startElement(java.lang.String namespace_URI,
                         java.lang.String local_name,
                         java.lang.String qualified_name,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespace_URI,
                       java.lang.String local_name,
                       java.lang.String qualified_name)
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(char[] c,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Overrides:
fatalError in class org.xml.sax.helpers.DefaultHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Overrides:
skippedEntity in class org.xml.sax.helpers.DefaultHandler

notationDeclaration

public void notationDeclaration(java.lang.String name,
                                java.lang.String publicId,
                                java.lang.String systemId)

warning

public void warning(org.xml.sax.SAXParseException e)
Specified by:
warning in interface org.xml.sax.ErrorHandler
Overrides:
warning in class org.xml.sax.helpers.DefaultHandler