use of com.google.gwt.event.dom.client.MouseDownHandler in project che by eclipse.
the class View method handleEvents.
private void handleEvents() {
KeyDownHandler handler = new KeyDownHandler() {
@Override
public void onKeyDown(KeyDownEvent event) {
if (KeyboardEvent.KeyCode.ESC == event.getNativeEvent().getKeyCode()) {
event.stopPropagation();
event.preventDefault();
if (delegate != null) {
delegate.onEscapeKey();
}
} else if (KeyboardEvent.KeyCode.ENTER == event.getNativeEvent().getKeyCode()) {
event.stopPropagation();
event.preventDefault();
if (delegate != null) {
delegate.onEnterKey();
}
}
}
};
focusPanel.addDomHandler(handler, KeyDownEvent.getType());
closeButton.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (delegate != null) {
delegate.onClose();
}
event.stopPropagation();
}
}, ClickEvent.getType());
/* Don't start moving the window when clicking close button */
closeButton.addDomHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
event.preventDefault();
event.stopPropagation();
}
}, MouseDownEvent.getType());
MouseHandler mouseHandler = new MouseHandler();
header.addDomHandler(mouseHandler, MouseDownEvent.getType());
header.addDomHandler(mouseHandler, MouseUpEvent.getType());
header.addDomHandler(mouseHandler, MouseMoveEvent.getType());
}
use of com.google.gwt.event.dom.client.MouseDownHandler in project rstudio by rstudio.
the class ModifyKeyboardShortcutsWidget method addHandlers.
private void addHandlers() {
table_.addCellPreviewHandler(new CellPreviewEvent.Handler<KeyboardShortcutEntry>() {
@Override
public void onCellPreview(CellPreviewEvent<KeyboardShortcutEntry> preview) {
Handle shortcutsHandler = shortcuts_.disable();
int column = preview.getColumn();
if (column == 0)
onNameCellPreview(preview);
else if (column == 1)
onShortcutCellPreview(preview);
else if (column == 2)
onNameCellPreview(preview);
shortcutsHandler.close();
}
});
table_.addColumnSortHandler(new ColumnSortEvent.Handler() {
@Override
public void onColumnSort(ColumnSortEvent event) {
List<KeyboardShortcutEntry> data = dataProvider_.getList();
if (event.getColumn().equals(nameColumn_))
sort(data, 0, event.isSortAscending());
else if (event.getColumn().equals(shortcutColumn_))
sort(data, 1, event.isSortAscending());
else if (event.getColumn().equals(typeColumn_))
sort(data, 2, event.isSortAscending());
updateData(data);
}
});
// Fix a bug where clicking on a table header would also
// select the cell at position [0, 0]. It seems that GWT's
// DataGrid over-aggressively selects the first cell on the
// _first_ mouse down event seen; after the first click,
// cell selection occurs only after full mouse clicks.
table_.addDomHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
Element target = event.getNativeEvent().getEventTarget().cast();
if (target.hasAttribute("__gwt_header")) {
event.stopPropagation();
event.preventDefault();
}
}
}, MouseDownEvent.getType());
}
Aggregations