Hi,

my webapp asynchronously kicks of a a process that takes some (1-2
minutes) time till a result is provided. After the kickoff and before
the result is available I'd like the Page to reload itself untill the
result is there, stopping the reload.

So far I tried two approaches.
First I worked with the pages meta tag. I controlled it's attributes
using AttributeModifier.
something like:

Markup:
<meta wicket:id="refresh" id="refresh" content="" />

Code:
        final Label refresh = new Label("refresh");
        final AttributeModifier http_equiv = new AttributeModifier(
                "http-equiv", true, new Model("refresh")) {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isEnabled() {
                return !isRequestTokenDone();
            }
        };
        final AttributeModifier content = new AttributeModifier("content",
                true, new PropertyModel(this, "content")) {
            private static final long serialVersionUID = 1L;

            @Override
            public boolean isEnabled() {
                return !isRequestTokenDone();
            }
        };
        refresh.add(http_equiv);
        refresh.add(content);
        add(refresh);

This was ok, except that the performance was bad. The whole page is
reloaded, even on localhost this took 2 seconds. Too much.

On the second aproach I added a AjaxSelfUpdatingTimerBehavior to the
panel I wanted to reload.
        myPanel panel = new MyPanel("myPanel");
        panel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(10)));
        add(panel);

Performance is grat now, but I don't see a way for disabeling the
UpdateBehaviour, once the result is available.

Any ideas?

Martin


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to