Package org.apache.wicket.ajax
Class AjaxNewWindowNotifyingBehavior
- 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:
java.io.Serializable,IComponentAwareEventSink,IRequestListener,IComponentAwareHeaderContributor,org.apache.wicket.util.io.IClusterable
public class AjaxNewWindowNotifyingBehavior extends AbstractDefaultAjaxBehavior
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:
onNewWindow(AjaxRequestTarget), Serialized Form
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.ajax.AbstractDefaultAjaxBehavior
INDICATOR
-
-
Constructor Summary
Constructors Constructor Description AjaxNewWindowNotifyingBehavior()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetWindowName()Returns the window's name.protected java.lang.StringnewWindowName()Create a name for a nameless window, default uses a randomUUID.protected voidonNewWindow(AjaxRequestTarget target)A callback method when a new window/tab is opened for a page instance which is already opened in another window/tab.static AjaxNewWindowNotifyingBehavioronNewWindow(org.danekja.java.util.function.serializable.SerializableConsumer<AjaxRequestTarget> onNewWindow)Creates anAjaxNewWindowNotifyingBehaviorbased on lambda expressionsvoidrenderHead(Component component, IHeaderResponse response)Overridden to initiate a request once the page was rendered.protected voidrespond(AjaxRequestTarget target)protected voidupdateAjaxAttributes(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, 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
-
-
-
-
Method Detail
-
getWindowName
public java.lang.String getWindowName()
Returns the window's name.- Returns:
- name of {@value null} if not yet bound to a window
-
updateAjaxAttributes
protected void updateAjaxAttributes(AjaxRequestAttributes attributes)
Overridden to add the current window name to the request.- Overrides:
updateAjaxAttributesin classAbstractDefaultAjaxBehavior
-
renderHead
public void renderHead(Component component, IHeaderResponse response)
Overridden to initiate a request once the page was rendered.- Specified by:
renderHeadin interfaceIComponentAwareHeaderContributor- Overrides:
renderHeadin 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:
Behavior.renderHead(Component, org.apache.wicket.markup.head.IHeaderResponse)
-
respond
protected void respond(AjaxRequestTarget target)
- Specified by:
respondin classAbstractDefaultAjaxBehavior- Parameters:
target- The AJAX target
-
newWindowName
protected java.lang.String newWindowName()
Create a name for a nameless window, default uses a randomUUID.- Returns:
- window name
-
onNewWindow
protected void onNewWindow(AjaxRequestTarget target)
A callback method 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 anAjaxNewWindowNotifyingBehaviorbased on lambda expressions- Parameters:
onNewWindow- theSerializableConsumerwhich accepts theAjaxRequestTarget- Returns:
- the
AjaxNewWindowNotifyingBehavior
-
-