You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Noel Grandin <no...@gmail.com> on 2012/02/01 17:21:40 UTC
Re: 2.0.1 TextArea - removed text event
on second thoughts, I'm not sure I follow the design here.
Greg, how is TextAreaContentListener meant to be used?
I would have thought that it would expose events for changes to the
content of a paragraph as well as changes in the Sequence<Paragraph>
collection.
Or am I missing something?
On 2012-02-01 16:05, Noel Grandin wrote:
> That's a valid bug. Please log a JIRA issue for that.
>
> On 2012-02-01 16:02, RafaĆ Gierusz wrote:
>> Hi,
>>
>> I'm trying to get information about text removed from TextArea
>> component. In the ParagraphListener, which I used for text changes
>> tracking, there are two methods:
>>
>> - void textInserted(Paragraph paragraph, int index, int count) - this
>> one is perfect for me, I can retrieve inserted text from the
>> paragraph's CharSequence (using getCharacters() method), I have all I
>> need: index and count
>> - void textRemoved(Paragraph paragraph, int index, int count) - here
>> my problem begins, paragraph received as parameter has no text I'm
>> looking for because is has been already removed.
>>
>> Of course I can make a deep copy of paragraph's characters (every
>> time it changed) and search for my removed text using previously
>> created copy, but is it really the only way I can do that? It's quite
>> expensive.
>>
>> I checked the source and in the TextArea.Paragraph class in the
>> method void removeText(int index, int count) there is a line where
>> real text removal operation takes place: characters.delete(index,
>> index + count), but removed text is not stored or passed to any of
>> the listeners.
>>
>> Thanks,
>> Rafal