Class CmsContentEditor
java.lang.Object
org.opencms.acacia.client.CmsEditorBase
org.opencms.ade.contenteditor.client.CmsContentEditor
- All Implemented Interfaces:
I_CmsInlineHtmlUpdateHandler
The content editor.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
CSS marker class added to the html element when the editor is active.protected boolean
Flag indicating that an AJAX call for the editor change handler is running.protected String
The current content locale.protected I_CmsEditorCloseHandler
The on close call back.protected CmsToolbar
The edit tool-bar.Fields inherited from class org.opencms.acacia.client.CmsEditorBase
GUI_CHOICE_ADD_CHOICE_1, GUI_VIEW_ADD_1, GUI_VIEW_CLOSE_0, GUI_VIEW_DELETE_1, GUI_VIEW_EDIT_1, GUI_VIEW_MOVE_1, GUI_VIEW_MOVE_DOWN_0, GUI_VIEW_MOVE_UP_0, m_entityBackend, m_entityId
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addEntityChangeListener
(I_CmsEntityChangeListener changeListener, String changeScope) Adds an entity change listener.protected void
Clears the editor.void
Closes the editor.void
fixFocus()
Bypasses a focus bug in IE which can happen if the user opens the HTML code editor from the WYSIWYG editor.static String
getClientIdForEditable
(I_CmsEditableData editableData) Gets the client id for the editable element.protected CmsEditorContext
Gets the editor context.protected String
Returns the context URI.static org.opencms.acacia.shared.CmsEntity
Returns the currently edited entity.protected String
Gets the entity id.protected String
Returns the in-line HTML context info.static CmsContentEditor
Returns the in-line editor instance.org.opencms.ade.contenteditor.shared.rpc.I_CmsContentServiceAsync
Returns the content service instance.protected Collection<String>
Returns the paths to be skipped when synchronizing locale independent fields.static boolean
hasEditable
(com.google.gwt.dom.client.Element element) Returns if the given element or it's descendants are inline editable.static boolean
isEditable
(com.google.gwt.dom.client.Element element) Checks whether the given element is annotated for inline editing.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.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.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.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.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.void
openStandAloneFormEditor
(CmsEditorContext context) Opens the form based editor.void
registerClonedEntity
(String sourceEntityId, String targetEntityId) Registers a deep copy of the source entity with the given target entity id.void
registerContentDefinition
(org.opencms.ade.contenteditor.shared.CmsContentDefinition definition) Registers the given content definition.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.void
saveAndDeleteEntities
(boolean clearOnSuccess, I_CmsSimpleCallback<Boolean> callback) Saves the given entities.void
saveAndDeleteEntities
(org.opencms.acacia.shared.CmsEntity lastEditedEntity, List<String> deletedEntites, boolean clearOnSuccess, I_CmsSimpleCallback<Boolean> callback) Saves the given entities.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.static boolean
setEditable
(com.google.gwt.dom.client.Element element, String serverId, boolean editable) Sets all annotated child elements editable.void
setShowEditorHelp
(boolean show) Sets the show editor help flag to the user session.void
unregistereEntity
(String entityId) Removes the given entity from the entity VIE store.Methods inherited from class org.opencms.acacia.client.CmsEditorBase
addEntityChangeHandler, addOverlayClickHandler, addValidationChangeHandler, destroyForm, getCurrentEntity, getFormTabs, getMessageForKey, getRootAttributeHandler, getValidationHandler, getWidgetService, hasDictionary, initEditOverlay, loadContentDefinition, markForInlineFocus, onRpcError, registerContentDefinition, reinitWidgets, removeEditOverlays, renderEntityForm, renderEntityForm, renderInlineEntity, rerenderForm, saveEntities, saveEntities, saveEntity, saveEntity, saveEntity, setDictionary, shouldFocusOnInlineEdit, updateHtml, updateOverlayPosition
-
Field Details
-
EDITOR_MARKER_CLASS
CSS marker class added to the html element when the editor is active.- See Also:
-
m_callingChangeHandlers
Flag indicating that an AJAX call for the editor change handler is running. -
m_locale
The current content locale. -
m_onClose
The on close call back. -
m_toolbar
The edit tool-bar.
-
-
Method Details
-
addEntityChangeListener
public static void addEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope) Adds an entity change listener.- Parameters:
changeListener
- the change listenerchangeScope
- the change scope
-
getClientIdForEditable
Gets the client id for the editable element.- Parameters:
editableData
- the editable element- Returns:
- the client id for the editable element
-
getEntity
Returns the currently edited entity.- Returns:
- the currently edited entity
-
getInstance
Returns the in-line editor instance.- Returns:
- the in-line editor instance
-
hasEditable
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
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 elementoldId
- the old idnewId
- 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 elementserverId
- the editable resource structure ideditable
-true
to enable editing- Returns:
true
if the element had editable elements
-
closeEditor
Closes the editor.May be used from outside the editor module.
-
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
Description copied from class:CmsEditorBase
Returns the content service instance.- Overrides:
getService
in classCmsEditorBase
- Returns:
- the content service
- See Also:
-
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 contextelementId
- the element idlocale
- the content localepanel
- the element panelmainLocale
- the main language to copy in case the element language node does not exist yetloadTime
- the time when the requested resource was loadedonClose
- 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
Registers a deep copy of the source entity with the given target entity id.- Parameters:
sourceEntityId
- the source entity idtargetEntityId
- the target entity id
-
saveAndDeleteEntities
Saves the given entities.- Parameters:
clearOnSuccess
-true
to clear the VIE instance on successcallback
- 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 contentcontentPath
- the xpath for which to set the valuelocale
- the locale for which to set the valuevalue
- the new valueasyncCallback
- the callback for the result
-
setShowEditorHelp
Sets the show editor help flag to the user session.- Parameters:
show
- the show editor help flag
-
unregistereEntity
Removes the given entity from the entity VIE store.- Parameters:
entityId
- the entity id
-
clearEditor
Description copied from class:CmsEditorBase
Clears the editor.- Overrides:
clearEditor
in classCmsEditorBase
- See Also:
-
getContext
Gets the editor context.- Returns:
- the editor context
-
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 classCmsEditorBase
- Returns:
- the context URI
- See Also:
-
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 classCmsEditorBase
- 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
-