You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Andrea Del Bene (JIRA)" <ji...@apache.org> on 2014/09/25 17:25:35 UTC

[jira] [Commented] (WICKET-5708) Making FormComponent.convertInput() public

    [ https://issues.apache.org/jira/browse/WICKET-5708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14147855#comment-14147855 ] 

Andrea Del Bene commented on WICKET-5708:
-----------------------------------------

I totally agree to apply the suggested change to Wicket 7. I don't see any problem if we make convertInput public. The only drawback is that we force third-part libraries to change their code. However I don't think is a big issue. I checked Wicketstuff code and there are only two projects that override this method, for a total of 5 lines of code:

{code}

 grep -r -H  "convertInput()"  ../jdk-1.7-parent/objectautocomplete-parent/objectautocomplete/src/main/java/org/wicketstuff/objectautocomplete/ObjectAutoCompleteField.java:	protected void convertInput()
./jdk-1.7-parent/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2MultiChoice.java:	protected void convertInput() {
./jdk-1.7-parent/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2MultiChoice.java:			convertInput();
./jdk-1.7-parent/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2Choice.java:	protected void convertInput() {
./jdk-1.7-parent/select2-parent/select2/src/main/java/org/wicketstuff/select2/Select2Choice.java:			convertInput();
{code}

> Making FormComponent.convertInput() public
> ------------------------------------------
>
>                 Key: WICKET-5708
>                 URL: https://issues.apache.org/jira/browse/WICKET-5708
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 7.0.0-M3, 6.17.0
>            Reporter: Ilia Naryzhny
>              Labels: convert
>
> Please make FormComponent.convertInput() public.
> Whole conversation can be found here: 
> http://wicket-dev.markmail.org/message/eicsiw6akjxbfs3z?q=convertInput
> Some quotations:
> "My intent is following:
> Some form components should be shown or hiden dynamically according to
> entered information and(!!!) without touching underling models. Whole form
> content should be refreshed.
> To achive that I use following approach:
> 1) AjaxFormSubmitBehavior with event="change" to recieve form on server side
> 2) With the aid of FormComponent.hasRawInput() I can understand where to
> get actual value for the component: either by
> convertInput()->getConvertedInput() or directly from a model.
> 3) [HACK] if value should be taken from form component with the aid of
> reflection I'm invoking convertInput()
> Method convertInputMethod =
> FormComponent.class.getDeclaredMethod("convertInput");
> convertInputMethod.setAccessible(true);
> convertInputMethod.invoke(formComponent);
> I can't use "validate" because there are some validators on a components
> and they should be fired after actual data submition.
> Currently, whole that stack is working perfectly as expected. But that
> little hack is confusing me a bit:)"
> Andrea's answer:
> "If I understand correctly you submit form disabling default processing. 
> In this way Wicket retains fields value without validating them but also 
> without converting input. But you also need to convert the input value 
> of the desired field. Right? I guess you have to do it because raw input 
> is not enough for you."
> That description is absolutly correct. Please help by supporting this usecase in wicket!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)