Class CmsContentEditor

    • Method Detail

      • addEntityChangeListener

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

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

        public static java.lang.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
      • 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,
                                              java.lang.String oldId,
                                              java.lang.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,
                                          java.lang.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.

      • loadDefinition

        public void loadDefinition​(java.lang.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​(java.lang.String entityId,
                                          java.lang.String newLink,
                                          org.opencms.util.CmsUUID modelFileId,
                                          java.lang.String postCreateHandler,
                                          java.lang.String mode,
                                          java.lang.String mainLocale,
                                          org.opencms.ade.contenteditor.shared.CmsEditHandlerData editHandlerData,
                                          java.util.Map<java.lang.String,​java.lang.String> settingPresets,
                                          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
        callback - the callback
      • loadNewDefinition

        public void loadNewDefinition​(java.lang.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,
                                   java.lang.String locale,
                                   java.lang.String elementId,
                                   java.lang.String clientId,
                                   java.lang.String newLink,
                                   org.opencms.util.CmsUUID modelFileId,
                                   java.lang.String postCreateHandler,
                                   java.lang.String mode,
                                   java.lang.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,
                                     java.lang.String locale,
                                     I_CmsInlineFormParent panel,
                                     java.lang.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

        public void openStandAloneFormEditor​(CmsEditorContext context)
        Opens the form based editor. Used within the stand alone acacia/editor.jsp.

        Parameters:
        context - the editor context
      • registerClonedEntity

        public void registerClonedEntity​(java.lang.String sourceEntityId,
                                         java.lang.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<java.lang.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,
                                          java.util.List<java.lang.String> deletedEntites,
                                          boolean clearOnSuccess,
                                          I_CmsSimpleCallback<java.lang.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​(java.lang.String contentId,
                              java.lang.String contentPath,
                              java.lang.String locale,
                              java.lang.String value,
                              com.google.gwt.user.client.rpc.AsyncCallback<java.lang.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​(java.lang.String entityId)
        Removes the given entity from the entity VIE store.

        Parameters:
        entityId - the entity id
      • getEntityId

        protected java.lang.String getEntityId()
        Gets the entity id.

        Returns:
        the entity id
      • getSkipPaths

        protected java.util.Collection<java.lang.String> getSkipPaths()
        Returns the paths to be skipped when synchronizing locale independent fields.

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