You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by ccp999 <cc...@hotmail.com> on 2012/03/13 06:28:42 UTC

SuggestionPopUp for email recipients list

Hi,

How can I modify SuggestionPopup so that it attached selected texts to
append the end of existing texts in TextInput or replacing it?

I'm trying to implement a TextInput that act like a email recipient field. 
So it allows adding more recipients to the end of the list and keep giving
the suggestion.

I have successfully implement the suggesting and selecting part, but since
current implementation of SuggestionPopup can only replace the whole
TextInput.

Brendan





--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3821421.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: SuggestionPopUp for email recipients list

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
If you think the skin (as a style) is the appropriate place for now, I'm okay with that.  

Roger Whitcomb

-----Original Message-----
From: Sandro Martini [mailto:sandro.martini@gmail.com] 
Sent: Tuesday, March 13, 2012 10:20 AM
To: user@pivot.apache.org
Cc: dev@pivot.apache.org
Subject: Re: SuggestionPopUp for email recipients list

Hi Roger,

I was thinking at a skin style, because I'd wait 2.1 before adding
something at component level (generally speaking) ... and of course
another (related) style property would be needed for a separator ...
as always ideas are welcome :-) .

The listener idea could be a better long-term solution, but like you
I'm not sure this would be, so we could delay this, could be right for
you ?

Bye


2012/3/13 Roger L. Whitcomb <Ro...@actian.com>:
> Should it be a style (applies to the skin)? Or a property (applies to
> the component)?  I like the idea, but it might need something more (like
> a separator character/string when appending??)  Or maybe a more general
> concept would be a listener to implement the interaction between the
> popup and the text control (not sure what it would look like, though).
>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: Sandro Martini [mailto:sandro.martini@gmail.com]
> Sent: Tuesday, March 13, 2012 8:33 AM
> To: user@pivot.apache.org; Apache Pivot - Developers
> Subject: Re: SuggestionPopUp for email recipients list
>
> Hi,
> I like your idea, it's a good use case.
> To achieve your result, we could add a style (for example "append") to
> SuggestionPopup, and have it by default false so used only if/when
> necessary ... so no need to change the api.
>
> Could this be good to for you ?
> If yes please could you file an improvement for this in JIRA for 2.0.2 ?
> Thanks.
>
>
> What you (and others) think ?
> Tell me.
>
> Bye,
> Sandro
>
>
> 2012/3/13 ccp999 <cc...@hotmail.com>:
>> Hi,
>>
>> How can I modify SuggestionPopup so that it attached selected texts to
>> append the end of existing texts in TextInput or replacing it?
>>
>> I'm trying to implement a TextInput that act like a email recipient
> field.
>> So it allows adding more recipients to the end of the list and keep
> giving
>> the suggestion.
>>
>> I have successfully implement the suggesting and selecting part, but
> since
>> current implementation of SuggestionPopup can only replace the whole
>> TextInput.
>>
>> Brendan
>>
>>
>>
>>
>>
>> --
>> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
> -recipients-list-tp3821421p3821421.html
>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: SuggestionPopUp for email recipients list

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
If you think the skin (as a style) is the appropriate place for now, I'm okay with that.  

Roger Whitcomb

-----Original Message-----
From: Sandro Martini [mailto:sandro.martini@gmail.com] 
Sent: Tuesday, March 13, 2012 10:20 AM
To: user@pivot.apache.org
Cc: dev@pivot.apache.org
Subject: Re: SuggestionPopUp for email recipients list

Hi Roger,

I was thinking at a skin style, because I'd wait 2.1 before adding
something at component level (generally speaking) ... and of course
another (related) style property would be needed for a separator ...
as always ideas are welcome :-) .

The listener idea could be a better long-term solution, but like you
I'm not sure this would be, so we could delay this, could be right for
you ?

Bye


2012/3/13 Roger L. Whitcomb <Ro...@actian.com>:
> Should it be a style (applies to the skin)? Or a property (applies to
> the component)?  I like the idea, but it might need something more (like
> a separator character/string when appending??)  Or maybe a more general
> concept would be a listener to implement the interaction between the
> popup and the text control (not sure what it would look like, though).
>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: Sandro Martini [mailto:sandro.martini@gmail.com]
> Sent: Tuesday, March 13, 2012 8:33 AM
> To: user@pivot.apache.org; Apache Pivot - Developers
> Subject: Re: SuggestionPopUp for email recipients list
>
> Hi,
> I like your idea, it's a good use case.
> To achieve your result, we could add a style (for example "append") to
> SuggestionPopup, and have it by default false so used only if/when
> necessary ... so no need to change the api.
>
> Could this be good to for you ?
> If yes please could you file an improvement for this in JIRA for 2.0.2 ?
> Thanks.
>
>
> What you (and others) think ?
> Tell me.
>
> Bye,
> Sandro
>
>
> 2012/3/13 ccp999 <cc...@hotmail.com>:
>> Hi,
>>
>> How can I modify SuggestionPopup so that it attached selected texts to
>> append the end of existing texts in TextInput or replacing it?
>>
>> I'm trying to implement a TextInput that act like a email recipient
> field.
>> So it allows adding more recipients to the end of the list and keep
> giving
>> the suggestion.
>>
>> I have successfully implement the suggesting and selecting part, but
> since
>> current implementation of SuggestionPopup can only replace the whole
>> TextInput.
>>
>> Brendan
>>
>>
>>
>>
>>
>> --
>> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
> -recipients-list-tp3821421p3821421.html
>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi Roger,

I was thinking at a skin style, because I'd wait 2.1 before adding
something at component level (generally speaking) ... and of course
another (related) style property would be needed for a separator ...
as always ideas are welcome :-) .

The listener idea could be a better long-term solution, but like you
I'm not sure this would be, so we could delay this, could be right for
you ?

Bye


2012/3/13 Roger L. Whitcomb <Ro...@actian.com>:
> Should it be a style (applies to the skin)? Or a property (applies to
> the component)?  I like the idea, but it might need something more (like
> a separator character/string when appending??)  Or maybe a more general
> concept would be a listener to implement the interaction between the
> popup and the text control (not sure what it would look like, though).
>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: Sandro Martini [mailto:sandro.martini@gmail.com]
> Sent: Tuesday, March 13, 2012 8:33 AM
> To: user@pivot.apache.org; Apache Pivot - Developers
> Subject: Re: SuggestionPopUp for email recipients list
>
> Hi,
> I like your idea, it's a good use case.
> To achieve your result, we could add a style (for example "append") to
> SuggestionPopup, and have it by default false so used only if/when
> necessary ... so no need to change the api.
>
> Could this be good to for you ?
> If yes please could you file an improvement for this in JIRA for 2.0.2 ?
> Thanks.
>
>
> What you (and others) think ?
> Tell me.
>
> Bye,
> Sandro
>
>
> 2012/3/13 ccp999 <cc...@hotmail.com>:
>> Hi,
>>
>> How can I modify SuggestionPopup so that it attached selected texts to
>> append the end of existing texts in TextInput or replacing it?
>>
>> I'm trying to implement a TextInput that act like a email recipient
> field.
>> So it allows adding more recipients to the end of the list and keep
> giving
>> the suggestion.
>>
>> I have successfully implement the suggesting and selecting part, but
> since
>> current implementation of SuggestionPopup can only replace the whole
>> TextInput.
>>
>> Brendan
>>
>>
>>
>>
>>
>> --
>> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
> -recipients-list-tp3821421p3821421.html
>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi Roger,

I was thinking at a skin style, because I'd wait 2.1 before adding
something at component level (generally speaking) ... and of course
another (related) style property would be needed for a separator ...
as always ideas are welcome :-) .

The listener idea could be a better long-term solution, but like you
I'm not sure this would be, so we could delay this, could be right for
you ?

Bye


2012/3/13 Roger L. Whitcomb <Ro...@actian.com>:
> Should it be a style (applies to the skin)? Or a property (applies to
> the component)?  I like the idea, but it might need something more (like
> a separator character/string when appending??)  Or maybe a more general
> concept would be a listener to implement the interaction between the
> popup and the text control (not sure what it would look like, though).
>
> ~Roger Whitcomb
>
> -----Original Message-----
> From: Sandro Martini [mailto:sandro.martini@gmail.com]
> Sent: Tuesday, March 13, 2012 8:33 AM
> To: user@pivot.apache.org; Apache Pivot - Developers
> Subject: Re: SuggestionPopUp for email recipients list
>
> Hi,
> I like your idea, it's a good use case.
> To achieve your result, we could add a style (for example "append") to
> SuggestionPopup, and have it by default false so used only if/when
> necessary ... so no need to change the api.
>
> Could this be good to for you ?
> If yes please could you file an improvement for this in JIRA for 2.0.2 ?
> Thanks.
>
>
> What you (and others) think ?
> Tell me.
>
> Bye,
> Sandro
>
>
> 2012/3/13 ccp999 <cc...@hotmail.com>:
>> Hi,
>>
>> How can I modify SuggestionPopup so that it attached selected texts to
>> append the end of existing texts in TextInput or replacing it?
>>
>> I'm trying to implement a TextInput that act like a email recipient
> field.
>> So it allows adding more recipients to the end of the list and keep
> giving
>> the suggestion.
>>
>> I have successfully implement the suggesting and selecting part, but
> since
>> current implementation of SuggestionPopup can only replace the whole
>> TextInput.
>>
>> Brendan
>>
>>
>>
>>
>>
>> --
>> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
> -recipients-list-tp3821421p3821421.html
>> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: SuggestionPopUp for email recipients list

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Should it be a style (applies to the skin)? Or a property (applies to
the component)?  I like the idea, but it might need something more (like
a separator character/string when appending??)  Or maybe a more general
concept would be a listener to implement the interaction between the
popup and the text control (not sure what it would look like, though).

~Roger Whitcomb

-----Original Message-----
From: Sandro Martini [mailto:sandro.martini@gmail.com] 
Sent: Tuesday, March 13, 2012 8:33 AM
To: user@pivot.apache.org; Apache Pivot - Developers
Subject: Re: SuggestionPopUp for email recipients list

Hi,
I like your idea, it's a good use case.
To achieve your result, we could add a style (for example "append") to
SuggestionPopup, and have it by default false so used only if/when
necessary ... so no need to change the api.

Could this be good to for you ?
If yes please could you file an improvement for this in JIRA for 2.0.2 ?
Thanks.


What you (and others) think ?
Tell me.

Bye,
Sandro


2012/3/13 ccp999 <cc...@hotmail.com>:
> Hi,
>
> How can I modify SuggestionPopup so that it attached selected texts to
> append the end of existing texts in TextInput or replacing it?
>
> I'm trying to implement a TextInput that act like a email recipient
field.
> So it allows adding more recipients to the end of the list and keep
giving
> the suggestion.
>
> I have successfully implement the suggesting and selecting part, but
since
> current implementation of SuggestionPopup can only replace the whole
> TextInput.
>
> Brendan
>
>
>
>
>
> --
> View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
-recipients-list-tp3821421p3821421.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

RE: SuggestionPopUp for email recipients list

Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Should it be a style (applies to the skin)? Or a property (applies to
the component)?  I like the idea, but it might need something more (like
a separator character/string when appending??)  Or maybe a more general
concept would be a listener to implement the interaction between the
popup and the text control (not sure what it would look like, though).

~Roger Whitcomb

-----Original Message-----
From: Sandro Martini [mailto:sandro.martini@gmail.com] 
Sent: Tuesday, March 13, 2012 8:33 AM
To: user@pivot.apache.org; Apache Pivot - Developers
Subject: Re: SuggestionPopUp for email recipients list

Hi,
I like your idea, it's a good use case.
To achieve your result, we could add a style (for example "append") to
SuggestionPopup, and have it by default false so used only if/when
necessary ... so no need to change the api.

Could this be good to for you ?
If yes please could you file an improvement for this in JIRA for 2.0.2 ?
Thanks.


What you (and others) think ?
Tell me.

Bye,
Sandro


2012/3/13 ccp999 <cc...@hotmail.com>:
> Hi,
>
> How can I modify SuggestionPopup so that it attached selected texts to
> append the end of existing texts in TextInput or replacing it?
>
> I'm trying to implement a TextInput that act like a email recipient
field.
> So it allows adding more recipients to the end of the list and keep
giving
> the suggestion.
>
> I have successfully implement the suggesting and selecting part, but
since
> current implementation of SuggestionPopup can only replace the whole
> TextInput.
>
> Brendan
>
>
>
>
>
> --
> View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email
-recipients-list-tp3821421p3821421.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
I like your idea, it's a good use case.
To achieve your result, we could add a style (for example "append") to
SuggestionPopup, and have it by default false so used only if/when
necessary ... so no need to change the api.

Could this be good to for you ?
If yes please could you file an improvement for this in JIRA for 2.0.2 ? Thanks.


What you (and others) think ?
Tell me.

Bye,
Sandro


2012/3/13 ccp999 <cc...@hotmail.com>:
> Hi,
>
> How can I modify SuggestionPopup so that it attached selected texts to
> append the end of existing texts in TextInput or replacing it?
>
> I'm trying to implement a TextInput that act like a email recipient field.
> So it allows adding more recipients to the end of the list and keep giving
> the suggestion.
>
> I have successfully implement the suggesting and selecting part, but since
> current implementation of SuggestionPopup can only replace the whole
> TextInput.
>
> Brendan
>
>
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3821421.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
here ( https://issues.apache.org/jira/browse/PIVOT-844 ) you can find
a preliminary patch to start play with this new feature.
Of course you have to apply it to latest trunk, then run
SuggestionPopupTest.java to show a minimal sample.

Note that's really a very rough version (with many TODO inside and
some things to see, like if use a property or a style for the
appendMode), but just to give the idea to get some feedback.

Note that there is a problem: when I press some key and appendMode is
true, no chars are deleted in the text field, so there are extra chars
... we have to see if/how to handle this.

Tell me what you think.

Bye,
Sandro

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
here ( https://issues.apache.org/jira/browse/PIVOT-844 ) you can find
a preliminary patch to start play with this new feature.
Of course you have to apply it to latest trunk, then run
SuggestionPopupTest.java to show a minimal sample.

Note that's really a very rough version (with many TODO inside and
some things to see, like if use a property or a style for the
appendMode), but just to give the idea to get some feedback.

Note that there is a problem: when I press some key and appendMode is
true, no chars are deleted in the text field, so there are extra chars
... we have to see if/how to handle this.

Tell me what you think.

Bye,
Sandro

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi Brendan,
thanks for the issue.

> I hope the job is not too much for you.
no, don't worry ... but you have to wait some day, sorry.
I'll post an update here when committed.

Bye,
Sandro

Re: SuggestionPopUp for email recipients list

Posted by ccp999 <cc...@hotmail.com>.
Hi Sandro,

I opened an issue as you see. I hope the job is not too much for you.

Regards,

Brendan 

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3839802.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,

> The code you want is in method
>  selectedSuggestionChanged
> in
> TerraSuggestionPopupSkin
Yes, where there is the textInput.setText() ...

> If you're really sure that a simple dontUpdateTheTextInput flag is all you need, I will withdraw my objection :-)
Yes, I think for a simpler solution I could only add a check there and
if there is a style "append" (or with a better name, no problem) set
to true (by default false) it could take the current text and add the
new ... and maybe add even an "appendSeparator" style, but nothing
more at the moment.


But Brendan, please, could you open an issue for this for the 2.0.2 ?
So I can work on it in next days ...


Thank you very much,
Sandro

Re: SuggestionPopUp for email recipients list

Posted by Noel Grandin <no...@gmail.com>.
The code you want is in method
   selectedSuggestionChanged
in
TerraSuggestionPopupSkin

If you're really sure that a simple dontUpdateTheTextInput flag is all 
you need, I will withdraw my objection :-)

On 2012-03-16 05:03, ccp999 wrote:
> Hi All,
>
> I agree that Noel's solution is more comprehensive but it goes a bit too far
> from SuggestionPopup.  I would suggest a SuggestionPopup would just do a
> suggestion based on what string it received and just also replace  the
> suggestion the user chose to where the string came from.  so that
> SuggestionPopup can be linked to TextInput or TextArea and it won't replace
> the whole TextInput or TextArea.  And the user have to decide when to pass
> the string for suggestion and where to apply the replacement.  The problem
> of existing suggestionpopup code is it does too much.  I also think my
> solution can be applied to a email address case and beyond.
>
> I'm familiar of the skin implementation and not sure which part of the code
> does the replacement for suggestion.  Could you show me?
>
> Brendan
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3830842.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by ccp999 <cc...@hotmail.com>.
Hi All,

I agree that Noel's solution is more comprehensive but it goes a bit too far
from SuggestionPopup.  I would suggest a SuggestionPopup would just do a
suggestion based on what string it received and just also replace  the
suggestion the user chose to where the string came from.  so that
SuggestionPopup can be linked to TextInput or TextArea and it won't replace
the whole TextInput or TextArea.  And the user have to decide when to pass
the string for suggestion and where to apply the replacement.  The problem
of existing suggestionpopup code is it does too much.  I also think my
solution can be applied to a email address case and beyond.

I'm familiar of the skin implementation and not sure which part of the code
does the replacement for suggestion.  Could you show me?

Brendan

 

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3830842.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
after reading Noel point of view, yes I think it's better to do as
suggested ... my previous suggestion was related to a to simple use
case, probably not suitable for a real-world app.

So if you can, try and then tell us if there is something in Pivot
that we can improve to simplify it.

Bye,
Sandro

Re: SuggestionPopUp for email recipients list

Posted by Noel Grandin <no...@gmail.com>.
I think you should try cut and pasting the existing code, then modify it 
to do what you want, and then come back with what you have.

I think you'll find that just adding an append mode is not enough.
TO make a good email-recipient control, you will need
- to change how and when the popup triggers
- probably to modify the data that gets appended, depending on what the 
user has typed
- to modify the find criteria for the popup
- to add other characters like a separator between the addresses

So I don't think it's quite as simple as just adding another style to 
SuggestionPopup.

But the beauty of open-source is that you can cut and paste the existing 
code and modify it to do what you want :-)

On 2012-03-13 07:28, ccp999 wrote:
> Hi,
>
> How can I modify SuggestionPopup so that it attached selected texts to
> append the end of existing texts in TextInput or replacing it?
>
> I'm trying to implement a TextInput that act like a email recipient field.
> So it allows adding more recipients to the end of the list and keep giving
> the suggestion.
>
> I have successfully implement the suggesting and selecting part, but since
> current implementation of SuggestionPopup can only replace the whole
> TextInput.
>
> Brendan
>
>
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3821421.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: SuggestionPopUp for email recipients list

Posted by Sandro Martini <sa...@gmail.com>.
Hi,
I like your idea, it's a good use case.
To achieve your result, we could add a style (for example "append") to
SuggestionPopup, and have it by default false so used only if/when
necessary ... so no need to change the api.

Could this be good to for you ?
If yes please could you file an improvement for this in JIRA for 2.0.2 ? Thanks.


What you (and others) think ?
Tell me.

Bye,
Sandro


2012/3/13 ccp999 <cc...@hotmail.com>:
> Hi,
>
> How can I modify SuggestionPopup so that it attached selected texts to
> append the end of existing texts in TextInput or replacing it?
>
> I'm trying to implement a TextInput that act like a email recipient field.
> So it allows adding more recipients to the end of the list and keep giving
> the suggestion.
>
> I have successfully implement the suggesting and selecting part, but since
> current implementation of SuggestionPopup can only replace the whole
> TextInput.
>
> Brendan
>
>
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/SuggestionPopUp-for-email-recipients-list-tp3821421p3821421.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.