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


Java NativePreviewHandler类代码示例

本文整理汇总了Java中com.google.gwt.user.client.Event.NativePreviewHandler的典型用法代码示例。如果您正苦于以下问题:Java NativePreviewHandler类的具体用法?Java NativePreviewHandler怎么用?Java NativePreviewHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NativePreviewHandler类属于com.google.gwt.user.client.Event包,在下文中一共展示了NativePreviewHandler类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的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

示例2: ResizePanel

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的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

示例3: startRectangle

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的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

示例4: CustomOverlayWidget

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
/**
 * The constructor should first call super() to initialize the component and
 * then handle any initialization relevant to Vaadin.
 */
public CustomOverlayWidget() {
    setWidget(new HTML()); // Seems that we need this one
    overlay = new PopupPanel();
    overlay.addStyleName(CLASSNAME);
    overlay.setAutoHideEnabled(false);
    overlay.setAnimationEnabled(false);
    overlay.setModal(false);

    Event.addNativePreviewHandler(new NativePreviewHandler() {
        public void onPreviewNativeEvent(NativePreviewEvent event) {
            int typeInt = event.getTypeInt();
            // We're only listening for these
            if (typeInt == Event.ONSCROLL) {
                CustomOverlayWidget.this.updateOverlayPosition();
            }
        }
    });
}
 
开发者ID:Haulmont,项目名称:vaadin-overlays,代码行数:23,代码来源:CustomOverlayWidget.java

示例5: ExtendedPopupPanel

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
/**
 * ExtendedPopupPanel
 */
public ExtendedPopupPanel(boolean autoHide, boolean modal) {
	super(autoHide, modal);

	// Ensures when mouseup / onclick / ondblclick event is disabled drag flag and not consumed by popup
	Event.addNativePreviewHandler(new NativePreviewHandler() {
		@Override
		public void onPreviewNativeEvent(NativePreviewEvent event) {
			int type = event.getTypeInt();
			if (type == Event.ONMOUSEUP || type == Event.ONCLICK || type == Event.ONDBLCLICK) {
				Main.get().activeFolderTree.disableDragged();
			}
		}
	});
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:18,代码来源:ExtendedPopupPanel.java

示例6: accept

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
@Override
// Exception squid:S1604 - GWT 2.7 does not support Java 8
@SuppressWarnings("squid:S1604")
public void accept(final VDragEvent drag, final UIDL configuration, final VAcceptCallback callback) {

    if (isDragStarting(drag)) {
        final NativePreviewHandler nativeEventHandler = new NativePreviewHandler() {
            @Override
            public void onPreviewNativeEvent(NativePreviewEvent event) {
                if (isEscKey(event) || isMouseUp(event)) {
                    try {
                        hideDropTargetHints(configuration);
                    } finally {
                        nativeEventHandlerRegistration.removeHandler();
                    }
                }
            }
        };

        nativeEventHandlerRegistration = Event.addNativePreviewHandler(nativeEventHandler);
        setMultiRowDragDecoration(drag);
    }

    int childCount = configuration.getChildCount();
    accepted = false;
    for (int childIndex = 0; childIndex < childCount; childIndex++) {
        VAcceptCriterion crit = getCriteria(configuration, childIndex);
        crit.accept(drag, configuration.getChildUIDL(childIndex), this);
        if (Boolean.TRUE.equals(accepted)) {
            callback.accepted(drag);
            return;
        }
    }

    // if no VAcceptCriterion accepts and the mouse is release, an error
    // message is shown
    if (Event.ONMOUSEUP == Event.getTypeInt(drag.getCurrentGwtEvent().getType())) {
        showErrorNotification(drag);
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:41,代码来源:ViewClientCriterion.java

示例7: init

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    dummyRootMenuBar = GWT.create(MyVMenuBar.class);

    CustomMenuItem item = GWT.create(CustomMenuItem.class);
    dummyRootMenuBar.getItems().add(item);

    contextMenuWidget = new MyVMenuBar(true, dummyRootMenuBar);
    item.setSubMenu(contextMenuWidget);

    // application connection that is used for all our overlays
    MyVOverlay.setApplicationConnection(this.getConnection());

    registerRpc(ContextMenuClientRpc.class, new ContextMenuClientRpc() {
        @Override
        public void showContextMenu(int x, int y) {
            showMenu(x, y);
        }
    });

    Event.addNativePreviewHandler(new NativePreviewHandler() {
        @Override
        public void onPreviewNativeEvent(NativePreviewEvent event) {
            if (event.getTypeInt() == Event.ONKEYDOWN
                    && contextMenuWidget.isPopupShowing()) {
                boolean handled = contextMenuWidget.handleNavigation(
                        event.getNativeEvent().getKeyCode(),
                        event.getNativeEvent().getCtrlKey(),
                        event.getNativeEvent().getShiftKey());

                if (handled) {
                    event.cancel();
                }
            }
        }
    });
}
 
开发者ID:vaadin,项目名称:context-menu,代码行数:40,代码来源:ContextMenuConnector.java

示例8: addPreviewListener

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
@Override
public void addPreviewListener(NativePreviewHandler p_listener)
{
  if( !m_previewListenerCollection.contains( p_listener ) )
  {
    m_previewListenerCollection.add( p_listener );
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:9,代码来源:AppRoot.java

示例9: updateHandlers

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
private void updateHandlers() {
    if (nativePreviewHandlerRegistration != null) {
        nativePreviewHandlerRegistration.removeHandler();
        nativePreviewHandlerRegistration = null;
    }
    if (showing) {
        nativePreviewHandlerRegistration = Event.addNativePreviewHandler(new NativePreviewHandler() {
            public void onPreviewNativeEvent(NativePreviewEvent event) {
              previewNativeEvent(event);
            }
        });
    }
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:14,代码来源:BusyPopup.java

示例10: updateHandler

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
private void updateHandler() {
	if (this.previewHandler != null) {
		this.previewHandler.removeHandler();
		this.previewHandler = null;
	}
	if (this.focused) {
		this.previewHandler = Event.addNativePreviewHandler(new NativePreviewHandler() {
			@Override
			public void onPreviewNativeEvent(NativePreviewEvent event) {
				CompositeFocusHelper.this.previewNativeEvent(event);
			}
		});
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:15,代码来源:CompositeFocusHelper.java

示例11: previewMouseUpHandler

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
/**
 * Through a {@link NativePreviewHandler} and its {@link NativePreviewEvent} 
 * all mouse events are caught here before they are processed. 
 * If the event is of type {@link Event#ONMOUSEUP} and the click was outside 
 * the button or this drop-down panel, the panel is closed.
 *
 * @return handler registration
 */
private HandlerRegistration previewMouseUpHandler() {
	return Event.addNativePreviewHandler(new NativePreviewHandler() {
		public void onPreviewNativeEvent(NativePreviewEvent preview) {
			int typeInt = preview.getTypeInt();
			if (typeInt == Event.ONMOUSEUP) {
				Event event = Event.as(preview.getNativeEvent());
				// Can not retrieve the clicked widget from the Event, so here goes...
				int clientX = event.getClientX();
				int clientY = event.getClientY();
				// Was the button clicked?
				int left = button.getPageLeft();
				int right = button.getPageRight();
				int top = button.getPageTop();
				int bottom = button.getPageBottom();
				boolean mouseIsOutside = true;
				if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
					mouseIsOutside = false;
				}
				if (mouseIsOutside) {
					// Was this panel clicked?
					right = getPageRight();
					top = getPageTop();
					bottom = getPageBottom();
					if (clientX > left && clientX < right && clientY > top && clientY < bottom) {
						mouseIsOutside = false;
					}
				}
				if (mouseIsOutside) {
					hide();
				}
			}
		}
	});
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:43,代码来源:DropDownPanel.java

示例12: removePreviewListener

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
@Override
public void removePreviewListener(NativePreviewHandler p_listener)
{
  m_previewListenerCollection.remove( p_listener );
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:6,代码来源:AppRoot.java

示例13: addPreviewListener

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
void addPreviewListener(NativePreviewHandler p_listener); 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:2,代码来源:SourcesPreviewEvents.java

示例14: removePreviewListener

import com.google.gwt.user.client.Event.NativePreviewHandler; //导入依赖的package包/类
void removePreviewListener(NativePreviewHandler p_listener); 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:2,代码来源:SourcesPreviewEvents.java


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