[
https://issues.apache.org/jira/browse/WICKET-4259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158355#comment-13158355
]
Stefan Schulte edited comment on WICKET-4259 at 11/28/11 2:56 PM:
------------------------------------------------------------------
Yes, I think we have lost some funcionality. The cause for that, I think, is
not the PropertyModel. I found a difference in Component.getDefaultModel()
which is called from AbstractTextComponent.resolveType().
Place a breakpoint on Component.getDefaultModel() and then click on the
AjaxEditableLabel. In the Wicket 1.4.19 project you will get a IModel of type
PropertyModel<T>. The toString() value is:
Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[[Page
class = com.mycompany.FormPage, id = 0, version = 0, ajax =
1]]:expression=[value]
In the Wicket 1.5.3 project you will get a model of type AjaxEditableLabel$3.
The toString() value is:
org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel$3@a638fc
Here is the call stack in Wicket 1.5.3 of getDefaultModel():
Thread [qtp21307627-15] (Suspended (breakpoint at line 1616 in Component))
AjaxEditableLabel$1(Component).getDefaultModel() line: 1616
AjaxEditableLabel$1(AbstractTextComponent<T>).resolveType() line: 152
AjaxEditableLabel$1(AbstractTextComponent<T>).onBeforeRender() line:
142
AjaxEditableLabel$1(Component).internalBeforeRender() line: 981
AjaxEditableLabel$1(Component).beforeRender() line: 1015
AjaxEditableLabel<T>(MarkupContainer).onBeforeRenderChildren() line:
1785
AjaxEditableLabel<T>(Component).onBeforeRender() line: 3774
...
was (Author: dangermouse):
Yes, I think we lose some funcionality. The cause for that, I think, is not
the PropertyModel. I found a difference in Component.getDefaultModel() which is
called from AbstractTextComponent.resolveType().
Place a breakpoint on Component.getDefaultModel() and then click on the
AjaxEditableLabel. In the Wicket 1.4.19 project you will get a IModel of type
PropertyModel<T>. The toString() value is:
Model:classname=[org.apache.wicket.model.PropertyModel]:nestedModel=[[Page
class = com.mycompany.FormPage, id = 0, version = 0, ajax =
1]]:expression=[value]
In the Wicket 1.5.3 project you will get a model of type AjaxEditableLabel$3.
The toString() value is:
org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel$3@a638fc
Here is the call stack in Wicket 1.5.3 of getDefaultModel():
Thread [qtp21307627-15] (Suspended (breakpoint at line 1616 in Component))
AjaxEditableLabel$1(Component).getDefaultModel() line: 1616
AjaxEditableLabel$1(AbstractTextComponent<T>).resolveType() line: 152
AjaxEditableLabel$1(AbstractTextComponent<T>).onBeforeRender() line:
142
AjaxEditableLabel$1(Component).internalBeforeRender() line: 981
AjaxEditableLabel$1(Component).beforeRender() line: 1015
AjaxEditableLabel<T>(MarkupContainer).onBeforeRenderChildren() line:
1785
AjaxEditableLabel<T>(Component).onBeforeRender() line: 3774
...
> Using an IValidator on an AjaxEditableLabel causes ClassCastException
> ---------------------------------------------------------------------
>
> Key: WICKET-4259
> URL: https://issues.apache.org/jira/browse/WICKET-4259
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Affects Versions: 1.5.3
> Reporter: Stefan Schulte
> Priority: Minor
> Attachments: WICKET-4259.patch, myproject1_4_19.zip,
> myproject1_5_3.zip
>
>
> AjaxEditableLabel<Integer> label = new AjaxEditableLabel<Integer>("label",
> new PropertyModel<Integer>(this, "value"));
> form.add(label);
> label.setRequired(true);
> label.add(new RangeValidator<Integer>(1, 10));
> Using a RangeValidator<Integer> on an AjaxEditableLabel<Integer> causes an
> ClassCastException after editing the label.
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> java.lang.String
> This can be avoided by setting the type explicit on the AjaxEditableLabel.
> label.setType(Integer.class);
> But this wasn't necessary in Wicket 1.4.19. In this version all works fine
> without setting the type explicit.
> I found out, that AbstractTextComponent.resolveType() is not able to get the
> type of the DefaultModel of the AjaxEditableLabel in Wicket 1.5.3.
> I will attach two QuickStarts to demonstrate the bug. One with wicket 1.4.19
> and the other with Wicket 1.5.3
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira