Class GenerateIDElementsInfo
java.lang.Object
ro.sync.ecss.extensions.commons.id.GenerateIDElementsInfo
Information about the list of elements for which to generate auto ID + if the auto ID generation is activated
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default id generation pattern.static final String
The key from optionsstatic final String
The key from optionsstatic final String
The key from optionsstatic final String
The key from optionsstatic final String
Description for the id pattern macro.static final String
Description for the local name pattern macro.static final String
Local name pattern macro.static final String
The default pattern tooltip.static final String
Description for the uuid pattern macro. -
Constructor Summary
ConstructorsConstructorDescriptionGenerateIDElementsInfo
(boolean autoGenerateIds, String idGenerationPattern, String[] elementsWithIDGeneration) Constructor.GenerateIDElementsInfo
(boolean autoGenerateIds, String idGenerationPattern, String[] elementsWithIDGeneration, boolean filterIDsOnCopy) Constructor.GenerateIDElementsInfo
(AuthorAccess authorAccess, GenerateIDElementsInfo defaultOptions) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generateID
(String idGenerationPattern, String elementLocalName) Generate an ID from a pattern for the specified element.static String
generateID
(String idGenerationPattern, String elementLocalName, String editorLocation) Generate an ID from a pattern for the specified element.Get the QName of the attribute for which to generate theString[]
Get the pattern tooltip.boolean
boolean
static GenerateIDElementsInfo
loadDefaultsFromConfiguration
(AuthorAccess authorAccess, String proposedXMLResourceName) Load from the XML configuration.void
saveToOptions
(AuthorAccess authorAccess) Save to persistent optionsvoid
setAutoGenerateIds
(boolean autoGenerateIds) Set auto generate IDs.void
setElementsWithIDGeneration
(String[] elementsWithIDGeneration) Set a list of elements with ID generationvoid
setIdGenerationPattern
(String idGenerationPattern) Set the ID generation pattern.void
setPatternTooltip
(String patternTooltip) Set the pattern tooltip which will be shown in the configuration dialog.void
setRemoveIDsOnCopy
(boolean removeIDsOnCopy) Set the flag which controls whether the IDs will be removed on copy.
-
Field Details
-
GENERATE_ID_ELEMENTS_KEY
The key from options- See Also:
-
GENERATE_ID_ELEMENTS_ACTIVE_KEY
The key from options- See Also:
-
GENERATE_ID_PATTERN_KEY
The key from options- See Also:
-
FILTER_IDS_ON_COPY_KEY
The key from options- See Also:
-
LOCAL_NAME_PATTERN_MACRO
Local name pattern macro.- See Also:
-
LOCAL_NAME_PATTERN_DESCRIPTION
Description for the local name pattern macro.- See Also:
-
UUID_PATTERN_DESCRIPTION
Description for the uuid pattern macro.- See Also:
-
ID_PATTERN_DESCRIPTION
Description for the id pattern macro.- See Also:
-
DEFAULT_ID_GENERATION_PATTERN
The default id generation pattern.- See Also:
-
PATTERN_TOOLTIP
The default pattern tooltip.- See Also:
-
-
Constructor Details
-
GenerateIDElementsInfo
Constructor.- Parameters:
authorAccess
- The author accessdefaultOptions
- The default options.
-
GenerateIDElementsInfo
public GenerateIDElementsInfo(boolean autoGenerateIds, String idGenerationPattern, String[] elementsWithIDGeneration) Constructor.- Parameters:
autoGenerateIds
-true
to auto generate IDs.idGenerationPattern
- The pattern for id generation.elementsWithIDGeneration
- List of elements for which to generate IDs.
-
GenerateIDElementsInfo
public GenerateIDElementsInfo(boolean autoGenerateIds, String idGenerationPattern, String[] elementsWithIDGeneration, boolean filterIDsOnCopy) Constructor.- Parameters:
autoGenerateIds
-true
to auto generate IDs.idGenerationPattern
- The pattern for id generation.elementsWithIDGeneration
- List of elements for which to generate IDs.filterIDsOnCopy
- Filter IDs when copying content in the same file.
-
-
Method Details
-
isAutoGenerateIDs
public boolean isAutoGenerateIDs()- Returns:
true
if auto generates IDs for elements.
-
isFilterIDsOnCopy
public boolean isFilterIDsOnCopy()- Returns:
- Returns
true
to filter IDs when copying content in the Author page.
-
getIdGenerationPattern
- Returns:
- Returns the pattern for id generation.
-
getElementsWithIDGeneration
- Returns:
- Returns the elements for which to generate IDs.
-
saveToOptions
Save to persistent options- Parameters:
authorAccess
- The author access
-
generateID
Generate an ID from a pattern for the specified element.- Parameters:
idGenerationPattern
- The pattern.elementLocalName
- The element local name- Returns:
- The generated ID.
-
generateID
public static String generateID(String idGenerationPattern, String elementLocalName, String editorLocation) Generate an ID from a pattern for the specified element.- Parameters:
idGenerationPattern
- The pattern.elementLocalName
- The element local nameeditorLocation
- Editor location- Returns:
- The generated ID.
-
setAutoGenerateIds
public void setAutoGenerateIds(boolean autoGenerateIds) Set auto generate IDs.- Parameters:
autoGenerateIds
-true
to auto generate IDs.
-
setElementsWithIDGeneration
Set a list of elements with ID generation- Parameters:
elementsWithIDGeneration
- a list of elements with ID generation
-
setRemoveIDsOnCopy
public void setRemoveIDsOnCopy(boolean removeIDsOnCopy) Set the flag which controls whether the IDs will be removed on copy.- Parameters:
removeIDsOnCopy
- The filterIDsOnCopy to set.
-
setIdGenerationPattern
Set the ID generation pattern.- Parameters:
idGenerationPattern
- The idGeneration pattern.
-
getPatternTooltip
Get the pattern tooltip. Can be overwritten to provide another tooltip.- Returns:
- the pattern tooltip.
-
setPatternTooltip
Set the pattern tooltip which will be shown in the configuration dialog.- Parameters:
patternTooltip
- the pattern tooltip which will be shown in the configuration dialog.
-
loadDefaultsFromConfiguration
public static GenerateIDElementsInfo loadDefaultsFromConfiguration(AuthorAccess authorAccess, String proposedXMLResourceName) Load from the XML configuration.- Parameters:
authorAccess
- The author accessproposedXMLResourceName
- The proposed name of the resource from which to load the configuration.- Returns:
- The information loaded from the configuration.
-
getAttrQname
Get the QName of the attribute for which to generate the- Returns:
- Returns the attrQname.
-