Class CmsContentEditor

java.lang.Object
org.opencms.acacia.client.CmsEditorBase
org.opencms.ade.contenteditor.client.CmsContentEditor
All Implemented Interfaces:
I_CmsInlineHtmlUpdateHandler

public final class CmsContentEditor extends CmsEditorBase
The content editor.

  • Field Details

  • Method Details

    • addEntityChangeListener

      public static void addEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope)
      Adds an entity change listener.

      Parameters:
      changeListener - the change listener
      changeScope - the change scope
    • getClientIdForEditable

      public static String getClientIdForEditable(I_CmsEditableData editableData)
      Gets the client id for the editable element.

      Parameters:
      editableData - the editable element
      Returns:
      the client id for the editable element
    • getEntity

      public static org.opencms.acacia.shared.CmsEntity getEntity()
      Returns the currently edited entity.

      Returns:
      the currently edited entity
    • getInstance

      public static CmsContentEditor getInstance()
      Returns the in-line editor instance.

      Returns:
      the in-line editor instance
    • hasEditable

      public static boolean hasEditable(com.google.gwt.dom.client.Element element)
      Returns if the given element or it's descendants are inline editable.

      Parameters:
      element - the element
      Returns:
      true if the element has editable descendants
    • isEditable

      public static boolean isEditable(com.google.gwt.dom.client.Element element)
      Checks whether the given element is annotated for inline editing.

      Parameters:
      element - the element to check
      Returns:
      true if the given element is annotated for inline editing
    • replaceResourceIds

      public static void replaceResourceIds(com.google.gwt.dom.client.Element element, String oldId, String newId)
      Replaces the id's within data-oc-id attributes of the given element and all it's children.

      Parameters:
      element - the element
      oldId - the old id
      newId - the new id
    • setEditable

      public static boolean setEditable(com.google.gwt.dom.client.Element element, String serverId, boolean editable)
      Sets all annotated child elements editable.

      Parameters:
      element - the element
      serverId - the editable resource structure id
      editable - true to enable editing
      Returns:
      true if the element had editable elements
    • closeEditor

      public void closeEditor()
      Closes the editor.

      May be used from outside the editor module.

    • fixFocus

      public void fixFocus()
      Bypasses a focus bug in IE which can happen if the user opens the HTML code editor from the WYSIWYG editor.

      The next time they open the editor form from the same container page, the user may be unable to focus on any input fields. To prevent this, we create a dummy input field outside the visible screen region and focus it when opening the editor.

    • getService

      public org.opencms.ade.contenteditor.shared.rpc.I_CmsContentServiceAsync getService()
      Description copied from class: CmsEditorBase
      Returns the content service instance.

      Overrides:
      getService in class CmsEditorBase
      Returns:
      the content service
      See Also:
    • loadDefinition

      public void loadDefinition(String entityId, org.opencms.acacia.shared.CmsEntity editedEntity, I_CmsSimpleCallback<org.opencms.ade.contenteditor.shared.CmsContentDefinition> callback)
      Loads the content definition for the given entity and executes the callback on success.

      Parameters:
      entityId - the entity id
      editedEntity - the currently edited entity
      callback - the callback
    • loadInitialDefinition

      public void loadInitialDefinition(String entityId, String newLink, org.opencms.util.CmsUUID modelFileId, String postCreateHandler, String mode, String mainLocale, org.opencms.ade.contenteditor.shared.CmsEditHandlerData editHandlerData, Map<String,String> settingPresets, String editorStylesheet, I_CmsSimpleCallback<org.opencms.ade.contenteditor.shared.CmsContentDefinition> callback)
      Loads the content definition for the given entity and executes the callback on success.

      Parameters:
      entityId - the entity id
      newLink - the new link
      modelFileId - the model file id
      postCreateHandler - the post-create handler class name (optional)
      mode - the content creation mode
      mainLocale - the main language to copy in case the element language node does not exist yet
      editHandlerData - the data for the edit handler, if one is used to create a new content; null otherwise
      settingPresets - the presets for container element settings
      editorStylesheet - the path for the editor style sheet (may be null)
      callback - the callback
    • loadNewDefinition

      public void loadNewDefinition(String entityId, org.opencms.acacia.shared.CmsEntity editedEntity, I_CmsSimpleCallback<org.opencms.ade.contenteditor.shared.CmsContentDefinition> callback)
      Loads the content definition for the given entity and executes the callback on success.

      Parameters:
      entityId - the entity id
      editedEntity - the currently edited entity
      callback - the callback
    • openFormEditor

      public void openFormEditor(CmsEditorContext context, String locale, String elementId, String clientId, String newLink, org.opencms.util.CmsUUID modelFileId, String postCreateHandler, String mode, String mainLocale, org.opencms.ade.contenteditor.shared.CmsEditHandlerData editHandlerData, I_CmsEditorCloseHandler onClose)
      Opens the content editor dialog.

      Parameters:
      context - the editor context
      locale - the content locale
      elementId - the element id
      clientId - the container element client id if available
      newLink - the new link
      modelFileId - the model file id
      postCreateHandler - the post-create handler class (optional)
      mode - the content creation mode
      mainLocale - the main language to copy in case the element language node does not exist yet
      editHandlerData - the edit handler data, if we are using an edit handler to create a new element; null otherwise
      onClose - the command executed on dialog close
    • openInlineEditor

      public void openInlineEditor(CmsEditorContext context, org.opencms.util.CmsUUID elementId, String locale, I_CmsInlineFormParent panel, String mainLocale, long loadTime, I_CmsEditorCloseHandler onClose)
      Renders the in-line editor for the given element.

      Parameters:
      context - the editor context
      elementId - the element id
      locale - the content locale
      panel - the element panel
      mainLocale - the main language to copy in case the element language node does not exist yet
      loadTime - the time when the requested resource was loaded
      onClose - the command to execute on close
    • openStandAloneFormEditor

      Opens the form based editor. Used within the stand alone acacia/editor.jsp.

      Parameters:
      context - the editor context
    • registerClonedEntity

      public void registerClonedEntity(String sourceEntityId, String targetEntityId)
      Registers a deep copy of the source entity with the given target entity id.

      Parameters:
      sourceEntityId - the source entity id
      targetEntityId - the target entity id
    • registerContentDefinition

      public void registerContentDefinition(org.opencms.ade.contenteditor.shared.CmsContentDefinition definition)
      Registers the given content definition.

      Parameters:
      definition - the content definition
    • saveAndDeleteEntities

      public void saveAndDeleteEntities(boolean clearOnSuccess, I_CmsSimpleCallback<Boolean> callback)
      Saves the given entities.

      Parameters:
      clearOnSuccess - true to clear the VIE instance on success
      callback - the call back command
    • saveAndDeleteEntities

      public void saveAndDeleteEntities(org.opencms.acacia.shared.CmsEntity lastEditedEntity, List<String> deletedEntites, boolean clearOnSuccess, I_CmsSimpleCallback<Boolean> callback)
      Saves the given entities.

      Parameters:
      lastEditedEntity - the last edited entity
      deletedEntites - the deleted entity id's
      clearOnSuccess - true to clear the VIE instance on success
      callback - the call back command
    • saveValue

      public void saveValue(String contentId, String contentPath, String locale, String value, com.google.gwt.user.client.rpc.AsyncCallback<String> asyncCallback)
      Saves a value in an Xml content.

      Parameters:
      contentId - the structure id of the content
      contentPath - the xpath for which to set the value
      locale - the locale for which to set the value
      value - the new value
      asyncCallback - the callback for the result
    • setShowEditorHelp

      public void setShowEditorHelp(boolean show)
      Sets the show editor help flag to the user session.

      Parameters:
      show - the show editor help flag
    • unregistereEntity

      public void unregistereEntity(String entityId)
      Removes the given entity from the entity VIE store.

      Parameters:
      entityId - the entity id
    • clearEditor

      protected void clearEditor()
      Description copied from class: CmsEditorBase
      Clears the editor.

      Overrides:
      clearEditor in class CmsEditorBase
      See Also:
    • getContext

      Gets the editor context.

      Returns:
      the editor context
    • getContextUri

      protected String getContextUri()
      Description copied from class: CmsEditorBase
      Returns the context URI.

      Needed when updating the HTML due to content data changes.

      Override to supply the required info.

      Overrides:
      getContextUri in class CmsEditorBase
      Returns:
      the context URI
      See Also:
    • getEntityId

      protected String getEntityId()
      Gets the entity id.

      Returns:
      the entity id
    • getHtmlContextInfo

      Description copied from class: CmsEditorBase
      Returns the in-line HTML context info.

      Needed when updating the HTML due to content data changes.

      Override to supply the required info.

      Overrides:
      getHtmlContextInfo in class CmsEditorBase
      Returns:
      the HTML context info
      See Also:
    • getSkipPaths

      Returns the paths to be skipped when synchronizing locale independent fields.

      Returns:
      the paths to be skipped when synchronizing locale independent fields