Page 1 of 1

listener to any change in content

Posted: Wed Jan 11, 2012 10:04 am
by maxim.kovalev
Is there a listener for any changes in the content of the document except:

Code: Select all

authorAccess.getDocumentController().addAuthorListener(new AuthorListener() {
@Override
public void documentChanged (AuthorDocument arg0, AuthorDocument arg1) {
}
@Override
public void doctypeChanged () {
}
@Override
public void contentInserted (DocumentContentInsertedEvent arg0) {
}
@Override
public void contentDeleted (DocumentContentDeletedEvent arg0) {
}
@Override
public void beforeDoctypeChange () {
}
@Override
public void beforeContentInsert (DocumentContentInsertedEvent arg0) {
}
@Override
public void beforeContentDelete (DocumentContentDeletedEvent arg0) {
}
@Override
public void beforeAuthorNodeStructureChange (AuthorNode arg0) {
}
@Override
public void beforeAuthorNodeNameChange (AuthorNode arg0) {
}
@Override
public void beforeAttributeChange (AttributeChangedEvent arg0) {
}
@Override
public void authorNodeStructureChanged (AuthorNode arg0) {
}
@Override
public void authorNodeNameChanged (AuthorNode arg0) {
}
@Override
public void attributeChanged (AttributeChangedEvent arg0) {
}
});
This listener, I must call my desired method in each of the methods of the listener. For example, in attributeChanged,authorNodeNameChanged, contentInserted, contentDeleted.
A listener which operates by any change in content (xml)?

Re: listener to any change in content

Posted: Wed Jan 11, 2012 12:12 pm
by Radu
Hi Maxim,

I do not quite understand your use case and why the listener that you mentioned is not suitable for you.
Another option would be to add an ro.sync.ecss.extensions.api.AuthorDocumentFilter using the method:

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController.setDocumentFilter(AuthorDocumentFilter)
Such a filter receives callbacks from the Author code before any operation is performed and it can decide to do something different instead of performing the default action.

Another approach is in the ExtensionsBundle to create an implementation of:

Code: Select all

ro.sync.ecss.extensions.api.ExtensionsBundle.getAuthorSchemaAwareEditingHandler()
You can see the ro.sync.ecss.extensions.dita.DITAExtensionsBundle Java code to see how such an implementation works.

Regards,
Radu

Re: listener to any change in content

Posted: Wed Jan 11, 2012 12:33 pm
by maxim.kovalev
Thanks