當前位置: 首頁>>代碼示例>>Java>>正文


Java DOM.eventGetTarget方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:36,代碼來源:FilterBox.java

示例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);
  }
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:16,代碼來源:Wizard.java

示例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);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:43,代碼來源:TimeGrid.java


注:本文中的com.google.gwt.user.client.DOM.eventGetTarget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。