本文整理汇总了Java中com.google.gwt.user.client.Event.NativePreviewEvent.getTypeInt方法的典型用法代码示例。如果您正苦于以下问题:Java NativePreviewEvent.getTypeInt方法的具体用法?Java NativePreviewEvent.getTypeInt怎么用?Java NativePreviewEvent.getTypeInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event.NativePreviewEvent
的用法示例。
在下文中一共展示了NativePreviewEvent.getTypeInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
if (this.resizable) {
// We need to preventDefault() on mouseDown events (outside of the
// DialogBox content) to keep text from being selected when it
// is dragged.
NativeEvent nativeEvent = event.getNativeEvent();
if (!event.isCanceled()
&& (event.getTypeInt() == Event.ONMOUSEDOWN)
&& calcDragMode(nativeEvent.getClientX(),nativeEvent.getClientY()) >= 0) {
nativeEvent.preventDefault();
}
}
super.onPreviewNativeEvent(event);
}
示例2: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent p_event)
{
if( p_event.getTypeInt() == Event.ONKEYDOWN )
{
// start scrolling ?
onKeyDown( p_event.getNativeEvent().getKeyCode() );
return;
}
if( p_event.getTypeInt() == Event.ONKEYUP )
{
// stop scrolling ?
onKeyUp( p_event.getNativeEvent().getKeyCode() );
return;
}
if( (p_event.getTypeInt() == Event.ONMOUSEUP) && (m_cancelMouseUpEvent) )
{
// cancel event
return;
}
}
示例3: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = null;
if (Element.is(target)) {
targetElement = Element.as(target);
}
if (getWidget().getModalityCurtain().isOrHasChild(targetElement)
&& getWidget().isClosable()
&& (event.getTypeInt() & ACCEPTEDEVENTS) == 0) {
/*
* Close on events outside window. Special handling for mousemove
* etc to aid compatibility with desktop (testing purposes).
*/
rpc.close();
}
}
示例4: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
/**
* Processes a native event so that we can track mouse movements in and
* out of this widget.
* @param event
*/
protected void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONMOUSEMOVE) {
int x = event.getNativeEvent().getClientX();
int y = event.getNativeEvent().getClientY();
handleMouseMove(x, y);
}
}
示例5: isEscKey
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
/**
* Checks if the origin of the given event is a pressed ESC key.
*
* @param event
* the event to analyze
* @return <code>true</code> if the origin of the event is a pressed ESC
* key, otherwise <code>false</code>.
*/
private static boolean isEscKey(final NativePreviewEvent event) {
int typeInt = event.getTypeInt();
if (typeInt == Event.ONKEYDOWN) {
int keyCode = event.getNativeEvent().getKeyCode();
if (KeyCodes.KEY_ESCAPE == keyCode) {
return true;
}
}
return false;
}
示例6: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
/**
* pressing ESC closes the dialogbox
*/
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
if (event.getTypeInt() == Event.ONKEYDOWN &&
event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE) {
hide();
}
}
示例7: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent p_event)
{
if( (p_event.getTypeInt() == Event.ONKEYPRESS) && (p_event.getNativeEvent().getCtrlKey()) )
{
if( p_event.getNativeEvent().getKeyCode() == 'm'
|| p_event.getNativeEvent().getKeyCode() == 'M' )
{
// cancel event
return;
}
}
}
示例8: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
public void onPreviewNativeEvent(NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
int button = nativeEvent.getButton();
int x = nativeEvent.getClientX();
int y = nativeEvent.getClientY();
int keyCode = nativeEvent.getKeyCode();
int mouseWheelVelocity = nativeEvent.getMouseWheelVelocityY();
int screenX = nativeEvent.getScreenX();
int screenY = nativeEvent.getScreenY();
int keyModifiers =
((nativeEvent.getAltKey() ? 8 : 0) |
(nativeEvent.getCtrlKey() ? 4 : 0) |
(nativeEvent.getMetaKey() ? 2 : 0) |
(nativeEvent.getShiftKey() ? 1 : 0));
byte[] compressedData;
long currentTime = System.currentTimeMillis();
byte timeDiff = (byte) ((currentTime - previousSystemTime) & 0xff);
byte eventType = (byte) (event.getTypeInt() & 0xff);
if (keyCode != 0) {
compressedData = new byte[] {
timeDiff, eventType,
(byte) (keyCode & 0xff),
(byte) keyModifiers };
} else {
compressedData = new byte[] {
timeDiff,
eventType,
(byte) ((screenX - previousScreenX) & 0xff),
(byte) ((screenY - previousScreenY) & 0xff),
(byte) (button << 4 | keyModifiers),
(byte) mouseWheelVelocity };
}
previousScreenX = screenX;
previousScreenY = screenY;
previousSystemTime = currentTime;
addEntropy(ENTROPY_ID, ENTROPY_ESTMATE, compressedData);
}
示例9: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
if (!event.isCanceled() && (event.getTypeInt() == Event.ONMOUSEDOWN)
&& isCaptionEvent(nativeEvent)) {
nativeEvent.preventDefault();
}
super.onPreviewNativeEvent(event);
}
示例10: previewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
private void previewNativeEvent(NativePreviewEvent event) {
if (event.isCanceled() || event.isConsumed()) {
event.cancel();
return;
}
boolean eventTargetsContainerOrPartner = this.eventTargetsContainerOrPartner(event);
int type = event.getTypeInt();
switch (type) {
case Event.ONMOUSEDOWN:
case Event.ONTOUCHSTART:
if (!eventTargetsContainerOrPartner) {
this.blur();
return;
}
break;
case Event.ONFOCUS:
// Not used because focus events are not previewed yet
if (!eventTargetsContainerOrPartner) {
this.blur();
} else {
this.focus();
}
break;
default:
break;
}
}
示例11: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public final void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() != Event.ONKEYPRESS) {
return;
}
char ch = getCharCode(event.getNativeEvent());
onKeyPress(ch);
}
示例12: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent e) {
if (e.getTypeInt() == Event.getTypeInt(KeyDownEvent.getType().getName())) {
NativeEvent nativeEvent = e.getNativeEvent();
if (nativeEvent.getKeyCode() == KeyCodes.KEY_ESCAPE) {
nativeEvent.preventDefault();
}
}
}
示例13: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
if (!event.isCanceled()) {
EventTarget target = event.getNativeEvent().getEventTarget();
Element parent_element = parent_button.getElement();
switch (event.getTypeInt()) {
// OnScroll events are not previewable! The popup panel cannot
// move with scroll events using this method.
case Event.ONMOUSEDOWN:
// Check to see if the target is the current popup
if (parent_element.isOrHasChild(Element.as(target))) {
event.cancel();
hide();
return;
}
super.onPreviewNativeEvent(event);
return;
case Event.ONTOUCHSTART:
if (parent_element.isOrHasChild(Element.as(target))) {
event.cancel();
hide();
return;
}
super.onPreviewNativeEvent(event);
return;
}
super.onPreviewNativeEvent(event);
}
}
示例14: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYPRESS) {
futurama.evaluateKey((char) event.getNativeEvent().getKeyCode());
}
}
示例15: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent p_event)
{
if( p_event.getTypeInt() == Event.ONKEYPRESS )
{
if( DlgChatInput.isChatMode() )
{
// don't catch any key if chat dialog is visible
return;
}
if( p_event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER )
{
if( GameEngine.model().getGame().getGameType() == GameType.MultiPlayer
|| GameEngine.model().getGame().getGameType() == GameType.Initiation )
{
DlgChatInput.showDialog();
}
return;
}
else if( p_event.getNativeEvent().getKeyCode() == 'f'
|| p_event.getNativeEvent().getKeyCode() == 'F' )
{
if( GameEngine.model().isFireCoverDisplayed() )
{
GameEngine.model().setFireCoverDisplayed( false );
}
else
{
GameEngine.model().setFireCoverDisplayed( true );
}
// cancel event
return;
}
else if( p_event.getNativeEvent().getKeyCode() == '+' )
{
GameEngine.model().setZoomDisplayed( EnuZoom.Medium );
// cancel event
return;
}
else if( p_event.getNativeEvent().getKeyCode() == '-' )
{
GameEngine.model().setZoomDisplayed( EnuZoom.Small );
// cancel event
return;
}
else if( p_event.getNativeEvent().getKeyCode() == 'g'
|| p_event.getNativeEvent().getKeyCode() == 'G' )
{
GameEngine.model().setGridDisplayed( !GameEngine.model().isGridDisplayed() );
// cancel event
p_event.cancel();
return;
}
else if( p_event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ESCAPE )
{
try
{
GameEngine.model().getActionBuilder().userCancel();
AppRoot.getEventBus().fireEvent( new ModelUpdateEvent(GameEngine.model()) );
} catch( RpcFmpException e )
{
MAppMessagesStack.s_instance.showWarning( e.getLocalizedMessage() );
}
// cancel action
return;
}
}
}