You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex66955 <ba...@googlemail.com> on 2012/07/28 18:32:17 UTC

Wicket: Ajax callback onTimer() method not called

I use wicket 1.5 to develop a webapplication. I have three webpages, the
homePage, the ParentWebpage and a Panel. When I setup an
AbstractAjaxTimerBehavior in the ParentWebpage and call in the callback
function onTimer() the Panel, every thing is alright.But in the panel is
also an AbstractAjaxTimerBehavior and the callback function onTimer is never
called, but why??

Here my example:

HomePage.java

    BookmarkablePageLink bookmarkablePageLink = new
BookmarkablePageLink("linkToCurrentDiagnosePage", TestParent.class);
    bookmarkablePageLink.add("label");
    item.add(bookmarkablePageLink);

--> now I can navigate to the TestParent class

TestParent.java

    public class TestParent extends WebPage {
        /** The Constant logger. */
        private static final Logger LOGGER =
Logger.getLogger(TestParent.class);
        boolean isSet = false;
        public TestParent() {
            LOGGER.error("Parent -> Cstr");
            Fragment fragment = new Fragment("fragments", "fragment1",
TestParent.this);
            fragment.setOutputMarkupId(true);
            add(fragment);
            
            add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
                
                @Override
                protected void onTimer(AjaxRequestTarget target) {
                    LOGGER.error("Parent -> I'am here");
                    if(isSet == false){
                        LOGGER.error("Parent -> I set the panel");
                        isSet = true;
                        Fragment fragment = new Fragment("fragments",
"fragment2", TestParent.this);
                        fragment.setOutputMarkupId(true);
                        fragment.add(new TestChild("panel"));
                        TestParent.this.replace(fragment);
                        target.add(fragment);
                    }
                }
            });
        }
    }

TestParent.html

    <!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/loose.dtd&quot;>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    	
    
    	<wicket:fragment wicket:id="fragment1">
    		FILL TEXT
    	</wicket:fragment>
    
    	<wicket:fragment wicket:id="fragment2">
    		[message]
    	</wicket:fragment>
    </body>
    </html>

TestChild.java

    public class TestChild extends Panel {
        private static final Logger LOGGER =
Logger.getLogger(TestChild.class);
        
        public TestChild(String id) {
            super(id);
            LOGGER.error("Child -> Cstr");
            
            add(new AbstractAjaxTimerBehavior(Duration.seconds(1)) {
                
                @Override
                protected void onTimer(AjaxRequestTarget target) {
                    LOGGER.error("CHILD --> I'am here");
                }
            });               
        }
    }

TestChild.html

    <!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/loose.dtd&quot;>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    	<wicket:panel>
    	
    	</wicket:panel>
    </body>

</html>

OUTPUT:

    ERROR - TestParent                 - Parent -> Cstr
    
    ERROR - TestParent                 - Parent -> I'am here
    
    ERROR - TestParent                 - Parent -> I set the panel
    
    ERROR - TestChild                  - Child -> Cstr
    
    ERROR - TestParent                 - Parent -> I'am here
    
    ERROR - TestParent                 - Parent -> I'am here
    
    ERROR - TestParent                 - Parent -> I'am here
    
    ERROR - TestParent                 - Parent -> I'am here




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-callback-onTimer-method-not-called-tp4650851.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: Ajax callback onTimer() method not called

Posted by Alex66955 <ba...@googlemail.com>.
Francois Meillet wrote
> 
> It works perfectly with Wicket 6
> 
> Francois
> 

I migrate my project from wicket 1.5.X to 6.0.0-beta3. I can confirm, the
bug is lost =) 


Thanks for all

Alex



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-callback-onTimer-method-not-called-tp4650851p4650868.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: Ajax callback onTimer() method not called

Posted by Francois Meillet <fr...@gmail.com>.
Definitely ! you should use Wicket 6.x.x which is nearly in final release.
The 6.0.0-beta3 is already very stable.

François



-----
François Meillet
Développeur Wicket - indépendant - Paris - IDF
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-callback-onTimer-method-not-called-tp4650851p4650865.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: Ajax callback onTimer() method not called

Posted by Alex66955 <ba...@googlemail.com>.
Hey Francois,

thanks for your answer. 
Wicket 6 is a beta version. Is it stable?

I think the problem is, when I call in an ajax callback function like
"onTimer()" a panel or something else with also an ajax callback function,
the child header javascript for the ajax request is not set in the parent.
When I reload the page manually, the child javaScript is add to the parent
and everything work fine. But nobody want to reaload the page manually after
load it.
My current workaround is to call:

If it necessary. But the whole page is reload.

Greetings
alex



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-callback-onTimer-method-not-called-tp4650851p4650864.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket: Ajax callback onTimer() method not called

Posted by Francois Meillet <fr...@gmail.com>.
It works perfectly with Wicket 6

Francois



-----
François Meillet
Développeur Wicket - indépendant - Paris - IDF
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Ajax-callback-onTimer-method-not-called-tp4650851p4650863.html
Sent from the Users forum mailing list archive at Nabble.com.

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