List of usage examples for com.google.gwt.event.dom.client KeyPressEvent getType
public static Type<KeyPressHandler> getType()
From source file:ch.unifr.pai.ice.client.textedit.TextEditor.java
License:Apache License
public TextEditor(TextEntry1Space parentWidget, int userNo, int nbTextEntry) { super();/*from w w w .j ava 2 s.c om*/ parent = parentWidget; logVector = new Vector<String>(); this.userNo = userNo; this.nbTextEntry = nbTextEntry; if (parentWidget instanceof AbsolutePanel) isAPanel = true; if (nbTextEntry == 1) // if it's training { wordlist = traininglist; } text = new Label(wordlist[0]); text.getElement().getStyle().setColor("#fff"); text.getElement().getStyle().setFontSize(20, Unit.PT); text.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); hPanel.setWidth("100%"); hPanel.add(text); this.add(hPanel); MultiFocus.setVisible(true); MultiFocus.setWidth("100%"); MultiFocus.setHeight("100px"); MultiFocus.setWidth("250px"); MultiFocus.getElement().getStyle().setBackgroundColor("#fff"); // this.add(ta); this.add(MultiFocus); this.setBorderWidth(1); MultiFocus.addDomHandler(new KeyPressHandler() { //Listen for KeyPress events on MultiFocusTextBox @Override public void onKeyPress(KeyPressEvent event) { if (!isStarted) { startTime = System.currentTimeMillis(); if (!isSetStarted) { setStartTime = startTime; // set experiment start time isSetStarted = true; } isStarted = true; } typedText = typedText + event.getCharCode(); } }, KeyPressEvent.getType()); MultiFocus.addDomHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeEvent().getKeyCode() == 13) { if (isSetFinished && !isLast) { // for the second set log(typedText, ta.getText()); parent.setLoggedData(logVector, false, true); // done with experiment iteration++; text.setText(secondwordlist[iteration]); typedText = ""; isStarted = false; } if (isLast) { log(typedText, ta.getText()); parent.setLoggedData(logVector, true, true); // done with experiment text.setText(secondwordlist[0]); typedText = ""; isStarted = false; iteration = 0; isLast = false; } if (!isSetFinished) { if (!isLast) { iteration++; text.setText(wordlist[iteration]); log(typedText, ta.getText()); // log for wordlist[iteration-1] typedText = ""; isStarted = false; if ((iteration == (wordlist.length - 1))) { //last element isSetFinished = true; isLast = true; } } } } if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_BACKSPACE) { typedText = typedText + "~"; } } }, KeyUpEvent.getType()); }
From source file:com.alkacon.forms.client.widgets.StringWidget.java
License:Open Source License
/** * @see com.google.gwt.event.logical.shared.HasValueChangeHandlers#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) *///ww w . j a va 2 s .c o m public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) { // Initialization code if (!m_valueChangeHandlerInitialized) { m_valueChangeHandlerInitialized = true; addDomHandler(new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { fireValueChange(); } }, KeyPressEvent.getType()); addDomHandler(new ChangeHandler() { public void onChange(ChangeEvent event) { fireValueChange(); } }, ChangeEvent.getType()); addDomHandler(new BlurHandler() { public void onBlur(BlurEvent event) { fireValueChange(); } }, BlurEvent.getType()); } return addHandler(handler, ValueChangeEvent.getType()); }
From source file:com.alkacon.geranium.client.ui.input.TextBox.java
License:Open Source License
/** * @see com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) */// ww w . j av a 2s . co m public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { return addDomHandler(handler, KeyPressEvent.getType()); }
From source file:com.bearsoft.gwt.ui.widgets.DateTimeBox.java
@Override public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { return super.addHandler(handler, KeyPressEvent.getType()); }
From source file:com.bramosystems.oss.player.core.client.AbstractMediaPlayer.java
License:Apache License
/** * Adds the key press handler to the player * * @param handler the handler/* w w w.j a v a2s. co m*/ * @return the HandlerRegistration used to remove the handler * @since 1.1 */ @Override public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { return addDomHandler(handler, KeyPressEvent.getType()); }
From source file:com.brazoft.foundation.gwt.client.event.Events.java
License:Apache License
public static <W extends Widget> W on(W widget, KeyPressHandler handler) { widget.addDomHandler(handler, KeyPressEvent.getType()); return widget; }
From source file:com.edgenius.wiki.gwt.client.editor.TinyMCE.java
License:Open Source License
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { return addHandler(handler, KeyPressEvent.getType()); }
From source file:com.ephesoft.gxt.rv.client.controller.ReviewValidateSelectionController.java
License:Open Source License
public ReviewValidateSelectionController(final EventBus eventBus, final DCMARemoteServiceAsync rpcService) { super(eventBus, rpcService); RootPanel rootPanel = RootPanel.get(); Type<KeyDownHandler> keyDownEventType = KeyDownEvent.getType(); rootPanel.addDomHandler(getTraversalEventHandler(), keyDownEventType); rootPanel.addDomHandler(getImageOverlayPanelEventHandler(), keyDownEventType); rootPanel.addDomHandler(getOverlayImageTraversalHandler(), keyDownEventType); rootPanel.addDomHandler(getFocusInitializationEventHandler(), keyDownEventType); rootPanel.addDomHandler(getBatchOperationsHandler(), keyDownEventType); rootPanel.addDomHandler(getKeyUpPreventionHandler(), KeyUpEvent.getType()); rootPanel.addDomHandler(getKeyPressHandler(), KeyPressEvent.getType()); }
From source file:com.github.gwtbootstrap.client.ui.Button.java
License:Apache License
/** * {@inheritDoc} */ public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { return addDomHandler(handler, KeyPressEvent.getType()); }
From source file:com.google.gerrit.client.change.ReplyBox.java
License:Apache License
ReplyBox(CommentLinkProcessor clp, PatchSet.Id psId, String revision, NativeMap<LabelInfo> all,
NativeMap<JsArrayString> permitted) {
this.clp = clp;
this.psId = psId;
this.revision = revision;
this.lc = new LocalComments(psId.getParentKey());
initWidget(uiBinder.createAndBindUi(this));
List<String> names = new ArrayList<>(permitted.keySet());
if (names.isEmpty()) {
UIObject.setVisible(labelsParent, false);
} else {//from ww w . j a va 2 s .c om
Collections.sort(names);
renderLabels(names, all, permitted);
}
addDomHandler(new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent e) {
e.stopPropagation();
if ((e.getNativeKeyCode() == KEY_ENTER || e.getNativeKeyCode() == KEY_MAC_ENTER)
&& (e.isControlKeyDown() || e.isMetaKeyDown())) {
e.preventDefault();
if (post.isEnabled()) {
onPost(null);
}
}
}
}, KeyDownEvent.getType());
addDomHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent e) {
e.stopPropagation();
}
}, KeyPressEvent.getType());
}