Configuring a Unique Attributes Recognizer
The ro.sync.ecss.extensions.api.UniqueAttributesRecognizer
interface can be implemented if you want to provide for your framework the following
features:
- Automatic ID generation - You can automatically generate unique IDs for newly inserted elements. Implementations
are already available for the DITA and DocBook frameworks. The following methods can
be
implemented to accomplish this:
assignUniqueIDs(int startOffset, int endOffset)
,isAutoIDGenerationActive()
- Avoiding copying unique attributes when "Split" is called inside an element - You
can split the current block element by pressing the "Enter" key and then choosing
"Split".
This is a very useful way to create new paragraphs, for example. All attributes are
by
default copied on the new element but if those attributes are IDs you sometimes want
to
avoid creating validation errors in the editor. Implementing the following method,
you can
decide whether or not an attribute should be copied during the split:
boolean copyAttributeOnSplit(String attrQName, AuthorElement element)
Tip
Thero.sync.ecss.extensions.commons.id.DefaultUniqueAttributesRecognizer
class is an implementation of the interface that can be extended by your customization to provide easy assignation of IDs in your framework. You can also check out the DITA and DocBook implementations ofro.sync.ecss.extensions.api.UniqueAttributesRecognizer
to see how they were implemented and connected to the extensions bundle.
Note
The complete source code for the examples can be found in the Simple
Documentation Framework project, included in the oxygen-sample-framework module of the
Oxygen SDK , available as a Maven archetype on the Oxygen XML Editor plugin website.