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


Java Event.getClientY方法代码示例

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


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

示例1: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
	int x = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft();
	int y = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop();
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEMOVE:
		if (iHint.isShowing()) {
			iHint.setPopupPosition(x, y);
		} else {
			iShowHint.cancel();
			iHint.setPopupPosition(x, y);
			iShowHint.schedule(1000);
		}
		break;
	case Event.ONMOUSEOUT:
		iShowHint.cancel();
		if (iHint.isShowing())
			iHideHint.schedule(1000);
		break;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:HorizontalPanelWithHint.java

示例2: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
	if (iHint.getText().isEmpty()) return;
	iX = 10 + event.getClientX() + getElement().getOwnerDocument().getScrollLeft();
	iY = 10 + event.getClientY() + getElement().getOwnerDocument().getScrollTop();
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEMOVE:
		if (iInfoPanel.isShowing()) {
			int maxX = Window.getScrollLeft() + Window.getClientWidth() - iInfoPanel.getOffsetWidth() - 10;
			iInfoPanel.setPopupPosition(Math.min(iX, maxX), iY);
		} else if (iInfo.getRowCount() > 0) {
			iShowInfo.cancel();
			iShowInfo.schedule(1000);
		}
		break;
	case Event.ONMOUSEOUT:
		iShowInfo.cancel();
		if (iInfoPanel.isShowing())
			iHideInfo.schedule(1000);
		break;
	}
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:23,代码来源:InfoPanelImpl.java

示例3: showContextMenu

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void showContextMenu(Event event) {
    if (!readonly && !disabled) {
        if (!isSelected()) {
            getConnector().setContextMenuSelection(true);

            toggleSelection();
        }
        if (customContextMenu == null) {
            super.showContextMenu(event);
        } else {
            int left = event.getClientX();
            int top = event.getClientY();
            top += Window.getScrollTop();
            left += Window.getScrollLeft();

            showContextMenuPopup(left, top);

            event.stopPropagation();
            event.preventDefault();
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:CubaTreeWidget.java

示例4: cursorInsideBrowserContentArea

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
private boolean cursorInsideBrowserContentArea(Event event) {
    if (event.getClientX() < 0 || event.getClientY() < 0) {
        // Outside to the left or above
        return false;
    }

    if (event.getClientX() > Window.getClientWidth()
            || event.getClientY() > Window.getClientHeight()) {
        // Outside to the right or below
        return false;
    }

    return true;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:CubaFileUploadProgressWindow.java

示例5: handleResize

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
protected void handleResize(Event event) {
    //calculate and set the new size
    if (dragDrop) {
        int mouseX = event.getClientX();
        int mouseY = event.getClientY();
        int absoluteLeft = getAbsoluteLeft();
        int absoluteTop = getAbsoluteTop();

        ComputedStyle cs = new ComputedStyle(getElement().getFirstChildElement());

        //do not allow mirror-functionality
        if (mouseY > absoluteTop + cs.getDoubleProperty("min-height") && mouseX > absoluteLeft + MINIMAL_WIDTH) {
            int width = mouseX - absoluteLeft + 2;
            int height = mouseY - absoluteTop + 2;

            switch (resizableDirection) {
                case BOTH:
                    setHeight(height + "px");
                    setWidth(width + "px");
                    break;
                case VERTICAL:
                    setHeight(height + "px");
                    break;
                case HORIZONTAL:
                    setWidth(width + "px");
                    break;
            }

            if (resizeHandler != null) {
                resizeHandler.handleResize();
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:CubaResizableTextAreaWrapperWidget.java

示例6: OffsetPosition

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
 * Create a offset position base on the event's client X, Y. The return offset
 * position is relative to the Document body coordinate.
 *
 * @param event
 */
public OffsetPosition(Event event) {
  // convert the event's client coordinate system, which is client area base, to the
  // body position coordinate system.

  this.left = event.getClientX() + Window.getScrollLeft() - Document.get().getBodyOffsetLeft();
  this.top = event.getClientY() + Window.getScrollTop() - Document.get().getBodyOffsetTop();

  this.offsetParent = null;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:16,代码来源:OffsetPosition.java

示例7: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
	if (Event.ONMOUSEMOVE == DOM.eventGetType(event) && !iSelection.isActive() && iMoving != null) {
		iMoving.onBrowserEvent(event);
		if (iMoving.iCursor != null)
			getElement().getStyle().setCursor(iMoving.iCursor);
		return;
	}

	double x = event.getClientX() - getAbsoluteLeft() + Window.getScrollLeft();
	double y = event.getClientY() - getAbsoluteTop() + Window.getScrollTop();

	int slot = 3 * Math.min(Math.max(0, (int)Math.round(4 * (y - 1 + iStart * iCellHeight) / iCellHeight)), 96);
	int day = Math.min(Math.max(0, (int)Math.floor((x - 2) / iCellWidth)), iDays.length - 1);
	int dayOfWeek = iDays[day];
	int weeks = (isSingleRoom() ? iSelectedWeeks.size() : iRoomResources.size());
	int week = Math.min(Math.max(0, (int)Math.floor(weeks * (x - 2 - iCellWidth * day) / (iCellWidth - 6))), weeks - 1);
	int h = slot / 12;
	int m = 5 * (slot % 12);
	String time = (CONSTANTS.useAmPm() ? (h == 0 ? "12": h <= 12 ? h : h-12) : h) + ":" + (m < 10 ? "0" : "") + m + (CONSTANTS.useAmPm() ? (h <= 11 ? "a" : "p") : "");
	
	String text = (iDayOfWeeks == null ? CONSTANTS.longDays()[dayOfWeek] : iDayOfWeeks.get(dayOfWeek)) + " " + (isSingleRoom() ? iSelectedWeeks.get(week) : iSelectedWeeks.get(0)).getDayNames().get(dayOfWeek) +
			" " + time + (isSingleRoom() ? "" : " " + iRoomResources.get(week).getName());
	ResourceInterface room = (isSingleRoom() ? iRoomResources.get(0) : iRoomResources.get(week));
	iPopup.setPopupPosition(event.getClientX() + Window.getScrollLeft(), event.getClientY() + Window.getScrollTop());
	
	getElement().getStyle().setCursor(Cursor.CROSSHAIR);
	
	switch (DOM.eventGetType(event)) {
	case Event.ONMOUSEDOWN:
		iSelection.setStart(dayOfWeek, slot, week);
		iSelection.setEnd(dayOfWeek, slot, week);
		iSelection.setVisible(true);
		iSelection.setActive(true);
		break;
	case Event.ONMOUSEMOVE:
		iSelection.setEnd(dayOfWeek, slot, week);
		if (!iPopup.isShowing()) iPopup.show();
		if (!room.getId().equals(iLastRoomId)) {
			RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false);
			iLastRoomId = room.getId();
		}
		break;
	case Event.ONMOUSEUP:
		onMouseUp();
		break;
	case Event.ONMOUSEOVER:
		if (!iPopup.isShowing() && (iSelection.isActive() || iMoving == null)) iPopup.show();
		if (iSelection.isActive() && !iSelection.isVisible()) {
			iSelection.setVisible(true);					
		}
		if (!room.getId().equals(iLastRoomId)) {
			RoomHint.showHint(iPopup.getElement(), room.getId(), "", (room.hasDistance() ? String.valueOf(Math.round(room.getDistance())) : ""), false);
			iLastRoomId = room.getId();
		}
		break;
	case Event.ONMOUSEOUT:
		Element child = DOM.eventGetToElement(event);
		if (child != null && !getElement().isOrHasChild(child)) {
			if (iPopup.isShowing()) {
				iPopup.hide();
				RoomHint.hideHint(); iLastRoomId = null;
			}
			iSelection.setVisible(false);
		}
		/*
		if (iSelection.isActive() && !DOM.isOrHasChild(TimeGrid.this.getElement(), DOM.eventGetToElement(event))) {
			iSelection.setActive(false);
		}
		*/
		break;
	}
	
	iHint.setText((iSelection.isVisible() && iSelection.isActive() ? iSelection.toString() : text));
	
	event.preventDefault();
	event.stopPropagation();
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:79,代码来源:TimeGrid.java

示例8: onBrowserEvent

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {

	// When de button mouse is released
	if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
		// When de button mouse is released
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);

		// remove dragable item
		Main.get().draggable.clear();

		switch (DOM.eventGetButton(event)) {
			case Event.BUTTON_RIGHT:
				DOM.eventPreventDefault(event); // Prevent to fire event to browser
				flagPopup = true;
				mouseDownX = 0;
				mouseDownY = 0;
				dragged = false;
				Main.get().activeFolderTree.menuPopup.disableAllOptions();
				fireSelection(elementClicked(DOM.eventGetTarget(event)));
				break;
			default:
				flagPopup = false;
				// dragging is enable only if cursor is inside actual item
				dragged = isCursorInsideActualItem(elementClicked(DOM.eventGetTarget(event)));
				mouseDownX = event.getScreenX();
				mouseDownY = event.getClientY();
		}
	} else if (DOM.eventGetType(event) == Event.ONMOUSEMOVE) {
		mouseX = DOM.eventGetClientX(event);
		mouseY = DOM.eventGetClientY(event);
		if (Main.get().activeFolderTree.canDrag() && dragged && mouseDownX > 0 && mouseDownY > 0
				&& evalDragPixelSensibility()) {
			TreeItem actualItem = Main.get().activeFolderTree.getActualItem();
			Main.get().draggable.show(actualItem.getHTML(), OriginPanel.TREE_ROOT);
			Main.get().activeFolderTree.fileBrowserRefreshDone();
			mouseDownX = 0;
			mouseDownY = 0;
			dragged = false;
		}
	} else if (DOM.eventGetType(event) == Event.ONMOUSEUP || DOM.eventGetType(event) == Event.ONCLICK
			|| DOM.eventGetType(event) == Event.ONDBLCLICK) {
		mouseDownX = 0;
		mouseDownY = 0;
		dragged = false; // Always disabling the popup flag
	}

	// Prevent folder creation or renaming propagate actions to other tree nodes
	int action = Main.get().activeFolderTree.getFolderAction();

	if (action != FolderTree.ACTION_CREATE && action != FolderTree.ACTION_RENAME) {
		super.onBrowserEvent(event);
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:56,代码来源:ExtendedTree.java

示例9: mousePoint

import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
 * @return A string describing the client x,y position,
 *        e.g., " (100, 100)"
 */
private static String mousePoint(Event event) {
  return " (" + event.getClientX() + ", " + event.getClientY() + ")";
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:8,代码来源:EventWrapper.java


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