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
FieldsModifier and TypeFieldDescriptionstatic final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.static final StringMessage constant for key in the resource bundle.protected I_CmsEntityBackendThe entity back-end instance.protected StringThe id of the edited entity. -
Constructor Summary
ConstructorsConstructorDescriptionCmsEditorBase(org.opencms.acacia.shared.rpc.I_CmsContentServiceAsync service, I_CmsWidgetService widgetService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntityChangeHandler(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.HandlerRegistrationaddOverlayClickHandler(com.google.gwt.event.dom.client.ClickHandler handler) Adds a click handler to the edit overlay.com.google.gwt.event.shared.HandlerRegistrationaddValidationChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<CmsValidationContext> handler) Adds a validation change handler.protected voidClears the editor.voiddestroyForm(boolean clearEntities) Destroys the form and related resources.protected StringReturns the context URI.org.opencms.acacia.shared.CmsEntityReturns the currently edited entity.Returns editor form tabs or null in case no tabs are used.protected StringReturns the in-line HTML context info.static StringgetMessageForKey(String key, Object... args) Returns the formated message.protected CmsRootHandlerReturns the root attribute handler.org.opencms.acacia.shared.rpc.I_CmsContentServiceAsyncReturns the content service instance.protected CmsValidationHandlerReturns the validation handler.protected I_CmsWidgetServiceReturns the widget service.static booleanReturns if the messages dictionary is set.protected voidinitEditOverlay(com.google.gwt.dom.client.Element element) Initializes the edit overlay to be positioned around the given element.voidloadContentDefinition(String entityId, com.google.gwt.user.client.Command callback) Loads the content definition for the given entity and executes the callback on success.static voidmarkForInlineFocus(com.google.gwt.dom.client.Element element) Marks the given element to receive focus once the inline editing is initialized.protected voidonRpcError(Throwable caught) Handles RPC errors.voidregisterContentDefinition(org.opencms.acacia.shared.CmsContentDefinition definition) Registers the types and entities of the given content definition.voidreinitWidgets(I_CmsInlineFormParent formParent) Reinitializes the editing widget inside the form parent.protected voidRemoves the edit overlay from the DOM.voidrenderEntityForm(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.voidrenderEntityForm(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.voidrenderInlineEntity(String entityId, I_CmsInlineFormParent formParent) Renders the entity form within the given context.voidrerenderForm(org.opencms.acacia.shared.CmsEntity newContent) Re-renders the form with the given entity data.voidsaveEntities(List<org.opencms.acacia.shared.CmsEntity> entities, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entities.voidsaveEntities(Set<String> entityIds, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.voidsaveEntity(String entityId, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.voidsaveEntity(String entityId, com.google.gwt.user.client.Command callback) Saves the given entity.voidsaveEntity(org.opencms.acacia.shared.CmsEntity entity, boolean clearOnSuccess, com.google.gwt.user.client.Command callback) Saves the given entity.static voidsetDictionary(com.google.gwt.i18n.client.Dictionary dictionary) Sets the m_dictionary.static booleanshouldFocusOnInlineEdit(com.google.gwt.dom.client.Element element) Checks whether the given element is marked to receive focus once the inline editing is initialized.voidupdateHtml(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 voidUpdates 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:
trueif 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:
trueif 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-trueto 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_CmsInlineHtmlUpdateHandlerReinitializes the editing widget inside the form parent.- Specified by:
reinitWidgetsin 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-trueto 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-trueto 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-trueto 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_CmsInlineHtmlUpdateHandlerUpdates the HTML inside the form parent according to the currently edited entiy data.- Specified by:
updateHtmlin 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.
-