Re: Debugging options

2018-06-07 Thread Sven Meier

Hi,

the value of the  will not be sent when it is already disabled 
before Wicket serializes its value.


You should use #getBeforeSendHandler() instead.

Sven


Am 07.06.2018 um 19:55 schrieb sorinev:

Ok, so I found out what it appears to be. My full code for the DropDownChoice
I'm setting up is this:

selectedAccountDropdown = new DropDownChoice("selectedAccount", new
PropertyModel(this, "selectedAccount"), accountList, new
ChoiceRenderer("name", "id"));
selectedAccountDropdown.add(new AjaxFormComponentUpdatingBehavior("change")
{
@Override
protected void onError(AjaxRequestTarget target, RuntimeException e) {
if (e != null) {
LOG.error(e, e);
error(e);
} else {
LOG.error("Exception null, see feedback on page.");
}
error("Page may not have been updated");
target.add(feedbackPanel);
}

@Override
protected void onUpdate(AjaxRequestTarget target) {
//[code here]
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new AjaxCallListener()

.onBefore("$('#selectedAccount').prop('disabled',true);")

.onComplete("$('#selectedAccount').prop('disabled',false);"));
}
});
selectedAccountDropdown.setMarkupId("selectedAccount");
selectedAccountDropdown.setNullValid(false);
selectedAccountDropdown.setRequired(true);
baseForm.add(selectedAccountDropdown);

When I comment out the updateAjaxAttributes method, everything works as
expected. If I add it back in, my model object becomes null again when
changing. So, I'm obviously doing that the wrong way. What is the proper way
to achieve what I'm doing on the updateAjaxAttributes override? What I need
to do is disable the dropdown *while* the dropdown is being updated because
there's code that runs that needs to be allowed to finish. I obviously can't
disable/enable the component inside the onUpdate method because those won't
take effect until after onUpdate finishes. Which, clearly, is useless. Hence
the Ajax bits.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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




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



Re: Debugging options

2018-06-07 Thread sorinev
Ok, so I found out what it appears to be. My full code for the DropDownChoice
I'm setting up is this:

selectedAccountDropdown = new DropDownChoice("selectedAccount", new
PropertyModel(this, "selectedAccount"), accountList, new
ChoiceRenderer("name", "id"));
selectedAccountDropdown.add(new AjaxFormComponentUpdatingBehavior("change")
{
@Override
protected void onError(AjaxRequestTarget target, RuntimeException e) {
if (e != null) {
LOG.error(e, e);
error(e);
} else {
LOG.error("Exception null, see feedback on page.");
}
error("Page may not have been updated");
target.add(feedbackPanel);
}

@Override
protected void onUpdate(AjaxRequestTarget target) {
//[code here]
}

@Override
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
super.updateAjaxAttributes(attributes);
attributes.getAjaxCallListeners().add(new AjaxCallListener()

.onBefore("$('#selectedAccount').prop('disabled',true);")

.onComplete("$('#selectedAccount').prop('disabled',false);"));
}
});
selectedAccountDropdown.setMarkupId("selectedAccount");
selectedAccountDropdown.setNullValid(false);
selectedAccountDropdown.setRequired(true);
baseForm.add(selectedAccountDropdown);

When I comment out the updateAjaxAttributes method, everything works as
expected. If I add it back in, my model object becomes null again when
changing. So, I'm obviously doing that the wrong way. What is the proper way
to achieve what I'm doing on the updateAjaxAttributes override? What I need
to do is disable the dropdown *while* the dropdown is being updated because
there's code that runs that needs to be allowed to finish. I obviously can't
disable/enable the component inside the onUpdate method because those won't
take effect until after onUpdate finishes. Which, clearly, is useless. Hence
the Ajax bits.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Debugging options

2018-06-07 Thread sorinev
It seems like nothing in that class is being called when I change the
selection in the DropDownChoice.

I'm setting it up like this:

new DropDownChoice("account", new PropertyModel(this, "selectedAccount"),
accountList, new ChoiceRenderer("name", "id"));

But I've tried several other ways too, such as a CompoundPropertyModel
straight, a CompoundPropertyModel with bind(), putting the selectedAccount
object not in "this" ("this" is the page itself, derived from Wicket
WebPage), but in an normal object, etc. and it always results in
selectedAccount being null. But like I said, this same thing works in a
quickstart, so I'm baffled.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Debugging options

2018-06-07 Thread Sven Meier

Hi,

Wicket doesn't need any special equals() implementations.

Debug AbstractSingleSelectChoice#getModelValue() and check what it does.

Have fun
Sven

Am 07.06.2018 um 17:12 schrieb sorinev:

I don't have an equals method for the class, and most of the classes I've
come across in our code that are being used in Wicket components don't. Is a
class supposed to? How does it work otherwise? Bit-by-bit comparison by the
JVM?

Anyhow, yeah debugging is what I've been doing but I've been getting
nowhere. I was wondering what I can zero in on in the Wicket sources that
might help me debug why setting up the dropdown is perfectly fine, as is
setting the initial value when the page is constructed, but why changing is
always null.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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




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



Re: Debugging options

2018-06-07 Thread sorinev
I don't have an equals method for the class, and most of the classes I've
come across in our code that are being used in Wicket components don't. Is a
class supposed to? How does it work otherwise? Bit-by-bit comparison by the
JVM?

Anyhow, yeah debugging is what I've been doing but I've been getting
nowhere. I was wondering what I can zero in on in the Wicket sources that
might help me debug why setting up the dropdown is perfectly fine, as is
setting the initial value when the page is constructed, but why changing is
always null.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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



Re: Debugging options

2018-06-07 Thread Sven Meier

Hi,

I'd guess you have a problem with your equals() implementation.

If you can't reproduce the problem in a quickstart, you'll have to 
resort to debugging. If you send me some details (PM?), I can take a look.


Have fun
Sven


Am 06.06.2018 um 21:16 schrieb sorinev:

I have some code that's not working like it should, and like it does in other
projects. I made a quickstart, but it works there. What other debugging
options do I have besides plain Java debugging (short of sharing my repo
with a maintainer / expert, which I'm 100% open to)?

I have a DropDownChoice with a PropertyModel. The dropdown is set up
initially just fine. But any changes to the selection result in the property
object being null and I can't for the life of me figure out why. I've
included the wicket sources in my debugger and have poked around in there,
but can't see anything obvious to my untrained eye. I use this same pattern
in lots of other files in different projects, but for some reason it's just
not working here, so I'm obviously missing something, but can't figure out
what.

Wicket 7.11.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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




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



Debugging options

2018-06-06 Thread sorinev
I have some code that's not working like it should, and like it does in other
projects. I made a quickstart, but it works there. What other debugging
options do I have besides plain Java debugging (short of sharing my repo
with a maintainer / expert, which I'm 100% open to)?

I have a DropDownChoice with a PropertyModel. The dropdown is set up
initially just fine. But any changes to the selection result in the property
object being null and I can't for the life of me figure out why. I've
included the wicket sources in my debugger and have poked around in there,
but can't see anything obvious to my untrained eye. I use this same pattern
in lots of other files in different projects, but for some reason it's just
not working here, so I'm obviously missing something, but can't figure out
what.

Wicket 7.11.

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

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