本文整理汇总了Java中com.google.gwt.user.client.Event.getRelatedEventTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getRelatedEventTarget方法的具体用法?Java Event.getRelatedEventTarget怎么用?Java Event.getRelatedEventTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.getRelatedEventTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
EventTarget related = event.getRelatedEventTarget();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
if (getCell().hasId() && getCell().getType() == TimetableGridCell.Type.Class) {
UniTimeFrameDialog.openDialog(MESSAGES.dialogSuggestions(), "suggestions.do?id=" + getCell().getId() + "&op=Reset","900","90%");
select(false);
}
break;
case Event.ONMOUSEOVER:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(true);
}
break;
case Event.ONMOUSEOUT:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(false);
}
break;
}
super.onBrowserEvent(event);
}
示例2: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
if (iDummy) return;
Element target = DOM.eventGetTarget(event);
boolean anchor = false;
for (; target != null; target = DOM.getParent(target)) {
String tag = target.getPropertyString("tagName");
if ("a".equalsIgnoreCase(tag)) {
anchor = true;
break;
} else if ("div".equalsIgnoreCase(tag)) {
break;
}
}
EventTarget related = event.getRelatedEventTarget();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
select(false);
if (!anchor) {
MeetingClickEvent e = new MeetingClickEvent(Meeting.this);
for (MeetingClickHandler h: iMeetingClickHandlers)
h.onMeetingClick(e);
}
break;
case Event.ONMOUSEOVER:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(true);
}
break;
case Event.ONMOUSEOUT:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(false);
}
break;
case Event.ONMOUSEMOVE:
int relativeX = event.getClientX() - getElement().getAbsoluteLeft() + getElement().getScrollLeft() + getElement().getOwnerDocument().getScrollLeft();
if (relativeX < iLeft - 6 - getDay() * iCellWidth || relativeX > iLeft - 2 - getDay() * iCellWidth + iWidth) {
select(false);
}
break;
}
super.onBrowserEvent(event);
}
示例3: handleEventInner
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private void handleEventInner(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONCONTEXTMENU:
event.preventDefault();
break;
case Event.ONKEYPRESS:
case Event.ONKEYDOWN: {
// NOTE(user): It is necessary to stop propagation on the key events to
// prevent them from leaking to the blip/wave presenters.
int keyCode = DOM.eventGetKeyCode(event);
// Move left/right to previous/next drop down widget
switch (keyCode) {
case KeyCodes.KEY_LEFT:
case KeyCodes.KEY_RIGHT:
handler.handleLeftRight(keyCode == KeyCodes.KEY_RIGHT);
event.stopPropagation();
return;
case KeyCodes.KEY_ENTER:
event.stopPropagation();
}
if (keyCode >= '1' && keyCode <= '9') {
// TODO(danilatos): Is this ok? i18n etc?
int index = keyCode - '1';
if (index >= 0 && index < getItems().size()) {
MenuItem item = getItems().get(index);
if (item == null) {
return;
}
item.getCommand().execute();
DOM.eventPreventDefault(event);
}
}
break;
}
case Event.ONMOUSEOUT: {
// Need to check that we really seem to have left the menu, as
// mouse-out events get triggered whenever the mouse moves between
// selections in the menu.
EventTarget target = event.getRelatedEventTarget();
Element targetElement = Element.as(target);
if (!getElement().isOrHasChild(targetElement)) {
handler.handleMouseOut();
}
break;
}
case Event.ONMOUSEOVER: {
handler.handleMouseOver();
break;
}
}
}