use of com.google.gwt.dom.client.Element in project rstudio by rstudio.
the class DiagnosticsBackgroundPopup method start.
public void start() {
isRunning_ = true;
stopRequested_ = false;
if (handler_ != null) {
handler_.removeHandler();
handler_ = null;
}
handler_ = Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONMOUSEMOVE) {
movedMouseMostRecently_ = true;
Element target = Element.as(event.getNativeEvent().getEventTarget());
if (target.hasClassName("ace_gutter-cell")) {
lastMouseCoords_ = null;
hidePopup();
return;
}
lastMouseCoords_ = ScreenCoordinates.create(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
if (activeMarker_ != null && !activeMarker_.getRange().containsRightExclusive(editor_.toDocumentPosition(lastMouseCoords_))) {
hidePopup();
}
} else {
movedMouseMostRecently_ = false;
}
}
});
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
if (stopRequested_)
return stopExecution();
// restarted later)
if (!docDisplay_.isFocused())
return stopExecution();
long currentTime = System.currentTimeMillis();
long lastModifiedTime = docDisplay_.getLastModifiedTime();
long lastCursorChangedTime = docDisplay_.getLastCursorChangedTime();
// cursor was moved recently, then bail
if ((currentTime - lastModifiedTime) < 500)
return completeExecution();
if ((currentTime - lastCursorChangedTime) < 500)
return completeExecution();
Markers markers = editor_.getSession().getMarkers(true);
Position currentPos;
if (movedMouseMostRecently_) {
if (lastMouseCoords_ == null)
return completeExecution();
currentPos = editor_.toDocumentPosition(lastMouseCoords_);
} else {
currentPos = docDisplay_.getCursorPosition();
}
int[] keys = markers.getIds();
for (int i = 0; i < keys.length; i++) {
Marker marker = markers.get(keys[i]);
if (marker.getRange().containsRightExclusive(currentPos)) {
displayMarkerDiagnostics(marker);
return completeExecution();
}
}
return completeExecution();
}
}, 500);
}
use of com.google.gwt.dom.client.Element in project gwt-test-utils by gwt-test-utils.
the class Browser method prepareEvents.
private static void prepareEvents(IsWidget target, Event... events) {
for (Event event : events) {
Element effectiveTarget = JavaScriptObjects.getObject(event, JsoProperties.EVENT_TARGET);
if (effectiveTarget == null) {
effectiveTarget = target.asWidget().getElement();
JavaScriptObjects.setProperty(event, JsoProperties.EVENT_TARGET, effectiveTarget);
}
}
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class Tools method createContextMenu.
protected static VOverlay createContextMenu() {
return new TableOverlay() {
@Override
protected void onDetach() {
super.onDetach();
}
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONKEYDOWN == event.getTypeInt()) {
if (KeyCodes.KEY_ESCAPE == event.getNativeEvent().getKeyCode()) {
event.cancel();
event.getNativeEvent().stopPropagation();
event.getNativeEvent().preventDefault();
hide();
} else {
VAbstractOrderedLayout verticalLayout = ((VVerticalLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
Widget widgetParent = widget.getParent();
VAbstractOrderedLayout layout = (VAbstractOrderedLayout) widgetParent.getParent();
Widget focusWidget = null;
int widgetIndex = layout.getWidgetIndex(widgetParent);
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_DOWN) {
focusWidget = Tools.findNextWidget(layout, widgetIndex);
} else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_UP) {
focusWidget = Tools.findPrevWidget(layout, widgetIndex);
}
if (focusWidget instanceof VButton) {
VButton button = (VButton) focusWidget;
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
} else if (Event.ONMOUSEOVER == event.getTypeInt()) {
VAbstractOrderedLayout verticalLayout = ((VAbstractOrderedLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
if (widget instanceof VButton) {
VButton button = (VButton) widget;
Widget widgetParent = button.getParent();
if (!button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
}
}
};
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class TableAggregationRow method updateFromUIDL.
public void updateFromUIDL(UIDL uidl) {
if (getElement().hasChildNodes()) {
getElement().removeAllChildren();
}
aligns = tableWidget.getHead().getColumnAlignments();
if (uidl.getChildCount() > 0) {
final Element table = DOM.createTable();
table.setAttribute("cellpadding", "0");
table.setAttribute("cellspacing", "0");
final Element tBody = DOM.createTBody();
tr = DOM.createTR();
tr.setClassName(tableWidget.getStylePrimaryName() + "-arow-row");
addCellsFromUIDL(uidl);
tBody.appendChild(tr);
table.appendChild(tBody);
getElement().appendChild(table);
}
initialized = getElement().hasChildNodes();
}
use of com.google.gwt.dom.client.Element in project cuba by cuba-platform.
the class CubaCheckBoxConnector method onClick.
@Override
public void onClick(ClickEvent event) {
super.onClick(event);
Element target = Element.as(event.getNativeEvent().getEventTarget());
if (target == getWidget().contextHelpIcon) {
if (hasContextHelpIconListeners()) {
contextHelpIconClick(event);
}
}
}
Aggregations