RichFaces UI Components UI 4.2.2.Final

org.richfaces.json
Class JSContentHandler

java.lang.Object
  extended by org.richfaces.json.JSContentHandler
All Implemented Interfaces:
ContentHandler, LexicalHandler

public class JSContentHandler
extends Object
implements ContentHandler, LexicalHandler

Author:
shura SAX content handler for serialise events as JavaScript function.

Field Summary
static String DEFAULT_ENCODING
           
protected  char[] indentBuffer
           
protected  int level
           
protected  Writer outputWriter
           
 
Constructor Summary
JSContentHandler()
           
JSContentHandler(Writer outputWriter)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void close()
           
protected  boolean closeElement(boolean endElement)
          Write the end part of a start element (if necessary).
 void comment(char[] ch, int start, int length)
           
protected  void encode(char[] data)
          Encode and write an array of characters.
protected  void encode(char[] data, int start, int length)
          Encode and write a specific part of an array of characters.
protected  void encode(String data)
          Encode and write a String
protected  void encodeAttributeValue(Attributes attributes, int idx)
           
protected  void encodeText(char[] chars, int start, int length)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(String uri, String localName, String qName)
           
 void endEntity(String name)
           
 void endPrefixMapping(String prefix)
           
 int getColumnNumber()
          Return the column number where the current document event ends.
 int getLineNumber()
          Return the line number where the current document event ends.
protected  String getLocation()
          Return a String describing the current location.
 String getPublicId()
          Return the public identifier for the current document event.
 String getSystemId()
          Return the system identifier for the current document event.
 void ignorableWhitespace(char[] ch, int start, int length)
           
protected  boolean isBeforeDocumentStart()
           
protected  boolean isProcessingCdata()
           
 void processingInstruction(String target, String data)
           
 void setDocumentLocator(Locator locator)
          Receive an object for locating the origin of SAX document events.
 void skippedEntity(String name)
           
 void startCDATA()
           
 void startDocument()
           
 void startDTD(String name, String publicId, String systemId)
           
 void startElement(String uri, String localName, String qName, Attributes attributes)
           
 void startEntity(String name)
           
 void startPrefixMapping(String prefix, String uri)
           
protected  void writeIndent(int indent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final String DEFAULT_ENCODING
See Also:
Constant Field Values

indentBuffer

protected char[] indentBuffer

level

protected int level

outputWriter

protected Writer outputWriter
Constructor Detail

JSContentHandler

public JSContentHandler()

JSContentHandler

public JSContentHandler(Writer outputWriter)
Parameters:
outputWriter -
Method Detail

close

public void close()
           throws IOException
Throws:
IOException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

closeElement

protected boolean closeElement(boolean endElement)
                        throws SAXException
Write the end part of a start element (if necessary).

Parameters:
endElement - Whether this method was called because an element is being closed or not.
Returns:
true if this call successfully closed the element (and no further </element> is required.
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

setDocumentLocator

public final void setDocumentLocator(Locator locator)
Receive an object for locating the origin of SAX document events.

Specified by:
setDocumentLocator in interface ContentHandler

getPublicId

public String getPublicId()
Return the public identifier for the current document event.

Returns:
A String containing the public identifier, or null if none is available.

getSystemId

public String getSystemId()
Return the system identifier for the current document event.

Returns:
A String containing the system identifier, or null if none is available.

getLineNumber

public int getLineNumber()
Return the line number where the current document event ends.

Returns:
The line number, or -1 if none is available.

getColumnNumber

public int getColumnNumber()
Return the column number where the current document event ends.

Returns:
The column number, or -1 if none is available.

getLocation

protected String getLocation()
Return a String describing the current location.


skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes attributes)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

encodeAttributeValue

protected void encodeAttributeValue(Attributes attributes,
                                    int idx)
                             throws SAXException,
                                    IOException
Throws:
SAXException
IOException

encodeText

protected void encodeText(char[] chars,
                          int start,
                          int length)
                   throws SAXException,
                          IOException
Throws:
SAXException
IOException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Specified by:
comment in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Specified by:
startDTD in interface LexicalHandler
Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

writeIndent

protected void writeIndent(int indent)
                    throws SAXException
Throws:
SAXException

encode

protected void encode(String data)
               throws SAXException
Encode and write a String

Throws:
SAXException

encode

protected void encode(char[] data)
               throws SAXException
Encode and write an array of characters.

Throws:
SAXException

encode

protected void encode(char[] data,
                      int start,
                      int length)
               throws SAXException
Encode and write a specific part of an array of characters.

Throws:
SAXException

isProcessingCdata

protected boolean isProcessingCdata()

isBeforeDocumentStart

protected boolean isBeforeDocumentStart()

RichFaces UI Components UI 4.2.2.Final

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.