Class odf.ObjectNameGenerator
Defined in: ObjectNameGenerator.js.
Constructor Attributes | Constructor Name and Description |
---|---|
odf.ObjectNameGenerator(odfContainer, memberId)
Helper object for generating unique object names.
|
Method Attributes | Method Name and Description |
---|---|
Generate a unique frame name
|
|
Generate a unique image name
|
|
Generate a unique style name across the style:style elements
|
|
<inner> |
Get all the style names defined in the style:style elements of the
current document including automatic styles.
|
Class Detail
odf.ObjectNameGenerator(odfContainer, memberId)
Helper object for generating unique object names. Each name is only reported once per instance,
irrespective of whether it is actually then inserted into the dom tree in the odfContainer.
There is expected to be a single instance of the object name generator created per session. This is necessary
to close a potential race condition when generating unique names for operations. As there is no guarantee
when a given op is executed, it is insufficient to simply rely on all previously generated names to be now present
in the document definitions. To cope with this, the names generated by this instance are also cached for
the lifetime of this object.
Failure to do this could result in a situation like the following
1. SessionController generates new OpAddStyle & adds to session's queue
2. SessionController generates another OpAddStyle & adds to session's queue
At step 2, as the session's queue implementation has no requirement that it immediately executes the operation from
step 1, it is likely that the style created in step 1 is not yet present in the document DOM.
- Parameters:
- {!odf.OdfContainer} odfContainer
- {!string} memberId
Method Detail
{!string}
generateFrameName()
Generate a unique frame name
- Returns:
- {!string}
{!string}
generateImageName()
Generate a unique image name
- Returns:
- {!string}
{!string}
generateStyleName()
Generate a unique style name across the style:style elements
- Returns:
- {!string}
<inner>
{!Object.}
getAllStyleNames()
Get all the style names defined in the style:style elements of the
current document including automatic styles.
- Returns:
- {!Object.
}