use of com.google.gwt.dom.client.EventTarget in project drools-wb by kiegroup.
the class RadarMenuViewImpl method setup.
@PostConstruct
public void setup() {
radarCanvas.add(radarLayer);
radarMenuDropdown.setTitle(translationService.getTranslation(GuidedDecisionTableErraiConstants.RowContextMenuViewImpl_Title));
visibleBounds.setDraggable(true);
visibleBounds.addNodeDragMoveHandler(new NodeDragMoveHandler() {
@Override
public void onNodeDragMove(final NodeDragMoveEvent event) {
presenter.onDragVisibleBounds(visibleBounds.getX(), visibleBounds.getY());
}
});
visibleBounds.setFillColor(ColorName.GRAY);
visibleBounds.setAlpha(0.25);
visibleBounds.setLocation(new Point2D((RADAR_WIDTH - visibleBounds.getWidth()) / 2, (RADAR_HEIGHT - visibleBounds.getHeight()) / 2));
radarLayer.add(visibleBounds);
radarCanvas.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (eventTargetsPopup(event.getNativeEvent(), radarMenu)) {
event.stopPropagation();
event.preventDefault();
}
}
private boolean eventTargetsPopup(final NativeEvent event, final Element element) {
final EventTarget target = event.getEventTarget();
if (Element.is(target)) {
return element.isOrHasChild(Element.as(target));
}
return false;
}
});
}
use of com.google.gwt.dom.client.EventTarget in project cuba by cuba-platform.
the class CubaSuggestionFieldWidget method handleOnBlur.
protected void handleOnBlur(BlurEvent event) {
removeStyleName(MODIFIED_STYLENAME);
if (BrowserInfo.get().isIE()) {
if (iePreventBlur) {
textField.setFocus(true);
iePreventBlur = false;
} else {
resetComponentState();
}
} else {
if (!suggestionsPopup.isShowing()) {
resetComponentState();
return;
}
EventTarget eventTarget = event.getNativeEvent().getRelatedEventTarget();
if (eventTarget == null) {
resetComponentState();
return;
}
if (Element.is(eventTarget)) {
Widget widget = WidgetUtil.findWidget(Element.as(eventTarget), null);
if (widget != suggestionsContainer) {
resetComponentState();
}
}
}
}
use of com.google.gwt.dom.client.EventTarget in project ovirt-engine by oVirt.
the class MenuCell method onBrowserEvent.
@Override
public void onBrowserEvent(Context context, Element parent, T value, NativeEvent event, ValueUpdater<T> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
int eventX = event.getClientX();
int eventY = event.getClientY();
// Handle the click event.
if (BrowserEvents.CLICK.equals(event.getType())) {
// Ignore clicks that occur outside of the outermost element.
EventTarget eventTarget = event.getEventTarget();
if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {
menuPanelPopup.asPopupPanel().showAndFitToScreen(eventX, eventY);
}
} else if (BrowserEvents.MOUSEOVER.equals(event.getType())) {
if (isVisible(value)) {
// $NON-NLS-1$
parent.getFirstChildElement().getStyle().setBorderColor("#96B7D6");
}
} else {
// $NON-NLS-1$
parent.getFirstChildElement().getStyle().setBorderColor("transparent");
}
}
use of com.google.gwt.dom.client.EventTarget in project GwtMobile by dennisjzh.
the class DragController method fireDragEvent.
protected void fireDragEvent(DragEvent e) {
if (_capturingDragEventsHandler != null) {
e.dispatch(_capturingDragEventsHandler);
return;
}
EventTarget target = e.getNativeEvent().getEventTarget();
Node node = Node.as(target);
if (!Element.is(node)) {
// Text node
node = node.getParentNode();
}
if (Element.is(node)) {
Element ele = Element.as(target);
int count = 0;
while (ele != null) {
for (DragEventsHandler handler : _dragEventHandlers) {
if (ele.equals(handler.getElement())) {
e.dispatch(handler);
count++;
if (e.getStopPropagation() || count == _dragEventHandlers.size()) {
return;
}
}
}
ele = ele.getParentElement();
}
}
}
use of com.google.gwt.dom.client.EventTarget in project GwtMobile by dennisjzh.
the class DragController method fireSwipeEvent.
protected void fireSwipeEvent(SwipeEvent e) {
if (_capturingSwipeEventsHandler != null) {
e.dispatch(_capturingSwipeEventsHandler);
return;
}
if (_capturingDragEventsHandler != null) {
return;
}
EventTarget target = e.getNativeEvent().getEventTarget();
Node node = Node.as(target);
if (!Element.is(node)) {
// Text node
node = node.getParentNode();
}
if (Element.is(node)) {
Element ele = Element.as(target);
int count = 0;
while (ele != null) {
for (SwipeEventsHandler handler : _swipeEventHandlers) {
if (ele.equals(handler.getElement())) {
e.dispatch(handler);
count++;
if (e.getStopPropagation() || count == _swipeEventHandlers.size()) {
return;
}
}
}
ele = ele.getParentElement();
}
}
}
Aggregations