本文整理匯總了Java中com.google.gwt.user.client.Event.getEventTarget方法的典型用法代碼示例。如果您正苦於以下問題:Java Event.getEventTarget方法的具體用法?Java Event.getEventTarget怎麽用?Java Event.getEventTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.getEventTarget方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onEventPreview
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public boolean onEventPreview(Event event) {
int type = DOM.eventGetType(event);
if ((type == Event.ONCLICK || type == Event.ONTOUCHEND)
&& event.getEventTarget() != null) {
Element target = Element.as(event.getEventTarget());
if (target.getClassName() != null && target.getClassName().contains(CUBA_NOTIFICATION_MODALITY_CURTAIN)) {
hide();
return false;
}
}
if (type == Event.ONKEYDOWN && event.getKeyCode() == KeyCodes.KEY_ESCAPE) {
if (!getElement().getClassName().contains(TRAY_STYLE)) {
hide();
return false;
}
}
return super.onEventPreview(event);
}
示例2: onBrowserEvent
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
/**
* Overridden to send ValueChangeEvents only when appropriate.
*/
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
case Event.ONBLUR:
case Event.ONKEYDOWN:
// Note the old value for onValueChange purposes (in ONCLICK case)
oldValue = getValue();
break;
case Event.ONCLICK:
EventTarget target = event.getEventTarget();
if (Element.is(target) && labelElem.isOrHasChild(Element.as(target))) {
// They clicked the label. Note our pre-click value, and
// short circuit event routing so that other click handlers
// don't hear about it
oldValue = getValue();
return;
}
// It's not the label. Let our handlers hear about the
// click...
super.onBrowserEvent(event);
// ...and now maybe tell them about the change
ValueChangeEvent.fireIfNotEqual(AccessibleRadioButton.this, oldValue, getValue());
return;
}
super.onBrowserEvent(event);
}
示例3: onBrowserEvent
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
CellBasedWidgetImpl.get().onBrowserEvent(this, event);
// Ignore spurious events (such as onblur) while we refresh the table.
if (refreshing) {
return;
}
// Verify that the target is still a child of this widget. IE fires focus
// events even after the element has been removed from the DOM.
EventTarget eventTarget = event.getEventTarget();
if (!Element.is(eventTarget)) {
return;
}
Element target = Element.as(eventTarget);
if (!getElement().isOrHasChild(Element.as(eventTarget))) {
return;
}
super.onBrowserEvent(event);
String eventType = event.getType();
if (BrowserEvents.FOCUS.equals(eventType)) {
// Remember the focus state.
focused = true;
onFocus();
} else if (BrowserEvents.BLUR.equals(eventType)) {
// Remember the blur state.
focused = false;
onBlur();
} else if (BrowserEvents.KEYDOWN.equals(eventType)) {
// A key event indicates that we already have focus.
focused = true;
} else if (BrowserEvents.MOUSEDOWN.equals(eventType)
&& CellBasedWidgetImpl.get().isFocusable(Element.as(target))) {
// If a natively focusable element was just clicked, then we must have
// focus.
focused = true;
}
}