Oxygen XML Editor 14.2 Author API

ro.sync.ecss.extensions.commons.id
Class DefaultUniqueAttributesRecognizer

java.lang.Object
  extended by ro.sync.ecss.extensions.commons.id.DefaultUniqueAttributesRecognizer
All Implemented Interfaces:
AuthorExtensionStateListener, ClipboardFragmentProcessor, Extension, UniqueAttributesProcessor, UniqueAttributesRecognizer
Direct Known Subclasses:
DITAUniqueAttributesRecognizer, Docbook4UniqueAttributesRecognizer, Docbook5UniqueAttributesRecognizer, TEIP4UniqueAttributesRecognizer, TEIP5UniqueAttributesRecognizer, XHTMLUniqueAttributesRecognizer

@API(type=INTERNAL,
     src=PUBLIC)
public abstract class DefaultUniqueAttributesRecognizer
extends java.lang.Object
implements UniqueAttributesRecognizer, ClipboardFragmentProcessor

Default unique attributes recognizer


Field Summary
protected  AuthorAccess authorAccess
          The author access
protected  java.lang.String idAttrQname
          The ID attribute qname
 
Constructor Summary
DefaultUniqueAttributesRecognizer(java.lang.String idAttrQname)
          Constructor.
 
Method Summary
 void activated(AuthorAccess authorAccess)
          Method called when the Author extension was activated.
 void assignUniqueIDs(int startOffset, int endOffset, boolean forceGeneration)
          Assigns unique IDs between a start and an end offset in the document.
 boolean copyAttributeOnSplit(java.lang.String attrQName, AuthorElement element)
          Checks if the attribute specified by QName can be considered as a valid attribute to copy when the element is split.
 void deactivated(AuthorAccess authorAccess)
          Method called when the Author extension was deactivated.
protected  java.lang.String generateUniqueIDFor(java.lang.String idGenerationPattern, AuthorElement element)
          Generate an unique ID for an element
protected abstract  GenerateIDElementsInfo getDefaultOptions()
           
protected  java.lang.String getGenerateIDAttributeQName(AuthorElement element, java.lang.String[] elemsWithAutoGeneration, boolean forceGeneration)
           
 GenerateIDElementsInfo getGenerateIDElementsInfo()
           
 boolean isAutoIDGenerationActive()
           
 void process(ClipboardFragmentInformation fragmentInformation)
          Process a fragment in the clipboard before inserting it in the document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ro.sync.ecss.extensions.api.Extension
getDescription
 

Field Detail

idAttrQname

protected final java.lang.String idAttrQname
The ID attribute qname


authorAccess

protected AuthorAccess authorAccess
The author access

Constructor Detail

DefaultUniqueAttributesRecognizer

public DefaultUniqueAttributesRecognizer(java.lang.String idAttrQname)
Constructor.

Parameters:
idAttrQname - The ID attribute qname
Method Detail

copyAttributeOnSplit

public boolean copyAttributeOnSplit(java.lang.String attrQName,
                                    AuthorElement element)
Description copied from interface: UniqueAttributesProcessor
Checks if the attribute specified by QName can be considered as a valid attribute to copy when the element is split.

Specified by:
copyAttributeOnSplit in interface UniqueAttributesProcessor
Parameters:
attrQName - The attribute qualified name.
element - The element.
Returns:
true if the attribute should be copied when Split is performed.
See Also:
UniqueAttributesProcessor.copyAttributeOnSplit(java.lang.String, ro.sync.ecss.extensions.api.node.AuthorElement)

activated

public void activated(AuthorAccess authorAccess)
Description copied from interface: AuthorExtensionStateListener
Method called when the Author extension was activated. This event is triggered when the Author extension where this listener is defined was activated in relation with a document opened in Author page. Listeners like AuthorMouseListener or AuthorListener can be added at this point.

Specified by:
activated in interface AuthorExtensionStateListener
Parameters:
authorAccess - The AuthorAccess of the Author page where the listener was activated.
See Also:
AuthorExtensionStateListener.activated(ro.sync.ecss.extensions.api.AuthorAccess)

deactivated

public void deactivated(AuthorAccess authorAccess)
Description copied from interface: AuthorExtensionStateListener
Method called when the Author extension was deactivated. This event is triggered when another Author extension corresponding to the the current document opened in Author page was activated, the user switches to another editor page or the editor is closed.

Specified by:
deactivated in interface AuthorExtensionStateListener
Parameters:
authorAccess - The AuthorAccess of the Author page where the listener was deactivated.
See Also:
AuthorExtensionStateListener.deactivated(ro.sync.ecss.extensions.api.AuthorAccess)

getDefaultOptions

protected abstract GenerateIDElementsInfo getDefaultOptions()
Returns:
The default generation options

isAutoIDGenerationActive

public boolean isAutoIDGenerationActive()
Specified by:
isAutoIDGenerationActive in interface UniqueAttributesRecognizer
Returns:
true if auto generation is active and we have elements for which to generate.

getGenerateIDAttributeQName

protected java.lang.String getGenerateIDAttributeQName(AuthorElement element,
                                                       java.lang.String[] elemsWithAutoGeneration,
                                                       boolean forceGeneration)
Parameters:
element - The current element.
elemsWithAutoGeneration - The array of elements for which generation is activated
forceGeneration - Force ID generation if there is no selection.
Returns:
The name of the attribute for which to generate the ID or null (default behavior).

generateUniqueIDFor

protected java.lang.String generateUniqueIDFor(java.lang.String idGenerationPattern,
                                               AuthorElement element)
Generate an unique ID for an element

Parameters:
idGenerationPattern - The pattern for id generation.
element - The element
Returns:
The unique ID

assignUniqueIDs

public void assignUniqueIDs(int startOffset,
                            int endOffset,
                            boolean forceGeneration)
Description copied from interface: UniqueAttributesProcessor
Assigns unique IDs between a start and an end offset in the document.

Specified by:
assignUniqueIDs in interface UniqueAttributesProcessor
Parameters:
startOffset - Start offset.
endOffset - End offset.
forceGeneration - true to generate ID even if the ID generation pattern list does not match.
See Also:
UniqueAttributesProcessor.assignUniqueIDs(int, int, boolean)

getGenerateIDElementsInfo

public GenerateIDElementsInfo getGenerateIDElementsInfo()
Returns:
Returns the autoGenerateElementsInfo.

process

public void process(ClipboardFragmentInformation fragmentInformation)
Description copied from interface: ClipboardFragmentProcessor
Process a fragment in the clipboard before inserting it in the document.

Specified by:
process in interface ClipboardFragmentProcessor
Parameters:
fragmentInformation - Information about a fragment in the clipboard.
See Also:
ClipboardFragmentProcessor.process(ro.sync.ecss.extensions.api.content.ClipboardFragmentInformation)

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.