|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.montsuqi.monsia.AbstractDocumentHandler
abstract class AbstractDocumentHandler
Abstract base class for Glade1Handler and MonsiaHandler.
Thid document parser runs as a state transition machine. Subclass must instantiate ParserState instances for each element to make this work.
| Field Summary | |
|---|---|
protected java.util.List |
accels
|
protected java.lang.StringBuffer |
content
|
(package private) ParserState |
FINISH
A ParserState instance that represents that parsing is end. |
protected static Logger |
logger
|
protected ParserState |
prevState
|
protected java.util.Map |
properties
|
protected java.lang.String |
propertyName
|
protected PropertyType |
propertyType
|
protected java.util.List |
signals
|
protected ParserState |
startState
|
protected ParserState |
state
|
protected java.util.List |
topLevels
|
protected ParserState |
UNKNOWN
A ParserState instance that represents the "UNKNOWN" state. |
protected int |
unknownDepth
|
protected WidgetInfo |
widget
|
protected int |
widgetDepth
|
protected java.util.Map |
widgets
|
| Constructor Summary | |
|---|---|
AbstractDocumentHandler()
Constructs and initializes the instance. |
|
| Method Summary | |
|---|---|
void |
characters(char[] chars,
int start,
int length)
A SAX hander called on character chunks. |
protected void |
clearContent()
Empties the content buffer. |
protected void |
dialogHack(WidgetInfo info)
Replace className in a WidgetInfo to "Dialog" if it is a dialog. |
void |
endDocument()
SAX handler called at te end of a document. |
void |
endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
SAX handler called at the end of an element. |
void |
error(org.xml.sax.SAXParseException e)
|
void |
fatalError(org.xml.sax.SAXParseException e)
|
protected void |
flushAccels()
Assigns pending accel info to current WidgetInfo. |
protected void |
flushProperties()
Assigns pending properties to the appropriate variable depending on current value of propertyType. |
protected void |
flushSignals()
Assigns pending signal info to current WidgetInfo. |
protected Interface |
getInterface(Protocol protocol)
Builds the interface as the result of parsing. |
protected boolean |
isFinished()
Tests if the parsing has ended. |
protected int |
keyCode(java.lang.String keyName)
Converts symbolic key names to AWT key code. |
protected java.lang.String |
makePropertyName(java.lang.String name)
Returns a string all dashes in given name replaced to underscores. |
protected int |
parseButtonMask(java.lang.String mask)
Converts button mask to integer. |
protected int |
parseModifiers(java.lang.String modifierValue)
Converts a set of symbolic modifier names to an integer. |
protected abstract boolean |
shouldAppendCharactersToContent()
Tests if current characters should be appended to the content. |
void |
startDocument()
SAX handler called at the start of a document. |
void |
startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
SAX handler called at the start of an element. |
void |
warning(org.xml.sax.SAXParseException e)
|
protected void |
warnMissingAttribute(java.lang.String element)
Warning helper method that warns that some attributes are missing. |
protected void |
warnNotSupported(java.lang.String value)
Warning helper method that warns about an attribute alue which is not supported in Java. |
protected void |
warnNotZero(java.lang.String name,
int actual)
Warning helper method that warns about an attribute which should be zero but not. |
protected void |
warnUnexpectedElement(java.lang.String outer,
java.lang.String inner)
Warning helper method that warns unexpected element nesting is found. |
protected void |
warnUnknownAttribute(java.lang.String element,
java.lang.String attr)
Warning helper method that warns about an unknown attribute. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endPrefixMapping, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final Logger logger
protected final java.lang.StringBuffer content
protected final java.util.Map widgets
protected final java.util.List topLevels
protected final java.util.Map properties
protected final java.util.List signals
protected final java.util.List accels
protected ParserState state
protected ParserState prevState
protected ParserState startState
protected int unknownDepth
protected int widgetDepth
protected WidgetInfo widget
protected java.lang.String propertyName
protected PropertyType propertyType
protected final ParserState UNKNOWN
A ParserState instance that represents the "UNKNOWN" state.
Parser starts parsing at this state.
Parser transits to this state when it detects an unknown element.
final ParserState FINISH
A ParserState instance that represents that parsing is end.
| Constructor Detail |
|---|
public AbstractDocumentHandler()
Constructs and initializes the instance.
| Method Detail |
|---|
protected abstract boolean shouldAppendCharactersToContent()
Tests if current characters should be appended to the content.
protected boolean isFinished()
Tests if the parsing has ended.
protected void clearContent()
Empties the content buffer.
protected void warnNotZero(java.lang.String name,
int actual)
Warning helper method that warns about an attribute which should be zero but not.
name - an attribute that is expected to be zero.actual - the attribute's actual value.
protected void warnUnknownAttribute(java.lang.String element,
java.lang.String attr)
Warning helper method that warns about an unknown attribute.
element - the element interested.attr - an attribute detected but unknown.protected void warnMissingAttribute(java.lang.String element)
Warning helper method that warns that some attributes are missing.
element - the element interested.
protected void warnUnexpectedElement(java.lang.String outer,
java.lang.String inner)
Warning helper method that warns unexpected element nesting is found.
outer - the outer method who does not expect the inner method.inner - the inner method who is not expected to be a child of outer.protected void warnNotSupported(java.lang.String value)
Warning helper method that warns about an attribute alue which is not supported in Java.
value - the unsupported value name.protected Interface getInterface(Protocol protocol)
Builds the interface as the result of parsing.
protocol - the protocol used for event binding(connecting).
public void startDocument()
throws org.xml.sax.SAXException
SAX handler called at the start of a document.
Initializes parser state and variables.
startDocument in interface org.xml.sax.ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void endDocument()
throws org.xml.sax.SAXException
SAX handler called at te end of a document.
endDocument in interface org.xml.sax.ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void startElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes attrs)
throws org.xml.sax.SAXException
SAX handler called at the start of an element.This method delegates its work to current state's startElement.
startElement in interface org.xml.sax.ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void endElement(java.lang.String uri,
java.lang.String localName,
java.lang.String qName)
throws org.xml.sax.SAXException
SAX handler called at the end of an element.
This method delegates its work to current state's endElement.
endElement in interface org.xml.sax.ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
warning in interface org.xml.sax.ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
error in interface org.xml.sax.ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXExceptionprotected void flushProperties()
Assigns pending properties to the appropriate variable depending on current value of propertyType.
protected void dialogHack(WidgetInfo info)
Replace className in a WidgetInfo to "Dialog" if it is a dialog.
Since Gtk+ treats a Dialog as a kind of Window while Swing treats these two in different way, this hack is required.
info - the WidgetInfo interested.protected void flushSignals()
Assigns pending signal info to current WidgetInfo.
protected void flushAccels()
Assigns pending accel info to current WidgetInfo.
protected int keyCode(java.lang.String keyName)
Converts symbolic key names to AWT key code.
keyName - Key name
protected int parseModifiers(java.lang.String modifierValue)
Converts a set of symbolic modifier names to an integer.
modifierValue - symbolic modifier names. Multiple modifiers can be OR-ed with | operator.
protected int parseButtonMask(java.lang.String mask)
Converts button mask to integer.
mask - a button mask
protected java.lang.String makePropertyName(java.lang.String name)
Returns a string all dashes in given name replaced to underscores.
name - dash-separated-parameter-name.
public void characters(char[] chars,
int start,
int length)
throws org.xml.sax.SAXException
A SAX hander called on character chunks.
characters in interface org.xml.sax.ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerorg.xml.sax.SAXException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||