本文整理汇总了Java中com.google.gwt.user.client.Event.NativePreviewEvent.getNativeEvent方法的典型用法代码示例。如果您正苦于以下问题:Java NativePreviewEvent.getNativeEvent方法的具体用法?Java NativePreviewEvent.getNativeEvent怎么用?Java NativePreviewEvent.getNativeEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event.NativePreviewEvent
的用法示例。
在下文中一共展示了NativePreviewEvent.getNativeEvent方法的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
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getCtrlKey()) {
switch (evt.getKeyCode()) {
case 'a':
case 'A':
evt.preventDefault();
okButton.click();
case 'z':
case 'Z':
evt.preventDefault();
closeButton.click();
break;
}
}
}
示例3: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
default:
break;
}
}
}
示例4: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getCtrlKey()) {
switch (evt.getKeyCode()) {
case 'a':
case 'A':
evt.preventDefault();
okButton.click();
case 'z':
case 'Z':
evt.preventDefault();
closeButton.click();
break;
default:
break;
}
}
}
示例5: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent p_event)
{
if( p_event == null || p_event.getNativeEvent() == null
|| p_event.getNativeEvent().getEventTarget() == null )
{
return;
}
com.google.gwt.dom.client.Element elmt = com.google.gwt.dom.client.Element.as( p_event
.getNativeEvent().getEventTarget() );
if( elmt instanceof InputElement )
{
String type = ((InputElement)elmt).getType();
if( type != null
&& (type.equals( "text" ) || type.equals( "password" ) || type.equals( "textarea" )) )
{
return;
}
}
// don't preview event if user is editing someting in an input form
m_previewListenerCollection.fireEventPreview( p_event );
}
示例6: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType()
.equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
}
}
}
示例7: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
}
}
}
示例8: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown")) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
switch (evt.getKeyCode()) {
case KeyCodes.KEY_ENTER:
case KeyCodes.KEY_ESCAPE:
hide();
break;
}
}
}
示例9: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
final NativeEvent natEvent = event.getNativeEvent();
final Element element = natEvent.getEventTarget().cast();
final String eventType = natEvent.getType();
if (!(element == left || element == right)) {
if ("mousedown".equals(eventType)) {
//No need to do anything, the event will be passed on to the column sort handler
} else if (!dragging && "mouseover".equals(eventType)) {
cleanUp();
}
return;
}
final NativeEvent nativeEvent = getEventAndPreventPropagation(event);
if ("mousedown".equals(eventType)) {
if (element == right) {
left.removeFromParent();
new ColumnResizeHelper(this, source, right, nativeEvent);
} else
new ColumnMoverHelper(this, source, nativeEvent);
dragging = true;
}
}
示例10: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals(KEYDOWN) && evt.getKeyCode() == KeyCodes.KEY_ESCAPE && performCancelOnEscape && listener != null
&& cancelButton.isVisible()) {
listener.onCancelClick();
hide();
}
}
示例11: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown") && evt.getKeyCode() == KeyCodes.KEY_ESCAPE) {
// Use the popup's key preview hooks to close the dialog when either
// enter or escape is pressed.
hide();
}
}
示例12: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent preview) {
super.onPreviewNativeEvent(preview);
NativeEvent evt = preview.getNativeEvent();
if (evt.getType().equals("keydown") && evt.getKeyCode() == KeyCodes.KEY_ESCAPE) {
hide();
}
}
示例13: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入方法依赖的package包/类
@Override
public void onPreviewNativeEvent(final NativePreviewEvent event) {
final NativeEvent natEvent = event.getNativeEvent();
final Element element = natEvent.getEventTarget().cast();
final String eventType = natEvent.getType();
if (!(element == moveHandle || element == resizeHandle)) {
if ("mousedown".equals(eventType)) {
//No need to do anything, the event will be passed on to the column sort handler
} else if (!dragging && "mouseover".equals(eventType)) {
cleanUp();
}
return;
}
final NativeEvent nativeEvent = getEventAndPreventPropagation(event);
if ("mousedown".equals(eventType)) {
if (element == resizeHandle) {
moveHandle.removeFromParent();
new ColumnResizeHelper(this,
source,
nativeEvent);
} else {
new ColumnMoverHelper(this,
source,
nativeEvent);
}
dragging = true;
}
}
示例14: 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);
}
示例15: 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);
}