当前位置: 首页>>代码示例>>Java>>正文


Java NativePreviewEvent类代码示例

本文整理汇总了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);
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:19,代码来源:VComboBoxMultiselect.java

示例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);
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:18,代码来源:WindowBox.java

示例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;
		}
	}

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:22,代码来源:ExternalAppDialogBox.java

示例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;
		}
	}
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:AboutDialog.java

示例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;
		}
	}

}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:24,代码来源:ExternalAppDialogBox.java

示例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);
        }
    }
}
 
开发者ID:melistik,项目名称:vaadin-sliderpanel,代码行数:21,代码来源:VSliderPanel.java

示例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 );
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:24,代码来源:AppRoot.java

示例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;
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:22,代码来源:WgtScroll.java

示例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();
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:18,代码来源:ResizableMovableHeader.java

示例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;
                }
            }
        }
    });
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:22,代码来源:PanelManagerImpl.java

示例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;
    }
  }
}
 
开发者ID:mvp4g,项目名称:mvp4g-examples,代码行数:18,代码来源:AboutDialog.java

示例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();
                }
            }
        }
        
    });
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:26,代码来源:ResizePanel.java

示例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;
		}
	}
}
 
开发者ID:jlSites,项目名称:funWithGwt,代码行数:17,代码来源:InforDialog.java

示例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;
    }
  }
}
 
开发者ID:jlSites,项目名称:funWithGwt,代码行数:17,代码来源:InforDialog.java

示例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);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:18,代码来源:ZoomToRectangleControl.java


注:本文中的com.google.gwt.user.client.Event.NativePreviewEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。