Class CmsDefaultPageEditor

Direct Known Subclasses:
CmsSimplePageEditor

public abstract class CmsDefaultPageEditor extends CmsEditor
Provides methods for building editors for the CmsDefaultPage page type.

Extend this class for all editors that work with the CmsDefaultPage.

Since:
6.0.0
  • Field Details

  • Constructor Details

  • Method Details

    • actionChangeBodyElement

      public void actionChangeBodyElement()
      Performs the change body action of the editor.

    • actionCleanupBodyElement

      public void actionCleanupBodyElement()
      Performs the cleanup body action of the editor.

    • actionClear

      public void actionClear(boolean forceUnlock)
      Description copied from class: CmsEditor
      Unlocks the edited resource when in direct edit mode or when the resource was not modified.

      Specified by:
      actionClear in class CmsEditor
      Parameters:
      forceUnlock - if true, the resource will be unlocked anyway
      See Also:
    • actionDeleteElementLocale

      public void actionDeleteElementLocale() throws javax.servlet.jsp.JspException
      Performs the delete locale action.

      Throws:
      javax.servlet.jsp.JspException - if something goes wrong
    • actionDirectEdit

      public void actionDirectEdit() throws IOException, javax.servlet.jsp.JspException, javax.servlet.ServletException
      Performs a configurable action performed by the editor.

      The default action is: save resource, clear temporary files and publish the resource directly.

      Throws:
      IOException - if a forward fails
      javax.servlet.jsp.JspException - if including a JSP fails
      javax.servlet.ServletException - if a forward fails
    • actionExit

      public void actionExit() throws IOException, javax.servlet.jsp.JspException, javax.servlet.ServletException
      Performs the exit editor action and deletes the temporary file.

      Specified by:
      actionExit in class CmsEditor
      Throws:
      IOException - if a forward fails
      javax.servlet.jsp.JspException - if including an element fails
      javax.servlet.ServletException - if a forward fails
      See Also:
    • actionPreview

      public void actionPreview() throws IOException, javax.servlet.jsp.JspException
      Performs the preview page action in a new browser window.

      Throws:
      IOException - if redirect fails
      javax.servlet.jsp.JspException - if inclusion of error page fails
    • actionSave

      public void actionSave() throws javax.servlet.jsp.JspException
      Description copied from class: CmsEditor
      Performs the save content action.

      Specified by:
      actionSave in class CmsEditor
      Throws:
      javax.servlet.jsp.JspException - if including an element fails
      See Also:
    • buildSelectElementLanguage

      Builds the html String for the element language selector.

      Parameters:
      attributes - optional attributes for the <select> tag
      Returns:
      the html for the element language selectbox
    • buildSelectElementName

      public String buildSelectElementName(String attributes)
      Builds the html String for the element name selector.

      Parameters:
      attributes - optional attributes for the <select> tag
      Returns:
      the html for the element name selectbox
    • buildSelectFonts

      public String buildSelectFonts(String attributes)
      Builds the html for the font face select box of a WYSIWYG editor.

      Parameters:
      attributes - optional attributes for the <select> tag
      Returns:
      the html for the font face select box
    • escapeParams

      public void escapeParams()
      Escapes the content and title parameters to display them in the editor form.

      This method has to be called on the JSP right before the form display html is created.

      *

    • getElementLocale

      Returns the current element locale.

      Returns:
      the current element locale
    • getParamElementname

      Returns the current element name.

      Returns:
      the current element name
    • getParamOldelementname

      Returns the old element name.

      Returns:
      the old element name
    • getUriStyleSheet

      Returns the OpenCms VFS uri of the style sheet of the current page.

      Returns:
      the OpenCms VFS uri of the style sheet of the current page
    • getUriTemplate

      Returns the OpenCms VFS uri of the template of the current page.

      Returns:
      the OpenCms VFS uri of the template of the current page
    • setParamElementname

      public void setParamElementname(String elementName)
      Sets the current element name.

      Parameters:
      elementName - the current element name
    • setParamOldelementname

      public void setParamOldelementname(String oldElementName)
      Sets the old element name.

      Parameters:
      oldElementName - the old element name
    • getElementList

      Returns the list of active elements of the page.

      Returns:
      the list of active elements of the page
    • initBodyElementLanguage

      protected void initBodyElementLanguage()
      Initializes the body element language for the first call of the editor.

    • initBodyElementName

      protected void initBodyElementName(String elementName)
      Initializes the body element name of the editor.

      This has to be called after the element language has been set with setParamBodylanguage().

      Parameters:
      elementName - the name of the element to initialize or null, if default element should be used
    • initContent

      protected void initContent()
      This method has to be called after initializing the body element name and language.

      Specified by:
      initContent in class CmsEditor
      See Also:
    • performSaveContent

      protected void performSaveContent(String body, Locale locale) throws CmsException
      Saves the editor content to the temporary file.

      Parameters:
      body - the body name to write
      locale - the body locale to write
      Throws:
      CmsException - if writing the file fails
    • prepareContent

      protected abstract String prepareContent(boolean save)
      Manipulates the content String for different editor views and the save operation.

      Parameters:
      save - if set to true, the result String is not escaped and the content parameter is not updated
      Returns:
      the prepared content String