@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
if (isNresizable()) {
double newTop = targetScrollTop + dy;
aMovableTarget.getElement().getStyle().setTop(newTop >= 0 ? newTop : 0, Style.Unit.PX);
if (newTop >= 0) {
aResizableTarget.getElement().getStyle().setHeight(targetHeight - dy, Style.Unit.PX);
/*
if (aResizableTarget instanceof RequiresResize) {
((RequiresResize) aResizableTarget).onResize();
}
*/
}
return true;
} else {
return false;
}
}
java类com.google.gwt.event.dom.client.MouseEvent的实例源码
DraggablePanel.java 文件源码
项目:platypus-js
阅读 21
收藏 0
点赞 0
评论 0
DraggablePanel.java 文件源码
项目:platypus-js
阅读 22
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
if (isWresizable()) {
double newLeft = targetScrollLeft + dx;
aMovableTarget.getElement().getStyle().setLeft(newLeft >= 0 ? newLeft : 0, Style.Unit.PX);
if (newLeft >= 0) {
aResizableTarget.getElement().getStyle().setWidth(targetWidth - dx, Style.Unit.PX);
/*
if (aResizableTarget instanceof RequiresResize) {
((RequiresResize) aResizableTarget).onResize();
}
*/
}
return true;
} else {
return false;
}
}
EventFactory.java 文件源码
项目:qafe-platform
阅读 19
收藏 0
点赞 0
评论 0
private static Map<String,String> getMouseInfo(MouseEvent event) {
Map<String,String> mouseInfo = new HashMap<String,String>();
int posX = -1;
int posY = -1;
try {
// In QTree class a SelectionEvent is translated to a ClickEvent,
// so position X and Y are not present (nativeEvent is null, is used to get the clientX and clientY)
posX = event.getClientX();
posY = event.getClientY();
} catch (Exception e) {
// Ignore
}
mouseInfo.put(EventDataI.MOUSE_X, String.valueOf(posX));
mouseInfo.put(EventDataI.MOUSE_Y, String.valueOf(posY));
return mouseInfo;
}
AbstractGraphicsController.java 文件源码
项目:geomajas-project-client-gwt
阅读 27
收藏 0
点赞 0
评论 0
@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());
}
}
PolygonEditController.java 文件源码
项目:geomajas-project-client-gwt
阅读 23
收藏 0
点赞 0
评论 0
protected void createTempLines(FeatureTransaction featureTransaction, MouseEvent<?> event) {
if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0
&& tempLine1 == null) {
Coordinate position = getPanPosition(event);
Geometry geom = getGeometryIndex().getGeometry(featureTransaction);
LineString lineString = geom.getGeometryFactory().createLineString(new Coordinate[] { position, position });
tempLine1 = new GfxGeometry("LineStringEditController.updateLine1");
tempLine1.setGeometry(lineString);
tempLine1.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
mapWidget.render(tempLine1, RenderGroup.VECTOR, RenderStatus.ALL);
tempLine2 = new GfxGeometry("LineStringEditController.updateLine2");
tempLine2.setGeometry(lineString);
tempLine2.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
mapWidget.render(tempLine2, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
PressCancelEvent.java 文件源码
项目:WebConsole
阅读 17
收藏 0
点赞 0
评论 0
public PressCancelEvent(MouseEvent<MouseOutHandler> sourceEvent) {
super(sourceEvent);
clientXPos = sourceEvent.getClientX();
clientYPos = sourceEvent.getClientY();
screenXPos = sourceEvent.getScreenX();
screenYPos = sourceEvent.getScreenY();
}
ComponentRenderer.java 文件源码
项目:componentrenderer
阅读 20
收藏 0
点赞 0
评论 0
private void handleClickEvent(MouseEvent clickEvent) {
Element clickedTarget = Element.as(clickEvent.getNativeEvent().getEventTarget());
if (clickedTarget.getClassName().contains("cr-component-cell") ||
clickedTarget.getClassName().contains("v-layout"))
{
NativeEvent event = cloneClickEvent(clickEvent);
clickedTarget.getParentElement().dispatchEvent(event);
} else {
clickEvent.stopPropagation();
}
}
ComponentRenderer.java 文件源码
项目:componentrenderer
阅读 21
收藏 0
点赞 0
评论 0
private NativeEvent cloneClickEvent(MouseEvent clickEvent) {
return Document.get().createClickEvent(SINGLE_CLICK,
clickEvent.getNativeEvent().getScreenX(),
clickEvent.getNativeEvent().getScreenY(),
clickEvent.getNativeEvent().getClientX(),
clickEvent.getNativeEvent().getClientY(),
clickEvent.getNativeEvent().getCtrlKey(),
clickEvent.getNativeEvent().getAltKey(),
clickEvent.getNativeEvent().getShiftKey(),
clickEvent.getNativeEvent().getMetaKey());
}
PopupPane.java 文件源码
项目:firefly
阅读 24
收藏 0
点赞 0
评论 0
private int getAbsoluteX(HumanInputEvent ev) {
if (ev instanceof MouseEvent) {
return ((MouseEvent)ev).getClientX()+Window.getScrollLeft();
}
if (ev instanceof TouchEvent) {
JsArray<Touch> tAry= ((TouchEvent)ev).getTargetTouches();
return tAry.get(0).getClientX()+Window.getScrollLeft();
}
return 0;
}
PopupPane.java 文件源码
项目:firefly
阅读 25
收藏 0
点赞 0
评论 0
private int getAbsoluteY(HumanInputEvent ev) {
if (ev instanceof MouseEvent) {
return ((MouseEvent)ev).getClientY()+ Window.getScrollTop();
}
if (ev instanceof TouchEvent) {
JsArray<Touch> tAry= ((TouchEvent)ev).getTargetTouches();
return tAry.get(0).getClientY() + Window.getScrollTop();
}
return 0;
}
EventHandlingUtils.java 文件源码
项目:umlet
阅读 26
收藏 0
点赞 0
评论 0
private static Point getPoint(EventHandlingTarget drawPanelCanvas, HumanInputEvent<?> event) {
Element e = drawPanelCanvas.getElement();
if (event instanceof MouseEvent<?>) {
return new Point(((MouseEvent<?>) event).getRelativeX(e), ((MouseEvent<?>) event).getRelativeY(e));
}
else if (event instanceof TouchEndEvent) {
return new Point(((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getChangedTouches().get(0).getRelativeY(e));
}
else if (event instanceof TouchEvent<?>) {
return new Point(((TouchEvent<?>) event).getTouches().get(0).getRelativeX(e), ((TouchEvent<?>) event).getTouches().get(0).getRelativeY(e));
}
else {
throw new RuntimeException("Unknown Event Type: " + event);
}
}
EventHandlingUtils.java 文件源码
项目:umlet
阅读 20
收藏 0
点赞 0
评论 0
private static Point getPointAbsolute(HumanInputEvent<?> event) {
if (event instanceof MouseEvent<?>) {
return new Point(((MouseEvent<?>) event).getClientX(), ((MouseEvent<?>) event).getClientY());
}
else if (event instanceof TouchEndEvent) {
return new Point(((TouchEvent<?>) event).getChangedTouches().get(0).getPageX(), ((TouchEvent<?>) event).getChangedTouches().get(0).getPageY());
}
else if (event instanceof TouchEvent<?>) {
return new Point(((TouchEvent<?>) event).getTouches().get(0).getPageX(), ((TouchEvent<?>) event).getTouches().get(0).getPageY());
}
else {
throw new RuntimeException("Unknown Event Type: " + event);
}
}
GraphWidget.java 文件源码
项目:daris
阅读 27
收藏 0
点赞 0
评论 0
@SuppressWarnings("rawtypes")
private Node findAtomicNodeForMouseEvent(MouseEvent me) {
double x = (((double) me.getX()) / ((double) _gc.width()));
double y = (((double) me.getY()) / ((double) _gc.height()));
return _graph.findAtomicNodeAt(new Point(x, y));
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 17
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
if (isSresizable()) {
aResizableTarget.getElement().getStyle().setHeight(targetHeight + dy, Style.Unit.PX);
/*
if (aResizableTarget instanceof RequiresResize) {
((RequiresResize) aResizableTarget).onResize();
}
*/
return true;
} else {
return false;
}
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
if (isEresizable()) {
aResizableTarget.getElement().getStyle().setWidth(targetWidth + dx, Style.Unit.PX);
/*
if (aResizableTarget instanceof RequiresResize) {
((RequiresResize) aResizableTarget).onResize();
}
*/
return true;
} else {
return false;
}
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
n.assignMouseState(nw);
n.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
w.assignMouseState(nw);
w.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
return true;
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
n.assignMouseState(ne);
n.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
e.assignMouseState(ne);
e.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
return true;
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 18
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
s.assignMouseState(sw);
s.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
w.assignMouseState(sw);
w.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
return true;
}
DraggablePanel.java 文件源码
项目:platypus-js
阅读 22
收藏 0
点赞 0
评论 0
@Override
protected boolean changeTarget(Widget aMovableTarget, Widget aResizableTarget, int dx, int dy, MouseEvent<?> aEvent) {
s.assignMouseState(se);
s.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
e.assignMouseState(se);
e.changeTarget(aMovableTarget, aResizableTarget, dx, dy, aEvent);
return true;
}
HTMLTable.java 文件源码
项目:gwt-gantt
阅读 35
收藏 0
点赞 0
评论 0
/**
* Given a click event, return the Cell that was clicked, or null if the event
* did not hit this table. The cell can also be null if the click event does
* not occur on a specific cell.
*
* @param event A click event of indeterminate origin
* @return The appropriate cell, or null
*/
public Cell getCellForEvent(MouseEvent<? extends EventHandler> event) {
Element td = getEventTargetCell(Event.as(event.getNativeEvent()));
if (td == null) {
return null;
}
int row = TableRowElement.as(td.getParentElement()).getSectionRowIndex();
int column = TableCellElement.as(td).getCellIndex();
return new Cell(row, column);
}
LineStringDrawController.java 文件源码
项目:geomajas-project-client-gwt
阅读 25
收藏 0
点赞 0
评论 0
protected void updateTempLineAfterMove(MouseEvent<?> event) {
if (tempLine == null) {
updateTempLineAfterClick();
}
if (currentLineStringCoordinates != null && currentLineStringCoordinates.length > 0) {
Coordinate[] newCoords = new Coordinate[currentLineStringCoordinates.length + 1];
System.arraycopy(currentLineStringCoordinates, 0, newCoords, 0, currentLineStringCoordinates.length);
newCoords[currentLineStringCoordinates.length] = getPanPosition(event);
LineString lineString = geometry.getGeometryFactory().createLineString(newCoords);
tempLine.setGeometry(lineString);
mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.UPDATE);
}
}
PolygonDrawController.java 文件源码
项目:geomajas-project-client-gwt
阅读 21
收藏 0
点赞 0
评论 0
@Override
protected void updateTempLineAfterMove(MouseEvent<?> event) {
if (tempPolygon == null) {
updateTempLineAfterClick();
}
Polygon polygon = (Polygon) geometry;
if (polygon != null && polygon.getCoordinates() != null && polygon.getCoordinates().length > 0) {
LinearRing ring = geometry.getGeometryFactory().createLinearRing(polygon.getCoordinates());
if (ring != null && geometry.getCoordinates().length > 0) {
Coordinate[] coordinates = ring.getCoordinates();
Coordinate firstCoordinate = coordinates[0];
Coordinate lastCoordinate = coordinates[coordinates.length - 2];
LineString lineStringPan = geometry.getGeometryFactory().createLineString(new Coordinate[] {
getTransformer().worldToPan(lastCoordinate),
getPanPosition(event),
getTransformer().worldToPan(firstCoordinate) });
tempLine.setGeometry(lineStringPan);
mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
}
AbstractCircleController.java 文件源码
项目:geomajas-project-client-gwt
阅读 23
收藏 0
点赞 0
评论 0
private void updateGraphics(MouseEvent<?> event) {
Coordinate position = getScreenPosition(event);
double deltaX = position.getX() - getScreenCenter().getX();
double deltaY = position.getY() - getScreenCenter().getY();
radius = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
LineString radiusLine = mapWidget.getMapModel().getGeometryFactory().createLineString(
new Coordinate[] { center, position });
mapWidget.getVectorContext().drawCircle(circleGroup, "outer", center, radius, circleStyle);
mapWidget.getVectorContext().drawLine(circleGroup, "radius", radiusLine, circleStyle);
}
MeasureDistanceController.java 文件源码
项目:geomajas-project-client-gwt
阅读 18
收藏 0
点赞 0
评论 0
protected void updateMeasure(MouseEvent event, boolean complete) {
Geometry lastClickedLineGeometry = (Geometry) distanceLine.getOriginalLocation();
Coordinate lastClickedCoordinate = lastClickedLineGeometry.getCoordinates()[distanceLine.getGeometry()
.getNumPoints() - 1];
Coordinate mouseCoordinate = getWorldPosition(event);
lineSegment.setGeometry(getFactory().createLineString(
new Coordinate[] { lastClickedCoordinate, mouseCoordinate }));
mapWidget.render(mapWidget.getMapModel(), RenderGroup.VECTOR, RenderStatus.UPDATE);
}
AbstractSnappingController.java 文件源码
项目:geomajas-project-client-gwt
阅读 22
收藏 0
点赞 0
评论 0
/**
* Return the screen position of the mouse event, unless snapping is activated. If that is the case, a snapped
* point will be returned (still in screen space).
*/
protected Coordinate getScreenPosition(MouseEvent<?> event) {
if (snappingActive) {
return getTransformer().worldToView(getWorldPosition(event));
}
return super.getScreenPosition(event);
}
AbstractSnappingController.java 文件源码
项目:geomajas-project-client-gwt
阅读 21
收藏 0
点赞 0
评论 0
/**
* Return the screen position of the mouse event, unless snapping is activated. If that is the case, a snapped
* point will be returned (still in pan space).
*/
protected Coordinate getPanPosition(MouseEvent<?> event) {
if (snappingActive) {
return getTransformer().worldToPan(getWorldPosition(event));
}
return super.getPanPosition(event);
}
AbstractSnappingController.java 文件源码
项目:geomajas-project-client-gwt
阅读 25
收藏 0
点赞 0
评论 0
/**
* Return the world position of the mouse event, unless snapping is activated. If that is the case, a snapped point
* will be returned (still in world space).
*/
protected Coordinate getWorldPosition(MouseEvent<?> event) {
Coordinate world = super.getWorldPosition(event);
if (snappingActive) {
return snapper.snap(world);
}
return world;
}
LineStringEditController.java 文件源码
项目:geomajas-project-client-gwt
阅读 21
收藏 0
点赞 0
评论 0
private void createTempLine(FeatureTransaction featureTransaction, MouseEvent<?> event) {
if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0
&& tempLine == null) {
Coordinate position = getPanPosition(event);
LineString lineString = getGeometryIndex().getGeometry(featureTransaction).getGeometryFactory()
.createLineString(new Coordinate[] { position, position });
tempLine = new GfxGeometry("LineStringEditController.updateLine");
tempLine.setGeometry(lineString);
tempLine.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
LineStringEditController.java 文件源码
项目:geomajas-project-client-gwt
阅读 25
收藏 0
点赞 0
评论 0
private void updateTempLine(FeatureTransaction featureTransaction, MouseEvent<?> event) {
if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0) {
if (tempLine == null) {
createTempLine(featureTransaction, event);
}
Coordinate[] coordinates = getGeometryIndex().getGeometry(featureTransaction).getCoordinates();
if (coordinates != null && coordinates.length > 0) {
Coordinate lastCoordinate = getTransformer().worldToPan(coordinates[coordinates.length - 1]);
LineString lineString = featureTransaction.getNewFeatures()[0].getGeometry().getGeometryFactory()
.createLineString(new Coordinate[] { lastCoordinate, getPanPosition(event) });
tempLine.setGeometry(lineString);
mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
}
PolygonEditController.java 文件源码
项目:geomajas-project-client-gwt
阅读 19
收藏 0
点赞 0
评论 0
protected void updateTempLines(FeatureTransaction featureTransaction, MouseEvent<?> event) {
if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0) {
if (tempLine1 == null) {
createTempLines(featureTransaction, event);
}
Polygon polygon = (Polygon) getGeometryIndex().getGeometry(featureTransaction);
LinearRing ring = getGeometryIndex().getLinearRing(polygon);
if (ring != null) {
Coordinate[] coordinates = ring.getCoordinates();
if (coordinates != null && coordinates.length > 0) {
Coordinate lastCoordinate = coordinates[coordinates.length - 2];
LineString lineString1 = featureTransaction.getNewFeatures()[index.getFeatureIndex()].getGeometry()
.getGeometryFactory().createLineString(
new Coordinate[] {getTransformer().worldToPan(lastCoordinate),
getPanPosition(event)});
tempLine1.setGeometry(lineString1);
mapWidget.render(tempLine1, RenderGroup.VECTOR, RenderStatus.ALL);
LineString lineString2 = featureTransaction.getNewFeatures()[index.getFeatureIndex()].getGeometry()
.getGeometryFactory().createLineString(
new Coordinate[] {getTransformer().worldToPan(coordinates[0]),
getPanPosition(event)});
tempLine2.setGeometry(lineString2);
mapWidget.render(tempLine2, RenderGroup.VECTOR, RenderStatus.ALL);
}
}
}
}