use of com.google.gwt.event.dom.client.KeyPressEvent in project gerrit by GerritCodeReview.
the class ProjectTagsScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
initPageHeader();
prev = PagingHyperlink.createPrev();
prev.setVisible(false);
next = PagingHyperlink.createNext();
next.setVisible(false);
addPanel = new FlowPanel();
Grid addGrid = new Grid(2, 2);
addGrid.setStyleName(Gerrit.RESOURCES.css().addBranch());
int texBoxLength = 50;
nameTxtBox = new HintTextBox();
nameTxtBox.setVisibleLength(texBoxLength);
nameTxtBox.setHintText(AdminConstants.I.defaultTagName());
nameTxtBox.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
doAddNewTag();
}
}
});
addGrid.setText(0, 0, AdminConstants.I.columnTagName() + ":");
addGrid.setWidget(0, 1, nameTxtBox);
irevTxtBox = new HintTextBox();
irevTxtBox.setVisibleLength(texBoxLength);
irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
irevTxtBox.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
doAddNewTag();
}
}
});
addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":");
addGrid.setWidget(1, 1, irevTxtBox);
addTag = new Button(AdminConstants.I.buttonAddTag());
addTag.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
doAddNewTag();
}
});
addPanel.add(addGrid);
addPanel.add(addTag);
tagTable = new TagsTable();
delTag = new Button(AdminConstants.I.buttonDeleteTag());
delTag.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
delTag.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
tagTable.deleteChecked();
}
});
HorizontalPanel buttons = new HorizontalPanel();
buttons.setStyleName(Gerrit.RESOURCES.css().branchTablePrevNextLinks());
buttons.add(delTag);
buttons.add(prev);
buttons.add(next);
add(tagTable);
add(buttons);
add(addPanel);
}
use of com.google.gwt.event.dom.client.KeyPressEvent in project gerrit by GerritCodeReview.
the class GlobalKey method initEvents.
private static void initEvents() {
if (active == null) {
DocWidget.get().addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(final KeyPressEvent event) {
final KeyCommandSet s = active.live;
if (s != active.all) {
active.live = active.all;
restoreTimer.cancel();
}
s.onKeyPress(event);
}
});
restoreTimer = new Timer() {
@Override
public void run() {
active.live = active.all;
}
};
global = new State(null);
active = global;
}
}
use of com.google.gwt.event.dom.client.KeyPressEvent in project rstudio by rstudio.
the class DomUtils method addKeyHandlers.
public static void addKeyHandlers(HasAllKeyHandlers widget, final NativeEventHandler handler) {
widget.addKeyDownHandler(new KeyDownHandler() {
@Override
public void onKeyDown(final KeyDownEvent event) {
handler.onNativeEvent(event.getNativeEvent());
}
});
widget.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(final KeyPressEvent event) {
handler.onNativeEvent(event.getNativeEvent());
}
});
widget.addKeyUpHandler(new KeyUpHandler() {
@Override
public void onKeyUp(final KeyUpEvent event) {
handler.onNativeEvent(event.getNativeEvent());
}
});
}
use of com.google.gwt.event.dom.client.KeyPressEvent in project rstudio by rstudio.
the class ChooseFolderDialog method createMainWidget.
@Override
public Widget createMainWidget() {
Widget mainWidget = super.createMainWidget();
browser_.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
maybeInvalidateSelection();
}
});
browser_.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
maybeInvalidateSelection();
}
});
return mainWidget;
}
use of com.google.gwt.event.dom.client.KeyPressEvent in project perun by CESNET.
the class SuggestBox method addEventsToTextBox.
private void addEventsToTextBox() {
class TextBoxEvents extends HandlesAllKeyEvents implements ValueChangeHandler<String> {
public void onKeyDown(KeyDownEvent event) {
switch(event.getNativeKeyCode()) {
case KeyCodes.KEY_DOWN:
display.moveSelectionDown();
break;
case KeyCodes.KEY_UP:
display.moveSelectionUp();
break;
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_TAB:
Suggestion suggestion = display.getCurrentSelection();
if (suggestion == null) {
display.hideSuggestions();
} else {
setNewSelection(suggestion);
}
break;
}
delegateEvent(SuggestBox.this, event);
}
public void onKeyPress(KeyPressEvent event) {
delegateEvent(SuggestBox.this, event);
}
public void onKeyUp(KeyUpEvent event) {
// After every user key input, refresh the popup's suggestions.
refreshSuggestions();
delegateEvent(SuggestBox.this, event);
}
public void onValueChange(ValueChangeEvent<String> event) {
delegateEvent(SuggestBox.this, event);
}
}
TextBoxEvents events = new TextBoxEvents();
events.addKeyHandlersTo(box);
box.addValueChangeHandler(events);
}
Aggregations