Class CmsContainerpageController
java.lang.Object
org.opencms.ade.containerpage.client.CmsContainerpageController
Data provider for the container-page editor. All data concerning the container-page is requested and maintained by this provider.
- Since:
- 8.0.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enum which is used to control how elements are removed from the page.static interface
Wrapper for the event details object for custom page editor events.static interface
Visitor interface used to process the current container content on the page.static interface
Interface for classes that should be notified when container page elements are reloaded.protected class
Visitor implementation which is used to gather the container contents for saving.static class
This visitor implementation checks whether there are other elements in the current page which correspond to the same VFS resource as a given container element.protected class
Visitor implementation which is used to gather the container contents for saving. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The client side id/setting-hash seperator.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.static final String
Custom event name.The container element data.The new element data by resource type name.static final String
CSS class on the body to signal whether we are currently editing a group container.static final String
Parameter name. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a handler for container page events.protected void
addElements
(List<org.opencms.ade.containerpage.shared.CmsContainerElementData> elements) Adds the given element data to the element cache.protected void
addElements
(Map<String, org.opencms.ade.containerpage.shared.CmsContainerElementData> elements) Adds the given element data to the element cache.void
addToFavoriteList
(String clientId) Adds an element specified by it's id to the favorite list.void
addToRecentList
(String clientId, Runnable nextAction) Adds an element specified by it's id to the recent list.protected void
askWhetherRemovedElementShouldBeDeleted
(org.opencms.ade.containerpage.shared.CmsRemovedElementStatus status) Asks the user whether an element which has been removed should be deleted.void
checkNewWidgetsAvailable
(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<Boolean> resultCallback) Checks whether GWT widgets are available for all fields of a content.protected void
Checks that a removed can be possibly deleted and if so, asks the user if it should be deleted.void
checkReuse
(CmsContainerPageElementPanel elementWidget, Runnable action) Checks reuse status of a container element, then shows a warning dialog if it is reused, and finally executes an action.void
Checks for container elements that are no longer present within the DOM.void
copyElement
(String id, I_CmsSimpleCallback<org.opencms.util.CmsUUID> callback) Copies an element and asynchronously returns the structure id of the copy.void
createAndEditNewElement
(CmsContainerPageElementPanel element, boolean inline) Creates a new resource for crag container elements with the status new and opens the content editor.void
createAndEditNewElement
(CmsContainerPageElementPanel element, org.opencms.util.CmsUUID modelResourceStructureId) Creates a new resource for drag container elements with the status new and opens the content editor.Creates the details object for a custom page editor event based on the given container page element.void
createNewElement
(CmsContainerPageElementPanel element, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.ade.containerpage.shared.CmsContainerElement> callback) Creates a new element.protected void
Disables option and toolbar buttons.void
deleteElement
(String elementId, String relatedElementId) Deletes an element from the VFS, removes it from all containers and the client side cache.void
disableInlineEditing
(CmsContainerPageElementPanel notThisOne) Disables the inline editing for all content elements but the given one.void
enableFavoriteEditing
(boolean enable, I_CmsDNDController dndController) Enables the favorites editing drag and drop controller.void
executeCopyModelReplace
(String originalElementId, com.google.gwt.dom.client.Element modelGroupParent, org.opencms.ade.containerpage.shared.CmsContainerElementData elementData) Replaces all element instances of the original element with the new element within the former copy model.void
fireEvent
(CmsContainerpageEvent event) Fires an event on the core event bus.static CmsContainerpageController
get()
Returns the data provider instance.protected List<CmsContainerPageElementPanel>
getAllContainerPageElements
(boolean includeGroupContents) Helper method to get all current container page elements.Returns all drag elements of the page.org.opencms.ade.containerpage.shared.CmsContainerElementData
getCachedElement
(String clientId) Returns the data for the requested element, ornull
if the element has not been cached yet.org.opencms.ade.containerpage.shared.CmsContainerElementData
getCachedNewElement
(String resourceTypeName) Returns the data for the requested element, ornull
if the element has not been cached yet.org.opencms.ade.containerpage.shared.CmsContainer
getContainer
(String containerName) Returns the container data of container with the given name.com.google.common.base.Optional<CmsContainerPageElementPanel>
getContainerElementWidgetForElement
(com.google.gwt.dom.client.Element element) Gets the container element widget to which the given element belongs, or Optional.absent if none could be found.org.opencms.gwt.shared.CmsGalleryContainerInfo
Gets the container info to send to the gallery service.org.opencms.ade.containerpage.shared.rpc.I_CmsContainerpageServiceAsync
Returns the container-page RPC service.Returns theCmsContainerpageUtil
.Returns the containers.getContainerTarget
(String containerName) Returns the container drag target by name (HTML id attribute).Returns a map of the container drag targets.getContainerType
(String containerName) Returns the type of container with the given name.Returns the XML content editor handler.protected org.opencms.gwt.shared.rpc.I_CmsCoreServiceAsync
Returns the core RPC service.static String
Returns the current URI.org.opencms.ade.containerpage.shared.CmsCntPageData
getData()
Returns the prefetched data.void
getDeleteOptions
(String clientId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Returns the delete options for the given content element.Gets the DND controller.Returns the drag and drop handler.void
getEditOptions
(String clientId, boolean isListElement, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Returns the edit options for the given content element.void
getElementForDragAndDropFromContainer
(String clientId, String containerId, boolean alwaysCopy, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Requests the data for a container element specified by the client id for drag and drop from a container.void
getElements
(Set<String> clientIds, I_CmsSimpleCallback<Map<String, org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Requests the data for container elements specified by the client id.void
getElementSettingsConfig
(String clientId, String containerId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsElementSettingsConfig> callback) Requests the element settings config data for a container element specified by the client id.org.opencms.ade.containerpage.shared.CmsElementViewInfo
Returns the current element view.void
getElementWithSettings
(String clientId, Map<String, String> settings, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Retrieves a container element with a given set of settings.Returns the group-container element being edited.Returns the id of the currently edited group-container.protected A_CmsGroupEditor
Returns the currently active group editor.Returns the container-page handler.long
Returns the time off page load.protected String
Returns the content locale.Gets the lock error message.Returns the model group base element id.Collects all container elements which are model groups.void
getNewElement
(String resourceType, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Returns the element data for a resource type representing a new element.void
getNewOptions
(String clientId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Fetches the options for creating a new element from the edit handler.protected List<org.opencms.ade.containerpage.shared.CmsContainer>
Gets the page content for purposes of saving.protected List<org.opencms.ade.containerpage.shared.CmsContainer>
Returns the containers of the page in their current state.protected String
Returns the request parameters of the displayed container-page.Produces the "return code", which is needed to return to the current page from the sitemap.org.opencms.ade.containerpage.shared.CmsContainer
getSerializedContainer
(String data) Returns the deserialized element data.org.opencms.ade.containerpage.shared.CmsContainerElement
getSerializedElement
(String data) Returns the deserialized element data.static String
getServerId
(String clientId) Returns the server id for a given client element id.Gets the handler for small elements.org.opencms.ade.containerpage.shared.CmsElementViewInfo
Gets the view with the given id.void
handleChangeTemplateContext
(CmsContainerPageElementPanel element, String newValue) Handler that gets called when the template context setting of an element was changed by the user.void
Asks the user for confirmation before removing a container page element.void
handleDelete
(String clientId, String deleteOption, I_CmsSimpleCallback<Void> callback) Calls the edit handler to handle the delete action.boolean
Returns if the selection button is active.protected boolean
Checks if any of the containers are nested containers.boolean
Returns if the page has changed.void
Hides list collector direct edit buttons, if present.void
init
(CmsContainerpageHandler handler, CmsDNDHandler dndHandler, CmsContentEditorHandler contentEditorHandler, CmsContainerpageUtil containerpageUtil) Initializes the controller.void
initializeSubContainers
(CmsContainerPageElementPanel containerElement) Checks for element sub containers.static boolean
Checks whether element removal should be confirmed.boolean
isContainerEditable
(I_CmsDropContainer dragParent) Returns if the given container is editable.boolean
Returns the flag indicating that a content element is being edited.boolean
Returns if this page displays a detail view.boolean
Checks if the page editing features should be disabled.boolean
Returns if a group-container is currently being edited.boolean
isInlineEditable
(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) Checks whether the given element should be inline editable.protected boolean
isRootContainer
(org.opencms.ade.containerpage.shared.CmsContainer container) Returns whether the given container is considered a root container.void
leaveUnsaved
(String targetUri) Method to leave the page without saving.void
loadContextMenu
(org.opencms.util.CmsUUID structureId, org.opencms.gwt.shared.CmsCoreData.AdeContext context) Loads the context menu entries.void
loadFavorites
(I_CmsSimpleCallback<List<org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Loads the favorite list and adds the elements to the favorite list widget of the tool-bar menu.void
loadRecent
(I_CmsSimpleCallback<List<org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Loads the recent list and adds the elements to the recent list widget of the tool-bar menu.void
lockContainerpage
(I_CmsSimpleCallback<Boolean> callback) Locks the container-page.boolean
matchRootView
(org.opencms.util.CmsUUID viewIdFromElement) Returns true if the view with the given view id and the current view have the same root view.void
onLockFail
(String lockError) This method should be called when locking the page has failed.void
This method should be called when locking the page has succeeded.void
Handler which is executed when the window closes.protected void
openEditorForNewElement
(CmsContainerPageElementPanel element, org.opencms.ade.containerpage.shared.CmsContainerElement newElementData, boolean inline) Opens the editor for the newly created element.void
prepareForEdit
(String clientId, String editOption, I_CmsSimpleCallback<org.opencms.util.CmsUUID> callback) Calls the edit handler to prepare the given content element for editing.protected void
previewNativeEvent
(com.google.gwt.user.client.Event.NativePreviewEvent event) Previews events.protected void
Iterates over all the container contents and calls a visitor object with the visited containers/elements as parameters.void
Reinitializes the buttons in the container element menus.void
Re-initializes the inline editing.void
reloadElements
(String[] ids, Runnable callback) Reloads the content for the given element and all related elements.void
reloadElements
(String[] ids, CmsContainerpageController.I_ReloadHandler callback) Reloads the content for the given element and all related elements.void
reloadElements
(Collection<String> ids, Runnable callback) Reloads the content for the given elements and related elements.void
reloadElements
(Collection<String> ids, CmsContainerpageController.I_ReloadHandler callback) Reloads the content for the given elements and related elements.void
reloadElementWithSettings
(CmsContainerPageElementPanel elementWidget, String clientId, Map<String, String> settings, CmsContainerpageController.I_ReloadHandler reloadHandler) Reloads a container page element with a new set of settings.void
Reloads the page.protected void
removeContainerElements
(String resourceId) Removes all container elements with the given id from all containers and the client side cache.void
removeElement
(CmsContainerPageElementPanel dragElement) Removes the given container element from its parent container.void
removeElement
(CmsContainerPageElementPanel dragElement, CmsContainerpageController.ElementRemoveMode removeMode) Removes the given container element from its parent container.replaceContainerElement
(CmsContainerPageElementPanel containerElement, org.opencms.ade.containerpage.shared.CmsContainerElementData elementData) Replaces the given drag-element with the given container element.void
replaceElement
(CmsContainerPageElementPanel elementWidget, String elementId, Runnable callback) Replaces the given element with another content while keeping it's settings.void
replaceElement
(CmsContainerPageElementPanel elementWidget, String elementId, CmsContainerpageController.I_ReloadHandler handler) Replaces the given element with another content while keeping it's settings.boolean
requiresOptionBar
(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) Checks whether the given element should display the option bar.void
Resets all edit buttons an there positions.void
Resets the container-page.void
saveAndLeave
(com.google.gwt.user.client.Command leaveCommand) Method to save and leave the page.void
saveAndLeave
(String targetUri) Method to save and leave the page.void
saveClipboardTab
(int tabIndex) Saves the clipboard tab index selected by the user.void
saveContainerpage
(Runnable... afterSaveActions) Saves the current state of the container-page.void
saveFavoriteList
(List<String> clientIds) Saves the favorite list.void
saveGroupcontainer
(org.opencms.ade.containerpage.shared.CmsGroupContainer groupContainer, CmsGroupContainerElementPanel groupContainerElement) Saves the group-container.void
saveInheritContainer
(org.opencms.ade.containerpage.shared.CmsInheritanceContainer inheritanceContainer, CmsGroupContainerElementPanel groupContainerElement) Saves the inheritance container.protected void
Schedules an update of the gallery data according to the current element view and the editable containers.void
sendDragFinished
(com.google.gwt.dom.client.Element dragElement, com.google.gwt.dom.client.Element target, boolean isNew) Sends the ocDragFinished event.void
sendDragStarted
(boolean isNew) Sends the ocDragStarted event.void
Sends the custom 'ocElementAdded' event for added container elements.void
Sends the custom 'ocElementDeleted' event for a deleted container element.void
sendElementEditedContent
(CmsContainerPageElementPanel widget, elemental2.dom.Element replacedElement, boolean wasNew) Sends the custom 'ocElementEditedContent' event for an edited container element.void
sendElementEditedSettings
(CmsContainerPageElementPanel widget, CmsContainerPageElementPanel replacedWidget) Sends the custom 'ocElementEditedSettings' event for an edited container element.void
Sends the custom 'ocElementMoved' event for a moved container element.void
setContentEditing
(boolean isContentEditing) Sets the flag indicating that a content element is being edited.void
Sets the DND controller.void
setElementView
(org.opencms.ade.containerpage.shared.CmsElementViewInfo viewInfo, Runnable nextAction) Sets the element view.void
setModelGroupElementId
(String modelGroupElementId) Sets the model group base element id.protected void
setPageChanged
(boolean changed, boolean unlock) Sets the page changed flag and initializes the window closing handler if necessary.void
setPageChanged
(Runnable... nextActions) Marks the page as changed.void
setPreviewHandler
(com.google.gwt.user.client.Event.NativePreviewHandler handler) Sets an alternative event preview handler.boolean
shouldShowInContext
(org.opencms.ade.containerpage.shared.CmsContainerElementData elementData) Method to determine whether a container element should be shown in the current template context.void
startEditingGroupcontainer
(CmsGroupContainerElementPanel groupContainer, boolean isElementGroup) Tells the controller that group-container editing has started.void
Starts the publish lock check.void
Tells the controller that group-container editing has stopped.protected void
Asynchronously unlocks the container page.boolean
unlockResource
(org.opencms.util.CmsUUID structureId) Unlocks the given resource.void
Updates he
-
Field Details
-
CLIENT_ID_SEPERATOR
The client side id/setting-hash seperator.- See Also:
-
EVENT_DRAG
Custom event name.- See Also:
-
EVENT_DRAG_FINISHED
Custom event name.- See Also:
-
EVENT_DRAG_STARTED
Custom event name.- See Also:
-
EVENT_ELEMENT_ADDED
Custom event name.- See Also:
-
EVENT_ELEMENT_DELETED
Custom event name.- See Also:
-
EVENT_ELEMENT_EDITED
Custom event name.- See Also:
-
EVENT_ELEMENT_EDITED_CONTENT
Custom event name.- See Also:
-
EVENT_ELEMENT_EDITED_SETTINGS
Custom event name.- See Also:
-
EVENT_ELEMENT_MODIFIED
Custom event name.- See Also:
-
EVENT_ELEMENT_MOVED
Custom event name.- See Also:
-
OC_EDITING_GROUPCONTAINER
CSS class on the body to signal whether we are currently editing a group container.- See Also:
-
PARAM_REMOVEMODE
Parameter name.- See Also:
-
m_elements
The container element data. All requested elements will be cached here. -
m_newElements
The new element data by resource type name.
-
-
Constructor Details
-
CmsContainerpageController
public CmsContainerpageController()Constructor.
-
-
Method Details
-
get
Returns the data provider instance.- Returns:
- the data provider
-
getCurrentUri
Returns the current URI.- Returns:
- the current URI
-
getServerId
Returns the server id for a given client element id.- Parameters:
clientId
- the client id including an optional element settings hash- Returns:
- the server id
-
isConfirmRemove
Checks whether element removal should be confirmed.- Returns:
- true if element removal should be confirmed
-
addContainerpageEventHandler
Adds a handler for container page events.- Parameters:
handler
- the handler to add
-
addToFavoriteList
Adds an element specified by it's id to the favorite list.- Parameters:
clientId
- the element id
-
addToRecentList
Adds an element specified by it's id to the recent list.- Parameters:
clientId
- the element idnextAction
- the action to execute after the element has been added
-
checkNewWidgetsAvailable
public void checkNewWidgetsAvailable(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<Boolean> resultCallback) Checks whether GWT widgets are available for all fields of a content.- Parameters:
structureId
- the structure id of the contentresultCallback
- the callback for the result
-
checkReuse
Checks reuse status of a container element, then shows a warning dialog if it is reused, and finally executes an action.- Parameters:
elementWidget
- the container element for which to check the reuse statusaction
- the action to execute after the reuse warning dialog is closed
-
cleanUpContainers
Checks for container elements that are no longer present within the DOM. -
copyElement
Copies an element and asynchronously returns the structure id of the copy.- Parameters:
id
- the element idcallback
- the callback for the result
-
createAndEditNewElement
Creates a new resource for crag container elements with the status new and opens the content editor.- Parameters:
element
- the container elementinline
-true
to open the inline editor for the given element if available
-
createAndEditNewElement
public void createAndEditNewElement(CmsContainerPageElementPanel element, org.opencms.util.CmsUUID modelResourceStructureId) Creates a new resource for drag container elements with the status new and opens the content editor.- Parameters:
element
- the container elementmodelResourceStructureId
- the model resource structure id
-
createEventDetails
public CmsContainerpageController.I_EventDetails createEventDetails(CmsContainerPageElementPanel widget) Creates the details object for a custom page editor event based on the given container page element.- Parameters:
widget
- a container page element- Returns:
- the event details object
-
createNewElement
public void createNewElement(CmsContainerPageElementPanel element, com.google.gwt.user.client.rpc.AsyncCallback<org.opencms.ade.containerpage.shared.CmsContainerElement> callback) Creates a new element.- Parameters:
element
- the widget belonging to the element which is currently in memory onlycallback
- the callback to call with the result
-
deleteElement
Deletes an element from the VFS, removes it from all containers and the client side cache.- Parameters:
elementId
- the element to deleterelatedElementId
- related element to reload after the element has been deleted
-
disableInlineEditing
Disables the inline editing for all content elements but the given one.- Parameters:
notThisOne
- the content element not to disable
-
enableFavoriteEditing
Enables the favorites editing drag and drop controller.- Parameters:
enable
- iftrue
favorites editing will enabled, otherwise disableddndController
- the favorites editing drag and drop controller
-
fireEvent
Fires an event on the core event bus.- Parameters:
event
- the event to fire
-
getAllDragElements
Returns all drag elements of the page.- Returns:
- the drag elements
-
getCachedElement
public org.opencms.ade.containerpage.shared.CmsContainerElementData getCachedElement(String clientId) Returns the data for the requested element, ornull
if the element has not been cached yet.- Parameters:
clientId
- the element id- Returns:
- the element data
-
getCachedNewElement
public org.opencms.ade.containerpage.shared.CmsContainerElementData getCachedNewElement(String resourceTypeName) Returns the data for the requested element, ornull
if the element has not been cached yet.- Parameters:
resourceTypeName
- the element resource type- Returns:
- the element data
-
getContainer
Returns the container data of container with the given name.- Parameters:
containerName
- the container name- Returns:
- the container data
-
getContainerElementWidgetForElement
public com.google.common.base.Optional<CmsContainerPageElementPanel> getContainerElementWidgetForElement(com.google.gwt.dom.client.Element element) Gets the container element widget to which the given element belongs, or Optional.absent if none could be found.- Parameters:
element
- the element for which the container element widget should be found- Returns:
- the container element widget, or Optional.absent if none can be found
-
getContainerInfoForGalleries
Gets the container info to send to the gallery service.- Returns:
- the container info to send to the gallery service
-
getContainerpageService
public org.opencms.ade.containerpage.shared.rpc.I_CmsContainerpageServiceAsync getContainerpageService()Returns the container-page RPC service.- Returns:
- the container-page service
-
getContainerpageUtil
Returns theCmsContainerpageUtil
.- Returns:
- the containerpage-util
-
getContainers
Returns the containers.- Returns:
- the containers
-
getContainerTarget
Returns the container drag target by name (HTML id attribute).- Parameters:
containerName
- the container name- Returns:
- the drag target
-
getContainerTargets
Returns a map of the container drag targets.- Returns:
- the drag targets
-
getContainerType
Returns the type of container with the given name.- Parameters:
containerName
- the container name- Returns:
- the container type
-
getContentEditorHandler
Returns the XML content editor handler.- Returns:
- the XML content editor handler
-
getData
Returns the prefetched data.- Returns:
- the prefetched data
-
getDeleteOptions
public void getDeleteOptions(String clientId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Returns the delete options for the given content element.- Parameters:
clientId
- the content idcallback
- the callback to execute
-
getDndController
Gets the DND controller.- Returns:
- the DND controller
-
getDndHandler
Returns the drag and drop handler.- Returns:
- the drag and drop handler
-
getEditOptions
public void getEditOptions(String clientId, boolean isListElement, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Returns the edit options for the given content element.- Parameters:
clientId
- the content idisListElement
- in case a list element, not a container element is about to be editedcallback
- the callback to execute
-
getElementForDragAndDropFromContainer
public void getElementForDragAndDropFromContainer(String clientId, String containerId, boolean alwaysCopy, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Requests the data for a container element specified by the client id for drag and drop from a container. The data will be provided to the given call-back function.- Parameters:
clientId
- the element idcontainerId
- the id of the container from which the element is being draggedalwaysCopy
-true
in case reading data for a clipboard element used as a copy groupcallback
- the call-back to execute with the requested data
-
getElements
public void getElements(Set<String> clientIds, I_CmsSimpleCallback<Map<String, org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Requests the data for container elements specified by the client id. The data will be provided to the given call-back function.- Parameters:
clientIds
- the element id'scallback
- the call-back to execute with the requested data
-
getElementSettingsConfig
public void getElementSettingsConfig(String clientId, String containerId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsElementSettingsConfig> callback) Requests the element settings config data for a container element specified by the client id. The data will be provided to the given call-back function.- Parameters:
clientId
- the element idcontainerId
- the parent container idcallback
- the call-back to execute with the requested data
-
getElementView
Returns the current element view.- Returns:
- the current element view
-
getElementWithSettings
public void getElementWithSettings(String clientId, Map<String, String> settings, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Retrieves a container element with a given set of settings.- Parameters:
clientId
- the id of the container elementsettings
- the set of settingscallback
- the callback which should be executed when the element has been loaded
-
getGroupcontainer
Returns the group-container element being edited.- Returns:
- the group-container
-
getGroupcontainerId
Returns the id of the currently edited group-container.- Returns:
- the group-container id, or
null
if no editing is taking place
-
getHandler
Returns the container-page handler.- Returns:
- the container-page handler
-
getLoadTime
Returns the time off page load.- Returns:
- the time stamp
-
getLockErrorMessage
Gets the lock error message.- Returns:
- the lock error message
-
getModelGroupElementId
Returns the model group base element id.- Returns:
- the model group base element id
-
getModelGroups
Collects all container elements which are model groups.- Returns:
- the list of model group container elements
-
getNewElement
public void getNewElement(String resourceType, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsContainerElementData> callback) Returns the element data for a resource type representing a new element.- Parameters:
resourceType
- the resource type namecallback
- the callback to execute with the new element data
-
getNewOptions
public void getNewOptions(String clientId, I_CmsSimpleCallback<org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo> callback) Fetches the options for creating a new element from the edit handler.- Parameters:
clientId
- the client id of the elementcallback
- the callback which is called with the result
-
getReturnCode
Produces the "return code", which is needed to return to the current page from the sitemap.- Returns:
- the return code
-
getSerializedContainer
public org.opencms.ade.containerpage.shared.CmsContainer getSerializedContainer(String data) throws com.google.gwt.user.client.rpc.SerializationException Returns the deserialized element data.- Parameters:
data
- the data to deserialize- Returns:
- the container element
- Throws:
com.google.gwt.user.client.rpc.SerializationException
- if deserialization fails
-
getSerializedElement
public org.opencms.ade.containerpage.shared.CmsContainerElement getSerializedElement(String data) throws com.google.gwt.user.client.rpc.SerializationException Returns the deserialized element data.- Parameters:
data
- the data to deserialize- Returns:
- the container element
- Throws:
com.google.gwt.user.client.rpc.SerializationException
- if deserialization fails
-
getSmallElementsHandler
Gets the handler for small elements.- Returns:
- the small elements handler
-
getView
Gets the view with the given id.- Parameters:
value
- the view id as a string- Returns:
- the view with the given id, or null if no such view is available
-
handleChangeTemplateContext
Handler that gets called when the template context setting of an element was changed by the user.- Parameters:
element
- the element whose template context setting was changednewValue
- the new value of the setting
-
handleConfirmRemove
Asks the user for confirmation before removing a container page element.- Parameters:
element
- the element for which the user should confirm the removal
-
handleDelete
Calls the edit handler to handle the delete action.- Parameters:
clientId
- the content client iddeleteOption
- the selected delete optioncallback
- the callback to execute after the delete
-
hasActiveSelection
Returns if the selection button is active.- Returns:
true
if the selection button is active
-
hasPageChanged
Returns if the page has changed.- Returns:
true
if the page has changed
-
hideEditableListButtons
Hides list collector direct edit buttons, if present. -
init
public void init(CmsContainerpageHandler handler, CmsDNDHandler dndHandler, CmsContentEditorHandler contentEditorHandler, CmsContainerpageUtil containerpageUtil) Initializes the controller.- Parameters:
handler
- the container-page handlerdndHandler
- the drag and drop handlercontentEditorHandler
- the XML content editor handlercontainerpageUtil
- the container-page utility
-
initializeSubContainers
Checks for element sub containers.- Parameters:
containerElement
- the container element
-
isContainerEditable
Returns if the given container is editable.- Parameters:
dragParent
- the parent container- Returns:
true
if the given container is editable
-
isContentEditing
Returns the flag indicating that a content element is being edited.- Returns:
- the flag indicating that a content element is being edited
-
isDetailPage
Returns if this page displays a detail view.- Returns:
true
if this page displays a detail view
-
isEditingDisabled
Checks if the page editing features should be disabled.- Returns:
- true if the page editing features should be disabled
-
isGroupcontainerEditing
Returns if a group-container is currently being edited.- Returns:
true
if a group-container is being edited
-
isInlineEditable
public boolean isInlineEditable(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) Checks whether the given element should be inline editable.- Parameters:
element
- the elementdragParent
- the element parent- Returns:
true
if the element should be inline editable
-
leaveUnsaved
Method to leave the page without saving.- Parameters:
targetUri
- the new URI to call
-
loadFavorites
public void loadFavorites(I_CmsSimpleCallback<List<org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Loads the favorite list and adds the elements to the favorite list widget of the tool-bar menu.- Parameters:
callback
- the call-back to execute with the result data
-
loadRecent
public void loadRecent(I_CmsSimpleCallback<List<org.opencms.ade.containerpage.shared.CmsContainerElementData>> callback) Loads the recent list and adds the elements to the recent list widget of the tool-bar menu.- Parameters:
callback
- the call-back to execute with the result data
-
lockContainerpage
Locks the container-page.- Parameters:
callback
- the callback to execute
-
matchRootView
Returns true if the view with the given view id and the current view have the same root view.- Parameters:
viewIdFromElement
- the id of a view- Returns:
- true if the root view of the id matches the root view of the current view
-
onLockFail
This method should be called when locking the page has failed.- Parameters:
lockError
- the locking information
-
onLockSuccess
This method should be called when locking the page has succeeded. -
onWindowClose
Handler which is executed when the window closes. -
prepareForEdit
public void prepareForEdit(String clientId, String editOption, I_CmsSimpleCallback<org.opencms.util.CmsUUID> callback) Calls the edit handler to prepare the given content element for editing.- Parameters:
clientId
- the element ideditOption
- the selected edit optioncallback
- the callback to execute
-
reinitializeButtons
Reinitializes the buttons in the container element menus. -
reInitInlineEditing
Re-initializes the inline editing. -
reloadElements
public void reloadElements(Collection<String> ids, CmsContainerpageController.I_ReloadHandler callback) Reloads the content for the given elements and related elements.- Parameters:
ids
- the element idscallback
- the callback to execute after the reload
-
reloadElements
Reloads the content for the given elements and related elements.- Parameters:
ids
- the element idscallback
- the callback to execute after the reload
-
reloadElements
Reloads the content for the given element and all related elements.Call this if the element content has changed.
- Parameters:
ids
- the element idscallback
- the callback to execute after the reload
-
reloadElements
Reloads the content for the given element and all related elements.Call this if the element content has changed.
- Parameters:
ids
- the element idscallback
- the callback to execute after the reload
-
reloadElementWithSettings
public void reloadElementWithSettings(CmsContainerPageElementPanel elementWidget, String clientId, Map<String, String> settings, CmsContainerpageController.I_ReloadHandler reloadHandler) Reloads a container page element with a new set of settings.- Parameters:
elementWidget
- the widget of the container page element which should be reloadedclientId
- the id of the container page element which should be reloadedsettings
- the new set of settingsreloadHandler
- the handler to call with the reloaded element
-
reloadPage
Reloads the page. -
removeElement
Removes the given container element from its parent container.- Parameters:
dragElement
- the element to remove
-
removeElement
public void removeElement(CmsContainerPageElementPanel dragElement, CmsContainerpageController.ElementRemoveMode removeMode) Removes the given container element from its parent container.- Parameters:
dragElement
- the element to removeremoveMode
- the remove mode
-
replaceElement
public void replaceElement(CmsContainerPageElementPanel elementWidget, String elementId, CmsContainerpageController.I_ReloadHandler handler) Replaces the given element with another content while keeping it's settings.- Parameters:
elementWidget
- the element to replaceelementId
- the id of the replacing contentcallback
- the callback to execute after the element is replaced
-
replaceElement
public void replaceElement(CmsContainerPageElementPanel elementWidget, String elementId, Runnable callback) Replaces the given element with another content while keeping it's settings.- Parameters:
elementWidget
- the element to replaceelementId
- the id of the replacing contentcallback
- the callback to execute after the element is replaced
-
requiresOptionBar
public boolean requiresOptionBar(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) Checks whether the given element should display the option bar.- Parameters:
element
- the elementdragParent
- the element parent- Returns:
true
if the given element should display the option bar
-
resetEditButtons
Resets all edit buttons an there positions. -
resetPage
Resets the container-page. -
saveAndLeave
Method to save and leave the page.- Parameters:
leaveCommand
- the command to execute to leave the page
-
saveAndLeave
Method to save and leave the page.- Parameters:
targetUri
- the new URI to call
-
saveClipboardTab
Saves the clipboard tab index selected by the user.- Parameters:
tabIndex
- the tab index
-
saveContainerpage
Saves the current state of the container-page.- Parameters:
afterSaveActions
- the actions to execute after saving
-
saveFavoriteList
Saves the favorite list.- Parameters:
clientIds
- the client id's of the list's elements
-
sendDragFinished
public void sendDragFinished(com.google.gwt.dom.client.Element dragElement, com.google.gwt.dom.client.Element target, boolean isNew) Sends the ocDragFinished event.- Parameters:
dragElement
- the drag elementtarget
- the target elementisNew
- true if the dragged element is new
-
sendDragStarted
Sends the ocDragStarted event.- Parameters:
isNew
- true if the user started dragging a new element
-
sendElementAdded
Sends the custom 'ocElementAdded' event for added container elements.- Parameters:
widget
- the container element
-
sendElementDeleted
Sends the custom 'ocElementDeleted' event for a deleted container element.- Parameters:
details
- the event details
-
sendElementEditedContent
public void sendElementEditedContent(CmsContainerPageElementPanel widget, elemental2.dom.Element replacedElement, boolean wasNew) Sends the custom 'ocElementEditedContent' event for an edited container element.- Parameters:
widget
- the container elementreplacedElement
- the element that was formerly on the page before the user edited itwasNew
- true if the element was a new element before editing
-
sendElementEditedSettings
public void sendElementEditedSettings(CmsContainerPageElementPanel widget, CmsContainerPageElementPanel replacedWidget) Sends the custom 'ocElementEditedSettings' event for an edited container element.- Parameters:
widget
- the container elementreplacedWidget
- the former container element that has now been replaced with 'widget'
-
sendElementMoved
Sends the custom 'ocElementMoved' event for a moved container element.- Parameters:
widget
- the container element
-
setContentEditing
Sets the flag indicating that a content element is being edited.- Parameters:
isContentEditing
- the flag indicating that a content element is being edited
-
setDndController
Sets the DND controller.- Parameters:
dnd
- the new DND controller
-
setModelGroupElementId
Sets the model group base element id.- Parameters:
modelGroupElementId
- the model group base element id
-
setPageChanged
Marks the page as changed.- Parameters:
nextActions
- the actions to perform after the page has been marked as changed
-
setPreviewHandler
Sets an alternative event preview handler.- Parameters:
handler
- the alternative preview handler to use
-
startEditingGroupcontainer
public void startEditingGroupcontainer(CmsGroupContainerElementPanel groupContainer, boolean isElementGroup) Tells the controller that group-container editing has started.- Parameters:
groupContainer
- the group containerisElementGroup
-true
if the group container is an element group and not an inheritance group
-
startPublishLockCheck
Starts the publish lock check. -
stopEditingGroupcontainer
Tells the controller that group-container editing has stopped. -
unlockResource
Unlocks the given resource.- Parameters:
structureId
- the structure id of the resource to unlock- Returns:
true
if the resource was unlocked successfully
-
updateButtonsForCurrentView
Updates he -
addElements
protected void addElements(List<org.opencms.ade.containerpage.shared.CmsContainerElementData> elements) Adds the given element data to the element cache.- Parameters:
elements
- the element data
-
addElements
protected void addElements(Map<String, org.opencms.ade.containerpage.shared.CmsContainerElementData> elements) Adds the given element data to the element cache.- Parameters:
elements
- the element data
-
checkReferencesToRemovedElement
Checks that a removed can be possibly deleted and if so, asks the user if it should be deleted.- Parameters:
id
- the client id of the element
-
deactivateOnClosing
Disables option and toolbar buttons. -
getAllContainerPageElements
protected List<CmsContainerPageElementPanel> getAllContainerPageElements(boolean includeGroupContents) Helper method to get all current container page elements.- Parameters:
includeGroupContents
- true if the contents of group containers should also be included- Returns:
- the list of current container page elements
-
getCoreService
Returns the core RPC service.- Returns:
- the core service
-
getGroupEditor
Returns the currently active group editor.- Returns:
- the currently active group editor
-
getLocale
Returns the content locale.- Returns:
- the content locale
-
getPageContent
Gets the page content for purposes of saving.- Returns:
- the page content
-
getPageState
Returns the containers of the page in their current state.- Returns:
- the containers of the page
-
getRequestParams
Returns the request parameters of the displayed container-page.- Returns:
- the request parameters
-
hasNestedContainers
Checks if any of the containers are nested containers.- Returns:
- true if there are nested containers
-
previewNativeEvent
Previews events. Shows the leaving page dialog, if the page has changed and an anchor has been clicked.Also triggers an element view change on 'Ctrl+E'.
- Parameters:
event
- the native event
-
processPageContent
Iterates over all the container contents and calls a visitor object with the visited containers/elements as parameters.- Parameters:
visitor
- the visitor which the container elements should be passed to
-
removeContainerElements
Removes all container elements with the given id from all containers and the client side cache.- Parameters:
resourceId
- the resource id
-
scheduleGalleryUpdate
Schedules an update of the gallery data according to the current element view and the editable containers. -
setPageChanged
Sets the page changed flag and initializes the window closing handler if necessary.- Parameters:
changed
- iftrue
the page has changedunlock
- iftrue
the page will be unlocked for unchanged pages
-
unlockContainerpage
Asynchronously unlocks the container page.
-