Change CopyableLabel to hide onKeyUp

This changes the CopyableLabel to hide itself onKeyUp, after a
copy, since hiding onKeyPress would hide the text box before Safari
had a chance to copy it.  Ultimately, the effect is the same, it
just delays the processing a little further on.

Bug: Issue 2635
Change-Id: I06a25b81c1da7286a09561732510fe4d6835a2a7
This commit is contained in:
Doug Kelly 2014-05-12 16:59:11 -05:00 committed by Doug Kelly
parent 0e9cff85b8
commit 2d68f32f21

View File

@ -22,6 +22,8 @@ import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
@ -189,9 +191,14 @@ public class CopyableLabel extends Composite implements HasText {
switch (event.getCharCode()) {
case 'c':
case 'x':
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
hideTextBox();
textBox.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(final KeyUpEvent event) {
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
hideTextBox();
}
});
}
});
break;