|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.html.HTMLEditorKit.ParserCallback | +--gate.html.HtmlDocumentHandler
Implements the behaviour of the HTML reader. Methods of an object of this class are called by the HTML parser when events will appear. The idea is to parse the HTML document and construct Gate annotations objects. This class also will replace the content of the Gate document with a new one containing anly text from the HTML document.
Nested Class Summary | |
(package private) class |
HtmlDocumentHandler.CustomObject
The objects belonging to this class are used inside the stack. |
Field Summary | |
private RepositioningInfo |
ampCodingInfo
Keep the refference to this structure |
private AnnotationSet |
basicAS
|
private LinkedList |
colector
|
protected long |
customObjectsId
|
private static boolean |
DEBUG
Debug flag |
private Document |
doc
|
private int |
elements
|
(package private) static int |
ELEMENTS_RATE
This method verifies if data contained by the CustomObject can be used to create a GATE annotation. |
private boolean |
isInsideStyleTag
The text inside the STYLE tag is processed with handleText() . |
private Map |
markupElementsMap
|
protected List |
myStatusListeners
|
private RepositioningInfo |
reposInfo
Keep the refference to this structure |
private Stack |
stack
|
private StringBuffer |
tmpDocContent
|
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
IMPLIED |
Constructor Summary | |
HtmlDocumentHandler(Document aDocument,
Map aMarkupElementsMap)
Constructor initialises all the private memeber data. |
|
HtmlDocumentHandler(Document aDocument,
Map aMarkupElementsMap,
AnnotationSet anAnnotationSet)
Constructor initialises all the private memeber data |
Method Summary | |
void |
addRepositioningInfo(String content,
int pos,
int extractedPos)
For given content the list with shrink position information is searched and on the corresponding positions the correct repositioning information is calculated and generated. |
void |
addStatusListener(StatusListener listener)
|
protected void |
customizeAppearanceOfDocumentWithEndTag(HTML.Tag t)
This method analizes the tag t and adds some \n chars and spaces to the tmpDocContent.The reason behind is that we need to have a readable form for the final document. |
protected void |
customizeAppearanceOfDocumentWithSimpleTag(HTML.Tag t)
This method analizes the tag t and adds some \n chars and spaces to the tmpDocContent.The reason behind is that we need to have a readable form for the final document. |
protected void |
customizeAppearanceOfDocumentWithStartTag(HTML.Tag t)
This method analizes the tag t and adds some \n chars and spaces to the tmpDocContent.The reason behind is that we need to have a readable form for the final document. |
protected void |
fireStatusChangedEvent(String text)
|
void |
flush()
This method is called once, when the HTML parser reaches the end of its input streamin order to notify the parserCallback that there is nothing more to parse. |
RepositioningInfo |
getAmpCodingInfo()
Return current RepositioningInfo object for ampersand coding. |
RepositioningInfo |
getRepositioningInfo()
Return current RepositioningInfo object |
void |
handleComment(char[] text,
int pos)
This method is called when the HTML parser encounts a comment |
void |
handleEndTag(HTML.Tag t,
int pos)
This method is called when the HTML parser encounts the end of a tag that means that the tag is paired by a beginning tag |
void |
handleError(String errorMsg,
int pos)
This method is called when the HTML parser encounts an error it depends on the programmer if he wants to deal with that error |
void |
handleSimpleTag(HTML.Tag t,
MutableAttributeSet a,
int pos)
This method is called when the HTML parser encounts an empty tag |
void |
handleStartTag(HTML.Tag t,
MutableAttributeSet a,
int pos)
This method is called when the HTML parser encounts the beginning of a tag that means that the tag is paired by an end tag and it's not an empty one. |
void |
handleText(char[] text,
int pos)
This method is called when the HTML parser encounts text (PCDATA) |
void |
removeStatusListener(StatusListener listener)
|
void |
setAmpCodingInfo(RepositioningInfo info)
Set repositioning information structure refference for ampersand coding. |
void |
setRepositioningInfo(RepositioningInfo info)
Set repositioning information structure refference. |
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
handleEndOfLineString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final boolean DEBUG
private RepositioningInfo reposInfo
private RepositioningInfo ampCodingInfo
private boolean isInsideStyleTag
handleText()
.
We should skip inserting of this text in the document.
static final int ELEMENTS_RATE
private Map markupElementsMap
private StringBuffer tmpDocContent
private Stack stack
private Document doc
private AnnotationSet basicAS
protected List myStatusListeners
private int elements
protected long customObjectsId
private LinkedList colector
Constructor Detail |
public HtmlDocumentHandler(Document aDocument, Map aMarkupElementsMap)
aDocument
- The gate document that will be processedaMarkupElementsMap
- The map containing the elements that will
transform into annotationspublic HtmlDocumentHandler(Document aDocument, Map aMarkupElementsMap, AnnotationSet anAnnotationSet)
aDocument
- The gate document that will be processedaMarkupElementsMap
- The map containing the elements that will
transform into annotationsMethod Detail |
public void setRepositioningInfo(RepositioningInfo info)
public RepositioningInfo getRepositioningInfo()
public void setAmpCodingInfo(RepositioningInfo info)
public RepositioningInfo getAmpCodingInfo()
public void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
handleStartTag
in class HTMLEditorKit.ParserCallback
public void handleEndTag(HTML.Tag t, int pos)
handleEndTag
in class HTMLEditorKit.ParserCallback
public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos)
handleSimpleTag
in class HTMLEditorKit.ParserCallback
public void handleText(char[] text, int pos)
handleText
in class HTMLEditorKit.ParserCallback
public void addRepositioningInfo(String content, int pos, int extractedPos)
protected void customizeAppearanceOfDocumentWithSimpleTag(HTML.Tag t)
t
- the Html tag encounted by the HTML parserprotected void customizeAppearanceOfDocumentWithStartTag(HTML.Tag t)
t
- the Html tag encounted by the HTML parserprotected void customizeAppearanceOfDocumentWithEndTag(HTML.Tag t)
t
- the Html tag encounted by the HTML parserpublic void handleError(String errorMsg, int pos)
handleError
in class HTMLEditorKit.ParserCallback
public void flush() throws BadLocationException
flush
in class HTMLEditorKit.ParserCallback
BadLocationException
public void handleComment(char[] text, int pos)
handleComment
in class HTMLEditorKit.ParserCallback
public void addStatusListener(StatusListener listener)
public void removeStatusListener(StatusListener listener)
protected void fireStatusChangedEvent(String text)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |