Oxygen XML Editor 11.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, Extension, UniqueAttributesRecognizer
Direct Known Subclasses:
DITAUniqueAttributesRecognizer, Docbook4UniqueAttributesRecognizer, Docbook5UniqueAttributesRecognizer, TEIP4UniqueAttributesRecognizer, TEIP5UniqueAttributesRecognizer, XHTMLUniqueAttributesRecognizer

public abstract class DefaultUniqueAttributesRecognizer
extends Object
implements UniqueAttributesRecognizer

Default unique attributes recognizer


Field Summary
protected  AuthorAccess authorAccess
          The author access
protected  String idAttrQname
          The ID attribute qname
 
Constructor Summary
DefaultUniqueAttributesRecognizer(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)
          Assign unique IDs between a start and an end offset in the document
 boolean copyAttributeOnSplit(String attrQName, AuthorElement element)
          Check 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  String generateUniqueIDFor(String idGenerationPattern, AuthorElement element)
          Generate an unique ID for an element
protected abstract  GenerateIDElementsInfo getDefaultOptions()
           
protected  String getGenerateIDAttributeQName(AuthorElement element, String[] elemsWithAutoGeneration, boolean forceGeneration)
           
 GenerateIDElementsInfo getGenerateIDElementsInfo()
           
 boolean isAutoIDGenerationActive()
           
 
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 String idAttrQname
The ID attribute qname


authorAccess

protected AuthorAccess authorAccess
The author access

Constructor Detail

DefaultUniqueAttributesRecognizer

public DefaultUniqueAttributesRecognizer(String idAttrQname)
Constructor.

Parameters:
idAttrQname - The ID attribute qname
Method Detail

copyAttributeOnSplit

public boolean copyAttributeOnSplit(String attrQName,
                                    AuthorElement element)
Description copied from interface: UniqueAttributesRecognizer
Check 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 UniqueAttributesRecognizer
Parameters:
attrQName - The attribute qualified name
element - The element
Returns:
true if the attribute should be copied when Split is performed.
See Also:
UniqueAttributesRecognizer.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 String getGenerateIDAttributeQName(AuthorElement element,
                                             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 String generateUniqueIDFor(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: UniqueAttributesRecognizer
Assign unique IDs between a start and an end offset in the document

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

getGenerateIDElementsInfo

public GenerateIDElementsInfo getGenerateIDElementsInfo()
Returns:
Returns the autoGenerateElementsInfo.

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.