public final class ProfilingHook extends Object implements OpenedDocumentHook2, Traversal.Handler
Constructor and Description |
---|
ProfilingHook() |
Modifier and Type | Method and Description |
---|---|
boolean |
checkingDocument(OpenedDocument openedDoc)
Invoked before specified OpenedDocument is checked for validity.
|
boolean |
closingDocument(OpenedDocument openedDoc)
Invoked before specified OpenedDocument is being closed.
|
boolean |
creatingDocument(OpenedDocument openedDoc,
URL templateURL)
Invoked before a specified OpenedDocument is ``created''.
|
Diagnostic[] |
documentChecked(OpenedDocument openedDoc,
HookStatus status,
Diagnostic[] diagnostics)
Invoked after specified OpenedDocument has been checked for validity.
|
void |
documentClosed(OpenedDocument openedDoc,
HookStatus status)
Invoked after specified OpenedDocument has been closed.
|
void |
documentCreated(OpenedDocument openedDoc,
HookStatus status)
Invoked after specified OpenedDocument has been ``created''.
|
void |
documentDisposed(OpenedDocument openedDoc)
Invoked after specified OpenedDocument has been disposed.
|
void |
documentEvent(OpenedDocument openedDoc,
DocumentEvent event)
A DocumentEvent has been received by openedDoc which then
forwards it to this hook.
|
void |
documentOpened(OpenedDocument openedDoc,
HookStatus status)
Invoked after specified OpenedDocument has been ``opened''.
|
void |
documentSaved(OpenedDocument openedDoc,
HookStatus status)
Invoked after specified OpenedDocument has been saved.
|
void |
documentSavedAs(OpenedDocument openedDoc,
HookStatus status)
Invoked after specified OpenedDocument has been saved to a different
location.
|
Object |
enterElement(Element element)
Invoked to signal that an element is being entered.
|
Object |
leaveElement(Element element)
Invoked to signal that an element is being leaved.
|
boolean |
openingDocument(OpenedDocument openedDoc,
URL openURL,
boolean readOnly)
Invoked before a specified OpenedDocument is ``opened''.
|
Object |
processComment(Comment comment)
Invoked to signal the traversal of a Comment node.
|
Object |
processPI(ProcessingInstruction pi)
Invoked to signal the traversal of a ProcessingInstruction node.
|
Object |
processText(Text text)
Invoked to signal the traversal of a Text node.
|
boolean |
savingDocument(OpenedDocument openedDoc)
Invoked before specified OpenedDocument is being saved.
|
boolean |
savingDocumentAs(OpenedDocument openedDoc,
URL saveURL)
Invoked before specified OpenedDocument is being saved to a different
location.
|
public boolean creatingDocument(OpenedDocument openedDoc, URL templateURL)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentCreated(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus)
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
creatingDocument
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventtemplateURL
- URL of the document templatefalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.newFromTemplate(java.net.URL)
public void documentCreated(OpenedDocument openedDoc, HookStatus status)
OpenedDocumentHook
This method is invoked before an
UndoManager
is added to
the newly created Document
. Therefore it's
possible to modify the document in this method.
documentCreated
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationOpenedDocument.newFromTemplate(java.net.URL)
public boolean openingDocument(OpenedDocument openedDoc, URL openURL, boolean readOnly)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentOpened(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus)
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
openingDocument
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventopenURL
- URL of the document to be openedreadOnly
- if true
, the document is to be opened in
read-only modefalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.open(java.net.URL, boolean)
public void documentOpened(OpenedDocument openedDoc, HookStatus status)
OpenedDocumentHook
This method is invoked before an
UndoManager
is added to
the newly opened Document
. Therefore it's
possible to modify the document in this method.
documentOpened
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationOpenedDocument.open(java.net.URL, boolean)
public boolean checkingDocument(OpenedDocument openedDoc)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentChecked(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus, com.xmlmind.xml.validate.Diagnostic[])
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
checkingDocument
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventfalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.checkValidity(com.xmlmind.xmleditapp.validatehook.Reason, java.net.URL)
public Diagnostic[] documentChecked(OpenedDocument openedDoc, HookStatus status, Diagnostic[] diagnostics)
OpenedDocumentHook
This method can be used to implement semantic validation. Such
validation method must append semantic
warnings (Diagnostic.Severity#SEMANTIC_WARNING
)
and errors (Diagnostic.Severity#SEMANTIC_ERROR
) to the
list of validity warnings and errors passed as third argument.
documentChecked
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationdiagnostics
- (possibly empty) list of warnings and errors found
during validationOpenedDocument.checkValidity(com.xmlmind.xmleditapp.validatehook.Reason, java.net.URL)
public Object enterElement(Element element)
Traversal.Handler
enterElement
in interface Traversal.Handler
element
- Element being enteredTraversal.LEAVE_ELEMENT
to skip this element or a value
other than null
to stop the traversal or
null
to continue the traversalpublic Object processText(Text text)
Traversal.Handler
processText
in interface Traversal.Handler
text
- Text node being traversednull
to stop the traversal
or null
to continue the traversalpublic Object processPI(ProcessingInstruction pi)
Traversal.Handler
processPI
in interface Traversal.Handler
pi
- ProcessingInstruction node being traversednull
to stop the traversal
or null
to continue the traversalpublic Object processComment(Comment comment)
Traversal.Handler
processComment
in interface Traversal.Handler
comment
- Comment node being traversednull
to stop the traversal
or null
to continue the traversalpublic Object leaveElement(Element element)
Traversal.Handler
leaveElement
in interface Traversal.Handler
element
- Element being leavednull
to stop the traversal
or null
to continue the traversalpublic boolean savingDocument(OpenedDocument openedDoc)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentSaved(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus)
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
savingDocument
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventfalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.save()
public boolean savingDocumentAs(OpenedDocument openedDoc, URL saveURL)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentSavedAs(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus)
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
savingDocumentAs
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventsaveURL
- URL where the document is to be savedfalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.saveAs(java.net.URL)
public void documentSaved(OpenedDocument openedDoc, HookStatus status)
OpenedDocumentHook
documentSaved
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationOpenedDocument.save()
public void documentSavedAs(OpenedDocument openedDoc, HookStatus status)
OpenedDocumentHook
documentSavedAs
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationOpenedDocument.saveAs(java.net.URL)
public boolean closingDocument(OpenedDocument openedDoc)
OpenedDocumentHook
Receiving this notification guarantees that OpenedDocumentHook.documentClosed(com.xmlmind.xmleditapp.desktop.OpenedDocument, com.xmlmind.xmleditapp.desktop.HookStatus)
will also being invoked, even if the status passed to this method may
be different from HookStatus.SUCCESS
.
closingDocument
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventfalse
if this operation is vetoed by this hook;
true
otherwiseOpenedDocument.close()
public void documentClosed(OpenedDocument openedDoc, HookStatus status)
OpenedDocumentHook
documentClosed
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this eventstatus
- status of this operationOpenedDocument.close()
public void documentDisposed(OpenedDocument openedDoc)
OpenedDocumentHook
documentDisposed
in interface OpenedDocumentHook
openedDoc
- OpenedDocument which is the subject of this event.
The state of openedDoc has already been cleared.
For example, openedDoc.getDocument()
returns null
.
OpenedDocument.dispose()
public void documentEvent(OpenedDocument openedDoc, DocumentEvent event)
OpenedDocumentHook2
documentEvent
in interface OpenedDocumentHook2
openedDoc
- the OpenedDocument forwarding the DocumentEventevent
- contains the ``message'' sent by the invoker