本文整理汇总了Java中com.google.gwt.user.client.Event.getClientX方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getClientX方法的具体用法?Java Event.getClientX怎么用?Java Event.getClientX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.getClientX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
}
示例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();
}
}
}
示例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;
}
示例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();
}
}
}
}
示例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;
}
示例7: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
public void onBrowserEvent(Event event) {
if (iDummy) return;
Element target = DOM.eventGetTarget(event);
boolean anchor = false;
for (; target != null; target = DOM.getParent(target)) {
String tag = target.getPropertyString("tagName");
if ("a".equalsIgnoreCase(tag)) {
anchor = true;
break;
} else if ("div".equalsIgnoreCase(tag)) {
break;
}
}
EventTarget related = event.getRelatedEventTarget();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
select(false);
if (!anchor) {
MeetingClickEvent e = new MeetingClickEvent(Meeting.this);
for (MeetingClickHandler h: iMeetingClickHandlers)
h.onMeetingClick(e);
}
break;
case Event.ONMOUSEOVER:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(true);
}
break;
case Event.ONMOUSEOUT:
if (related == null || !getElement().isOrHasChild((Element)related.cast())) {
select(false);
}
break;
case Event.ONMOUSEMOVE:
int relativeX = event.getClientX() - getElement().getAbsoluteLeft() + getElement().getScrollLeft() + getElement().getOwnerDocument().getScrollLeft();
if (relativeX < iLeft - 6 - getDay() * iCellWidth || relativeX > iLeft - 2 - getDay() * iCellWidth + iWidth) {
select(false);
}
break;
}
super.onBrowserEvent(event);
}
示例8: 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() + ")";
}