Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann
Are the changes pushed to the git repo? Or is this only a solution which 
will work in my case but will not be pushed because of side effects, no 
necessity etc.?


Thanks in advance.

Oli

Am 25.11.2012 20:25, schrieb Sven Meier:

Without the 'true ||'.


Great :)

Sven

On 11/25/2012 07:15 PM, Martin Grigorov wrote:
On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov 
wrote:



diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 

b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 


@@ -21,6 +21,7 @@ import
org.apache.wicket.core.util.string.JavaScriptUtils;
  import org.apache.wicket.markup.head.IHeaderResponse;
  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
  import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
  import org.apache.wicket.request.http.WebRequest;
  import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
 @Override
 protected final void respond(final AjaxRequestTarget target)
 {
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
  {
 onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())


Without the 'true ||'.



+   {
+ target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
 }
 }

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+ getComponent().findParent(WebPage.class)
!= null;
+   }
+
 /**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:


Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the
next timeout after #onTimer().

This is why I think it should re-check #isStopped(), since the user 
might

stop the timer in #onTimer().

I'll take a look at WICKET-4886.

Sven


On 11/25/2012 06:58 PM, Martin Grigorov wrote:


I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  }
  });

But it doesn't use 'target' to repaint any component, so the 
registered

JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call 
triggered by
the obsolete timer fails with "The behavior's component (a Form 
which is

no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 


**wrote:

  As suggested i created the JIRA issue https://issues.apache.org/**

jira/browse/WICKET-4886browse/WICKET-4886 
>


I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  
wrote:


   Make a copy of AbstractAjaxTimerBehavior and let it be 
stoppable from



onTimer():

diff --git a/wicket-core/src/main/java/
**org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**


AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
{
onTimer(target);

- target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));

+if (!isStopped())

   But this code is already in : if (!isStopped() &&


isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


   +{


+ target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));


+}
}
}

You could create a jira issue too.

  Additionally there are two global Ajax listeners at the 
bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete 
timers.
I haven't debugged the 

Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier

Without the 'true ||'.


Great :)

Sven

On 11/25/2012 07:15 PM, Martin Grigorov wrote:

On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov wrote:


diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -21,6 +21,7 @@ import
org.apache.wicket.core.util.string.JavaScriptUtils;
  import org.apache.wicket.markup.head.IHeaderResponse;
  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
  import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
  import org.apache.wicket.request.http.WebRequest;
  import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
 @Override
 protected final void respond(final AjaxRequestTarget target)
 {
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
  {
 onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())


Without the 'true ||'.



+   {
+   target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
 }
 }

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+   getComponent().findParent(WebPage.class)
!= null;
+   }
+
 /**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:


Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the
next timeout after #onTimer().

This is why I think it should re-check #isStopped(), since the user might
stop the timer in #onTimer().

I'll take a look at WICKET-4886.

Sven


On 11/25/2012 06:58 PM, Martin Grigorov wrote:


I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  }
  });

But it doesn't use 'target' to repaint any component, so the registered
JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is
no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 
**wrote:

  As suggested i created the JIRA issue https://issues.apache.org/**

jira/browse/WICKET-4886https://issues.apache.org/jira/browse/WICKET-4886>>

I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from


onTimer():

diff --git a/wicket-core/src/main/java/
**org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**


AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
{
onTimer(target);

-target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));

+if (!isStopped())

   But this code is already in : if (!isStopped() &&


isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


   +{


+target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
updateInterval)));


+}
}
}

You could create a jira issue too.

  Additionally there are two global Ajax listeners at the bottom of

wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.



  Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

   Unfortunately this is not a solution as i have about 30 different


panel

Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann


Am 25.11.2012 18:58, schrieb Martin Grigorov:

I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 }
 });

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.
I am pretty new to wicket. If there is a better way to do that, please 
feel free to give me hints :)
I see no other way of doing what i want without using ajax that way 
(directly in the panel instead of the base page).




On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:


As suggested i created the JIRA issue https://issues.apache.org/**
jira/browse/WICKET-4886
I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:


Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

onTimer():

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**

AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
   {
   onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())

  But this code is already in : if (!isStopped() &&

isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


  +{

+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));

+}
   }
   }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

  Unfortunately this is not a solution as i have about 30 different

panels.
And i guess at least 10 of them should later use JS. With the approach
you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also
lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically

registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

  final WebMarkupContainer wmc = new
WebMarkupContainer("container"
**);
  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
{

  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  target.add(wmc);

  stop(target);
  }
  });
  add(wmc);

  wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:

  The problem is that this leads to a Page not found error. The problem

is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so
this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:

  What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

  Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace


The first panel gets displayed, after a few seconds it should be
replaced by the second panel. Is there any way to achieve this
be

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
On Sun, Nov 25, 2012 at 7:14 PM, Martin Grigorov wrote:

> diff --git
> a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> index 3071875..0651c33 100644
> ---
> a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> +++
> b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
> @@ -21,6 +21,7 @@ import
> org.apache.wicket.core.util.string.JavaScriptUtils;
>  import org.apache.wicket.markup.head.IHeaderResponse;
>  import org.apache.wicket.markup.head.JavaScriptHeaderItem;
>  import org.apache.wicket.markup.head.OnLoadHeaderItem;
> +import org.apache.wicket.markup.html.WebPage;
>  import org.apache.wicket.request.http.WebRequest;
>  import org.apache.wicket.util.time.Duration;
>
> @@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
> extends AbstractDefaultAjaxBehav
> @Override
> protected final void respond(final AjaxRequestTarget target)
> {
> -   if (!isStopped() && isEnabled(getComponent()))
> +   if (shouldTrigger())
>  {
> onTimer(target);
>
> -   target.getHeaderResponse().render(
> -
> OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
> +   if (true || shouldTrigger())
>

Without the 'true ||'.


> +   {
> +   target.getHeaderResponse().render(
> +
> OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
> +   }
> }
> }
>
> +   private boolean shouldTrigger()
> +   {
> +   return isStopped() == false &&
> +   isEnabled(getComponent()) &&
> +   getComponent().findParent(WebPage.class)
> != null;
> +   }
> +
> /**
>
>
>
> On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:
>
>> Of course the component should be added to the ART.
>> But the example already fails when the behavior tries to write out the
>> next timeout after #onTimer().
>>
>> This is why I think it should re-check #isStopped(), since the user might
>> stop the timer in #onTimer().
>>
>> I'll take a look at WICKET-4886.
>>
>> Sven
>>
>>
>> On 11/25/2012 06:58 PM, Martin Grigorov wrote:
>>
>>> I see now what Sven meant with the second check for isStopped().
>>>
>>> But additionally I see that the quickstart is very broken.
>>>
>>> PanelOne does:
>>> form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>>  @Override
>>>  protected void onTimer(AjaxRequestTarget target) {
>>>  PanelTwo two = new PanelTwo("panel");
>>>  wmc.addOrReplace(two);
>>>  }
>>>  });
>>>
>>> But it doesn't use 'target' to repaint any component, so the registered
>>> JS
>>> timer continues with its original Url which uses the old pageId and
>>> component path to PanelOne. And as expected the second call triggered by
>>> the obsolete timer fails with "The behavior's component (a Form which is
>>> no
>>> more connected to the Page) cannot find its page.
>>> This is a plain error in the application.
>>>
>>>
>>>
>>> On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann 
>>> **wrote:
>>>
>>>  As suggested i created the JIRA issue https://issues.apache.org/**
 jira/browse/WICKET-4886>>> browse/WICKET-4886 >

 I will test the diff tomorrow.

 Am 25.11.2012 15:41, schrieb Martin Grigorov:

  Hi,
>
>
> On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:
>
>   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
>
>> onTimer():
>>
>> diff --git a/wicket-core/src/main/java/
>> **org/apache/wicket/ajax/
>> AbstractAjaxTimerBehavior.java
>> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>> AbstractAjaxTimerBehavior.java
>> index 3071875..b982a39 100644
>> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>> AbstractAjaxTimerBehavior.java
>> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>>
>>
>> AbstractAjaxTimerBehavior.java
>> @@ -131,8 +131,11 @@
>>{
>>onTimer(target);
>>
>> -target.getHeaderResponse().**render(
>> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
>> updateInterval)));
>>
>> +if (!isStopped())
>>
>>   But this code is already in : if (!isStopped() &&
>>
> isEnabled(getComponent()))
> How the second "if (!isStopped())" fixes the issue ?
>
>
>   +{
>
>> +target.getHeaderResponse().**render(
>> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
>> updateInterval)));

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
diff --git
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
index 3071875..0651c33 100644
---
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
@@ -21,6 +21,7 @@ import org.apache.wicket.core.util.string.JavaScriptUtils;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
 import org.apache.wicket.markup.head.OnLoadHeaderItem;
+import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.request.http.WebRequest;
 import org.apache.wicket.util.time.Duration;

@@ -127,15 +128,25 @@ public abstract class AbstractAjaxTimerBehavior
extends AbstractDefaultAjaxBehav
@Override
protected final void respond(final AjaxRequestTarget target)
{
-   if (!isStopped() && isEnabled(getComponent()))
+   if (shouldTrigger())
{
onTimer(target);

-   target.getHeaderResponse().render(
-
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   if (true || shouldTrigger())
+   {
+   target.getHeaderResponse().render(
+
OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+   }
}
}

+   private boolean shouldTrigger()
+   {
+   return isStopped() == false &&
+   isEnabled(getComponent()) &&
+   getComponent().findParent(WebPage.class) !=
null;
+   }
+
/**



On Sun, Nov 25, 2012 at 7:07 PM, Sven Meier  wrote:

> Of course the component should be added to the ART.
> But the example already fails when the behavior tries to write out the
> next timeout after #onTimer().
>
> This is why I think it should re-check #isStopped(), since the user might
> stop the timer in #onTimer().
>
> I'll take a look at WICKET-4886.
>
> Sven
>
>
> On 11/25/2012 06:58 PM, Martin Grigorov wrote:
>
>> I see now what Sven meant with the second check for isStopped().
>>
>> But additionally I see that the quickstart is very broken.
>>
>> PanelOne does:
>> form.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>  @Override
>>  protected void onTimer(AjaxRequestTarget target) {
>>  PanelTwo two = new PanelTwo("panel");
>>  wmc.addOrReplace(two);
>>  }
>>  });
>>
>> But it doesn't use 'target' to repaint any component, so the registered JS
>> timer continues with its original Url which uses the old pageId and
>> component path to PanelOne. And as expected the second call triggered by
>> the obsolete timer fails with "The behavior's component (a Form which is
>> no
>> more connected to the Page) cannot find its page.
>> This is a plain error in the application.
>>
>>
>>
>> On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann *
>> *wrote:
>>
>>  As suggested i created the JIRA issue https://issues.apache.org/**
>>> jira/browse/WICKET-4886>> browse/WICKET-4886 >
>>>
>>> I will test the diff tomorrow.
>>>
>>> Am 25.11.2012 15:41, schrieb Martin Grigorov:
>>>
>>>  Hi,


 On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

   Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

> onTimer():
>
> diff --git a/wicket-core/src/main/java/
> **org/apache/wicket/ajax/
> AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> index 3071875..b982a39 100644
> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
>
>
> AbstractAjaxTimerBehavior.java
> @@ -131,8 +131,11 @@
>{
>onTimer(target);
>
> -target.getHeaderResponse().**render(
> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
> updateInterval)));
>
> +if (!isStopped())
>
>   But this code is already in : if (!isStopped() &&
>
 isEnabled(getComponent()))
 How the second "if (!isStopped())" fixes the issue ?


   +{

> +target.getHeaderResponse().**render(
> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**
> updateInterval)));
>
>
> +}
>}
>}
>
> You could create a jira issue too.
>
>  Additionally there are two global Ajax listeners at the bottom of
 wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
 I hav

Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier

Of course the component should be added to the ART.
But the example already fails when the behavior tries to write out the 
next timeout after #onTimer().


This is why I think it should re-check #isStopped(), since the user 
might stop the timer in #onTimer().


I'll take a look at WICKET-4886.

Sven

On 11/25/2012 06:58 PM, Martin Grigorov wrote:

I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 }
 });

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:


As suggested i created the JIRA issue https://issues.apache.org/**
jira/browse/WICKET-4886
I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:


Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from

onTimer():

diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**

AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
   {
   onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())

  But this code is already in : if (!isStopped() &&

isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


  +{

+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));

+}
   }
   }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:

  Unfortunately this is not a solution as i have about 30 different

panels.
And i guess at least 10 of them should later use JS. With the approach
you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also
lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically

registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

  final WebMarkupContainer wmc = new
WebMarkupContainer("container"
**);
  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
{

  @Override
  protected void onTimer(AjaxRequestTarget target) {
  PanelTwo two = new PanelTwo("panel");
  wmc.addOrReplace(two);
  target.add(wmc);

  stop(target);
  }
  });
  add(wmc);

  wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:

  The problem is that this leads to a Page not found error. The problem

is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so
this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:

  What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

  Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace


The first panel gets displayed, after a few seco

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
I see now what Sven meant with the second check for isStopped().

But additionally I see that the quickstart is very broken.

PanelOne does:
form.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
}
});

But it doesn't use 'target' to repaint any component, so the registered JS
timer continues with its original Url which uses the old pageId and
component path to PanelOne. And as expected the second call triggered by
the obsolete timer fails with "The behavior's component (a Form which is no
more connected to the Page) cannot find its page.
This is a plain error in the application.



On Sun, Nov 25, 2012 at 6:34 PM, Oliver Zemann wrote:

> As suggested i created the JIRA issue https://issues.apache.org/**
> jira/browse/WICKET-4886
> I will test the diff tomorrow.
>
> Am 25.11.2012 15:41, schrieb Martin Grigorov:
>
>> Hi,
>>
>>
>> On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:
>>
>>  Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
>>> onTimer():
>>>
>>> diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/
>>> AbstractAjaxTimerBehavior.java
>>> b/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>> AbstractAjaxTimerBehavior.java
>>> index 3071875..b982a39 100644
>>> --- a/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>> AbstractAjaxTimerBehavior.java
>>> +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/**
>>>
>>> AbstractAjaxTimerBehavior.java
>>> @@ -131,8 +131,11 @@
>>>   {
>>>   onTimer(target);
>>>
>>> -target.getHeaderResponse().render(
>>> - OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
>>> +if (!isStopped())
>>>
>>>  But this code is already in : if (!isStopped() &&
>> isEnabled(getComponent()))
>> How the second "if (!isStopped())" fixes the issue ?
>>
>>
>>  +{
>>> +target.getHeaderResponse().render(
>>> + OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
>>>
>>> +}
>>>   }
>>>   }
>>>
>>> You could create a jira issue too.
>>>
>>
>> Additionally there are two global Ajax listeners at the bottom of
>> wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
>> I haven't debugged the application so I'm not sure where exactly is the
>> problem.
>>
>>
>>
>>> Sven
>>>
>>>
>>>
>>> On 11/25/2012 01:13 AM, Oliver Zemann wrote:
>>>
>>>  Unfortunately this is not a solution as i have about 30 different
 panels.
 And i guess at least 10 of them should later use JS. With the approach
 you
 suggested i would have to check which panel should be displayed and load
 that (switch/case with 10 different panels). I guess that would also
 lead
 in heavy mixing the panels with the HomePage (BasePage) (destroying
 reusability).

 There is also no way for me to create a "flow based" dialogue as this is
 done in the backend controller which only tells me which panel to load.

 So there is no other way to go?

 Am 24.11.2012 22:57, schrieb Sven Meier:

  After the timer has fired, AbstractAjaxTimerBehavior automatically
> registers another timeout for the form inside PanelOne.
> But at that point PanelOne is no longer in the component tree, it's
> replaced by PanelTwo already.
>
> I'd recommend adding the behavor to the container instead:
>
>  final WebMarkupContainer wmc = new
> WebMarkupContainer("container"
> **);
>  wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5))
> {
>
>  @Override
>  protected void onTimer(AjaxRequestTarget target) {
>  PanelTwo two = new PanelTwo("panel");
>  wmc.addOrReplace(two);
>  target.add(wmc);
>
>  stop(target);
>  }
>  });
>  add(wmc);
>
>  wmc.add(new PanelOne("panel"));
>
> This way you won't have to pass 'wmc' to PanelOne any longer.
>
> Sven
>
> On 11/24/2012 10:04 PM, Oliver Zemann wrote:
>
>  The problem is that this leads to a Page not found error. The problem
>> is that the Panel which should be replaced is still looked up in the
>> findPage() method. But findPage() returns null on that component, so
>> this
>> error is thrown.
>>
>> Am 24.11.2012 21:48, schrieb Sven Meier:
>>
>>  What is the problem?
>>>
>>> Sven
>>>
>>> On 11/24/2012 08:22 PM, Oliver Zemann wrote:
>>>
>>>  Hi,

 i created a small wicket application to show my problem:
 https://github.com/olze/WicketPanelRep

Re: Ajax based panel replacement

2012-11-25 Thread Oliver Zemann
As suggested i created the JIRA issue 
https://issues.apache.org/jira/browse/WICKET-4886

I will test the diff tomorrow.

Am 25.11.2012 15:41, schrieb Martin Grigorov:

Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:


Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
onTimer():

diff --git 
a/wicket-core/src/main/java/**org/apache/wicket/ajax/**AbstractAjaxTimerBehavior.java
b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
index 3071875..b982a39 100644
--- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
+++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
AbstractAjaxTimerBehavior.java
@@ -131,8 +131,11 @@
  {
  onTimer(target);

-target.getHeaderResponse().**render(
- OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
+if (!isStopped())


But this code is already in : if (!isStopped() && isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?



+{
+target.getHeaderResponse().**render(
+ OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
+}
  }
  }

You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.




Sven



On 11/25/2012 01:13 AM, Oliver Zemann wrote:


Unfortunately this is not a solution as i have about 30 different panels.
And i guess at least 10 of them should later use JS. With the approach you
suggested i would have to check which panel should be displayed and load
that (switch/case with 10 different panels). I guess that would also lead
in heavy mixing the panels with the HomePage (BasePage) (destroying
reusability).

There is also no way for me to create a "flow based" dialogue as this is
done in the backend controller which only tells me which panel to load.

So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:


After the timer has fired, AbstractAjaxTimerBehavior automatically
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's
replaced by PanelTwo already.

I'd recommend adding the behavor to the container instead:

 final WebMarkupContainer wmc = new WebMarkupContainer("container"
**);
 wmc.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
 @Override
 protected void onTimer(AjaxRequestTarget target) {
 PanelTwo two = new PanelTwo("panel");
 wmc.addOrReplace(two);
 target.add(wmc);

 stop(target);
 }
 });
 add(wmc);

 wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:


The problem is that this leads to a Page not found error. The problem
is that the Panel which should be replaced is still looked up in the
findPage() method. But findPage() returns null on that component, so this
error is thrown.

Am 24.11.2012 21:48, schrieb Sven Meier:


What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:


Hi,

i created a small wicket application to show my problem:
https://github.com/olze/**WicketPanelReplace

The first panel gets displayed, after a few seconds it should be
replaced by the second panel. Is there any way to achieve this behavior
with that kind of architecture?

If not, how should a ajax based panel wizard work? Any
recommendations?

Thanks in advance.

Oli

--**--**
-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



--**--**
-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



--**--**
-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



--**--**
-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@wicket.**apache.org
For additional commands, e-mail: users-h...@w

Re: Ajax based panel replacement

2012-11-25 Thread Martin Grigorov
Hi,


On Sun, Nov 25, 2012 at 9:51 AM, Sven Meier  wrote:

> Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from
> onTimer():
>
> diff --git 
> a/wicket-core/src/main/java/**org/apache/wicket/ajax/**AbstractAjaxTimerBehavior.java
> b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> index 3071875..b982a39 100644
> --- a/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> +++ b/wicket-core/src/main/java/**org/apache/wicket/ajax/**
> AbstractAjaxTimerBehavior.java
> @@ -131,8 +131,11 @@
>  {
>  onTimer(target);
>
> -target.getHeaderResponse().**render(
> - OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
> +if (!isStopped())
>

But this code is already in : if (!isStopped() && isEnabled(getComponent()))
How the second "if (!isStopped())" fixes the issue ?


> +{
> +target.getHeaderResponse().**render(
> + OnLoadHeaderItem.forScript(**getJsTimeoutCall(**updateInterval)));
> +}
>  }
>  }
>
> You could create a jira issue too.


Additionally there are two global Ajax listeners at the bottom of
wicket-ajax-jquery.js which purpose is to remove any obsolete timers.
I haven't debugged the application so I'm not sure where exactly is the
problem.


>
>
> Sven
>
>
>
> On 11/25/2012 01:13 AM, Oliver Zemann wrote:
>
>> Unfortunately this is not a solution as i have about 30 different panels.
>> And i guess at least 10 of them should later use JS. With the approach you
>> suggested i would have to check which panel should be displayed and load
>> that (switch/case with 10 different panels). I guess that would also lead
>> in heavy mixing the panels with the HomePage (BasePage) (destroying
>> reusability).
>>
>> There is also no way for me to create a "flow based" dialogue as this is
>> done in the backend controller which only tells me which panel to load.
>>
>> So there is no other way to go?
>>
>> Am 24.11.2012 22:57, schrieb Sven Meier:
>>
>>> After the timer has fired, AbstractAjaxTimerBehavior automatically
>>> registers another timeout for the form inside PanelOne.
>>> But at that point PanelOne is no longer in the component tree, it's
>>> replaced by PanelTwo already.
>>>
>>> I'd recommend adding the behavor to the container instead:
>>>
>>> final WebMarkupContainer wmc = new WebMarkupContainer("container"
>>> **);
>>> wmc.add(new AbstractAjaxTimerBehavior(**Duration.seconds(5)) {
>>> @Override
>>> protected void onTimer(AjaxRequestTarget target) {
>>> PanelTwo two = new PanelTwo("panel");
>>> wmc.addOrReplace(two);
>>> target.add(wmc);
>>>
>>> stop(target);
>>> }
>>> });
>>> add(wmc);
>>>
>>> wmc.add(new PanelOne("panel"));
>>>
>>> This way you won't have to pass 'wmc' to PanelOne any longer.
>>>
>>> Sven
>>>
>>> On 11/24/2012 10:04 PM, Oliver Zemann wrote:
>>>
 The problem is that this leads to a Page not found error. The problem
 is that the Panel which should be replaced is still looked up in the
 findPage() method. But findPage() returns null on that component, so this
 error is thrown.

 Am 24.11.2012 21:48, schrieb Sven Meier:

> What is the problem?
>
> Sven
>
> On 11/24/2012 08:22 PM, Oliver Zemann wrote:
>
>> Hi,
>>
>> i created a small wicket application to show my problem:
>> https://github.com/olze/**WicketPanelReplace
>>
>> The first panel gets displayed, after a few seconds it should be
>> replaced by the second panel. Is there any way to achieve this behavior
>> with that kind of architecture?
>>
>> If not, how should a ajax based panel wizard work? Any
>> recommendations?
>>
>> Thanks in advance.
>>
>> Oli
>>
>> --**--**
>> -
>> To unsubscribe, e-mail: 
>> users-unsubscribe@wicket.**apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> --**--**
> -
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

 --**--**
 -
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org


>>>
>>> --**--**
>>> -
>>> To unsubscribe, e-mail: 
>>> users-unsubscribe@wicket.**apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>> --**-

Re: Ajax based panel replacement

2012-11-25 Thread Sven Meier
Make a copy of AbstractAjaxTimerBehavior and let it be stoppable from 
onTimer():


diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java 
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java

index 3071875..b982a39 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java

@@ -131,8 +131,11 @@
 {
 onTimer(target);

-target.getHeaderResponse().render(
- OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+if (!isStopped())
+{
+target.getHeaderResponse().render(
+ OnLoadHeaderItem.forScript(getJsTimeoutCall(updateInterval)));
+}
 }
 }

You could create a jira issue too.

Sven


On 11/25/2012 01:13 AM, Oliver Zemann wrote:
Unfortunately this is not a solution as i have about 30 different 
panels. And i guess at least 10 of them should later use JS. With the 
approach you suggested i would have to check which panel should be 
displayed and load that (switch/case with 10 different panels). I 
guess that would also lead in heavy mixing the panels with the 
HomePage (BasePage) (destroying reusability).


There is also no way for me to create a "flow based" dialogue as this 
is done in the backend controller which only tells me which panel to 
load.


So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:
After the timer has fired, AbstractAjaxTimerBehavior automatically 
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's 
replaced by PanelTwo already.


I'd recommend adding the behavor to the container instead:

final WebMarkupContainer wmc = new 
WebMarkupContainer("container");

wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
target.add(wmc);

stop(target);
}
});
add(wmc);

wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:
The problem is that this leads to a Page not found error. The 
problem is that the Panel which should be replaced is still looked 
up in the findPage() method. But findPage() returns null on that 
component, so this error is thrown.


Am 24.11.2012 21:48, schrieb Sven Meier:

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any 
recommendations?


Thanks in advance.

Oli

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax based panel replacement

2012-11-24 Thread Oliver Zemann
Unfortunately this is not a solution as i have about 30 different 
panels. And i guess at least 10 of them should later use JS. With the 
approach you suggested i would have to check which panel should be 
displayed and load that (switch/case with 10 different panels). I guess 
that would also lead in heavy mixing the panels with the HomePage 
(BasePage) (destroying reusability).


There is also no way for me to create a "flow based" dialogue as this is 
done in the backend controller which only tells me which panel to load.


So there is no other way to go?

Am 24.11.2012 22:57, schrieb Sven Meier:
After the timer has fired, AbstractAjaxTimerBehavior automatically 
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's 
replaced by PanelTwo already.


I'd recommend adding the behavor to the container instead:

final WebMarkupContainer wmc = new 
WebMarkupContainer("container");

wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
target.add(wmc);

stop(target);
}
});
add(wmc);

wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:
The problem is that this leads to a Page not found error. The problem 
is that the Panel which should be replaced is still looked up in the 
findPage() method. But findPage() returns null on that component, so 
this error is thrown.


Am 24.11.2012 21:48, schrieb Sven Meier:

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any 
recommendations?


Thanks in advance.

Oli

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax based panel replacement

2012-11-24 Thread Sven Meier
After the timer has fired, AbstractAjaxTimerBehavior automatically 
registers another timeout for the form inside PanelOne.
But at that point PanelOne is no longer in the component tree, it's 
replaced by PanelTwo already.


I'd recommend adding the behavor to the container instead:

final WebMarkupContainer wmc = new WebMarkupContainer("container");
wmc.add(new AbstractAjaxTimerBehavior(Duration.seconds(5)) {
@Override
protected void onTimer(AjaxRequestTarget target) {
PanelTwo two = new PanelTwo("panel");
wmc.addOrReplace(two);
target.add(wmc);

stop(target);
}
});
add(wmc);

wmc.add(new PanelOne("panel"));

This way you won't have to pass 'wmc' to PanelOne any longer.

Sven

On 11/24/2012 10:04 PM, Oliver Zemann wrote:
The problem is that this leads to a Page not found error. The problem 
is that the Panel which should be replaced is still looked up in the 
findPage() method. But findPage() returns null on that component, so 
this error is thrown.


Am 24.11.2012 21:48, schrieb Sven Meier:

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any recommendations?

Thanks in advance.

Oli

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax based panel replacement

2012-11-24 Thread Oliver Zemann
The problem is that this leads to a Page not found error. The problem is 
that the Panel which should be replaced is still looked up in the 
findPage() method. But findPage() returns null on that component, so 
this error is thrown.


Am 24.11.2012 21:48, schrieb Sven Meier:

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any recommendations?

Thanks in advance.

Oli

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Ajax based panel replacement

2012-11-24 Thread Sven Meier

What is the problem?

Sven

On 11/24/2012 08:22 PM, Oliver Zemann wrote:

Hi,

i created a small wicket application to show my problem:
https://github.com/olze/WicketPanelReplace

The first panel gets displayed, after a few seconds it should be 
replaced by the second panel. Is there any way to achieve this 
behavior with that kind of architecture?


If not, how should a ajax based panel wizard work? Any recommendations?

Thanks in advance.

Oli

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org