本文整理汇总了Java中com.google.gwt.user.client.Event.getTypeInt方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getTypeInt方法的具体用法?Java Event.getTypeInt怎么用?Java Event.getTypeInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.getTypeInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
event.preventDefault();
int eventType = event.getTypeInt();
switch (eventType) {
case ONMOUSEDOWN:
case ONTOUCHSTART:
onClick();
break;
case ONMOUSEUP:
if (!singleClick) {
onClick();
}
break;
case ONMOUSEOVER:
onMouseOver();
break;
case ONTOUCHEND:
case ONMOUSEOUT:
onMouseOut();
break;
}
}
示例2: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (!isEnabled()) return;
super.onBrowserEvent(event);
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
int type = DOM.eventGetType(event);
char keyCode = (char) event.getKeyCode();
switch (type) {
case Event.ONKEYDOWN:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
if (iDown != null) setResource(iDown);
}
break;
case Event.ONKEYUP:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
setResource(iUp);
onClick();
}
break;
}
}
}
示例3: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
* Invoked by GWT whenever a browser event is dispatched to this component.
*/
@Override
public final void onBrowserEvent(Event event) {
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
case Event.ONMOUSEMOVE:
case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
cancelBrowserEvent(event);
mouseListeners.fireMouseEvent(this, event);
break;
case Event.ONCLICK:
cancelBrowserEvent(event);
select();
break;
default:
// Ignore unexpected events
break;
}
}
示例4: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
debug("VComboBoxMultiselect.SP: onBrowserEvent()");
if (event.getTypeInt() == Event.ONCLICK) {
final Element target = DOM.eventGetTarget(event);
if (target == this.up || target == DOM.getChild(this.up, 0)) {
this.lazyPageScroller.scrollUp();
} else if (target == this.down || target == DOM.getChild(this.down, 0)) {
this.lazyPageScroller.scrollDown();
}
}
/*
* Prevent the keyboard focus from leaving the textfield by
* preventing the default behaviour of the browser. Fixes #4285.
*/
handleMouseDownEvent(event);
}
示例5: handleMouseDownEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
* Handles special behavior of the mouse down event.
*
* @param event
*/
private void handleMouseDownEvent(Event event) {
/*
* Prevent the keyboard focus from leaving the textfield by preventing
* the default behaviour of the browser. Fixes #4285.
*/
if (event.getTypeInt() == Event.ONMOUSEDOWN) {
debug("VComboBoxMultiselect: blocking mouseDown event to avoid blur");
event.preventDefault();
event.stopPropagation();
/*
* In IE the above wont work, the blur event will still trigger. So,
* we set a flag here to prevent the next blur event from happening.
* This is not needed if do not already have focus, in that case
* there will not be any blur event and we should not cancel the
* next blur.
*/
if (BrowserInfo.get()
.isIE() && this.focused) {
this.preventNextBlurEventInIE = true;
debug("VComboBoxMultiselect: Going to prevent next blur event on IE");
}
}
}
示例6: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (contextMenuHandler != null && event.getTypeInt() == Event.ONCONTEXTMENU) {
contextMenuHandler.onContextMenu(event);
return;
}
if ((event.getTypeInt() == Event.ONCLICK
|| event.getTypeInt() == Event.ONMOUSEDOWN)
&& event.getButton() != NativeEvent.BUTTON_LEFT) {
event.preventDefault();
event.stopPropagation();
return;
}
super.onBrowserEvent(event);
}
示例7: sinkEvents
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
* Sink events on the widget.
*
* @param widget the {@link Widget} that will handle the events
* @param typeNames the names of the events to sink
*/
public final void sinkEvents(Widget widget, Set<String> typeNames) {
if (typeNames == null) {
return;
}
int eventsToSink = 0;
for (String typeName : typeNames) {
int typeInt = Event.getTypeInt(typeName);
if (typeInt < 0) {
widget.sinkBitlessEvent(typeName);
} else {
typeInt = sinkEvent(widget, typeName);
if (typeInt > 0) {
eventsToSink |= typeInt;
}
}
}
if (eventsToSink > 0) {
widget.sinkEvents(eventsToSink);
}
}
示例8: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
int type = DOM.eventGetType(event);
char keyCode = (char) event.getKeyCode();
switch (type) {
case Event.ONKEYUP:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r')
onClick();
break;
}
}
}
示例9: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (event.getTypeInt() == Event.ONKEYUP && event.getKeyCode() == KeyCodes.KEY_SPACE) {
onClick();
}
if (event.getTypeInt() == Event.ONCLICK) {
setValue(!getValue());
}
super.onBrowserEvent(event);
}
示例10: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if(event.getTypeInt() == Event.ONCLICK) {
event.stopPropagation();
}
super.onBrowserEvent(event);
}
示例11: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
// If we're not yet dragging, only trigger mouse events if the event occurs
// in the caption wrapper
if (this.resizable) {
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
case Event.ONMOUSEMOVE:
case Event.ONMOUSEOVER:
case Event.ONMOUSEOUT:
if (this.dragMode >= 0 || calcDragMode(event.getClientX(),event.getClientY()) >= 0) {
// paste'n'copy from Widget.onBrowserEvent
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
// Only fire the mouse over event if it's coming from outside this
// widget.
case Event.ONMOUSEOUT:
// Only fire the mouse out event if it's leaving this
// widget.
Element related = event.getRelatedEventTarget().cast();
if (related != null && getElement().isOrHasChild(related)) {
return;
}
break;
}
DomEvent.fireNativeEvent(event, this, this.getElement());
return;
}
if (this.dragMode<0)
this.updateCursor(this.dragMode);
}
}
super.onBrowserEvent(event);
}
示例12: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if (isEnabled() && event.getTypeInt() == Event.ONCONTEXTMENU) {
if (getStyleName().contains("-header-sortable")) {
_delegate.showSortMenu(td, cid);
}
event.preventDefault();
event.stopPropagation();
}
}
示例13: modifiers
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
* @return A string describing which modifier keys were pressed,
* and whether this was a repeat event, e.g., " shift ctrl"
*/
@SuppressWarnings("deprecation")
public static String modifiers(Event event) {
// repeat is deprecated, but useful for debugging
return (event.getAltKey() ? " alt" : "")
+ (event.getShiftKey() ? " shift" : "")
+ (event.getCtrlKey() ? " ctrl" : "")
+ (event.getMetaKey() ? " meta" : "")
+ ((event.getTypeInt() == Event.ONKEYDOWN) && event.getRepeat() ? " repeat" : "");
}
示例14: asString
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public static String asString(Event event) {
// Start with the event type string
String string = DOM.eventGetTypeString(event);
// Next type-specific fields
switch (event.getTypeInt()) {
case Event.ONKEYPRESS:
case Event.ONKEYUP:
case Event.ONKEYDOWN:
string += key(event) + modifiers(event);
break;
case Event.ONCLICK:
case Event.ONDBLCLICK:
case Event.ONMOUSEMOVE:
string += mousePoint(event) + modifiers(event);
break;
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
string += mousePoint(event) + mouseButtons(event) + modifiers(event);
break;
case Event.ONMOUSEOUT:
string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event);
break;
case Event.ONMOUSEOVER:
string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event);
break;
case Event.ONMOUSEWHEEL:
string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event);
break;
case Event.ONFOCUS:
case Event.ONBLUR:
case Event.ONCHANGE:
case Event.ONERROR:
case Event.ONLOAD:
case Event.ONLOSECAPTURE:
case Event.ONSCROLL:
break;
}
return string;
}
示例15: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (mouseListener == null) {
super.onBrowserEvent(event);
return;
}
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
mouseListener.onMouseDown();
break;
case Event.ONMOUSEOUT:
mouseListener.onMouseLeave();
break;
case Event.ONMOUSEOVER:
mouseListener.onMouseEnter();
break;
case Event.ONMOUSEUP:
mouseListener.onMouseUp();
break;
case Event.ONCLICK:
mouseListener.onClick();
if (stopPropagation) {
event.stopPropagation();
}
break;
}
super.onBrowserEvent(event);
}