Class AbstractComponentProvider
java.lang.Object
ro.sync.ecss.extensions.api.component.InternalComponentProvider
ro.sync.ecss.extensions.api.component.AbstractComponentProvider
- All Implemented Interfaces:
ComponentProvider
,EditorComponentProvider
,DisplayModeConstants
- Direct Known Subclasses:
AuthorComponentProvider
,GenericEditorComponentProvider
@API(type=NOT_EXTENDABLE,
src=PRIVATE)
public abstract class AbstractComponentProvider
extends ro.sync.ecss.extensions.api.component.InternalComponentProvider
implements DisplayModeConstants, EditorComponentProvider
A component encapsulating all the editing part.
Developers can create an editor, and access the document through the
WSEditor
API.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
True if the detection finishedprotected static final org.slf4j.Logger
Logger for logging.protected static final ro.sync.i18n.MessageBundle
The messages resource bundle.Fields inherited from interface ro.sync.exml.workspace.api.editor.page.author.DisplayModeConstants
DISPLAY_MODE_BLOCK_TAGS, DISPLAY_MODE_BLOCK_TAGS_WITHOUT_TEXT, DISPLAY_MODE_FULL_TAGS, DISPLAY_MODE_FULL_TAGS_WITH_ATTRS, DISPLAY_MODE_INLINE_TAGS, DISPLAY_MODE_NO_TAGS, DISPLAY_MODE_PARTIAL_TAGS
Fields inherited from interface ro.sync.ecss.extensions.api.component.EditorComponentProvider
ATTRIBUTES_PANEL_ID, ELEMENTS_PANEL_ID, ENTITIES_PANEL_ID, MODEL_PANEL_ID, OUTLINER_PANEL_ID, REVIEWS_PANEL_ID
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an author component listener.protected abstract ro.sync.exml.editor.AbstractEditor
createEditor
(ro.sync.exml.workspace.impl.component.BaseComponentEditorManager parentEditorManager, Frame parentFrame, String[] allowedPages, String initialPage, String contentType) Create an editorCreate a reader over the editor's current page contentgetAdditionalEditHelper
(int helperID) Get an additional edit helper panel.Get the main editor panel.Get the status panel which shows the status of the edited document.Get the access to the WS Editor.boolean
Check if the component is modifiedvoid
Sets the content to edit.void
print
(boolean preview) Print the author component content.void
Removes an author component listener.void
save()
Save the content back to the original URL from where it was loaded using the internal support.void
setModified
(boolean modified) Sets the modified status.void
showLocation
(URL url) Show the location referenced by a given URL in the editor.void
showLocation
(URL url, Reader reader) Show the location referenced by a given URL in the editor.
-
Field Details
-
logger
protected static final org.slf4j.Logger loggerLogger for logging. -
messages
protected static final ro.sync.i18n.MessageBundle messagesThe messages resource bundle. -
detectionFinished
protected boolean detectionFinishedTrue if the detection finished
-
-
Method Details
-
save
public void save()Save the content back to the original URL from where it was loaded using the internal support. Useful only when you provide an initial URL from which the component is loaded. -
load
Sets the content to edit.This does not guarantee that the set content has been interpreted, you should set an
AuthorComponentListener
and listen fordocumentTypeChanged()
before using the author extension actions.- Specified by:
load
in interfaceComponentProvider
- Parameters:
url
- URL to load, can benull
if the reader is specified If no XML content reader is given, the URL will be used both to obtain the content and to solve relative references (eg: images). If the XML content reader is also given, the URL will only be used to solve relative references from the file.reader
- The reader.- Throws:
AuthorComponentException
- When there was a load problem (eg: IOException).
-
showLocation
Description copied from interface:EditorComponentProvider
Show the location referenced by a given URL in the editor.
If the document pointed by this URL is different than the document currently loaded in the editor page, this URL will be used to set the content to edit, to solve relative references (eg: images) and to show the location pointed by the URL reference part.
If the document pointed by this URL is currently loaded in the editor page, only the reference part of the given URL will be used to show the corresponding location in the editor.- Specified by:
showLocation
in interfaceEditorComponentProvider
- Parameters:
url
- The URL to show location for.reader
- The reader over the URL, can be null.- Throws:
AuthorComponentException
- When there was a load problem (eg: IOException).- See Also:
-
createEditor
protected abstract ro.sync.exml.editor.AbstractEditor createEditor(ro.sync.exml.workspace.impl.component.BaseComponentEditorManager parentEditorManager, Frame parentFrame, String[] allowedPages, String initialPage, String contentType) throws AuthorComponentException Create an editor- Parameters:
parentEditorManager
- The view manager.parentFrame
- View's parent frame.allowedPages
- The enumeration of allowed pages.initialPage
- The initial page. Can benull
contentType
- The content type of the editor.- Returns:
- The new created editor.
- Throws:
AuthorComponentException
-
createReader
Create a reader over the editor's current page content- Returns:
- The reader over the current page's content
-
addAuthorComponentListener
Adds an author component listener.- Specified by:
addAuthorComponentListener
in interfaceEditorComponentProvider
- Parameters:
listener
- The listener.
-
removeAuthorComponentListener
Removes an author component listener.- Specified by:
removeAuthorComponentListener
in interfaceEditorComponentProvider
- Parameters:
listener
- The listener.
-
getEditorComponent
Description copied from interface:ComponentProvider
Get the main editor panel.- Specified by:
getEditorComponent
in interfaceComponentProvider
- Returns:
- The editor panel.
-
getStatusComponent
Description copied from interface:ComponentProvider
Get the status panel which shows the status of the edited document.- Specified by:
getStatusComponent
in interfaceComponentProvider
- Returns:
- The status panel.
-
isModified
public boolean isModified()Check if the component is modified- Returns:
true
if the component is modified.
-
setModified
public void setModified(boolean modified) Sets the modified status.- Parameters:
modified
-true
to flag as modified.- Since:
- 13
-
getWSEditorAccess
Get the access to the WS Editor.- Specified by:
getWSEditorAccess
in interfaceComponentProvider
- Returns:
- The author access.
-
getEditorKey
- Specified by:
getEditorKey
in classro.sync.ecss.extensions.api.component.InternalComponentProvider
- Returns:
- The editor.
-
getAdditionalEditHelper
Get an additional edit helper panel. It can be the Attributes, Reviews, Outliner, Elements, Entities, Model component, depending on the ID. Note that the Elements, Entities and Model views are not available in the Author Reviewer edition.- Specified by:
getAdditionalEditHelper
in interfaceEditorComponentProvider
- Parameters:
helperID
- One of:- Returns:
- The additional component.
-
print
public void print(boolean preview) Print the author component content. Shows the Print dialog.- Specified by:
print
in interfaceComponentProvider
- Parameters:
preview
-true
to show the Print Preview dialog,false
to show the Print dialog.- Since:
- 13
-
showLocation
Show the location referenced by a given URL in the editor.
If the document pointed by this URL is different than the document currently loaded in the editor page, this URL will be used to set the content to edit, to solve relative references (eg: images) and to show the location pointed by the URL reference part.
If the document pointed by this URL is currently loaded in the editor page, only the reference part of the given URL will be used to show the corresponding location in the editor.- Parameters:
url
- The URL to show location for.- Throws:
AuthorComponentException
- When there was a load problem (eg: IOException).- Since:
- 14.1
-