IAjaxIndicatorAware simply takes the html id of the element you want
to show/hide; it can be placed anywhere in html...

alternatively there are clientside javascript callbacks you can hook
into to create gmail-like busy indicator, see wicket-ajax.js

-igor


On Jan 29, 2008 11:11 AM, Martin Makundi
<[EMAIL PROTECTED]> wrote:
> Hi!
>
> I can get the default behaviour to work. However, I do not want the
> ajax indicator icon to be appended after the button. Instead, I want
> to simply mark it elsewhere in my html file to position it suitably. I
> have not found a way to separate the button from the icon in the
> markup. I am new to Wicket, so I haven't got my mind wrapped around
> this the right way yet.
>
> To put it in swing, I would set the icon visible on default render.
> Then I would set it visible for the duration of the processing and set
> it invisible again after that. At least this is what it should look
> like, but I cannot seem to get the pieces together nicely. Anybody can
> help? Anyone have boilerplate code for the same problem?
>
> **
> Martin
>
> 2008/1/29, Michael Sparer <[EMAIL PROTECTED]>:
>
> >
> > Take a look at IndicatingAjaxButton in the extensions-project and adapt it
> > for your form.
> > If you don't mind taking the default indicator, you can use
> > WicketAjaxIndicatorAppender just like in the mentioned class
> >
> >
> >
> > Martin Makundi wrote:
> > >
> > > Hi!
> > >
> > > Can anyone help? I am having difficulties showing a bysy indicator
> > > besides the submit button, while the form is being submitted and
> > > processed. I have only found pieces of varying examples and I have
> > > tried to put them work together, but it just does not seem want to
> > > show the indicator. Here is my code:
> > >
> > > public class Login extends WebPage {
> > >     // ... default constructor contents:
> > >     final Form loginForm = new Form(LOGIN_FORM, new Model());
> > >     final AjaxIndicatorContainer indicatorContainer = new
> > > AjaxIndicatorContainer();
> > >     indicatorContainer.setOutputMarkupId(true);
> > >     loginForm.add(indicatorContainer);
> > >       final SubmitLink loginButton = new SubmitLink(LOGIN_BUTTON, new
> > > Model()) {
> > >         /**
> > >          * @see org.apache.wicket.markup.html.form.SubmitLink#onSubmit()
> > >          */
> > >         @Override
> > >         public void onSubmit() {
> > >           super.onSubmit();
> > >           Thread.sleep(5000); // Simulate form processing
> > >         }
> > >       };
> > >       abstract class AjaxFormSubmitIndicator extends
> > > AjaxFormSubmitBehavior implements IAjaxIndicatorAware {
> > >         /**
> > >          * Constructor for TODO
> > >          *
> > >          */
> > >         public AjaxFormSubmitIndicator() {
> > >           super("onchange"); // I have tried "onchange" and "onclick"
> > >         }
> > >       }
> > >       loginButton.add(new AjaxFormSubmitIndicator() {
> > >         @Override
> > >         protected void onError(AjaxRequestTarget arg0) {
> > >           // TODO Auto-generated method stub
> > >         }
> > >
> > >         @Override
> > >         protected void onSubmit(AjaxRequestTarget arg0) {
> > >           loginButton.onSubmit();
> > >         }
> > >
> > >         public String getAjaxIndicatorMarkupId() {
> > >           return indicatorContainer.getMarkupId();
> > >         }
> > >       });
> > >       loginForm.add(loginButton);
> > >
> > > // ... etc..
> > >
> > >       add(new FeedbackPanel("feedback"));
> > >       add(loginForm);
> > > }
> > >
> > >
> > >
> > >
> > > public class AjaxIndicatorContainer extends WebMarkupContainer {
> > >   /**
> > >    *
> > >    */
> > >   private static final long serialVersionUID = 5573778050703849297L;
> > >   /**
> > >    *
> > >    */
> > >   public static final String INDICATOR_MARKUP_ID = "ajaxIndicator";
> > >
> > >   /**
> > >    * Constructor for TODO
> > >    */
> > >   public AjaxIndicatorContainer() {
> > >     super(INDICATOR_MARKUP_ID);
> > >   }
> > >
> > >   /**
> > >    * @see
> > > org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
> > >    */
> > >   @Override
> > >   protected void onComponentTag(ComponentTag tag) {
> > >     super.onComponentTag(tag);
> > >     tag.put("src",urlFor(AbstractDefaultAjaxBehavior.INDICATOR));
> > >   }
> > >
> > >
> > >
> > >
> > > <body>
> > > <wicket:extend>
> > > <h1>Login</h1>
> > > Feedback messages will be here.
> > > <form wicket:id="loginForm">
> > > <table border="0" cellspacing="0" cellpadding="2" align="center">
> > > <tr><td NOWRAP width="80" align="right">
> > > Username:
> > > </td>
> > > <td><input type="text" wicket:id="userId"></td></tr>
> > > <tr><td NOWRAP align="right">
> > > Password: </td><td><input type="password" wicket:id="password"></td></tr>
> > > <tr><td align="right"> # </td><td NOWRAP>
> > > <input type="submit" value="Sign in" wicket:id="loginButton">
> > > </td></tr>
> > > </table>
> > > </form>
> > > </wicket:extend>
> > > </body>
> > >
> > >
> > > **
> > > Martin
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> > >
> >
> >
> > -----
> > Michael Sparer
> > http://talk-on-tech.blogspot.com
> > --
> > View this message in context: 
> > http://www.nabble.com/Ajax-Busy-Indicator-tp15153150p15160382.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to