Class CmsEditorBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String GUI_CHOICE_ADD_CHOICE_1
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_ADD_1
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_CLOSE_0
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_DELETE_1
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_EDIT_1
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_MOVE_1
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_MOVE_DOWN_0
      Message constant for key in the resource bundle.
      static java.lang.String GUI_VIEW_MOVE_UP_0
      Message constant for key in the resource bundle.
      protected I_CmsEntityBackend m_entityBackend
      The entity back-end instance.
      protected java.lang.String m_entityId
      The id of the edited entity.
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsEditorBase​(org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync service, I_CmsWidgetService widgetService)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntityChangeHandler​(java.lang.String entityId, com.google.gwt.event.logical.shared.ValueChangeHandler<org.opencms.acacia.shared.CmsEntity> handler)
      Adds the value change handler to the entity with the given id.
      protected com.google.gwt.event.shared.HandlerRegistration addOverlayClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
      Adds a click handler to the edit overlay.
      com.google.gwt.event.shared.HandlerRegistration addValidationChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsValidationContext> handler)
      Adds a validation change handler.
      protected void clearEditor()
      Clears the editor.
      void destroyForm​(boolean clearEntities)
      Destroys the form and related resources.
      protected java.lang.String getContextUri()
      Returns the context URI.
      org.opencms.acacia.shared.CmsEntity getCurrentEntity()
      Returns the currently edited entity.
      CmsTabbedPanel<?> getFormTabs()
      Returns editor form tabs or null in case no tabs are used.
      protected java.lang.String getHtmlContextInfo()
      Returns the in-line HTML context info.
      static java.lang.String getMessageForKey​(java.lang.String key, java.lang.Object... args)
      Returns the formated message.
      protected CmsRootHandler getRootAttributeHandler()
      Returns the root attribute handler.
      org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync getService()
      Returns the content service instance.
      protected CmsValidationHandler getValidationHandler()
      Returns the validation handler.
      protected I_CmsWidgetService getWidgetService()
      Returns the widget service.
      static boolean hasDictionary()
      Returns if the messages dictionary is set.
      protected void initEditOverlay​(com.google.gwt.dom.client.Element element)
      Initializes the edit overlay to be positioned around the given element.
      void loadContentDefinition​(java.lang.String entityId, com.google.gwt.user.client.Command callback)
      Loads the content definition for the given entity and executes the callback on success.
      static void markForInlineFocus​(com.google.gwt.dom.client.Element element)
      Marks the given element to receive focus once the inline editing is initialized.
      protected void onRpcError​(java.lang.Throwable caught)
      Handles RPC errors.
      void registerContentDefinition​(org.opencms.acacia.shared.CmsContentDefinition definition)
      Registers the types and entities of the given content definition.
      void reinitWidgets​(I_CmsInlineFormParent formParent)
      Reinitializes the editing widget inside the form parent.
      protected void removeEditOverlays()
      Removes the edit overlay from the DOM.
      void renderEntityForm​(java.lang.String entityId, com.google.gwt.user.client.ui.Panel context, com.google.gwt.dom.client.Element scrollParent)
      Renders the entity form within the given context.
      void renderEntityForm​(java.lang.String entityId, java.util.List<org.opencms.acacia.shared.CmsTabInfo> tabInfos, com.google.gwt.user.client.ui.Panel context, com.google.gwt.dom.client.Element scrollParent)
      Renders the entity form within the given context.
      void renderInlineEntity​(java.lang.String entityId, I_CmsInlineFormParent formParent)
      Renders the entity form within the given context.
      void rerenderForm​(org.opencms.acacia.shared.CmsEntity newContent)
      Re-renders the form with the given entity data.
      void saveEntities​(java.util.List<org.opencms.acacia.shared.CmsEntity> entities, boolean clearOnSuccess, com.google.gwt.user.client.Command callback)
      Saves the given entities.
      void saveEntities​(java.util.Set<java.lang.String> entityIds, boolean clearOnSuccess, com.google.gwt.user.client.Command callback)
      Saves the given entity.
      void saveEntity​(java.lang.String entityId, boolean clearOnSuccess, com.google.gwt.user.client.Command callback)
      Saves the given entity.
      void saveEntity​(java.lang.String entityId, com.google.gwt.user.client.Command callback)
      Saves the given entity.
      void saveEntity​(org.opencms.acacia.shared.CmsEntity entity, boolean clearOnSuccess, com.google.gwt.user.client.Command callback)
      Saves the given entity.
      static void setDictionary​(com.google.gwt.i18n.client.Dictionary dictionary)
      Sets the m_dictionary.
      static boolean shouldFocusOnInlineEdit​(com.google.gwt.dom.client.Element element)
      Checks whether the given element is marked to receive focus once the inline editing is initialized.
      void updateHtml​(I_CmsInlineFormParent formParent, com.google.gwt.user.client.Command onSuccess)
      Updates the HTML inside the form parent according to the currently edited entiy data.
      protected void updateOverlayPosition()
      Updates the edit overlay position.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CmsEditorBase

        public CmsEditorBase​(org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync service,
                             I_CmsWidgetService widgetService)
        Constructor.

        Parameters:
        service - the content service
        widgetService - the widget service to use
    • Method Detail

      • getMessageForKey

        public static java.lang.String getMessageForKey​(java.lang.String key,
                                                        java.lang.Object... args)
        Returns the formated message.

        Parameters:
        key - the message key
        args - the parameters to insert into the placeholders
        Returns:
        the formated message
      • hasDictionary

        public static boolean hasDictionary()
        Returns if the messages dictionary is set.

        Returns:
        true if the messages dictionary is set
      • markForInlineFocus

        public static void markForInlineFocus​(com.google.gwt.dom.client.Element element)
        Marks the given element to receive focus once the inline editing is initialized.

        Parameters:
        element - the element to mark
      • setDictionary

        public static void setDictionary​(com.google.gwt.i18n.client.Dictionary dictionary)
        Sets the m_dictionary.

        Parameters:
        dictionary - the m_dictionary to set
      • shouldFocusOnInlineEdit

        public static boolean shouldFocusOnInlineEdit​(com.google.gwt.dom.client.Element element)
        Checks whether the given element is marked to receive focus once the inline editing is initialized.

        Parameters:
        element - the element to check
        Returns:
        true if the given element is marked to receive focus once the inline editing is initialized
      • addEntityChangeHandler

        public void addEntityChangeHandler​(java.lang.String entityId,
                                           com.google.gwt.event.logical.shared.ValueChangeHandler<org.opencms.acacia.shared.CmsEntity> handler)
        Adds the value change handler to the entity with the given id.

        Parameters:
        entityId - the entity id
        handler - the change handler
      • addValidationChangeHandler

        public com.google.gwt.event.shared.HandlerRegistration addValidationChangeHandler​(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsValidationContext> handler)
        Adds a validation change handler.

        Parameters:
        handler - the validation change handler
        Returns:
        the handler registration
      • destroyForm

        public void destroyForm​(boolean clearEntities)
        Destroys the form and related resources. Also clears all entities from the entity back-end

        Parameters:
        clearEntities - true to also clear all entities
      • getCurrentEntity

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

        Returns:
        the currently edited entity
      • getFormTabs

        public CmsTabbedPanel<?> getFormTabs()
        Returns editor form tabs or null in case no tabs are used.

        Returns:
        the editor form tabs
      • getService

        public org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync getService()
        Returns the content service instance.

        Returns:
        the content service
      • loadContentDefinition

        public void loadContentDefinition​(java.lang.String entityId,
                                          com.google.gwt.user.client.Command callback)
        Loads the content definition for the given entity and executes the callback on success.

        Parameters:
        entityId - the entity id
        callback - the callback
      • registerContentDefinition

        public void registerContentDefinition​(org.opencms.acacia.shared.CmsContentDefinition definition)
        Registers the types and entities of the given content definition.

        Parameters:
        definition - the content definition
      • renderEntityForm

        public void renderEntityForm​(java.lang.String entityId,
                                     java.util.List<org.opencms.acacia.shared.CmsTabInfo> tabInfos,
                                     com.google.gwt.user.client.ui.Panel context,
                                     com.google.gwt.dom.client.Element scrollParent)
        Renders the entity form within the given context.

        Parameters:
        entityId - the entity id
        tabInfos - the tab informations
        context - the context element
        scrollParent - the scroll element to be used for automatic scrolling during drag and drop
      • renderEntityForm

        public void renderEntityForm​(java.lang.String entityId,
                                     com.google.gwt.user.client.ui.Panel context,
                                     com.google.gwt.dom.client.Element scrollParent)
        Renders the entity form within the given context.

        Parameters:
        entityId - the entity id
        context - the context element
        scrollParent - the scroll element to be used for automatic scrolling during drag and drop
      • renderInlineEntity

        public void renderInlineEntity​(java.lang.String entityId,
                                       I_CmsInlineFormParent formParent)
        Renders the entity form within the given context.

        Parameters:
        entityId - the entity id
        formParent - the form parent widget
      • rerenderForm

        public void rerenderForm​(org.opencms.acacia.shared.CmsEntity newContent)
        Re-renders the form with the given entity data.

        Parameters:
        newContent - the entity data
      • saveEntities

        public void saveEntities​(java.util.List<org.opencms.acacia.shared.CmsEntity> entities,
                                 boolean clearOnSuccess,
                                 com.google.gwt.user.client.Command callback)
        Saves the given entities.

        Parameters:
        entities - the entities to save
        clearOnSuccess - true to clear the entity back-end instance on success
        callback - the call back command
      • saveEntities

        public void saveEntities​(java.util.Set<java.lang.String> entityIds,
                                 boolean clearOnSuccess,
                                 com.google.gwt.user.client.Command callback)
        Saves the given entity.

        Parameters:
        entityIds - the entity ids
        clearOnSuccess - true to clear all entities from entity back-end on success
        callback - the callback executed on success
      • saveEntity

        public void saveEntity​(org.opencms.acacia.shared.CmsEntity entity,
                               boolean clearOnSuccess,
                               com.google.gwt.user.client.Command callback)
        Saves the given entity.

        Parameters:
        entity - the entity
        clearOnSuccess - true to clear all entities from entity back-end on success
        callback - the callback executed on success
      • saveEntity

        public void saveEntity​(java.lang.String entityId,
                               boolean clearOnSuccess,
                               com.google.gwt.user.client.Command callback)
        Saves the given entity.

        Parameters:
        entityId - the entity id
        clearOnSuccess - true to clear all entities from entity back-end on success
        callback - the callback executed on success
      • saveEntity

        public void saveEntity​(java.lang.String entityId,
                               com.google.gwt.user.client.Command callback)
        Saves the given entity.

        Parameters:
        entityId - the entity id
        callback - the callback executed on success
      • addOverlayClickHandler

        protected com.google.gwt.event.shared.HandlerRegistration addOverlayClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
        Adds a click handler to the edit overlay.

        Parameters:
        handler - the click handler
        Returns:
        the click handler registration
      • clearEditor

        protected void clearEditor()
        Clears the editor.

      • getContextUri

        protected java.lang.String getContextUri()
        Returns the context URI.

        Needed when updating the HTML due to content data changes.

        Override to supply the required info.

        Returns:
        the context URI
      • getHtmlContextInfo

        protected java.lang.String getHtmlContextInfo()
        Returns the in-line HTML context info.

        Needed when updating the HTML due to content data changes.

        Override to supply the required info.

        Returns:
        the HTML context info
      • initEditOverlay

        protected void initEditOverlay​(com.google.gwt.dom.client.Element element)
        Initializes the edit overlay to be positioned around the given element.

        Parameters:
        element - the element
      • onRpcError

        protected void onRpcError​(java.lang.Throwable caught)
        Handles RPC errors.

        Override this for better error handling

        Parameters:
        caught - the error caught from the RPC
      • removeEditOverlays

        protected void removeEditOverlays()
        Removes the edit overlay from the DOM.