listener to any change in content

Having trouble installing Oxygen? Got a bug to report? Post it all here.
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

listener to any change in content

Post 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)?
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: listener to any change in content

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
maxim.kovalev
Posts: 35
Joined: Fri Nov 11, 2011 10:34 am

Re: listener to any change in content

Post by maxim.kovalev »

Thanks
Post Reply