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 Details

    • logger

      protected static final org.slf4j.Logger logger
      Logger for logging.
    • messages

      protected static final ro.sync.i18n.MessageBundle messages
      The messages resource bundle.
    • detectionFinished

      protected boolean detectionFinished
      True 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

      public void load(URL url, 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 for documentTypeChanged() before using the author extension actions.

      Specified by:
      load in interface ComponentProvider
      Parameters:
      url - URL to load, can be null 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(URL url, 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 interface EditorComponentProvider
      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 be null
      contentType - The content type of the editor.
      Returns:
      The new created editor.
      Throws:
      AuthorComponentException
    • createReader

      public 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 interface EditorComponentProvider
      Parameters:
      listener - The listener.
    • removeAuthorComponentListener

      public void removeAuthorComponentListener(AuthorComponentListener listener)
      Removes an author component listener.
      Specified by:
      removeAuthorComponentListener in interface EditorComponentProvider
      Parameters:
      listener - The listener.
    • getEditorComponent

      public Component getEditorComponent()
      Description copied from interface: ComponentProvider
      Get the main editor panel.
      Specified by:
      getEditorComponent in interface ComponentProvider
      Returns:
      The editor panel.
    • getStatusComponent

      public Component getStatusComponent()
      Description copied from interface: ComponentProvider
      Get the status panel which shows the status of the edited document.
      Specified by:
      getStatusComponent in interface ComponentProvider
      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 interface ComponentProvider
      Returns:
      The author access.
    • getEditorKey

      public Object getEditorKey()
      Specified by:
      getEditorKey in class ro.sync.ecss.extensions.api.component.InternalComponentProvider
      Returns:
      The editor.
    • getAdditionalEditHelper

      public 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 interface EditorComponentProvider
      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 interface ComponentProvider
      Parameters:
      preview - true to show the Print Preview dialog, false to show the Print dialog.
      Since:
      13
    • showLocation

      public void showLocation(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