You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2008/02/05 23:12:17 UTC

Re: Passing list of POJOs to AutoCompleteTextField?

shouldnt the pojo be availble from getmodelobject()?

-igor


On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com> wrote:
> I could - if it was a simple matter of extracting the strings from the
> POJOs. Problem is that, once an option is selected, I need the
> underlying POJOs to become the model for the rest of the form. Yes,
> there's probably a way to hack this, but I would prefer to do this in a
> clean fashion.
>
> I already got the custom renderer working, so I'm making progress. Task
> #2 now is to grab the underlying POJO after selecting it and populate
> the remainder of the form. This seems to be the tough part... Again, any
> help would be appreciated.
>
> Thanks!!
>
> Michael
>
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, January 29, 2008 11:47 AM
> To: users@wicket.apache.org
> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>
> can you not create an iterator adapter that takes an iterator of pojos
> and translates the pojo to some string?
>
> -igor
>
>
> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com> wrote:
> > I have a working test page containing an AutoCompleteTextField. Thus
> far
> > the data feeding it has been an Iterator of strings which is being
> > passed to its overridden getChoices method. So far so good.
> >
> > What I need to do now is to pass in an Iterator of POJOs instead and
> > have the AutoCompleteTextField render the 'name' field inside each of
> > those beans. After some digging in the Wicket source I suspect that I
> > need to create a custom renderer that does this - am I on the right
> > track here or would you guys suggest a different approach?
> >
> > Another challenge will be to populate other form fields in the page
> > after selecting an option from the AutoCompleteTextField. By selecting
> > an option in the dropdown I am basically selecting an entire POJO,
> which
> > is supposed to be used as the model for the other remaining fields.
> For
> > instance, the POJO will contain address, zip, phone, etc. fields and
> by
> > selecting the appropriate name in the AutoCompleteTextField it
> populates
> > all other fields with the remaining data in the underlying POJO. Hope
> > this makes sense - I think I have an idea of how to implement this,
> but
> > would appreciate any tips/insights.
> >
> > Thanks!!
> >
> > Michael
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Passing list of POJOs to AutoCompleteTextField?

Posted by Alan Romaniuc <a....@gmail.com>.
Hi

I ve read this discussion before (AutoComplete returning a list of
POJOs) and just a silly question: Shouldn't it be a new component? I
mean, if a dev wants a really text box that suggests a autocomplete,
but not enforce it, how would he use your component ?
A new component, like "TextFilterComboBox", would not be better?

Looking forward....



On Feb 6, 2008 10:53 PM, Sam Barnum <sa...@360works.com> wrote:
> I've committed a ticket for this, should have mentioned it here:
>
> https://issues.apache.org/jira/browse/WICKET-1324
>
> -sam
>
>
> On Feb 6, 2008, at 2:47 PM, Michael Mehrle wrote:
>
> > I would be happy to - what is the URL for this? (first time - new
> > contributor).
> >
> > In that context - I recently grepped through the Wicket source and
> > noticed that all the javascript event calls (onchange, onclick, etc.)
> > are all in the code as plain strings, which is bad practice. Thus I
> > wrote a *JavaScriptUtil* class that has String constants like CHANGE,
> > BLUR, DRAG_DROP, etc. (and can be statically imported jdk1.5
> > style). The
> > class also includes Javadoc that describes each event in detail. I
> > thought that this might be a little contribution to Wicket if you want
> > it. Let me know and I can submit the source (again, would need the URL
> > and procedure).
> >
> > Thanks,
> >
> > Michael
> >
> > -----Original Message-----
> > From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> > Sent: Tuesday, February 05, 2008 5:31 PM
> > To: users@wicket.apache.org
> > Subject: Re: Passing list of POJOs to AutoCompleteTextField?
> >
> > please add an rfe into jira for this.
> >
> > -igor
> >
> >
> > On Feb 5, 2008 4:38 PM, Michael Mehrle <mi...@ask.com> wrote:
> >> That's exactly what I wound up doing. I wrote my custom renderer that
> >> grabs the name field of my POJO for rendering. Of course that is what
> >> I'm getting back from getModelObjectAsString(). It's a work-around
> >> and
> > I
> >> was hoping for a more elegant way of doing this...
> >>
> >> Michael
> >>
> >>
> >> -----Original Message-----
> >> From: Sam Barnum [mailto:sam@360works.com]
> >> Sent: Tuesday, February 05, 2008 4:01 PM
> >> To: users@wicket.apache.org
> >> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
> >>
> >> I don't think it is, the getMmodelObject() returns the selected
> >> String.  I've gotten around this by saving the last query string sent
> >> via AJAX.  When the user makes a selection, I iterate over the
> >> options for that query string one more time, and take the POJO whose
> >> rendered string matches the user-selected text.
> >>
> >> I'm probably missing something obvious, but I don't think
> >> getModelObject() is it...
> >>
> >>
> >>
> >>
> >> --
> >> Sam Barnum
> >> 360 Works
> >> http://www.360works.com
> >> 415.865.0952
> >>
> >>
> >>
> >> On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:
> >>
> >>> shouldnt the pojo be availble from getmodelobject()?
> >>>
> >>> -igor
> >>>
> >>>
> >>> On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>
> >>> wrote:
> >>>> I could - if it was a simple matter of extracting the strings from
> >>>> the
> >>>> POJOs. Problem is that, once an option is selected, I need the
> >>>> underlying POJOs to become the model for the rest of the form. Yes,
> >>>> there's probably a way to hack this, but I would prefer to do this
> >>>> in a
> >>>> clean fashion.
> >>>>
> >>>> I already got the custom renderer working, so I'm making progress.
> >>>> Task
> >>>> #2 now is to grab the underlying POJO after selecting it and
> > populate
> >>>> the remainder of the form. This seems to be the tough part...
> >>>> Again, any
> >>>> help would be appreciated.
> >>>>
> >>>> Thanks!!
> >>>>
> >>>> Michael
> >>>>
> >>>>
> >>>> -----Original Message-----
> >>>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> >>>> Sent: Tuesday, January 29, 2008 11:47 AM
> >>>> To: users@wicket.apache.org
> >>>> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
> >>>>
> >>>> can you not create an iterator adapter that takes an iterator of
> >>>> pojos
> >>>> and translates the pojo to some string?
> >>>>
> >>>> -igor
> >>>>
> >>>>
> >>>> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>
> >>>> wrote:
> >>>>> I have a working test page containing an AutoCompleteTextField.
> > Thus
> >>>> far
> >>>>> the data feeding it has been an Iterator of strings which is being
> >>>>> passed to its overridden getChoices method. So far so good.
> >>>>>
> >>>>> What I need to do now is to pass in an Iterator of POJOs instead
> > and
> >>>>> have the AutoCompleteTextField render the 'name' field inside
> >>>>> each of
> >>>>> those beans. After some digging in the Wicket source I suspect
> >>>>> that I
> >>>>> need to create a custom renderer that does this - am I on the
> > right
> >>>>> track here or would you guys suggest a different approach?
> >>>>>
> >>>>> Another challenge will be to populate other form fields in the
> > page
> >>>>> after selecting an option from the AutoCompleteTextField. By
> >>>>> selecting
> >>>>> an option in the dropdown I am basically selecting an entire POJO,
> >>>> which
> >>>>> is supposed to be used as the model for the other remaining
> > fields.
> >>>> For
> >>>>> instance, the POJO will contain address, zip, phone, etc. fields
> > and
> >>>> by
> >>>>> selecting the appropriate name in the AutoCompleteTextField it
> >>>> populates
> >>>>> all other fields with the remaining data in the underlying POJO.
> >>>>> Hope
> >>>>> this makes sense - I think I have an idea of how to implement
> > this,
> >>>> but
> >>>>> would appreciate any tips/insights.
> >>>>>
> >>>>> Thanks!!
> >>>>>
> >>>>> Michael
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> > --------------------------------------------------------------------
> >>
> >>>>> -
> >>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>>
> >>>>>
> >>>>
> >>>>
> > ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>
> >>>>
> >>>>
> > ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>>
> >>>>
> >>>
> >>>
> > ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >>
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Alan R.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Passing list of POJOs to AutoCompleteTextField?

Posted by Sam Barnum <sa...@360works.com>.
I've committed a ticket for this, should have mentioned it here:

https://issues.apache.org/jira/browse/WICKET-1324

-sam

On Feb 6, 2008, at 2:47 PM, Michael Mehrle wrote:

> I would be happy to - what is the URL for this? (first time - new
> contributor).
>
> In that context - I recently grepped through the Wicket source and
> noticed that all the javascript event calls (onchange, onclick, etc.)
> are all in the code as plain strings, which is bad practice. Thus I
> wrote a *JavaScriptUtil* class that has String constants like CHANGE,
> BLUR, DRAG_DROP, etc. (and can be statically imported jdk1.5  
> style). The
> class also includes Javadoc that describes each event in detail. I
> thought that this might be a little contribution to Wicket if you want
> it. Let me know and I can submit the source (again, would need the URL
> and procedure).
>
> Thanks,
>
> Michael
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Tuesday, February 05, 2008 5:31 PM
> To: users@wicket.apache.org
> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>
> please add an rfe into jira for this.
>
> -igor
>
>
> On Feb 5, 2008 4:38 PM, Michael Mehrle <mi...@ask.com> wrote:
>> That's exactly what I wound up doing. I wrote my custom renderer that
>> grabs the name field of my POJO for rendering. Of course that is what
>> I'm getting back from getModelObjectAsString(). It's a work-around  
>> and
> I
>> was hoping for a more elegant way of doing this...
>>
>> Michael
>>
>>
>> -----Original Message-----
>> From: Sam Barnum [mailto:sam@360works.com]
>> Sent: Tuesday, February 05, 2008 4:01 PM
>> To: users@wicket.apache.org
>> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>>
>> I don't think it is, the getMmodelObject() returns the selected
>> String.  I've gotten around this by saving the last query string sent
>> via AJAX.  When the user makes a selection, I iterate over the
>> options for that query string one more time, and take the POJO whose
>> rendered string matches the user-selected text.
>>
>> I'm probably missing something obvious, but I don't think
>> getModelObject() is it...
>>
>>
>>
>>
>> --
>> Sam Barnum
>> 360 Works
>> http://www.360works.com
>> 415.865.0952
>>
>>
>>
>> On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:
>>
>>> shouldnt the pojo be availble from getmodelobject()?
>>>
>>> -igor
>>>
>>>
>>> On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>
>>> wrote:
>>>> I could - if it was a simple matter of extracting the strings from
>>>> the
>>>> POJOs. Problem is that, once an option is selected, I need the
>>>> underlying POJOs to become the model for the rest of the form. Yes,
>>>> there's probably a way to hack this, but I would prefer to do this
>>>> in a
>>>> clean fashion.
>>>>
>>>> I already got the custom renderer working, so I'm making progress.
>>>> Task
>>>> #2 now is to grab the underlying POJO after selecting it and
> populate
>>>> the remainder of the form. This seems to be the tough part...
>>>> Again, any
>>>> help would be appreciated.
>>>>
>>>> Thanks!!
>>>>
>>>> Michael
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>>>> Sent: Tuesday, January 29, 2008 11:47 AM
>>>> To: users@wicket.apache.org
>>>> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>>>>
>>>> can you not create an iterator adapter that takes an iterator of
>>>> pojos
>>>> and translates the pojo to some string?
>>>>
>>>> -igor
>>>>
>>>>
>>>> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>
>>>> wrote:
>>>>> I have a working test page containing an AutoCompleteTextField.
> Thus
>>>> far
>>>>> the data feeding it has been an Iterator of strings which is being
>>>>> passed to its overridden getChoices method. So far so good.
>>>>>
>>>>> What I need to do now is to pass in an Iterator of POJOs instead
> and
>>>>> have the AutoCompleteTextField render the 'name' field inside
>>>>> each of
>>>>> those beans. After some digging in the Wicket source I suspect
>>>>> that I
>>>>> need to create a custom renderer that does this - am I on the
> right
>>>>> track here or would you guys suggest a different approach?
>>>>>
>>>>> Another challenge will be to populate other form fields in the
> page
>>>>> after selecting an option from the AutoCompleteTextField. By
>>>>> selecting
>>>>> an option in the dropdown I am basically selecting an entire POJO,
>>>> which
>>>>> is supposed to be used as the model for the other remaining
> fields.
>>>> For
>>>>> instance, the POJO will contain address, zip, phone, etc. fields
> and
>>>> by
>>>>> selecting the appropriate name in the AutoCompleteTextField it
>>>> populates
>>>>> all other fields with the remaining data in the underlying POJO.
>>>>> Hope
>>>>> this makes sense - I think I have an idea of how to implement
> this,
>>>> but
>>>>> would appreciate any tips/insights.
>>>>>
>>>>> Thanks!!
>>>>>
>>>>> Michael
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
> --------------------------------------------------------------------
>>
>>>>> -
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>>
> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Passing list of POJOs to AutoCompleteTextField?

Posted by Michael Mehrle <mi...@ask.com>.
I would be happy to - what is the URL for this? (first time - new
contributor).

In that context - I recently grepped through the Wicket source and
noticed that all the javascript event calls (onchange, onclick, etc.)
are all in the code as plain strings, which is bad practice. Thus I
wrote a *JavaScriptUtil* class that has String constants like CHANGE,
BLUR, DRAG_DROP, etc. (and can be statically imported jdk1.5 style). The
class also includes Javadoc that describes each event in detail. I
thought that this might be a little contribution to Wicket if you want
it. Let me know and I can submit the source (again, would need the URL
and procedure).

Thanks,

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Tuesday, February 05, 2008 5:31 PM
To: users@wicket.apache.org
Subject: Re: Passing list of POJOs to AutoCompleteTextField?

please add an rfe into jira for this.

-igor


On Feb 5, 2008 4:38 PM, Michael Mehrle <mi...@ask.com> wrote:
> That's exactly what I wound up doing. I wrote my custom renderer that
> grabs the name field of my POJO for rendering. Of course that is what
> I'm getting back from getModelObjectAsString(). It's a work-around and
I
> was hoping for a more elegant way of doing this...
>
> Michael
>
>
> -----Original Message-----
> From: Sam Barnum [mailto:sam@360works.com]
> Sent: Tuesday, February 05, 2008 4:01 PM
> To: users@wicket.apache.org
> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>
> I don't think it is, the getMmodelObject() returns the selected
> String.  I've gotten around this by saving the last query string sent
> via AJAX.  When the user makes a selection, I iterate over the
> options for that query string one more time, and take the POJO whose
> rendered string matches the user-selected text.
>
> I'm probably missing something obvious, but I don't think
> getModelObject() is it...
>
>
>
>
> --
> Sam Barnum
> 360 Works
> http://www.360works.com
> 415.865.0952
>
>
>
> On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:
>
> > shouldnt the pojo be availble from getmodelobject()?
> >
> > -igor
> >
> >
> > On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>
> > wrote:
> >> I could - if it was a simple matter of extracting the strings from
> >> the
> >> POJOs. Problem is that, once an option is selected, I need the
> >> underlying POJOs to become the model for the rest of the form. Yes,
> >> there's probably a way to hack this, but I would prefer to do this
> >> in a
> >> clean fashion.
> >>
> >> I already got the custom renderer working, so I'm making progress.
> >> Task
> >> #2 now is to grab the underlying POJO after selecting it and
populate
> >> the remainder of the form. This seems to be the tough part...
> >> Again, any
> >> help would be appreciated.
> >>
> >> Thanks!!
> >>
> >> Michael
> >>
> >>
> >> -----Original Message-----
> >> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> >> Sent: Tuesday, January 29, 2008 11:47 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
> >>
> >> can you not create an iterator adapter that takes an iterator of
> >> pojos
> >> and translates the pojo to some string?
> >>
> >> -igor
> >>
> >>
> >> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>
> >> wrote:
> >>> I have a working test page containing an AutoCompleteTextField.
Thus
> >> far
> >>> the data feeding it has been an Iterator of strings which is being
> >>> passed to its overridden getChoices method. So far so good.
> >>>
> >>> What I need to do now is to pass in an Iterator of POJOs instead
and
> >>> have the AutoCompleteTextField render the 'name' field inside
> >>> each of
> >>> those beans. After some digging in the Wicket source I suspect
> >>> that I
> >>> need to create a custom renderer that does this - am I on the
right
> >>> track here or would you guys suggest a different approach?
> >>>
> >>> Another challenge will be to populate other form fields in the
page
> >>> after selecting an option from the AutoCompleteTextField. By
> >>> selecting
> >>> an option in the dropdown I am basically selecting an entire POJO,
> >> which
> >>> is supposed to be used as the model for the other remaining
fields.
> >> For
> >>> instance, the POJO will contain address, zip, phone, etc. fields
and
> >> by
> >>> selecting the appropriate name in the AutoCompleteTextField it
> >> populates
> >>> all other fields with the remaining data in the underlying POJO.
> >>> Hope
> >>> this makes sense - I think I have an idea of how to implement
this,
> >> but
> >>> would appreciate any tips/insights.
> >>>
> >>> Thanks!!
> >>>
> >>> Michael
> >>>
> >>>
> >>>
> >>>
> >>>
--------------------------------------------------------------------
>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Passing list of POJOs to AutoCompleteTextField?

Posted by Igor Vaynberg <ig...@gmail.com>.
please add an rfe into jira for this.

-igor


On Feb 5, 2008 4:38 PM, Michael Mehrle <mi...@ask.com> wrote:
> That's exactly what I wound up doing. I wrote my custom renderer that
> grabs the name field of my POJO for rendering. Of course that is what
> I'm getting back from getModelObjectAsString(). It's a work-around and I
> was hoping for a more elegant way of doing this...
>
> Michael
>
>
> -----Original Message-----
> From: Sam Barnum [mailto:sam@360works.com]
> Sent: Tuesday, February 05, 2008 4:01 PM
> To: users@wicket.apache.org
> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>
> I don't think it is, the getMmodelObject() returns the selected
> String.  I've gotten around this by saving the last query string sent
> via AJAX.  When the user makes a selection, I iterate over the
> options for that query string one more time, and take the POJO whose
> rendered string matches the user-selected text.
>
> I'm probably missing something obvious, but I don't think
> getModelObject() is it...
>
>
>
>
> --
> Sam Barnum
> 360 Works
> http://www.360works.com
> 415.865.0952
>
>
>
> On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:
>
> > shouldnt the pojo be availble from getmodelobject()?
> >
> > -igor
> >
> >
> > On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>
> > wrote:
> >> I could - if it was a simple matter of extracting the strings from
> >> the
> >> POJOs. Problem is that, once an option is selected, I need the
> >> underlying POJOs to become the model for the rest of the form. Yes,
> >> there's probably a way to hack this, but I would prefer to do this
> >> in a
> >> clean fashion.
> >>
> >> I already got the custom renderer working, so I'm making progress.
> >> Task
> >> #2 now is to grab the underlying POJO after selecting it and populate
> >> the remainder of the form. This seems to be the tough part...
> >> Again, any
> >> help would be appreciated.
> >>
> >> Thanks!!
> >>
> >> Michael
> >>
> >>
> >> -----Original Message-----
> >> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> >> Sent: Tuesday, January 29, 2008 11:47 AM
> >> To: users@wicket.apache.org
> >> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
> >>
> >> can you not create an iterator adapter that takes an iterator of
> >> pojos
> >> and translates the pojo to some string?
> >>
> >> -igor
> >>
> >>
> >> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>
> >> wrote:
> >>> I have a working test page containing an AutoCompleteTextField. Thus
> >> far
> >>> the data feeding it has been an Iterator of strings which is being
> >>> passed to its overridden getChoices method. So far so good.
> >>>
> >>> What I need to do now is to pass in an Iterator of POJOs instead and
> >>> have the AutoCompleteTextField render the 'name' field inside
> >>> each of
> >>> those beans. After some digging in the Wicket source I suspect
> >>> that I
> >>> need to create a custom renderer that does this - am I on the right
> >>> track here or would you guys suggest a different approach?
> >>>
> >>> Another challenge will be to populate other form fields in the page
> >>> after selecting an option from the AutoCompleteTextField. By
> >>> selecting
> >>> an option in the dropdown I am basically selecting an entire POJO,
> >> which
> >>> is supposed to be used as the model for the other remaining fields.
> >> For
> >>> instance, the POJO will contain address, zip, phone, etc. fields and
> >> by
> >>> selecting the appropriate name in the AutoCompleteTextField it
> >> populates
> >>> all other fields with the remaining data in the underlying POJO.
> >>> Hope
> >>> this makes sense - I think I have an idea of how to implement this,
> >> but
> >>> would appreciate any tips/insights.
> >>>
> >>> Thanks!!
> >>>
> >>> Michael
> >>>
> >>>
> >>>
> >>>
> >>> --------------------------------------------------------------------
>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >>> For additional commands, e-mail: users-help@wicket.apache.org
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Passing list of POJOs to AutoCompleteTextField?

Posted by Michael Mehrle <mi...@ask.com>.
That's exactly what I wound up doing. I wrote my custom renderer that
grabs the name field of my POJO for rendering. Of course that is what
I'm getting back from getModelObjectAsString(). It's a work-around and I
was hoping for a more elegant way of doing this...

Michael

-----Original Message-----
From: Sam Barnum [mailto:sam@360works.com] 
Sent: Tuesday, February 05, 2008 4:01 PM
To: users@wicket.apache.org
Subject: Re: Passing list of POJOs to AutoCompleteTextField?

I don't think it is, the getMmodelObject() returns the selected  
String.  I've gotten around this by saving the last query string sent  
via AJAX.  When the user makes a selection, I iterate over the  
options for that query string one more time, and take the POJO whose  
rendered string matches the user-selected text.

I'm probably missing something obvious, but I don't think  
getModelObject() is it...




--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952



On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:

> shouldnt the pojo be availble from getmodelobject()?
>
> -igor
>
>
> On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>  
> wrote:
>> I could - if it was a simple matter of extracting the strings from  
>> the
>> POJOs. Problem is that, once an option is selected, I need the
>> underlying POJOs to become the model for the rest of the form. Yes,
>> there's probably a way to hack this, but I would prefer to do this  
>> in a
>> clean fashion.
>>
>> I already got the custom renderer working, so I'm making progress.  
>> Task
>> #2 now is to grab the underlying POJO after selecting it and populate
>> the remainder of the form. This seems to be the tough part...  
>> Again, any
>> help would be appreciated.
>>
>> Thanks!!
>>
>> Michael
>>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>> Sent: Tuesday, January 29, 2008 11:47 AM
>> To: users@wicket.apache.org
>> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>>
>> can you not create an iterator adapter that takes an iterator of  
>> pojos
>> and translates the pojo to some string?
>>
>> -igor
>>
>>
>> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>  
>> wrote:
>>> I have a working test page containing an AutoCompleteTextField. Thus
>> far
>>> the data feeding it has been an Iterator of strings which is being
>>> passed to its overridden getChoices method. So far so good.
>>>
>>> What I need to do now is to pass in an Iterator of POJOs instead and
>>> have the AutoCompleteTextField render the 'name' field inside  
>>> each of
>>> those beans. After some digging in the Wicket source I suspect  
>>> that I
>>> need to create a custom renderer that does this - am I on the right
>>> track here or would you guys suggest a different approach?
>>>
>>> Another challenge will be to populate other form fields in the page
>>> after selecting an option from the AutoCompleteTextField. By  
>>> selecting
>>> an option in the dropdown I am basically selecting an entire POJO,
>> which
>>> is supposed to be used as the model for the other remaining fields.
>> For
>>> instance, the POJO will contain address, zip, phone, etc. fields and
>> by
>>> selecting the appropriate name in the AutoCompleteTextField it
>> populates
>>> all other fields with the remaining data in the underlying POJO.  
>>> Hope
>>> this makes sense - I think I have an idea of how to implement this,
>> but
>>> would appreciate any tips/insights.
>>>
>>> Thanks!!
>>>
>>> Michael
>>>
>>>
>>>
>>>
>>> --------------------------------------------------------------------

>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Passing list of POJOs to AutoCompleteTextField?

Posted by Sam Barnum <sa...@360works.com>.
I don't think it is, the getMmodelObject() returns the selected  
String.  I've gotten around this by saving the last query string sent  
via AJAX.  When the user makes a selection, I iterate over the  
options for that query string one more time, and take the POJO whose  
rendered string matches the user-selected text.

I'm probably missing something obvious, but I don't think  
getModelObject() is it...




--
Sam Barnum
360 Works
http://www.360works.com
415.865.0952



On Feb 5, 2008, at 2:12 PM, Igor Vaynberg wrote:

> shouldnt the pojo be availble from getmodelobject()?
>
> -igor
>
>
> On Jan 29, 2008 11:55 AM, Michael Mehrle <mi...@ask.com>  
> wrote:
>> I could - if it was a simple matter of extracting the strings from  
>> the
>> POJOs. Problem is that, once an option is selected, I need the
>> underlying POJOs to become the model for the rest of the form. Yes,
>> there's probably a way to hack this, but I would prefer to do this  
>> in a
>> clean fashion.
>>
>> I already got the custom renderer working, so I'm making progress.  
>> Task
>> #2 now is to grab the underlying POJO after selecting it and populate
>> the remainder of the form. This seems to be the tough part...  
>> Again, any
>> help would be appreciated.
>>
>> Thanks!!
>>
>> Michael
>>
>>
>> -----Original Message-----
>> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>> Sent: Tuesday, January 29, 2008 11:47 AM
>> To: users@wicket.apache.org
>> Subject: Re: Passing list of POJOs to AutoCompleteTextField?
>>
>> can you not create an iterator adapter that takes an iterator of  
>> pojos
>> and translates the pojo to some string?
>>
>> -igor
>>
>>
>> On Jan 29, 2008 11:14 AM, Michael Mehrle <mi...@ask.com>  
>> wrote:
>>> I have a working test page containing an AutoCompleteTextField. Thus
>> far
>>> the data feeding it has been an Iterator of strings which is being
>>> passed to its overridden getChoices method. So far so good.
>>>
>>> What I need to do now is to pass in an Iterator of POJOs instead and
>>> have the AutoCompleteTextField render the 'name' field inside  
>>> each of
>>> those beans. After some digging in the Wicket source I suspect  
>>> that I
>>> need to create a custom renderer that does this - am I on the right
>>> track here or would you guys suggest a different approach?
>>>
>>> Another challenge will be to populate other form fields in the page
>>> after selecting an option from the AutoCompleteTextField. By  
>>> selecting
>>> an option in the dropdown I am basically selecting an entire POJO,
>> which
>>> is supposed to be used as the model for the other remaining fields.
>> For
>>> instance, the POJO will contain address, zip, phone, etc. fields and
>> by
>>> selecting the appropriate name in the AutoCompleteTextField it
>> populates
>>> all other fields with the remaining data in the underlying POJO.  
>>> Hope
>>> this makes sense - I think I have an idea of how to implement this,
>> but
>>> would appreciate any tips/insights.
>>>
>>> Thanks!!
>>>
>>> Michael
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>