java.lang.Object
org.apache.wicket.behavior.Behavior
org.apache.wicket.behavior.AbstractAjaxBehavior
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
org.apache.wicket.ajax.AjaxNewWindowNotifyingBehavior
- All Implemented Interfaces:
Serializable
,IComponentAwareEventSink
,IRequestListener
,IComponentAwareHeaderContributor
,IClusterable
An Ajax behavior that notifies when a new browser window/tab is opened with url to a page
instance which is already opened in another window/tab in the same user session.
- Since:
- 6.0
- See Also:
-
Field Summary
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the window's name.protected String
Create a name for a nameless window, default uses a randomUUID
.protected void
onNewWindow
(AjaxRequestTarget target) A callback method that is called when a new window/tab is opened for a page instance which is already opened in another window/tab.onNewWindow
(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onNewWindow) Creates anAjaxNewWindowNotifyingBehavior
based on lambda expressionsvoid
renderHead
(Component component, IHeaderResponse response) Overridden to initiate a request once the page was rendered.protected void
respond
(AjaxRequestTarget target) protected void
updateAjaxAttributes
(AjaxRequestAttributes attributes) Overridden to add the current window name to the request.Methods inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
findIndicatorId, getAttributes, getCallbackFunction, getCallbackFunctionBody, getCallbackScript, getCallbackScript, onBind, onMethodMismatch, onRequest, postprocessConfiguration, renderAjaxAttributes, renderAjaxAttributes
Methods inherited from class org.apache.wicket.behavior.AbstractAjaxBehavior
afterRender, bind, getCallbackUrl, getComponent, onComponentRendered, onComponentTag, onComponentTag, onUnbind, unbind
Methods inherited from class org.apache.wicket.behavior.Behavior
beforeRender, canCallListener, detach, getStatelessHint, isEnabled, isTemporary, onAttribute, onConfigure, onEvent, onException, onRemove, onTag
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.IRequestListener
rendersPage
-
Constructor Details
-
AjaxNewWindowNotifyingBehavior
public AjaxNewWindowNotifyingBehavior()
-
-
Method Details
-
getWindowName
Returns the window's name.- Returns:
- name of
null
if not yet bound to a window
-
updateAjaxAttributes
Overridden to add the current window name to the request.- Overrides:
updateAjaxAttributes
in classAbstractDefaultAjaxBehavior
-
renderHead
Overridden to initiate a request once the page was rendered.- Specified by:
renderHead
in interfaceIComponentAwareHeaderContributor
- Overrides:
renderHead
in classAbstractDefaultAjaxBehavior
- Parameters:
component
- component which is contributing to the response. This parameter is here to give the component as the context for component-awares implementing this interfaceresponse
- Response object- See Also:
-
respond
- Specified by:
respond
in classAbstractDefaultAjaxBehavior
- Parameters:
target
- The AJAX target
-
newWindowName
Create a name for a nameless window, default uses a randomUUID
.- Returns:
- window name
-
onNewWindow
A callback method that is called when a new window/tab is opened for a page instance which is already opened in another window/tab.Default implementation redirects to a new page instance with identical page parameters.
- Parameters:
target
- the current request handler
-
onNewWindow
public static AjaxNewWindowNotifyingBehavior onNewWindow(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onNewWindow) Creates anAjaxNewWindowNotifyingBehavior
based on lambda expressions- Parameters:
onNewWindow
- theSerializableConsumer
which accepts theAjaxRequestTarget
- Returns:
- the
AjaxNewWindowNotifyingBehavior
-