Package org.opencms.gwt.client.util
Class CmsEmbeddedDialogHandler
- java.lang.Object
-
- org.opencms.gwt.client.util.CmsEmbeddedDialogHandler
-
- All Implemented Interfaces:
I_CmsHasInit
public class CmsEmbeddedDialogHandler extends java.lang.Object implements I_CmsHasInit
Handler for embedded VAADIN dialogs.
-
-
Constructor Summary
Constructors Constructor Description CmsEmbeddedDialogHandler()
Constructor.CmsEmbeddedDialogHandler(I_CmsActionHandler handler)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
encodeParam(java.lang.String str)
Encodes a parameter value for use in a query string.static void
exportNativeFunctions()
Exports native JS function cmsOpenEmbeddedDialog.void
finish(java.lang.String resources)
Called on dialog close.boolean
hasDialogFrame()
Returns if the dialog iframe is attached.static void
initClass()
Called on load, exports native functions.void
leavePage(java.lang.String targetUri)
Navigates to the given URI.void
onSiteOrProjectChange(java.lang.String sitePath, java.lang.String serverLink)
Called when site and or project have been changed.void
openDialog(java.lang.String dialogId, java.lang.String contextType, java.util.List<org.opencms.util.CmsUUID> resources)
Opens the dialog with the given id.void
openDialog(java.lang.String dialogId, java.lang.String contextType, java.util.List<org.opencms.util.CmsUUID> resources, java.util.Map<java.lang.String,java.lang.String> rawParams)
Opens the dialog with the given id.static void
openDialog(java.lang.String dialogId, java.util.List<org.opencms.util.CmsUUID> structureIds, java.util.function.Consumer<org.opencms.util.CmsUUID> finishCallback)
Opens the given dialog in an iframe.static void
openDialog(java.lang.String dialogId, java.util.List<org.opencms.util.CmsUUID> structureIds, java.util.Map<java.lang.String,java.lang.String> params, java.util.function.Consumer<org.opencms.util.CmsUUID> finishCallback)
Opens the given dialog in an iframe.static void
openEmbeddedDialog(java.lang.String dialogId, com.google.gwt.core.client.JavaScriptObject callback, com.google.gwt.core.client.JsArrayString structureIds, com.google.gwt.core.client.JavaScriptObject params)
Opens an embedded dialog.protected java.util.List<org.opencms.util.CmsUUID>
parseResources(java.lang.String resources)
Parses the resources string.void
reload()
Reloads the current page.void
selectString(java.lang.String principle)
Calls the principle select handler and closes the dialog frame.void
setOnCloseCommand(com.google.gwt.user.client.Command onCloseCommand)
Sets the on close command.void
setStringSelectHandler(I_CmsStringSelectHandler selectHandler)
Sets the principle select handler.
-
-
-
Constructor Detail
-
CmsEmbeddedDialogHandler
public CmsEmbeddedDialogHandler()
Constructor.
-
CmsEmbeddedDialogHandler
public CmsEmbeddedDialogHandler(I_CmsActionHandler handler)
Constructor.- Parameters:
handler
- the context handler
-
-
Method Detail
-
encodeParam
public static java.lang.String encodeParam(java.lang.String str)
Encodes a parameter value for use in a query string.- Parameters:
str
- the string to encode- Returns:
- the encoded string
-
exportNativeFunctions
public static void exportNativeFunctions()
Exports native JS function cmsOpenEmbeddedDialog.
-
initClass
public static void initClass()
Called on load, exports native functions.
-
openDialog
public static void openDialog(java.lang.String dialogId, java.util.List<org.opencms.util.CmsUUID> structureIds, java.util.function.Consumer<org.opencms.util.CmsUUID> finishCallback)
Opens the given dialog in an iframe.- Parameters:
dialogId
- the action classstructureIds
- the structure ids for the actionfinishCallback
- the callback to call after the dialog closes
-
openDialog
public static void openDialog(java.lang.String dialogId, java.util.List<org.opencms.util.CmsUUID> structureIds, java.util.Map<java.lang.String,java.lang.String> params, java.util.function.Consumer<org.opencms.util.CmsUUID> finishCallback)
Opens the given dialog in an iframe.- Parameters:
dialogId
- the action classstructureIds
- the structure ids for the actionparams
- additional parameters to passfinishCallback
- the callback to call after the dialog closes
-
openEmbeddedDialog
public static void openEmbeddedDialog(java.lang.String dialogId, com.google.gwt.core.client.JavaScriptObject callback, com.google.gwt.core.client.JsArrayString structureIds, com.google.gwt.core.client.JavaScriptObject params)
Opens an embedded dialog.- Parameters:
dialogId
- the dialogcallback
- the onClose callbackstructureIds
- the structure idsparams
- the parameters
-
finish
public void finish(java.lang.String resources)
Called on dialog close.- Parameters:
resources
- the resource ids to update as a ';' separated string.
-
hasDialogFrame
public boolean hasDialogFrame()
Returns if the dialog iframe is attached.- Returns:
true
if the dialog iframe is attached
-
leavePage
public void leavePage(java.lang.String targetUri)
Navigates to the given URI.- Parameters:
targetUri
- the target URI
-
onSiteOrProjectChange
public void onSiteOrProjectChange(java.lang.String sitePath, java.lang.String serverLink)
Called when site and or project have been changed.- Parameters:
sitePath
- the site path to the resource to displayserverLink
- the server link to the resource to display
-
openDialog
public void openDialog(java.lang.String dialogId, java.lang.String contextType, java.util.List<org.opencms.util.CmsUUID> resources)
Opens the dialog with the given id.- Parameters:
dialogId
- the dialog idcontextType
- the context type, used to check the action visibilityresources
- the resource to handle
-
openDialog
public void openDialog(java.lang.String dialogId, java.lang.String contextType, java.util.List<org.opencms.util.CmsUUID> resources, java.util.Map<java.lang.String,java.lang.String> rawParams)
Opens the dialog with the given id.- Parameters:
dialogId
- the dialog idcontextType
- the context type, used to check the action visibilityresources
- the resource to handlerawParams
- additional set of parameters to append to the query string (will not be escaped, therefore 'raw')
-
reload
public void reload()
Reloads the current page.
-
selectString
public void selectString(java.lang.String principle)
Calls the principle select handler and closes the dialog frame.- Parameters:
principle
- the principle to select
-
setOnCloseCommand
public void setOnCloseCommand(com.google.gwt.user.client.Command onCloseCommand)
Sets the on close command.- Parameters:
onCloseCommand
- the on close command
-
setStringSelectHandler
public void setStringSelectHandler(I_CmsStringSelectHandler selectHandler)
Sets the principle select handler.- Parameters:
selectHandler
- the principle select handler
-
parseResources
protected java.util.List<org.opencms.util.CmsUUID> parseResources(java.lang.String resources)
Parses the resources string.- Parameters:
resources
- the resources- Returns:
- the list of resource ids
-
-