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


Java HumanInputEvent类代码示例

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


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

示例1: humanStart

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanStart(HumanInputEvent ev) {
    int x= getAbsoluteX(ev);
    int y= getAbsoluteY(ev);
    PopupRegion r= findRegion(x,y);

    addPreventEvent();
    if (r== PopupRegion.TITLE_BAR) {
        if (_hideOnResizeWidget!=null) {
            GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "hidden");
        }
        ev.preventDefault();
        beginMove(x,y);

    } else if (_expandW!=null) {
        if (r== PopupRegion.SE_CORNER || r== PopupRegion.SW_CORNER) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "hidden");
            }
            ev.preventDefault();
            beginResize(r);
        }
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:24,代码来源:PopupPane.java

示例2: humanStop

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanStop(HumanInputEvent ev) {
        removePreventEvent();
        if (_moving) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "visible");
            }
            ev.preventDefault();
//            DOM.eventPreventDefault(ev);
            endMove();

        }
        else if (_resizing) {
            if (_hideOnResizeWidget!=null) {
                GwtUtil.setStyle(_hideOnResizeWidget, "visibility", "visible");
            }
            ev.preventDefault();
//            DOM.eventPreventDefault(ev);
            endResize();
        }
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:21,代码来源:PopupPane.java

示例3: handleMove

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private static void handleMove(final EventHandlingTarget panel, final DragCache storage, HumanInputEvent<?> event) {
	// Notification.showInfo("MOVE " + getPointAbsolute(event));
	if (storage.activePanel != null && DRAG_COMMANDS.contains(storage.dragging)) {
		Point p = getPoint(storage.activePanel, event);
		int diffX = p.x - storage.moveStart.getX();
		int diffY = p.y - storage.moveStart.getY();
		diffX -= diffX % SharedConstants.DEFAULT_GRID_SIZE;
		diffY -= diffY % SharedConstants.DEFAULT_GRID_SIZE;
		if (diffX != 0 || diffY != 0) {
			panel.onMouseMoveDraggingScheduleDeferred(storage.moveStart, diffX, diffY, storage.elementToDrag, event.isShiftKeyDown(), event.isControlKeyDown(), storage.dragging == DragStatus.FIRST);
			storage.dragging = DragStatus.CONTINUOUS; // after FIRST real drag switch to CONTINUOUS
			storage.moveStart = storage.moveStart.copy().move(diffX, diffY); // make copy because otherwise deferred action will act on wrong position
		}
	}
	else if (storage.mouseContainingPanel != null) {
		storage.mouseContainingPanel.onMouseMove(getPoint(storage.mouseContainingPanel, event));
	}
}
 
开发者ID:umlet,项目名称:umlet,代码行数:19,代码来源:EventHandlingUtils.java

示例4: getLocation

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public Coordinate getLocation(HumanInputEvent<?> event, RenderSpace renderSpace) {
	switch (renderSpace) {
		case WORLD:
			Coordinate screen = getLocation(event, RenderSpace.SCREEN);
			return mapWidget.getMapModel().getMapView().getWorldViewTransformer().viewToWorld(screen);
		case SCREEN:
		default:
			if (event instanceof MouseEvent<?>) {
				Element element = mapWidget.getDOM();
				double offsetX = ((MouseEvent<?>) event).getRelativeX(element);
				double offsetY = ((MouseEvent<?>) event).getRelativeY(element);
				return new Coordinate(offsetX, offsetY);
			} else if (event instanceof TouchEvent<?>) {
				Touch touch = ((TouchEvent<?>) event).getTouches().get(0);
				return new Coordinate(touch.getClientX(), touch.getClientY());
			}
			return new Coordinate(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:21,代码来源:AbstractGraphicsController.java

示例5: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
/**
 * Start dragging, register base for selection rectangle.
 * 
 * @param event
 *            event
 */
@Override
public void onDown(HumanInputEvent<?> event) {
	if (dragging && leftWidget) {
		// mouse was moved outside of widget
		doSelect(event);

	} else if (!isRightMouseButton(event)) {
		// no point trying to select when there is no active layer
		dragging = true;
		leftWidget = false;
		timestamp = new Date().getTime();
		begin = getLocation(event, RenderSpace.SCREEN);
		bounds = new Bbox(begin.getX(), begin.getY(), 0.0, 0.0);
		shift = event.isShiftKeyDown();
		rectangle = new Rectangle("selectionRectangle");
		rectangle.setStyle(rectangleStyle);
		rectangle.setBounds(bounds);
		mapWidget.render(rectangle, RenderGroup.SCREEN, RenderStatus.UPDATE);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:27,代码来源:AbstractRectangleController.java

示例6: updateRectangle

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void updateRectangle(HumanInputEvent<?> event) {
	Coordinate pos = getLocation(event, RenderSpace.SCREEN);
	double x = begin.getX();
	double y = begin.getY();
	double width = pos.getX() - x;
	double height = pos.getY() - y;
	if (width < 0) {
		x = pos.getX();
		width = -width;
	}
	if (height < 0) {
		y = pos.getY();
		height = -height;
	}
	bounds.setX(x);
	bounds.setY(y);
	bounds.setWidth(width);
	bounds.setHeight(height);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:20,代码来源:AbstractRectangleController.java

示例7: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onDown(HumanInputEvent<?> event) {
	SliderArea sliderArea = zoomSlider.getSliderArea();
	event.stopPropagation();
	double y = getLocation(event, RenderSpace.SCREEN).getY();
	double x = getLocation(event, RenderSpace.SCREEN).getX();
	Bbox sliderAreaBounds = sliderArea.getAddonBounds();
	Coordinate origin = sliderAreaBounds.getOrigin();
	Coordinate endPoint = sliderAreaBounds.getEndPoint();
	if (origin.getX() < x && endPoint.getX() > x &&
		origin.getY() < y && endPoint.getY() > y) {
		dragging = true;
		sliderArea.drawMapRectangle();
	}
	event.preventDefault();
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:17,代码来源:ZoomSliderController.java

示例8: onDraggerMouseUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void onDraggerMouseUp(HumanInputEvent event, double relativeY)
{
	if( m_isMouseDown )
	{
		Event.releaseCapture(Magnifier.this.m_dragger.getElement());
		event.preventDefault();
		
		//--- DRK > Pretty hacky, but I can't figure out how to "forward" the event up the DOM so tooltip can get it.
		if( event instanceof MouseUpEvent )
		{
			m_viewContext.toolTipMngr.onMouseUp((MouseUpEvent)event);
		}
		
		double mouseY = relativeY;
		Magnifier.this.setDraggerPositionFromMouse(mouseY + m_mouseDownOffset);
		
		m_isMouseDown = false;
	}
}
 
开发者ID:dougkoellmer,项目名称:swarm,代码行数:20,代码来源:Magnifier.java

示例9: onUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
public void onUp(HumanInputEvent<?> event) {
	// Only insert when service is in the correct state:
	if (service.getEditingState() == GeometryEditState.INSERTING) {
		try {
			if (isDoubleClick(event)) {
				stopInserting();					
			} else {
				// Insert the location at the given index:
				GeometryIndex insertIndex = service.getInsertIndex();
				Coordinate location = getSnappedLocationWithinMaxBounds(event);
				service.insert(Collections.singletonList(insertIndex),
						Collections.singletonList(Collections.singletonList(location)));

				String geometryType = service.getGeometry().getGeometryType();
				if (geometryType.equals(Geometry.POINT) || geometryType.equals(Geometry.MULTI_POINT)) {
					stopInserting();
				}
			}
		} catch (GeometryOperationFailedException e) {
			logger.log(Level.WARNING, "Operation failed", e);
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:24,代码来源:GeometryIndexInsertController.java

示例10: isDoubleClick

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private boolean isDoubleClick(HumanInputEvent<?> event) {
	Coordinate clickPosition = getLocation(event, RenderSpace.SCREEN);
	boolean doubleClicked = false;
	if (lastClickedPosition != null) {
		int distance = (int) Math.hypot(clickPosition.getX() - lastClickedPosition.getX(), clickPosition.getY()
				- lastClickedPosition.getY());
		if (distance < MIN_DOUBLECLICK_DISTANCE) {
			doubleClicked = true;
		} 
	} 
	if (doubleClicked) {
		lastClickedPosition = null;
		return true;
	} else {
		lastClickedPosition = clickPosition;
		return false;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:19,代码来源:GeometryIndexInsertController.java

示例11: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
public void onDown(HumanInputEvent<?> event) {
	if (service.getEditingState() == GeometryEditState.IDLE) {
		if (event.isShiftKeyDown()) {
			// Add to or remove from selection:
			if (service.getIndexStateService().isSelected(index)) {
				service.getIndexStateService().deselect(Collections.singletonList(index));
				event.stopPropagation();
			} else {
				service.getIndexStateService().select(Collections.singletonList(index));
			}
		} else {
			// Deselect all and select only this index:
			service.getIndexStateService().deselectAll();
			service.getIndexStateService().select(Collections.singletonList(index));				
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:18,代码来源:GeometryIndexSelectHandler.java

示例12: onDown

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onDown(HumanInputEvent<?> event) {
	if (!isRightMouseButton(event)) {
		dragging = true;
		begin = getLocation(event, RenderSpace.SCREEN);
		shift = event.isShiftKeyDown();
		
		circle = new Circle((int) begin.getX(), (int) begin.getY(), 0);
		circle.setFillColor(fillColor);
		circle.setFillOpacity(fillOpacity);
		circle.setStrokeColor(strokeColor);
		circle.setStrokeWidth(strokeWidth);
		getContainer().add(circle);
		
		line = new Line((int) begin.getX(), (int) begin.getY(), (int) begin.getX(), (int) begin.getY());
		line.setStrokeColor(strokeColor);
		line.setStrokeWidth(strokeWidth);
		getContainer().add(line);
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:21,代码来源:AbstractCircleController.java

示例13: onUp

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
@Override
public void onUp(HumanInputEvent<?> event) {
	// Assure dragging or clicking started inside this widget
	if (dragging) {
		shift |= event.isShiftKeyDown(); // shift is used when depressed either at beginning or end
		updateCircle(event);
		
		Geometry geometry = new Geometry(Geometry.POINT, 0, -1);
		Coordinate[] coordinates = new Coordinate[]{new Coordinate(circle.getUserX(), circle.getUserY())};
		geometry.setCoordinates(coordinates);

		ViewPort viewPort = mapPresenter.getViewPort();
		execute(viewPort.getTransformationService().transform(geometry, RenderSpace.SCREEN, RenderSpace.WORLD), 
				circle.getRadius() * viewPort.getResolution());

		stopDragging();
		dragging = false;
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:20,代码来源:AbstractCircleController.java

示例14: updateCircle

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void updateCircle(HumanInputEvent<?> event) {
	Coordinate pos = getLocation(event, RenderSpace.SCREEN);
	double x = begin.getX();
	double y = begin.getY();
	double currentX = pos.getX();
	double currentY = pos.getY();
	
	double deltaX = currentX - x;
	double deltaY = currentY - y;
	radius = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
	
	circle.setRadius((int) radius);
	
	line.setUserX2(currentX);
	line.setUserY2(currentY);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:17,代码来源:AbstractCircleController.java

示例15: humanMove

import com.google.gwt.event.dom.client.HumanInputEvent; //导入依赖的package包/类
private void humanMove(HumanInputEvent ev) {
        int x= getAbsoluteX(ev);
        int y= getAbsoluteY(ev);
        if (_moving) {
//            DOM.eventPreventDefault(ev.getNativeEvent());
            ev.preventDefault();
            doMove(x,y);
        }
        else if (_resizing) {
//            DOM.eventPreventDefault(ev);
            ev.preventDefault();
            moveResize(x,y);
        }
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:15,代码来源:PopupPane.java


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