本文整理汇总了Java中com.google.gwt.user.client.DOM.eventGetTarget方法的典型用法代码示例。如果您正苦于以下问题:Java DOM.eventGetTarget方法的具体用法?Java DOM.eventGetTarget怎么用?Java DOM.eventGetTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.DOM
的用法示例。
在下文中一共展示了DOM.eventGetTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
Element target = DOM.eventGetTarget(event);
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN:
boolean open = iFilterOpen.getElement().equals(target);
boolean close = iFilterClose.getElement().equals(target);
boolean clear = iFilterClear.getElement().equals(target);
boolean filter = iFilter.getElement().equals(target);
if (isFilterPopupShowing() || close) {
hideFilterPopup();
} else if (open) {
hideSuggestions();
showFilterPopup();
}
if (clear) {
iFilter.setText("");
removeAllChips();
setAriaLabel(toAriaString());
ValueChangeEvent.fire(FilterBox.this, getValue());
}
if (!filter) {
event.stopPropagation();
event.preventDefault();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
iFilter.setFocus(true);
}
});
}
break;
}
}
示例2: onEventPreview
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
@Override
public boolean onEventPreview(Event event) {
// Always allow event if capturing is enabled
if (DOM.getCaptureElement() != null) {
return true;
}
// If this is a modal wizard then only allow it if the target element is a child of this wizard
if (modal) {
Element target = DOM.eventGetTarget(event);
return (target != null && DOM.isOrHasChild(getElement(), target));
} else {
return super.onEventPreview(event);
}
}
示例3: onBrowserEvent
import com.google.gwt.user.client.DOM; //导入方法依赖的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);
}