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


Java EventHandler類代碼示例

本文整理匯總了Java中com.google.gwt.event.shared.EventHandler的典型用法代碼示例。如果您正苦於以下問題:Java EventHandler類的具體用法?Java EventHandler怎麽用?Java EventHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EventHandler類屬於com.google.gwt.event.shared包,在下文中一共展示了EventHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setEventHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
/**
 * Sets an event handler for an {@code Element}. All previous event handlers of this type of event are removed.
 * @param element The element to bind the event handler for
 * @param eventType The event type (e.g. {@code ClickEvent.getType()})
 * @param handler The handler that handler the event
 */
public static <H extends EventHandler> void setEventHandler(final Element element, DomEvent.Type<H> eventType, H handler) {
  if (element == null) {
    return;
  }
  HandlerManager hm = handlerManagers.get(element);
  if (hm == null) {
    handlerManagers.put(element, hm = new HandlerManager(element));
    DOM.setEventListener(element, new EventListener() {
      @Override
      public void onBrowserEvent(Event event) {
        DomEvent.fireNativeEvent(event, handlerManagers.get(element), element);
      }
    });
  }
  DOM.sinkBitlessEvent(element, eventType.getName());
  while (hm.getHandlerCount(eventType) > 0) {
    hm.removeHandler(eventType, hm.getHandler(eventType, 0));
  }
  hm.addHandler(eventType, handler);
}
 
開發者ID:turnsk,項目名稱:gwtmvp,代碼行數:27,代碼來源:EventManager.java

示例2: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void addHandler(Type<H> type) {
	// checks which kind of handler has been added
	if (type.equals(AnimationCompleteEvent.TYPE)) {
		// checks if property exist
		if (!has(Property.onComplete)) {
			// sets the java script code to get the event
			registerNativeCompleteHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onCompleteHandlers++;
	} else if (type.equals(AnimationProgressEvent.TYPE)) {
		// checks if property exist
		if (!has(Property.onProgress)) {
			// sets the java script code to get the event
			registerNativeProgressHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onProgressHandlers++;
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:22,代碼來源:Animation.java

示例3: removeHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void removeHandler(Type<H> type) {
	// checks which kind of handler has been removed
	if (type.equals(AnimationCompleteEvent.TYPE)) {
		// decrements amount of handlers
		onCompleteHandlers--;
		// if zero, no handler
		if (onCompleteHandlers == 0) {
			// therefore remove property
			remove(Property.onComplete);
		}
	} else if (type.equals(AnimationProgressEvent.TYPE)) {
		// decrements amount of handlers
		onProgressHandlers--;
		// if zero, no handler
		if (onProgressHandlers == 0) {
			// therefore remove property
			remove(Property.onProgress);
		}
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:22,代碼來源:Animation.java

示例4: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void addHandler(Type<H> type) {
	// checks if type of added event handler is dataset selection or click
	if (type.equals(ChartClickEvent.TYPE)) {
		// if java script property is missing
		if (!has(Property.onClick)) {
			// adds the java script function to catch the event
			registerNativeClickHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onClickHandlers++;
	} else if (type.equals(ChartHoverEvent.TYPE)) {
		// if java script property is missing
		if (!has(Property.onHover)) {
			// adds the java script function to catch the event
			registerNativeHoverHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onHoverHandlers++;
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:22,代碼來源:Legend.java

示例5: removeHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void removeHandler(Type<H> type) {
	// checks if type of removed event handler is dataset selection or click
	if (type.equals(DatasetSelectionEvent.TYPE) || type.equals(ChartClickEvent.TYPE)) {
		// decrements the amount of handlers
		onClickHandlers--;
		// if there is not any handler
		if (onClickHandlers == 0) {
			// removes the java script object
			remove(Property.onClick);
		}
	} else if (type.equals(ChartHoverEvent.TYPE)) {
		// decrements the amount of handlers
		onHoverHandlers--;
		// if there is not any handler
		if (onHoverHandlers == 0) {
			// removes the java script object
			remove(Property.onHover);
		}
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:22,代碼來源:Legend.java

示例6: prepare

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
public void prepare() {
	canvas = new GWTCanvas(width, height);
	popupPanel.setWidget(canvas);
	for (Entry<EventHandler, DomEvent.Type<EventHandler>> entry : eventHandlers.entrySet()) {
		canvas.addDomHandler(entry.getKey(), entry.getValue());
	}
}
 
開發者ID:nodchip,項目名稱:QMAClone,代碼行數:8,代碼來源:PopupCanvas.java

示例7: addEvent

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
public void addEvent(PointerEvent<? extends EventHandler> pointerEvent) {
    if (isFirstTouch(pointerEvent)) {
        pointersPoints.clear();
    }
    Point coordinates = new Point(pointerEvent.getClientX(), pointerEvent.getClientY());
    pointersPoints.put(pointerEvent.getPointerId(), coordinates);
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:8,代碼來源:PointerEventsCoordinates.java

示例8: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void addHandler(Type<H> type) {
	// checks if type of added event handler is dataset selection or click
	if (type.equals(DatasetSelectionEvent.TYPE) || type.equals(ChartClickEvent.TYPE)) {
		// if java script property is missing
		if (!has(Property.onClick)) {
			// adds the java script function to catch the event
			registerNativeClickHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onClickHandlers++;
	} else if (type.equals(ChartHoverEvent.TYPE)) {
		// if java script property is missing
		if (!has(Property.onHover)) {
			// adds the java script function to catch the event
			registerNativeHoverHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onHoverHandlers++;
	} else if (type.equals(ChartResizeEvent.TYPE)) {
		// if java script property is missing
		if (!has(Property.onResize)) {
			// adds the java script function to catch the event
			registerNativeResizeHandler(getJavaScriptObject());
		}
		// increments amount of handlers
		onResizeHandlers++;
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:30,代碼來源:BaseOptions.java

示例9: removeHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
protected <H extends EventHandler> void removeHandler(Type<H> type) {
	// checks if type of removed event handler is dataset selection or click
	if (type.equals(DatasetSelectionEvent.TYPE) || type.equals(ChartClickEvent.TYPE)) {
		// decrements the amount of handlers
		onClickHandlers--;
		// if there is not any handler
		if (onClickHandlers == 0) {
			// removes the java script object
			remove(Property.onClick);
		}
	} else if (type.equals(ChartHoverEvent.TYPE)) {
		// decrements the amount of handlers
		onHoverHandlers--;
		// if there is not any handler
		if (onHoverHandlers == 0) {
			// removes the java script object
			remove(Property.onHover);
		}
	} else if (type.equals(ChartResizeEvent.TYPE)) {
		// decrements the amount of handlers
		onResizeHandlers--;
		// if there is not any handler
		if (onResizeHandlers == 0) {
			// removes the java script object
			remove(Property.onResize);
		}
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:30,代碼來源:BaseOptions.java

示例10: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
public <H extends EventHandler> HandlerRegistration addHandler(Type<H> type, H handler) {
	// adds handler
	HandlerRegistration registration = super.addHandler(type, handler);
	// if the handler is a chart event handler one
	if (handler instanceof ChartEventHandler) {
		// sends the event
		fireEvent(new AddHandlerEvent(type));
	}
	return registration;
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:12,代碼來源:ChartHandlerManager.java

示例11: removeHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
@Override
public <H extends EventHandler> void removeHandler(Type<H> type, H handler) {
	// removes handler
	super.removeHandler(type, handler);
	// if the handler is a chart event handler one
	if (handler instanceof ChartEventHandler) {
		// sends the event
		fireEvent(new RemoveHandlerEvent(type));
	}
}
 
開發者ID:pepstock-org,項目名稱:Charba,代碼行數:11,代碼來源:ChartHandlerManager.java

示例12: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
public <T extends EventHandler> HandlerRegistration addHandler(Type<T> type,
        T handler) {
    return eventBus.addHandler(type, handler);
}
 
開發者ID:iSergio,項目名稱:gwt-cs,代碼行數:5,代碼來源:ShowcaseEventBusImpl.java

示例13: addHandler

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
<H extends EventHandler> HandlerRegistration addHandler(
    final H handler, DomEvent.Type<H> type) {
  return addDomHandler(handler, type);
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:5,代碼來源:GadgetWidgetUi.java

示例14: addHandlerToSource

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
public <T extends EventHandler> HandlerRegistration addHandlerToSource(
        Type<T> type,
        Object source, T handler) {
    return eventBus.addHandlerToSource(type, source, handler);
}
 
開發者ID:iSergio,項目名稱:gwt-olcs,代碼行數:6,代碼來源:ShowcaseEventBusImpl.java

示例15: clearEventHandlers

import com.google.gwt.event.shared.EventHandler; //導入依賴的package包/類
/**
 * Clears all event handlers of a specific event type from an element.
 * @param element The element to clear the event handlers from
 * @param eventType The event type
 */
public static <H extends EventHandler> void clearEventHandlers(Element element, GwtEvent.Type<H> eventType) {
  HandlerManager hm = handlerManagers.get(element);
  while (hm != null && hm.getHandlerCount(eventType) > 0) {
    hm.removeHandler(eventType, hm.getHandler(eventType, 0));
  }
}
 
開發者ID:turnsk,項目名稱:gwtmvp,代碼行數:12,代碼來源:EventManager.java


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