Hi,
it works similar to AjaxFormComponentUpdatingBehavior:
new CheckBox("id", model)
.add(new FormComponentUpdatingBehavior() {
protected void onUpdate() {
Boolean value = ((CheckBox)getFormComponent()).getModelObject()
}
});
#getFormComponent() doesn't know the generic type, so regretfully you have to
add an explicit cast :/.
Alternative:
CheckBox checkBox = new CheckBox("id", model):
checkbox.add(new FormComponentUpdatingBehavior() {
protected void onUpdate() {
Boolean value = checkbox.getModelObject();
}
});
Java 8 will add an implicit final modifier to your checkbox.
Sven
Am 26. Juni 2017, 12:46, um 12:46, Korbinian Bachl
schrieb:
>Hi,
>
>in https://issues.apache.org/jira/browse/WICKET-6348 the way how to
>react on onSelectionChanged(Object object) got changed to now a usage
>of
>
>// Wicket 7.x
>new CheckBox("id", model) {
>protected boolean wantOnSelectionChangedNotifications() {
>return true;
>}
>
>protected void onSelectionChanged(Boolean newSelection) {
>// do something, page will be rerendered;
>}
>};
>
>
>// Wicket 8.x
>new CheckBox("id", model)
>.add(new FormComponentUpdatingBehavior() {
>protected void onUpdate() {
>// do something, page will be rerendered;
>}
>
>protected void onError(RuntimeException ex) {
>super.onError(ex);
>}
>});
>
>
>My Problem is now that I try to get brix cms to compile and I have a
>code in there as:
>
>
>form.add(new DropDownChoice("tileType", new
>PropertyModel(this, "newTileTypeName"), new
>TileTypeNamesModel(),
>new TileTypeNameRenderer()) {
>private static final long serialVersionUID = 1L;
>[]
>
>@Override
>protected void onSelectionChanged(String tileTypeName) {
> [...]
>}
>
>}.setRequired(true));
>
>
>How can one access the String tileTypeName now in usage of the new
>FormComponentUpdatingBehaviour as the onUpdate there has no parameter
>at all ???
>
>
>
>Best,
>
>KB