Class CmsContainerpageHandler
- java.lang.Object
-
- org.opencms.gwt.client.ui.A_CmsToolbarHandler
-
- org.opencms.ade.containerpage.client.CmsContainerpageHandler
-
- All Implemented Interfaces:
I_CmsActionHandler
,I_CmsContextMenuHandler
,I_CmsToolbarHandler
public class CmsContainerpageHandler extends A_CmsToolbarHandler
The container-page handler.- Since:
- 8.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.Runnable
DO_NOTHING
Action which does nothing.protected CmsContainerpageController
m_controller
The container-page controller.protected CmsContainerpageEditor
m_editor
The container-page editor.
-
Constructor Summary
Constructors Constructor Description CmsContainerpageHandler(CmsContainerpageController controller, CmsContainerpageEditor editor)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateSelection()
Activates the selection button.void
addToFavorites(java.lang.String clientId)
Adds the element with the given id to the favorite list.void
addToFavorites(CmsListItem listItem)
Adds the given list item widget to the favorite list widget.void
addToRecent(java.lang.String clientId)
Adds the element with the given id to the favorite list.void
addToRecent(CmsListItem listItem)
Adds the given list item widget to the recent list widget.void
changeTemplateContextManually(java.lang.String cookieName, java.lang.String value)
Switches the template context.void
checkNewWidgetsAvailable(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> asyncCallback)
Checks whether GWT widgets are available for all fields of a content.protected I_CmsContextMenuEntry
createElementViewSelectionMenuEntry()
Creates the element view selection menu entry, returnsnull
in case no other views available.protected CmsContextMenuEntry
createRawMenuEntry(org.opencms.util.CmsUUID structureId, java.lang.Runnable action)
Creates a menu entry based on a structure id and action without anything else.CmsContextMenuEntry
createSimpleContextMenuEntry(org.opencms.util.CmsUUID structureId, java.lang.String name, boolean checked, java.lang.Runnable action)
Creates a context menu entry.protected I_CmsContextMenuEntry
createTemplateContextSelectionMenuEntry(org.opencms.util.CmsUUID structureId)
Creates the template context selection entry for the context menu.protected I_CmsContextMenuEntry
createToggleEditSmallElementsMenuEntry()
Creates the context menu entry for enabling or disabling editing of small elements.protected I_CmsContextMenuEntry
createViewOnlineEntry()
Creates the view online entry, if an online link is available.CmsSelectBox
createViewSelectorForGalleryDialog()
Creates a select box used to switch between views from the gallery dialog.void
deactivateCurrentButton()
De-activates the current button.void
deactivateMenuButton()
De-activates menu button.void
deactivateSelection()
Deactivates the selection.protected void
decorateMenuEntry(CmsContextMenuEntry entry, java.lang.String name, boolean checked)
Fills in label and checkbox of a menu entry.void
disableToolbarButtons()
Deactivates all toolbar buttons.void
editElementSettings(CmsContainerPageElementPanel elementWidget)
Starts the property editor for the given container element.void
enableFavoriteEditing(boolean enable, I_CmsDNDController dndController)
Enables the favorites editing drag and drop controller.void
enableToolbarButtons()
Enables the toolbar buttons.void
ensureLockOnResource(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<java.lang.Boolean> callback)
Tries to lock the given resource and returnstrue
on success.I_CmsToolbarButton
getActiveButton()
Returns the currently active button (may be null).java.util.Map<java.lang.String,I_CmsContextMenuCommand>
getContextMenuCommands()
Returns the available context menu commands as a map by class name.java.lang.String
getContextType()
Returns the context type.I_CmsContentEditorHandler
getEditorHandler()
Returns the editor handler.protected java.lang.String
getLockErrorMessage(org.opencms.gwt.shared.CmsLockInfo lockInfo)
Helper method for getting the error message for a locking error.protected java.lang.String
getLockErrorTitle(org.opencms.gwt.shared.CmsLockInfo lockInfo)
Helper method for getting the error message box title for a locking error.void
gotoSitemap()
Leaves the current page and opens the site-map.boolean
hasActiveSelection()
Returns if the selection button is active.void
hideMenu()
Hides any open menu.void
hidePageOverlay()
Removes page overlay if present.void
insertContextMenu(java.util.List<org.opencms.gwt.shared.CmsContextMenuEntryBean> menuBeans, org.opencms.util.CmsUUID structureId)
Inserts the context menu.void
leavePage(com.google.gwt.user.client.Command leavingCommand)
Call to leave the page.void
leavePage(java.lang.String target)
Call to leave the page.void
loadContextMenu(org.opencms.util.CmsUUID structureId, org.opencms.gwt.shared.CmsCoreData.AdeContext context)
Loads the context menu entries for a given URI.void
loadFavorites()
Loads the favorite list from the server and adds it's items to the clip-board.void
loadRecent()
Loads the recent list from the server and adds it's items to the clip-board.void
onLockFail(java.lang.String errorMessage)
Should be called when locking the container page failed.void
onSiteOrProjectChange(java.lang.String sitePath, java.lang.String serverLink)
Called when site and or project have been changed.void
openEditorForElement(CmsContainerPageElementPanel element, boolean inline, boolean wasNew)
Opens the edit dialog for the specified element.void
openElementsInfo()
Opens the elements info dialog.void
openLockReportForElement(CmsContainerPageElementPanel element)
Opens the lock report for the given element.void
openModelResourceSelect(CmsContainerPageElementPanel element, java.util.List<org.opencms.gwt.shared.CmsModelResourceInfo> modelResources)
Opens the model select dialog for the given new element.protected void
openPublish()
Opens the publish dialog without changes check.void
refreshResource(org.opencms.util.CmsUUID structureId)
Reloads the resource edited.void
reInitInlineEditing()
Re-initializes the inline editing.void
reloadElements(java.lang.String[] elementIds, java.lang.Runnable callback)
Reloads the content for the given element and all related elements.void
removeElement(CmsContainerPageElementPanel element)
Removes the given container-page element.void
removeElement(CmsContainerPageElementPanel element, CmsContainerpageController.ElementRemoveMode removeMode)
Removes the given container-page element.void
replaceElement(CmsContainerPageElementPanel element, java.lang.String elementId, java.lang.Runnable callback)
Replaces the given element with another content while keeping it's settings.void
resetEditableListButtons()
Shows list collector direct edit buttons (old direct edit style), if present.void
resetPage()
Resets the container-page to it's previous state.void
saveFavoriteList(java.util.List<java.lang.String> clientIds)
Saves the favorite list.void
savePage()
Saves the current state of the container-page.void
setActiveButton(I_CmsToolbarButton button)
Sets the currently active tool-bar button.void
setEditButtonsVisible(boolean visible)
Sets the edit button visible.protected void
setElementView(org.opencms.ade.containerpage.shared.CmsElementViewInfo elementView, java.lang.Runnable nextAction)
Sets the element view.void
showElementInfo(CmsContainerPageElementPanel element)
Shows resource information for a given element.void
showPageOverlay()
Shows a page overlay preventing user actions.void
showPreview(int buttonLeft)
Toggles the tool-bars visibility.void
showPublishDialog()
Shows the publish dialog.I_CmsContextMenuEntry
transformSingleEntry(org.opencms.util.CmsUUID structureId, org.opencms.gwt.shared.CmsContextMenuEntryBean menuEntryBean)
Creates a single context menu entry from a context menu entry bean.void
unlockResource(org.opencms.util.CmsUUID structureId)
Unlocks the resource if appropriate.void
updateClipboard(java.util.Map<java.lang.String,org.opencms.ade.containerpage.shared.CmsContainerElementData> elements)
Updates the clip board elements is necessary.-
Methods inherited from class org.opencms.gwt.client.ui.A_CmsToolbarHandler
transformEntries
-
-
-
-
Field Detail
-
DO_NOTHING
public static final java.lang.Runnable DO_NOTHING
Action which does nothing.
-
m_controller
protected CmsContainerpageController m_controller
The container-page controller.
-
m_editor
protected CmsContainerpageEditor m_editor
The container-page editor.
-
-
Constructor Detail
-
CmsContainerpageHandler
public CmsContainerpageHandler(CmsContainerpageController controller, CmsContainerpageEditor editor)
Constructor.- Parameters:
controller
- the container-page controllereditor
- the container-page editor
-
-
Method Detail
-
activateSelection
public void activateSelection()
Activates the selection button.
-
addToFavorites
public void addToFavorites(CmsListItem listItem)
Adds the given list item widget to the favorite list widget.- Parameters:
listItem
- the list item
-
addToFavorites
public void addToFavorites(java.lang.String clientId)
Adds the element with the given id to the favorite list.- Parameters:
clientId
- the client id
-
addToRecent
public void addToRecent(CmsListItem listItem)
Adds the given list item widget to the recent list widget.- Parameters:
listItem
- the list item
-
addToRecent
public void addToRecent(java.lang.String clientId)
Adds the element with the given id to the favorite list.- Parameters:
clientId
- the client id
-
changeTemplateContextManually
public void changeTemplateContextManually(java.lang.String cookieName, java.lang.String value)
Switches the template context.- Parameters:
cookieName
- the cookie namevalue
- the new template context
-
checkNewWidgetsAvailable
public void checkNewWidgetsAvailable(org.opencms.util.CmsUUID structureId, com.google.gwt.user.client.rpc.AsyncCallback<java.lang.Boolean> asyncCallback)
Checks whether GWT widgets are available for all fields of a content.- Parameters:
structureId
- the structure id of the contentasyncCallback
- the callback for the result
-
createSimpleContextMenuEntry
public CmsContextMenuEntry createSimpleContextMenuEntry(org.opencms.util.CmsUUID structureId, java.lang.String name, boolean checked, java.lang.Runnable action)
Creates a context menu entry.- Parameters:
structureId
- structure id of the resourcename
- the labelchecked
- true if checkbox should be displayedaction
- the action to execute- Returns:
- the menu entry
-
createViewSelectorForGalleryDialog
public CmsSelectBox createViewSelectorForGalleryDialog()
Creates a select box used to switch between views from the gallery dialog.- Returns:
- the created select box
-
deactivateCurrentButton
public void deactivateCurrentButton()
De-activates the current button.
-
deactivateMenuButton
public void deactivateMenuButton()
De-activates menu button.
-
deactivateSelection
public void deactivateSelection()
Deactivates the selection.
-
disableToolbarButtons
public void disableToolbarButtons()
Deactivates all toolbar buttons.
-
editElementSettings
public void editElementSettings(CmsContainerPageElementPanel elementWidget)
Starts the property editor for the given container element.- Parameters:
elementWidget
- the container element widget for which the properties should be edited
-
enableFavoriteEditing
public void enableFavoriteEditing(boolean enable, I_CmsDNDController dndController)
Enables the favorites editing drag and drop controller.- Parameters:
enable
- iftrue
favorites editing will enabled, otherwise disableddndController
- the favorites editing drag and drop controller
-
enableToolbarButtons
public void enableToolbarButtons()
Enables the toolbar buttons.
-
ensureLockOnResource
public void ensureLockOnResource(org.opencms.util.CmsUUID structureId, I_CmsSimpleCallback<java.lang.Boolean> callback)
Description copied from interface:I_CmsContextMenuHandler
Tries to lock the given resource and returnstrue
on success. If not successful a warning should be displayed.- Parameters:
structureId
- the structure id of the resource to lockcallback
- the callback to execute- See Also:
I_CmsContextMenuHandler.ensureLockOnResource(org.opencms.util.CmsUUID, org.opencms.gwt.client.util.I_CmsSimpleCallback)
-
getActiveButton
public I_CmsToolbarButton getActiveButton()
Description copied from interface:I_CmsToolbarHandler
Returns the currently active button (may be null).- Returns:
- the currently active button
- See Also:
I_CmsToolbarHandler.getActiveButton()
-
getContextMenuCommands
public java.util.Map<java.lang.String,I_CmsContextMenuCommand> getContextMenuCommands()
Description copied from interface:I_CmsContextMenuHandler
Returns the available context menu commands as a map by class name.- Returns:
- the available context menu commands as a map by class name
- See Also:
I_CmsContextMenuHandler.getContextMenuCommands()
-
getContextType
public java.lang.String getContextType()
Description copied from interface:I_CmsContextMenuHandler
Returns the context type.- Returns:
- the context type
- See Also:
I_CmsContextMenuHandler.getContextType()
-
getEditorHandler
public I_CmsContentEditorHandler getEditorHandler()
Description copied from interface:I_CmsContextMenuHandler
Returns the editor handler.- Returns:
- the editor handler
- See Also:
I_CmsContextMenuHandler.getEditorHandler()
-
gotoSitemap
public void gotoSitemap()
Leaves the current page and opens the site-map.
-
hasActiveSelection
public boolean hasActiveSelection()
Returns if the selection button is active.- Returns:
true
if the selection button is active
-
hideMenu
public void hideMenu()
Hides any open menu.
-
hidePageOverlay
public void hidePageOverlay()
Removes page overlay if present.
-
insertContextMenu
public void insertContextMenu(java.util.List<org.opencms.gwt.shared.CmsContextMenuEntryBean> menuBeans, org.opencms.util.CmsUUID structureId)
Inserts the context menu.- Parameters:
menuBeans
- the menu beans from the serverstructureId
- the structure id of the resource for which the context menu entries should be generated
-
leavePage
public void leavePage(com.google.gwt.user.client.Command leavingCommand)
Call to leave the page. Will open save/leave/cancel dialog if page contains any changes.- Parameters:
leavingCommand
- the page leaving command
-
leavePage
public void leavePage(java.lang.String target)
Call to leave the page. Will open save/leave/cancel dialog if page contains any changes.- Parameters:
target
- the target
-
loadContextMenu
public void loadContextMenu(org.opencms.util.CmsUUID structureId, org.opencms.gwt.shared.CmsCoreData.AdeContext context)
Loads the context menu entries for a given URI.- Parameters:
structureId
- the structure id of the resource for which the context menu should be loadedcontext
- the ade context (sitemap or containerpage)
-
loadFavorites
public void loadFavorites()
Loads the favorite list from the server and adds it's items to the clip-board.
-
loadRecent
public void loadRecent()
Loads the recent list from the server and adds it's items to the clip-board.
-
onLockFail
public void onLockFail(java.lang.String errorMessage)
Should be called when locking the container page failed.- Parameters:
errorMessage
- the locking information
-
onSiteOrProjectChange
public void onSiteOrProjectChange(java.lang.String sitePath, java.lang.String serverLink)
Description copied from interface:I_CmsActionHandler
Called when site and or project have been changed.- Parameters:
sitePath
- the site path to the target resourceserverLink
- the server link to the resource- See Also:
I_CmsActionHandler.onSiteOrProjectChange(java.lang.String, java.lang.String)
-
openEditorForElement
public void openEditorForElement(CmsContainerPageElementPanel element, boolean inline, boolean wasNew)
Opens the edit dialog for the specified element.- Parameters:
element
- the element to editinline
-true
to open the inline editor for the given element if availablewasNew
-true
in case this is a newly created element not previously edited
-
openElementsInfo
public void openElementsInfo()
Opens the elements info dialog.
-
openLockReportForElement
public void openLockReportForElement(CmsContainerPageElementPanel element)
Opens the lock report for the given element.- Parameters:
element
- the element
-
openModelResourceSelect
public void openModelResourceSelect(CmsContainerPageElementPanel element, java.util.List<org.opencms.gwt.shared.CmsModelResourceInfo> modelResources)
Opens the model select dialog for the given new element.- Parameters:
element
- the element widgetmodelResources
- the available resource models
-
refreshResource
public void refreshResource(org.opencms.util.CmsUUID structureId)
Description copied from interface:I_CmsActionHandler
Reloads the resource edited.- Parameters:
structureId
- the structure id of the resource to lock- See Also:
I_CmsActionHandler.refreshResource(org.opencms.util.CmsUUID)
-
reInitInlineEditing
public void reInitInlineEditing()
Re-initializes the inline editing.
-
reloadElements
public void reloadElements(java.lang.String[] elementIds, java.lang.Runnable callback)
Reloads the content for the given element and all related elements.- Parameters:
elementIds
- the element id'scallback
- the callback to execute after reloading
-
removeElement
public void removeElement(CmsContainerPageElementPanel element)
Removes the given container-page element.- Parameters:
element
- the element
-
removeElement
public void removeElement(CmsContainerPageElementPanel element, CmsContainerpageController.ElementRemoveMode removeMode)
Removes the given container-page element.- Parameters:
element
- the elementremoveMode
- the element remove mode
-
replaceElement
public void replaceElement(CmsContainerPageElementPanel element, java.lang.String elementId, java.lang.Runnable callback)
Replaces the given element with another content while keeping it's settings.- Parameters:
element
- the element to replaceelementId
- the id of the replacing contentcallback
- the callback to execute after replacing the element
-
resetEditableListButtons
public void resetEditableListButtons()
Shows list collector direct edit buttons (old direct edit style), if present.
-
resetPage
public void resetPage()
Resets the container-page to it's previous state.
-
saveFavoriteList
public void saveFavoriteList(java.util.List<java.lang.String> clientIds)
Saves the favorite list.- Parameters:
clientIds
- the client id's of the list's elements- See Also:
CmsContainerpageController.saveFavoriteList(java.util.List)
-
savePage
public void savePage()
Saves the current state of the container-page.
-
setActiveButton
public void setActiveButton(I_CmsToolbarButton button)
Sets the currently active tool-bar button.- Parameters:
button
- the button
-
setEditButtonsVisible
public void setEditButtonsVisible(boolean visible)
Sets the edit button visible.- Parameters:
visible
- the visibility
-
showElementInfo
public void showElementInfo(CmsContainerPageElementPanel element)
Shows resource information for a given element.- Parameters:
element
- the element for which to show the information
-
showPageOverlay
public void showPageOverlay()
Shows a page overlay preventing user actions.
-
showPreview
public void showPreview(int buttonLeft)
Toggles the tool-bars visibility.- Parameters:
buttonLeft
- the selection button absolute left position, needed to show the leave preview button in the same location
-
showPublishDialog
public void showPublishDialog()
Shows the publish dialog.
-
transformSingleEntry
public I_CmsContextMenuEntry transformSingleEntry(org.opencms.util.CmsUUID structureId, org.opencms.gwt.shared.CmsContextMenuEntryBean menuEntryBean)
Description copied from class:A_CmsToolbarHandler
Creates a single context menu entry from a context menu entry bean.- Overrides:
transformSingleEntry
in classA_CmsToolbarHandler
- Parameters:
structureId
- the structure id of the resourcemenuEntryBean
- the context menu entry bean- Returns:
- the created context menu entry
- See Also:
A_CmsToolbarHandler.transformSingleEntry(org.opencms.util.CmsUUID, org.opencms.gwt.shared.CmsContextMenuEntryBean)
-
unlockResource
public void unlockResource(org.opencms.util.CmsUUID structureId)
Description copied from interface:I_CmsContextMenuHandler
Unlocks the resource if appropriate.- Parameters:
structureId
- the structure id of the resource to lock- See Also:
I_CmsContextMenuHandler.unlockResource(org.opencms.util.CmsUUID)
-
updateClipboard
public void updateClipboard(java.util.Map<java.lang.String,org.opencms.ade.containerpage.shared.CmsContainerElementData> elements)
Updates the clip board elements is necessary.- Parameters:
elements
- the elements data
-
createElementViewSelectionMenuEntry
protected I_CmsContextMenuEntry createElementViewSelectionMenuEntry()
Creates the element view selection menu entry, returnsnull
in case no other views available.- Returns:
- the menu entry
-
createRawMenuEntry
protected CmsContextMenuEntry createRawMenuEntry(org.opencms.util.CmsUUID structureId, java.lang.Runnable action)
Creates a menu entry based on a structure id and action without anything else.- Parameters:
structureId
- the structure idaction
- the action for the menu entry- Returns:
- the new menu entry
-
createTemplateContextSelectionMenuEntry
protected I_CmsContextMenuEntry createTemplateContextSelectionMenuEntry(org.opencms.util.CmsUUID structureId)
Creates the template context selection entry for the context menu.- Parameters:
structureId
- the structure id of the page- Returns:
- the new context menu entry
-
createToggleEditSmallElementsMenuEntry
protected I_CmsContextMenuEntry createToggleEditSmallElementsMenuEntry()
Creates the context menu entry for enabling or disabling editing of small elements.- Returns:
- the created context menu entry
-
createViewOnlineEntry
protected I_CmsContextMenuEntry createViewOnlineEntry()
Creates the view online entry, if an online link is available.- Returns:
- the menu entry or null, if not available
-
decorateMenuEntry
protected void decorateMenuEntry(CmsContextMenuEntry entry, java.lang.String name, boolean checked)
Fills in label and checkbox of a menu entry.- Parameters:
entry
- the menu entryname
- the labelchecked
- true if checkbox should be shown
-
getLockErrorMessage
protected java.lang.String getLockErrorMessage(org.opencms.gwt.shared.CmsLockInfo lockInfo)
Helper method for getting the error message for a locking error.- Parameters:
lockInfo
- the lock information- Returns:
- the error message
-
getLockErrorTitle
protected java.lang.String getLockErrorTitle(org.opencms.gwt.shared.CmsLockInfo lockInfo)
Helper method for getting the error message box title for a locking error.- Parameters:
lockInfo
- the lock information- Returns:
- the error message box title
-
openPublish
protected void openPublish()
Opens the publish dialog without changes check.
-
setElementView
protected void setElementView(org.opencms.ade.containerpage.shared.CmsElementViewInfo elementView, java.lang.Runnable nextAction)
Sets the element view.- Parameters:
elementView
- the element viewnextAction
- the action to execute after setting the view
-
-