Package org.opencms.acacia.client
Class CmsEditorBase
java.lang.Object
org.opencms.acacia.client.CmsEditorBase
- All Implemented Interfaces:
I_CmsInlineHtmlUpdateHandler
- Direct Known Subclasses:
CmsContentEditor
The content editor base.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.static final String
Message constant for key in the resource bundle.protected I_CmsEntityBackend
The entity back-end instance.protected String
The id of the edited entity. -
Constructor Summary
ConstructorDescriptionCmsEditorBase
(org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync service, I_CmsWidgetService widgetService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntityChangeHandler
(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
Clears the editor.void
destroyForm
(boolean clearEntities) Destroys the form and related resources.protected String
Returns the context URI.org.opencms.acacia.shared.CmsEntity
Returns the currently edited entity.Returns editor form tabs or null in case no tabs are used.protected String
Returns the in-line HTML context info.static String
getMessageForKey
(String key, Object... args) Returns the formated message.protected CmsRootHandler
Returns the root attribute handler.org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync
Returns the content service instance.protected CmsValidationHandler
Returns the validation handler.protected I_CmsWidgetService
Returns the widget service.static boolean
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
(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
(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
Removes the edit overlay from the DOM.void
renderEntityForm
(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
(String entityId, 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
(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
(List<org.opencms.acacia.shared.CmsEntity> entities, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entities.void
saveEntities
(Set<String> entityIds, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.void
saveEntity
(String entityId, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.void
saveEntity
(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
Updates the edit overlay position.
-
Field Details
-
GUI_CHOICE_ADD_CHOICE_1
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_ADD_1
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_CLOSE_0
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_DELETE_1
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_EDIT_1
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_MOVE_1
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_MOVE_DOWN_0
Message constant for key in the resource bundle.- See Also:
-
GUI_VIEW_MOVE_UP_0
Message constant for key in the resource bundle.- See Also:
-
m_entityBackend
The entity back-end instance. -
m_entityId
The id of the edited entity.
-
-
Constructor Details
-
Method Details
-
getMessageForKey
Returns the formated message.- Parameters:
key
- the message keyargs
- the parameters to insert into the placeholders- Returns:
- the formated message
-
hasDictionary
Returns if the messages dictionary is set.- Returns:
true
if the messages dictionary is set
-
markForInlineFocus
Marks the given element to receive focus once the inline editing is initialized.- Parameters:
element
- the element to mark
-
setDictionary
Sets the m_dictionary.- Parameters:
dictionary
- the m_dictionary to set
-
shouldFocusOnInlineEdit
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
-
destroyForm
Destroys the form and related resources. Also clears all entities from the entity back-end- Parameters:
clearEntities
-true
to also clear all entities
-
getCurrentEntity
Returns the currently edited entity.- Returns:
- the currently edited entity
-
getFormTabs
Returns editor form tabs or null in case no tabs are used.- Returns:
- the editor form tabs
-
getService
Returns the content service instance.- Returns:
- the content service
-
loadContentDefinition
Loads the content definition for the given entity and executes the callback on success.- Parameters:
entityId
- the entity idcallback
- the callback
-
reinitWidgets
Description copied from interface:I_CmsInlineHtmlUpdateHandler
Reinitializes the editing widget inside the form parent.- Specified by:
reinitWidgets
in interfaceI_CmsInlineHtmlUpdateHandler
- Parameters:
formParent
- the form parent- See Also:
-
renderEntityForm
public void renderEntityForm(String entityId, 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 idtabInfos
- the tab informationscontext
- the context elementscrollParent
- the scroll element to be used for automatic scrolling during drag and drop
-
renderEntityForm
public void renderEntityForm(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 idcontext
- the context elementscrollParent
- the scroll element to be used for automatic scrolling during drag and drop
-
renderInlineEntity
Renders the entity form within the given context.- Parameters:
entityId
- the entity idformParent
- the form parent widget
-
saveEntities
public void saveEntities(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 saveclearOnSuccess
-true
to clear the entity back-end instance on successcallback
- the call back command
-
saveEntities
public void saveEntities(Set<String> entityIds, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.- Parameters:
entityIds
- the entity idsclearOnSuccess
-true
to clear all entities from entity back-end on successcallback
- the callback executed on success
-
saveEntity
public void saveEntity(String entityId, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.- Parameters:
entityId
- the entity idclearOnSuccess
-true
to clear all entities from entity back-end on successcallback
- the callback executed on success
-
saveEntity
Saves the given entity.- Parameters:
entityId
- the entity idcallback
- the callback executed on success
-
updateHtml
public void updateHtml(I_CmsInlineFormParent formParent, com.google.gwt.user.client.Command onSuccess) Description copied from interface:I_CmsInlineHtmlUpdateHandler
Updates the HTML inside the form parent according to the currently edited entiy data.- Specified by:
updateHtml
in interfaceI_CmsInlineHtmlUpdateHandler
- Parameters:
formParent
- the form parentonSuccess
- the callback to execute on success- See Also:
-
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
Clears the editor. -
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
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
-
getRootAttributeHandler
Returns the root attribute handler.- Returns:
- the root attribute handler
-
getValidationHandler
Returns the validation handler.- Returns:
- the validation handler
-
getWidgetService
Returns the widget service.- Returns:
- the widget service
-
initEditOverlay
Initializes the edit overlay to be positioned around the given element.- Parameters:
element
- the element
-
onRpcError
Handles RPC errors.Override this for better error handling
- Parameters:
caught
- the error caught from the RPC
-
removeEditOverlays
Removes the edit overlay from the DOM. -
updateOverlayPosition
Updates the edit overlay position.
-