wicket-bootstrap icon indicating copy to clipboard operation
wicket-bootstrap copied to clipboard

CompoundPropertyModel and BootstrapCheckbox(String id) constructor

Open vrozkovec opened this issue 7 years ago • 4 comments

When using BootstrapCheckbox with id only constructor and having set CompoundPropertyModel to the parent form, exception is thrown:

org.apache.wicket.WicketRuntimeException: Property could not be resolved for class: class cz.jaclean.pojo.Nabidka expression: checkbox

Problem is, that when no models are passed, setting check-box's model in the constructor triggers lookup by id for checkbox. Same goes for label with id post-label.

This change fixes the problem, please let me know if this change is ok and I will make a pull request.

protected void onInitialize() {
    	super.onInitialize();
    	checkbox.setModel(getModel());
    	if(checkbox.getLabel()!=null)
    		wrapper.get("label:post-label").setDefaultModel(checkbox.getLabel());
}

vrozkovec avatar Jul 10 '17 07:07 vrozkovec

I'll take a look soon!

martin-g avatar Jul 12 '17 14:07 martin-g

It seems I've fat fingered the commit message. This commit was about #687 .

martin-g avatar Jul 26 '17 14:07 martin-g

Hi, sorry to bother, did you have a time to look into this issue? I solved it by extending the class and using the fix stated above, so no problem for me.

vrozkovec avatar Aug 03 '17 19:08 vrozkovec

I guess I didn't look into it yet because I know you have a workaround and it is not urgent for you :-) Lately I'm either on vacation or busy with other things. I'll address it before the next release!

martin-g avatar Aug 04 '17 08:08 martin-g