You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Merrill <ch...@webperformance.com> on 2010/08/24 22:09:25 UTC

trouble with setOutputMarkupId() and WicketStuff ProgressBar

I'm trying to build a simple example of the ProgressBar from WicketStuff.

I'm getting this stack trace when pressing the "start" button:

java.lang.IllegalArgumentException: cannot update component that does not have setOutputMarkupId
property set to true. Component: [Page class =
com.webperformanceinc.office.licmgr.ui.MassUpgradeStatusPage, id = 20, version = 0, ajax = 3]
     at org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:346)
     at org.wicketstuff.progressbar.ProgressBar.start(ProgressBar.java:184)
     at
com.webperformanceinc.office.licmgr.ui.MassUpgradeStatusPage$2.onSubmit(MassUpgradeStatusPage.java:61)
     at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:102)
     ...

I have 3 elements with wicket:ids on them in my page, a form, a button and the
progress bar. I've called setOutputMarkupId(true) on all three, plus on the
page, since it was indicated as the offending componenet.  What am I missing?

See below for my code and HTML.

TIA to anyone who can point me in the right direction.
Chris



My page is constructed in this method (called from the page constructors):
    private void init()
        {
        setOutputMarkupId(true);

        final ProgressBar bar = new ProgressBar("bar", new ProgressionModel()
            {
            protected Progression getProgression()
                {
                return new Progression(progress);
                }

            protected void onFinished(AjaxRequestTarget target)
                {
                setVisible(false);
                target.appendJavascript("alert('Task done!')");
                }
            });
        add(bar);
        bar.setOutputMarkupId(true);

        Form form = new Form("form");
        add(form);
        form.setOutputMarkupId(true);
        IndicatingAjaxButton start_button = new IndicatingAjaxButton("start_button", form)
            {
            protected void onSubmit(AjaxRequestTarget target, Form form)
                {
                bar.start(target);
                new Thread()
                {
                public void run()
                    {
                    for (int i = 0; i <= 100; i++)
                        {
                        try
                            {
                            Thread.sleep(200);
                            }
                        catch (InterruptedException e)
                            {
                            }
                        progress = i;
                        }
                    }
                }.start();
                }
            };
        start_button.setOutputMarkupId(true);
        form.add(start_button);

        }

and my markup is pretty simple:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:wicket="http://wicket.sourceforge.net/">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>app title</title>
  </head>
  <body>
      <wicket:extend>

<p>Status goes here:</p>
<form action="#" wicket:id="form"><input type="submit" wicket:id="start_button" value="start"></form>
<div wicket:id="bar">[Progress]</div>


      </wicket:extend>
  </body>
</html>




-- 
------------------------------------------------------------------------ -
Chris Merrill                           |  Web Performance, Inc.
chris@webperformance.com                |  http://webperformance.com
919-433-1762                            |  919-845-7601

Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -

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


Re: trouble with setOutputMarkupId() and WicketStuff ProgressBar

Posted by Chris Merrill <ch...@webperformance.com>.
On 8/24/2010 4:25 PM, Igor Vaynberg wrote:
> maybe you need to put it all into a container?

That fixed it.  I thought a page _was_ a container?  Hmmmph.  I'll have to come
back to try to understand this one better at some point....

Thanks again, Igor!

Wicket rocks :>

Chris



-- 
------------------------------------------------------------------------ -
Chris Merrill                           |  Web Performance, Inc.
chris@webperformance.com                |  http://webperformance.com
919-433-1762                            |  919-845-7601

Web Performance: Website Load Testing Software & Services
------------------------------------------------------------------------ -

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


Re: trouble with setOutputMarkupId() and WicketStuff ProgressBar

Posted by Igor Vaynberg <ig...@gmail.com>.
maybe you need to put it all into a container?

-igor

On Tue, Aug 24, 2010 at 1:09 PM, Chris Merrill <ch...@webperformance.com> wrote:
> I'm trying to build a simple example of the ProgressBar from WicketStuff.
>
> I'm getting this stack trace when pressing the "start" button:
>
> java.lang.IllegalArgumentException: cannot update component that does not have setOutputMarkupId
> property set to true. Component: [Page class =
> com.webperformanceinc.office.licmgr.ui.MassUpgradeStatusPage, id = 20, version = 0, ajax = 3]
>     at org.apache.wicket.ajax.AjaxRequestTarget.addComponent(AjaxRequestTarget.java:346)
>     at org.wicketstuff.progressbar.ProgressBar.start(ProgressBar.java:184)
>     at
> com.webperformanceinc.office.licmgr.ui.MassUpgradeStatusPage$2.onSubmit(MassUpgradeStatusPage.java:61)
>     at org.apache.wicket.ajax.markup.html.form.AjaxButton$1.onSubmit(AjaxButton.java:102)
>     ...
>
> I have 3 elements with wicket:ids on them in my page, a form, a button and the
> progress bar. I've called setOutputMarkupId(true) on all three, plus on the
> page, since it was indicated as the offending componenet.  What am I missing?
>
> See below for my code and HTML.
>
> TIA to anyone who can point me in the right direction.
> Chris
>
>
>
> My page is constructed in this method (called from the page constructors):
>    private void init()
>        {
>        setOutputMarkupId(true);
>
>        final ProgressBar bar = new ProgressBar("bar", new ProgressionModel()
>            {
>            protected Progression getProgression()
>                {
>                return new Progression(progress);
>                }
>
>            protected void onFinished(AjaxRequestTarget target)
>                {
>                setVisible(false);
>                target.appendJavascript("alert('Task done!')");
>                }
>            });
>        add(bar);
>        bar.setOutputMarkupId(true);
>
>        Form form = new Form("form");
>        add(form);
>        form.setOutputMarkupId(true);
>        IndicatingAjaxButton start_button = new IndicatingAjaxButton("start_button", form)
>            {
>            protected void onSubmit(AjaxRequestTarget target, Form form)
>                {
>                bar.start(target);
>                new Thread()
>                {
>                public void run()
>                    {
>                    for (int i = 0; i <= 100; i++)
>                        {
>                        try
>                            {
>                            Thread.sleep(200);
>                            }
>                        catch (InterruptedException e)
>                            {
>                            }
>                        progress = i;
>                        }
>                    }
>                }.start();
>                }
>            };
>        start_button.setOutputMarkupId(true);
>        form.add(start_button);
>
>        }
>
> and my markup is pretty simple:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
>    xmlns:wicket="http://wicket.sourceforge.net/">
>  <head>
>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
>    <title>app title</title>
>  </head>
>  <body>
>      <wicket:extend>
>
> <p>Status goes here:</p>
> <form action="#" wicket:id="form"><input type="submit" wicket:id="start_button" value="start"></form>
> <div wicket:id="bar">[Progress]</div>
>
>
>      </wicket:extend>
>  </body>
> </html>
>
>
>
>
> --
> ------------------------------------------------------------------------ -
> Chris Merrill                           |  Web Performance, Inc.
> chris@webperformance.com                |  http://webperformance.com
> 919-433-1762                            |  919-845-7601
>
> Web Performance: Website Load Testing Software & Services
> ------------------------------------------------------------------------ -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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