Closed movit closed 11 years ago
@Override public void onModuleLoad() {
final TextBox textBox = new TextBox();
final int delayMilliseconds = 1000;
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
private String previousValue = "";
@Override
public boolean execute() {
final String newValue = textBox.getValue();
if (!previousValue.equals(newValue)) {
try {
valueChanged();
} finally {
previousValue = newValue;
}
}
return true;
}
private void valueChanged() {
// React on the change
Window.alert("Value changed");
}
}, delayMilliseconds);
RootPanel.get().add(textBox);
}
public native void addCutHandler(Element elementID) /-{ var temp = this; // hack to hold on to 'this' reference elementID.oncut = function(e) { temp.@org.package.YourClass::handleCut()(); } }-/;
public void handleCut() { Window.alert("Cut!"); }
final Listener
... (other listener events)
addListener(Events.OnPaste, l);
sinkEvents(Event.ONPASTE);
При paste мышкой не начинается поиск