You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by gr8coat gr8coat <dj...@gmail.com> on 2013/08/29 17:41:10 UTC
textinput cut/paste event
Hello,
I am pasting into a textinput and neither
textChanged nor
textInserted
get fired.
When I type the into the textinput, the textInserted gets fired. Wondering
if there is another event that handles textinput pasting?
RE: textinput cut/paste event
Posted by "Roger L. Whitcomb" <Ro...@actian.com>.
Well, the code in TextInput.paste() checks if access to the clipboard is
available and if there is any text content. If so, it removes the
selected text (if any) and inserts the clipboard contents at the current
selection point. Both of these events work the same as any other
delete/insert (that is, they call the listeners to check the Vote
results, and then call the listeners to notify of the change). Here is
a little bit of the code:
For Remove:
private void removeText(int index, int count, boolean
addToEditHistory) {
if (count > 0) {
Vote vote =
textInputContentListeners.previewRemoveText(this, index, count);
if (vote == Vote.APPROVE) {
// Add a remove history item
if (addToEditHistory) {
addHistoryItem(new RemoveTextEdit(index, count));
}
// Remove the text
characters.delete(index, index + count);
// Update the selection
int previousSelectionStart = selectionStart;
int previousSelectionLength = selectionLength;
selectionStart = index;
selectionLength = 0;
// Update the valid flag
boolean previousTextValid = textValid;
textValid = (validator == null) ? true :
validator.isValid(getText());
// Fire change events
textInputContentListeners.textRemoved(this, index,
count);
textInputContentListeners.textChanged(this);
if (textValid != previousTextValid) {
textInputListeners.textValidChanged(this);
}
if (selectionStart != previousSelectionStart
|| selectionLength != previousSelectionLength) {
textInputSelectionListeners.selectionChanged(this,
selectionStart, selectionLength);
}
For Insert:
private void insertText(CharSequence text, int index, boolean
addToEditHistory) {
if (text == null) {
throw new IllegalArgumentException();
}
if (characters.length() + text.length() > maximumLength) {
throw new IllegalArgumentException("Insertion of text would
exceed maximum length.");
}
if (text.length() > 0) {
Vote vote =
textInputContentListeners.previewInsertText(this, text, index);
if (vote == Vote.APPROVE) {
// Insert the text
characters.insert(index, text);
// Add an insert history item
if (addToEditHistory) {
addHistoryItem(new InsertTextEdit(text, index));
}
// Update selection
int previousSelectionStart = selectionStart;
int previousSelectionLength = selectionLength;
selectionStart = index + text.length();
selectionLength = 0;
// Update the valid flag
boolean previousTextValid = textValid;
textValid = (validator == null) ? true :
validator.isValid(getText());
// Fire change events
textInputContentListeners.textInserted(this, index,
text.length());
textInputContentListeners.textChanged(this);
if (textValid != previousTextValid) {
textInputListeners.textValidChanged(this);
}
if (selectionStart != previousSelectionStart
|| selectionLength != previousSelectionLength) {
textInputSelectionListeners.selectionChanged(this,
selectionStart, selectionLength);
}
So, my guess would be (as per the other comments) that
either there is no text on the clipboard or clipboard access is disabled
somehow....
HTH,
~Roger
From: Schwartz, Cynthia L [mailto:cynthia.l.schwartz@intel.com]
Sent: Thursday, August 29, 2013 10:14 AM
To: user@pivot.apache.org
Subject: RE: textinput cut/paste event
It is not an applet, it is a DesktopApplication.
C
From: Erik Innocent [mailto:einnocent@gmail.com]
Sent: Thursday, August 29, 2013 10:05 AM
To: user
Subject: Re: textinput cut/paste event
Is this for an applet? If so, it may not have access to the system
clipboard for security reasons. See the question "Why doesn't copy/paste
work in Pivot?" here:
http://pivot.apache.org/faq.html
Cheers,
--E
On Thu, Aug 29, 2013 at 10:41 AM, gr8coat gr8coat
<dj...@gmail.com> wrote:
Hello,
I am pasting into a textinput and neither
textChanged nor
textInserted
get fired.
When I type the into the textinput, the textInserted gets fired.
Wondering if there is another event that handles textinput pasting?
RE: textinput cut/paste event
Posted by "Schwartz, Cynthia L" <cy...@intel.com>.
It is not an applet, it is a DesktopApplication.
C
From: Erik Innocent [mailto:einnocent@gmail.com]
Sent: Thursday, August 29, 2013 10:05 AM
To: user
Subject: Re: textinput cut/paste event
Is this for an applet? If so, it may not have access to the system clipboard for security reasons. See the question "Why doesn't copy/paste work in Pivot?" here:
http://pivot.apache.org/faq.html
Cheers,
--E
On Thu, Aug 29, 2013 at 10:41 AM, gr8coat gr8coat <dj...@gmail.com>> wrote:
Hello,
I am pasting into a textinput and neither
textChanged nor
textInserted
get fired.
When I type the into the textinput, the textInserted gets fired. Wondering if there is another event that handles textinput pasting?
Re: textinput cut/paste event
Posted by Erik Innocent <ei...@gmail.com>.
Is this for an applet? If so, it may not have access to the system
clipboard for security reasons. See the question "Why doesn't copy/paste
work in Pivot?" here:
http://pivot.apache.org/faq.html
Cheers,
--E
On Thu, Aug 29, 2013 at 10:41 AM, gr8coat gr8coat <dj...@gmail.com>wrote:
> Hello,
>
> I am pasting into a textinput and neither
>
> textChanged nor
> textInserted
>
> get fired.
> When I type the into the textinput, the textInserted gets fired.
> Wondering if there is another event that handles textinput pasting?
>
>
>