Closed Patrick1701 closed 10 years ago
Hi Patrick,
I will try to reproduce this use-case to have a better view, even I think I see the concern...
Best regards, Sebastien.
Good Morning, I still work on it... so I will extract a quickstart... Coming back on afternoon...
Patrick
Hi Patrick,
I believe your request is not achievable...
It is important to understand that ACTF works either with String or with Beans but not both mixed. The reason is that the choice made by the user becomes the model object without any conversion (the index of the choice is transmitted and retrieved from the - previously cached - list of choices). That's why it is mandatory that the model object type and the type of the choices' list are the same.
Now you are wondering what is the purpose of the Class<T>
type argument then? The type is not taken into account when a choice is made and the model object is set, but it's used when the form component is posted, during the #convertInput
operation. So if the type is specified (and it should be), #convertInput
calls the ACTF's convertor, which underneath return the model object because we already now it.
So I said I believe your request is not achievable. I however think that in theory this can be managed, but in that case, the behavior the wicket-jquery-ui's ACTF will differ from the wicket built-in one and that's a point I would like to avoid...
Hope this explanation makes sense to you. :)
Thanks & best regards, Sebastien
Hi Sebastien,
will differ from the wicket built-in one
Ok, I see...
the choice made by the user becomes the model object without any conversion
I guess, this is a reason.
Now you are wondering what is the purpose of the Class
Understood...
Ok, have an idea... but not sure if its good. You have to say. :-) What about a new ACTF class in the hierarchy... between TextField and the existing ACTF containing a method onSelect(AjaxRequestTarget target, S selectedObject)? This ACTF does not setModelObject() by itself, and clients must handle this case.
Your existing ACTF extends, overrides and hides onSelected(AjaxRequestTarget target, S selectedObject) and features setModelObject() of selected and delegates the more restricted abstract onSelected(AjaxRequestTarget) for clients. (also with more restricted getChoices())
I am not sure about the generics, and if all will fit on extending, but if so, you could keep the existing ACTF as it is and provide a new ACTF with simple bean for the field and complex bean for choices.
Combined with the jquery template this yould be a great feature for your ACTF, I think.
kind regards :-) Patrick
Hi Patrick,
I will try to think/investigate a little bit on this... The most difficult will be to find a sexy name for this new component. (maybe could it be just AutoComplete
, like the widget name)
Best regards, Sebastien.
Hi Patrick,
I thought about this item while implementing the Kendo AutoComplete widget. So, I have added an AbstractAutoCompleteTextField
in the hierarchy.
There is a sample here: https://github.com/sebfz1/wicket-jquery-ui/blob/master/wicket-jquery-ui-samples/src/main/java/com/googlecode/wicket/jquery/ui/samples/pages/kendo/autocomplete/KendoRendererAutoCompletePage.java
It should meet you expectations; feel free to test it (either 6.16.1-SNAPSHOT
or the incoming 6.17.0
). If it's ok for you, I will apply the changes for the jQuery AutoComplete.
Thanks to let me know, Sebastien
Hi Sebastien, sorry for replying late... I was on vacations the last weeks. :-)
Sounds great... I really would like to test it, but unfortunately I'm still sticking on 6.14-SNAPSHOT due to the license changes on kendo-ui side coming up since 6.15. First I have to remove our kendo table implementations before updating.
Today I talked to my teamleader and I will get time now, but I still need some days using another table implementation. Then I will test and give feedback... (if I will find my quickstart again, I will try earlier...)
kind regards Patrick
Hi Patrick,
I also fall back to Wicket's DataTable - at work - with a custom extension using the Kendo UI style, just to give you an idea...
Best regards, Sebastien
Hi Sebastien,
It should meet you expectations; feel free to test it (either 6.16.1-SNAPSHOT or the incoming 6.17.0). >If it's ok for you, I will apply the changes for the jQuery AutoComplete.
Thanks to let me know,
also late :-D, tested and yes, thats what I need.
Would be great, if you could provide a jquery variant, next.
Thanx a lot and regards Patrick
Hi Sebastien, today I had a problem using the ACTF... and maybe I have a feature request. I'm not sure... I just try to explain, what I did. (possibly this also was a topic of our old https://github.com/sebfz1/wicket-jquery-ui/issues/18 ;-) , maybe I mixed it up with CompundPropertyModel issues...)
Ok, "reset"... this is what I've done today. :-)
I think, what I need is the possibility to init a ATFC like this: new AutoCompleteTextField("city", new TextRenderer("name"), ZipCode.class)
and the generics of getChoices and the template features are bound to the ZipCodes colasstype T, not to the ACTF T.
So, a new constructor could be: public AutoCompleteTextField(String id, IModel model, ITextRenderer<? super S> renderer, Class
type)with protected abstract List
getChoices(String input);Do you know, what I mean? :-) Less restrictions of generic types, to allow choices of complex beans, but modeling with simple bean(-member).
So, it can be seen as: searching and displaying are different use-cases as reading and writing the inputfield.
Could this work? Or am I completly wrong with this idea?! kind regards Patrick