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
FieldsModifier and TypeFieldDescriptionstatic final StringCSS marker class added to the html element when the editor is active.protected booleanFlag indicating that an AJAX call for the editor change handler is running.protected StringThe current content locale.protected I_CmsEditorCloseHandlerThe on close call back.protected CmsToolbarThe 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 voidaddEntityChangeListener(I_CmsEntityChangeListener changeListener, String changeScope) Adds an entity change listener.protected voidClears the editor.voidCloses the editor.voidfixFocus()Bypasses a focus bug in IE which can happen if the user opens the HTML code editor from the WYSIWYG editor.static StringgetClientIdForEditable(I_CmsEditableData editableData) Gets the client id for the editable element.protected CmsEditorContextGets the editor context.protected StringReturns the context URI.static org.opencms.acacia.shared.CmsEntityReturns the currently edited entity.protected StringGets the entity id.protected StringReturns the in-line HTML context info.static CmsContentEditorReturns the in-line editor instance.org.opencms.ade.contenteditor.shared.rpc.I_CmsContentServiceAsyncReturns the content service instance.protected Collection<String> Returns the paths to be skipped when synchronizing locale independent fields.static booleanhasEditable(com.google.gwt.dom.client.Element element) Returns if the given element or it's descendants are inline editable.static booleanisEditable(com.google.gwt.dom.client.Element element) Checks whether the given element is annotated for inline editing.voidloadDefinition(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.voidloadInitialDefinition(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.voidloadNewDefinition(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.voidopenFormEditor(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.voidopenInlineEditor(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.voidopenStandAloneFormEditor(CmsEditorContext context) Opens the form based editor.voidregisterClonedEntity(String sourceEntityId, String targetEntityId) Registers a deep copy of the source entity with the given target entity id.voidregisterContentDefinition(org.opencms.ade.contenteditor.shared.CmsContentDefinition definition) Registers the given content definition.static voidreplaceResourceIds(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.voidsaveAndDeleteEntities(boolean clearOnSuccess, I_CmsSimpleCallback<Boolean> callback) Saves the given entities.voidsaveAndDeleteEntities(org.opencms.acacia.shared.CmsEntity lastEditedEntity, List<String> deletedEntites, boolean clearOnSuccess, boolean failOnWarnings, I_CmsSimpleCallback<Boolean> callback) Saves the given entities.voidsaveValue(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 booleansetEditable(com.google.gwt.dom.client.Element element, String serverId, boolean editable) Sets all annotated child elements editable.voidsetShowEditorHelp(boolean show) Sets the show editor help flag to the user session.voidunregistereEntity(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:
trueif the element has editable descendants
-
isEditable
Checks whether the given element is annotated for inline editing.- Parameters:
element- the element to check- Returns:
trueif 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-trueto enable editing- Returns:
trueif 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:CmsEditorBaseReturns the content service instance.- Overrides:
getServicein 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-trueto 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:CmsEditorBaseClears the editor.- Overrides:
clearEditorin classCmsEditorBase- See Also:
-
getContext
Gets the editor context.- Returns:
- the editor context
-
getContextUri
Description copied from class:CmsEditorBaseReturns the context URI.Needed when updating the HTML due to content data changes.
Override to supply the required info.
- Overrides:
getContextUriin classCmsEditorBase- Returns:
- the context URI
- See Also:
-
getEntityId
Gets the entity id.- Returns:
- the entity id
-
getHtmlContextInfo
Description copied from class:CmsEditorBaseReturns the in-line HTML context info.Needed when updating the HTML due to content data changes.
Override to supply the required info.
- Overrides:
getHtmlContextInfoin 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
-