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 theWSEditor
API.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
detectionFinished
True if the detection finishedprotected static org.slf4j.Logger
logger
Logger for logging.protected static ro.sync.i18n.MessageBundle
messages
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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addAuthorComponentListener(AuthorComponentListener listener)
Adds an author component listener.protected abstract ro.sync.exml.editor.AbstractEditor
createEditor(ro.sync.exml.workspace.impl.component.BaseComponentEditorManager parentEditorManager, java.awt.Frame parentFrame, java.lang.String[] allowedPages, java.lang.String initialPage, java.lang.String contentType)
Create an editorjava.io.Reader
createReader()
Create a reader over the editor's current page contentjavax.swing.JComponent
getAdditionalEditHelper(int helperID)
Get an additional edit helper panel.java.awt.Component
getEditorComponent()
Get the main editor panel.java.lang.Object
getEditorKey()
java.awt.Component
getStatusComponent()
Get the status panel which shows the status of the edited document.WSEditor
getWSEditorAccess()
Get the access to the WS Editor.boolean
isModified()
Check if the component is modifiedvoid
load(java.net.URL url, java.io.Reader reader)
Sets the content to edit.void
print(boolean preview)
Print the author component content.void
removeAuthorComponentListener(AuthorComponentListener listener)
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(java.net.URL url)
Show the location referenced by a given URL in the editor.void
showLocation(java.net.URL url, java.io.Reader reader)
Show the location referenced by a given URL in the editor.
-
-
-
Method Detail
-
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
public void load(java.net.URL url, java.io.Reader reader) throws AuthorComponentException
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
public void showLocation(java.net.URL url, java.io.Reader reader) throws AuthorComponentException
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:
EditorComponentProvider.showLocation(java.net.URL, java.io.Reader)
-
createEditor
protected abstract ro.sync.exml.editor.AbstractEditor createEditor(ro.sync.exml.workspace.impl.component.BaseComponentEditorManager parentEditorManager, java.awt.Frame parentFrame, java.lang.String[] allowedPages, java.lang.String initialPage, java.lang.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
public java.io.Reader createReader()
Create a reader over the editor's current page content- Returns:
- The reader over the current page's content
-
addAuthorComponentListener
public void addAuthorComponentListener(AuthorComponentListener listener)
Adds an author component listener.- Specified by:
addAuthorComponentListener
in interfaceEditorComponentProvider
- Parameters:
listener
- The listener.
-
removeAuthorComponentListener
public void removeAuthorComponentListener(AuthorComponentListener listener)
Removes an author component listener.- Specified by:
removeAuthorComponentListener
in interfaceEditorComponentProvider
- Parameters:
listener
- The listener.
-
getEditorComponent
public java.awt.Component getEditorComponent()
Description copied from interface:ComponentProvider
Get the main editor panel.- Specified by:
getEditorComponent
in interfaceComponentProvider
- Returns:
- The editor panel.
-
getStatusComponent
public java.awt.Component 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
public WSEditor getWSEditorAccess()
Get the access to the WS Editor.- Specified by:
getWSEditorAccess
in interfaceComponentProvider
- Returns:
- The author access.
-
getEditorKey
public java.lang.Object getEditorKey()
- Specified by:
getEditorKey
in classro.sync.ecss.extensions.api.component.InternalComponentProvider
- Returns:
- The editor.
-
getAdditionalEditHelper
public javax.swing.JComponent getAdditionalEditHelper(int helperID)
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
public void showLocation(java.net.URL url) throws AuthorComponentException
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
-
-