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 Summary
Fields Modifier and Type Field Description static java.lang.String
EDITOR_MARKER_CLASS
CSS marker class added to the html element when the editor is active.protected boolean
m_callingChangeHandlers
Flag indicating that an AJAX call for the editor change handler is running.protected java.lang.String
m_locale
The current content locale.protected I_CmsEditorCloseHandler
m_onClose
The on close call back.protected CmsToolbar
m_toolbar
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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addEntityChangeListener(I_CmsEntityChangeListener changeListener, java.lang.String changeScope)
Adds an entity change listener.protected void
clearEditor()
Clears the editor.void
closeEditor()
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 java.lang.String
getClientIdForEditable(I_CmsEditableData editableData)
Gets the client id for the editable element.protected CmsEditorContext
getContext()
Gets the editor context.protected java.lang.String
getContextUri()
Returns the context URI.static org.opencms.acacia.shared.CmsEntity
getEntity()
Returns the currently edited entity.protected java.lang.String
getEntityId()
Gets the entity id.protected java.lang.String
getHtmlContextInfo()
Returns the in-line HTML context info.static CmsContentEditor
getInstance()
Returns the in-line editor instance.org.opencms.ade.contenteditor.shared.rpc.I_CmsContentServiceAsync
getService()
Returns the content service instance.protected java.util.Collection<java.lang.String>
getSkipPaths()
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(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.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, java.lang.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(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.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.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.void
openStandAloneFormEditor(CmsEditorContext context)
Opens the form based editor.void
registerClonedEntity(java.lang.String sourceEntityId, java.lang.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, 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.void
saveAndDeleteEntities(boolean clearOnSuccess, I_CmsSimpleCallback<java.lang.Boolean> callback)
Saves the given entities.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.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.static boolean
setEditable(com.google.gwt.dom.client.Element element, java.lang.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(java.lang.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 Detail
-
EDITOR_MARKER_CLASS
public static final java.lang.String EDITOR_MARKER_CLASS
CSS marker class added to the html element when the editor is active.- See Also:
- Constant Field Values
-
m_callingChangeHandlers
protected boolean m_callingChangeHandlers
Flag indicating that an AJAX call for the editor change handler is running.
-
m_locale
protected java.lang.String m_locale
The current content locale.
-
m_onClose
protected I_CmsEditorCloseHandler m_onClose
The on close call back.
-
m_toolbar
protected CmsToolbar m_toolbar
The edit tool-bar.
-
-
Method Detail
-
addEntityChangeListener
public static void addEntityChangeListener(I_CmsEntityChangeListener changeListener, java.lang.String changeScope)
Adds an entity change listener.- Parameters:
changeListener
- the change listenerchangeScope
- 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
-
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, 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 elementoldId
- the old idnewId
- 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 elementserverId
- the editable resource structure ideditable
-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 classCmsEditorBase
- Returns:
- the content service
- See Also:
CmsEditorBase.getService()
-
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 ideditedEntity
- the currently edited entitycallback
- 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, java.lang.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 idnewLink
- the new linkmodelFileId
- the model file idpostCreateHandler
- the post-create handler class name (optional)mode
- the content creation modemainLocale
- the main language to copy in case the element language node does not exist yeteditHandlerData
- the data for the edit handler, if one is used to create a new content; null otherwisesettingPresets
- the presets for container element settingseditorStylesheet
- the path for the editor style sheet (may be null)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 ideditedEntity
- the currently edited entitycallback
- 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 contextlocale
- the content localeelementId
- the element idclientId
- the container element client id if availablenewLink
- the new linkmodelFileId
- the model file idpostCreateHandler
- the post-create handler class (optional)mode
- the content creation modemainLocale
- the main language to copy in case the element language node does not exist yeteditHandlerData
- the edit handler data, if we are using an edit handler to create a new element; null otherwiseonClose
- 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 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
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 idtargetEntityId
- 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 successcallback
- 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 entitydeletedEntites
- the deleted entity id'sclearOnSuccess
-true
to clear the VIE instance on successcallback
- 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 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
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
-
clearEditor
protected void clearEditor()
Description copied from class:CmsEditorBase
Clears the editor.- Overrides:
clearEditor
in classCmsEditorBase
- See Also:
CmsEditorBase.clearEditor()
-
getContext
protected CmsEditorContext getContext()
Gets the editor context.- Returns:
- the editor context
-
getContextUri
protected java.lang.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 classCmsEditorBase
- Returns:
- the context URI
- See Also:
CmsEditorBase.getContextUri()
-
getEntityId
protected java.lang.String getEntityId()
Gets the entity id.- Returns:
- the entity id
-
getHtmlContextInfo
protected java.lang.String 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:
CmsEditorBase.getHtmlContextInfo()
-
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
-
-