本文整理汇总了Java中com.google.gwt.user.client.Event.NativePreviewEvent类的典型用法代码示例。如果您正苦于以下问题:Java NativePreviewEvent类的具体用法?Java NativePreviewEvent怎么用?Java NativePreviewEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NativePreviewEvent类属于com.google.gwt.user.client.Event包,在下文中一共展示了NativePreviewEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
// Check all events outside the combobox to see if they scroll the
// page. We cannot use e.g. Window.addScrollListener() because the
// scrolled element can be at any level on the page.
// Normally this is only called when the popup is showing, but make
// sure we don't accidentally process all events when not showing.
if (!this.scrollPending && isShowing()
&& !DOM.isOrHasChild(SuggestionPopup.this.getElement(), Element.as(event.getNativeEvent()
.getEventTarget()))) {
if (getDesiredLeftPosition() != this.leftPosition || getDesiredTopPosition() != this.topPosition) {
updatePopupPositionOnScroll();
}
}
super.onPreviewNativeEvent(event);
}
示例2: 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);
}
示例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.getCtrlKey()) {
switch (evt.getKeyCode()) {
case 'a':
case 'A':
evt.preventDefault();
okButton.click();
case 'z':
case 'Z':
evt.preventDefault();
closeButton.click();
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.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;
}
}
}
示例5: 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;
}
}
}
示例6: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (autoCollapseSlider && event != null && !event.isCanceled() && expand) {
Event nativeEvent = Event.as(event.getNativeEvent());
switch (nativeEvent.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONTOUCHSTART:
case Event.ONDBLCLICK:
if (eventTargetsPopup(nativeEvent)) {
return;
}
if (eventTargetsInnerElementsPopover(nativeEvent)) {
return;
}
setExpand(false, true);
}
}
}
示例7: 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 );
}
示例8: 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;
}
}
示例9: onPreviewNativeEvent
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
@Override
public void onPreviewNativeEvent(final NativePreviewEvent event) {
final NativeEvent nativeEvent = getEventAndPreventPropagation(event);
final String eventType = nativeEvent.getType();
if ("mousemove".equals(eventType)) {
moveColumn(nativeEvent.getClientX());
} else if ("mouseup".equals(eventType)) {
handler.removeHandler();
ghostColumn.removeFromParent();
ghostLine.removeFromParent();
if (fromIndex != toIndex) {
columnMoved(fromIndex,
toIndex);
}
dragCallback.dragFinished();
}
}
示例10: setup
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
@PostConstruct
private void setup() {
globalHandlerRegistration = com.google.gwt.user.client.Event.addNativePreviewHandler(new NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == com.google.gwt.user.client.Event.ONKEYPRESS &&
event.getNativeEvent().getCharCode() == 'm' &&
event.getNativeEvent().getCtrlKey()) {
if (maximizedPanel != null) {
maximizedPanel.unmaximize();
maximizedPanel = null;
} else if (activePart != null) {
WorkbenchPanelPresenter activePanelPresenter = mapPanelDefinitionToPresenter.get(activePart.getParentPanel());
activePanelPresenter.maximize();
maximizedPanel = activePanelPresenter;
}
}
}
});
}
示例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")) {
// 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;
}
}
}
示例12: ResizePanel
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
public ResizePanel(AvroUiStyle style) {
super();
DOM.sinkEvents(this.getElement(), Event.ONMOUSEDOWN | Event.ONMOUSEMOVE
| Event.ONMOUSEUP | Event.ONMOUSEOVER);
addStyleName(style.resizePanel());
resizeElement = DOM.createDiv();
resizeElement.addClassName(style.resizeHandle());
this.getElement().appendChild(resizeElement);
Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (resize) {
int clientX = event.getNativeEvent().getClientX();
int clientY = event.getNativeEvent().getClientY();
int originalX = getElement().getAbsoluteLeft();
int originalY = getElement().getAbsoluteTop();
if (clientX < originalX || clientY < originalY) {
event.cancel();
}
}
}
});
}
示例13: 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;
}
}
}
示例14: 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;
}
}
}
示例15: startRectangle
import com.google.gwt.user.client.Event.NativePreviewEvent; //导入依赖的package包/类
private void startRectangle() {
cleanup();
container = mapPresenter.getContainerManager().addScreenContainer();
zoomToRectangleGroup = new ZoomToRectGroup(mapPresenter.getViewPort());
escapeHandler = Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(NativePreviewEvent event) {
if (event.getTypeInt() == Event.ONKEYDOWN || event.getTypeInt() == Event.ONKEYPRESS) {
if (KeyCodes.KEY_ESCAPE == event.getNativeEvent().getKeyCode()) {
cleanup();
}
}
}
});
container.add(zoomToRectangleGroup);
}