Re: AjaxIndicatingButton

2015-12-04 Thread Mihir Chhaya
Hi,

As you have mentioned target.addComponent(comp), it seems you are using
Wicket 1.4. Just so that it might be helpful to you; Wicket 1.4 is no
longer supported - does not mean that you won't get answers from forum but
there won't be any release for 1.4 version (I am writing this based upon
online Wicket version status - so please take it as suggestion).

If I am understanding it correctly, all you want is disable two other
buttons on submit of 'this' button. And as by design; Wicket needs the
component to be added for ajax change via target.addComponent. Which should
take effect immediately.

I might be wrong in my suggestion as your scenario needs more details for
better understanding.

-Mihir.

On Fri, Dec 4, 2015 at 3:28 PM, sorinev <sori...@gmail.com> wrote:

> I have a dialog with 3 AjaxIndicatingButtons on it. When I override
> onSubmit(), I can disable the 'this' component in real time
> (this.setEnabled(false)), but traditionally, any other component that gets
> modified has to do target.addComponent(comp) and then wait for the
> onSubmit() to return in order for it to take effect.
>
> However, I really need to have all three buttons be disabled immediately if
> *any* button is actively inside it's onSubmit() function (being re-enabled
> when the function returns is ok). Is this possible?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


AjaxIndicatingButton

2015-12-04 Thread sorinev
I have a dialog with 3 AjaxIndicatingButtons on it. When I override
onSubmit(), I can disable the 'this' component in real time
(this.setEnabled(false)), but traditionally, any other component that gets
modified has to do target.addComponent(comp) and then wait for the
onSubmit() to return in order for it to take effect.

However, I really need to have all three buttons be disabled immediately if
*any* button is actively inside it's onSubmit() function (being re-enabled
when the function returns is ok). Is this possible? 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxIndicatingButton

2015-12-04 Thread sorinev
Yes, it's Wicket 1.4.17. I've thought about migrating it to one of the more
recent versions. But with 41k lines of java across 225 files just in the
Wicket portion of our enterprise application, it'll be a major pain to
migrate considering there were several enormous changes to certain
components/functionality that we use a lot. Believe me, it does kill me that
we are on a version that is so old. 

As for the disabling thing, more specifically I wanted to be able to do
something like this:

protected void onSubmit(AjaxRequestTarget target, Form form){
this.setEnabled(false);
//disable button 2 here
//disable button 3 here

//do a bunch of stuff here

//enable button 3 here
//enable button 2 here
this.setEnabled(true);
}

Meaning, I'd like the effect to happen immediately, without having to do
target.addComponent() and without having to wait for onSubmit() to return
(since it would be pointless to disable and re-enable after I've already
finished the work). Basically, the user needs to not be able to use any
other buttons while some other button's code is busy in onSubmit().
mihir wrote
> Hi,
> 
> As you have mentioned target.addComponent(comp), it seems you are using
> Wicket 1.4. Just so that it might be helpful to you; Wicket 1.4 is no
> longer supported - does not mean that you won't get answers from forum but
> there won't be any release for 1.4 version (I am writing this based upon
> online Wicket version status - so please take it as suggestion).
> 
> If I am understanding it correctly, all you want is disable two other
> buttons on submit of 'this' button. And as by design; Wicket needs the
> component to be added for ajax change via target.addComponent. Which
> should
> take effect immediately.
> 
> I might be wrong in my suggestion as your scenario needs more details for
> better understanding.
> 
> -Mihir.
> 
> On Fri, Dec 4, 2015 at 3:28 PM, sorinev 

> sorinev@

>  wrote:
> 
>> I have a dialog with 3 AjaxIndicatingButtons on it. When I override
>> onSubmit(), I can disable the 'this' component in real time
>> (this.setEnabled(false)), but traditionally, any other component that
>> gets
>> modified has to do target.addComponent(comp) and then wait for the
>> onSubmit() to return in order for it to take effect.
>>
>> However, I really need to have all three buttons be disabled immediately
>> if
>> *any* button is actively inside it's onSubmit() function (being
>> re-enabled
>> when the function returns is ok). Is this possible?
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

>>
>>



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874p4672877.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxIndicatingButton

2015-12-04 Thread Mihir Chhaya
You could something like below:

   final AjaxButton testButton1 = new AjaxButton("test1"){

/**
*
*/
   private static final long serialVersionUID = 1L;

   @Override
protected void onSubmit(AjaxRequestTarget target, Form form)
{

 target.appendJavascript("document.getElementById('tb2').disabled=true;");

 target.appendJavascript("document.getElementById('tb3').disabled=true;");
}
};

testButton1.setMarkupId("tb1");
testButton1.setOutputMarkupId(true);

final Button testButton2 = new Button("test2");
testButton2.setMarkupId("tb2");
testButton2.setOutputMarkupId(true);

final Button testButton3 = new Button("test3");
testButton3.setMarkupId("tb3");
testButton3.setOutputMarkupId(true);

Thanks,
-Mihir.

On Fri, Dec 4, 2015 at 4:32 PM, sorinev <sori...@gmail.com> wrote:

> Yes, it's Wicket 1.4.17. I've thought about migrating it to one of the more
> recent versions. But with 41k lines of java across 225 files just in the
> Wicket portion of our enterprise application, it'll be a major pain to
> migrate considering there were several enormous changes to certain
> components/functionality that we use a lot. Believe me, it does kill me
> that
> we are on a version that is so old.
>
> As for the disabling thing, more specifically I wanted to be able to do
> something like this:
>
> protected void onSubmit(AjaxRequestTarget target, Form form){
> this.setEnabled(false);
> //disable button 2 here
> //disable button 3 here
>
> //do a bunch of stuff here
>
> //enable button 3 here
> //enable button 2 here
> this.setEnabled(true);
> }
>
> Meaning, I'd like the effect to happen immediately, without having to do
> target.addComponent() and without having to wait for onSubmit() to return
> (since it would be pointless to disable and re-enable after I've already
> finished the work). Basically, the user needs to not be able to use any
> other buttons while some other button's code is busy in onSubmit().
> mihir wrote
> > Hi,
> >
> > As you have mentioned target.addComponent(comp), it seems you are using
> > Wicket 1.4. Just so that it might be helpful to you; Wicket 1.4 is no
> > longer supported - does not mean that you won't get answers from forum
> but
> > there won't be any release for 1.4 version (I am writing this based upon
> > online Wicket version status - so please take it as suggestion).
> >
> > If I am understanding it correctly, all you want is disable two other
> > buttons on submit of 'this' button. And as by design; Wicket needs the
> > component to be added for ajax change via target.addComponent. Which
> > should
> > take effect immediately.
> >
> > I might be wrong in my suggestion as your scenario needs more details for
> > better understanding.
> >
> > -Mihir.
> >
> > On Fri, Dec 4, 2015 at 3:28 PM, sorinev 
>
> > sorinev@
>
> >  wrote:
> >
> >> I have a dialog with 3 AjaxIndicatingButtons on it. When I override
> >> onSubmit(), I can disable the 'this' component in real time
> >> (this.setEnabled(false)), but traditionally, any other component that
> >> gets
> >> modified has to do target.addComponent(comp) and then wait for the
> >> onSubmit() to return in order for it to take effect.
> >>
> >> However, I really need to have all three buttons be disabled immediately
> >> if
> >> *any* button is actively inside it's onSubmit() function (being
> >> re-enabled
> >> when the function returns is ok). Is this possible?
> >>
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874.html
> >> Sent from the Users forum mailing list archive at Nabble.com.
> >>
> >> -
> >> To unsubscribe, e-mail:
>
> > users-unsubscribe@.apache
>
> >> For additional commands, e-mail:
>
> > users-help@.apache
>
> >>
> >>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874p4672877.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: AjaxIndicatingButton

2015-12-04 Thread sorinev
I gave that a shot but it didn't seem to work. It still did the disabling
after onSubmit() returned. I'm not going to worry about it at this point, I
just thought it'd be better to do it. 

Thanks for your assistance mihir. 


mihir wrote
> You could something like below:
> 
>final AjaxButton testButton1 = new AjaxButton("test1"){
> 
> /**
> *
> */
>private static final long serialVersionUID = 1L;
> 
>@Override
> protected void onSubmit(AjaxRequestTarget target, Form
> form)
> {
> 
>  target.appendJavascript("document.getElementById('tb2').disabled=true;");
> 
>  target.appendJavascript("document.getElementById('tb3').disabled=true;");
> }
> };
> 
> testButton1.setMarkupId("tb1");
> testButton1.setOutputMarkupId(true);
> 
> final Button testButton2 = new Button("test2");
> testButton2.setMarkupId("tb2");
> testButton2.setOutputMarkupId(true);
> 
> final Button testButton3 = new Button("test3");
> testButton3.setMarkupId("tb3");
> testButton3.setOutputMarkupId(true);
> 
> Thanks,
> -Mihir.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874p4672879.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: AjaxIndicatingButton

2015-12-04 Thread Martin Grigorov
Hi,

You need to disable the button with JavaScript just before its Ajax call is
made and re-enable it in the success/failure JS callbacks.
I don't remember how to do the first... For the latter you have to override
some extra methods. Check the API.
On Dec 5, 2015 1:54 AM, "sorinev" <sori...@gmail.com> wrote:

> I gave that a shot but it didn't seem to work. It still did the disabling
> after onSubmit() returned. I'm not going to worry about it at this point, I
> just thought it'd be better to do it.
>
> Thanks for your assistance mihir.
>
>
> mihir wrote
> > You could something like below:
> >
> >final AjaxButton testButton1 = new AjaxButton("test1"){
> >
> > /**
> > *
> > */
> >private static final long serialVersionUID = 1L;
> >
> >@Override
> > protected void onSubmit(AjaxRequestTarget target, Form
> > form)
> > {
> >
> >
> target.appendJavascript("document.getElementById('tb2').disabled=true;");
> >
> >
> target.appendJavascript("document.getElementById('tb3').disabled=true;");
> > }
> > };
> >
> > testButton1.setMarkupId("tb1");
> > testButton1.setOutputMarkupId(true);
> >
> > final Button testButton2 = new Button("test2");
> > testButton2.setMarkupId("tb2");
> > testButton2.setOutputMarkupId(true);
> >
> > final Button testButton3 = new Button("test3");
> > testButton3.setMarkupId("tb3");
> > testButton3.setOutputMarkupId(true);
> >
> > Thanks,
> > -Mihir.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AjaxIndicatingButton-tp4672874p4672879.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>