本文整理匯總了Java中com.google.gwt.user.client.Event.releaseCapture方法的典型用法代碼示例。如果您正苦於以下問題:Java Event.releaseCapture方法的具體用法?Java Event.releaseCapture怎麽用?Java Event.releaseCapture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.releaseCapture方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onMouseUp
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onMouseUp(MouseUpEvent event) {
if (mouseMoveCanceled
|| event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
return;
}
Event.releaseCapture(getElement());
setFocus(false);
if (moveRegistration != null) {
moveRegistration.removeHandler();
moveRegistration = null;
}
int endX = event.getClientX();
int endY = event.getClientY();
int xDiff = 0, yDiff = 0;
if (startX != -1 && startY != -1) {
// Drag started
xDiff = startX - endX;
yDiff = startY - endY;
}
startX = -1;
startY = -1;
mouseMoveStarted = false;
Style s = getElement().getStyle();
s.setZIndex(1);
if (!clickTargetsResize()) {
// check if mouse has moved over threshold of 3 pixels
boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);
if (!weekGrid.getCalendar().isDisabled() && mouseMoved) {
// Item Move:
// - calendar must be enabled
// - calendar must not be in read-only mode
weekGrid.itemMoved(this);
} else if (!weekGrid.getCalendar().isDisabled() && getCalendarItem().isClickable()) {
// Item Click:
// - calendar must be enabled (read-only is allowed)
EventTarget et = event.getNativeEvent().getEventTarget();
Element e = Element.as(et);
if (e == caption || e == eventContent
|| e.getParentElement() == caption) {
if (weekGrid.getCalendar().getItemClickListener() != null) {
weekGrid.getCalendar().getItemClickListener().itemClick(calendarItem);
}
}
}
} else {
// click targeted resize bar
removeGlobalResizeStyle();
if (weekGrid.getCalendar().getItemResizeListener() != null) {
weekGrid.getCalendar().getItemResizeListener().itemResized(calendarItem);
}
dateCell.recalculateItemWidths();
}
}
示例2: onMouseUp
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
public void onMouseUp(MouseUpEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
return;
}
if (moveRegistration != null) {
Event.releaseCapture(getElement());
moveRegistration.removeHandler();
moveRegistration = null;
keyDownHandler.removeHandler();
keyDownHandler = null;
}
Widget w = (Widget) event.getSource();
if (w == bottomspacer && monthEventMouseDown) {
GWT.log("Mouse up over bottomspacer");
} else if (clickedWidget instanceof MonthItemLabel && monthEventMouseDown) {
MonthItemLabel mel = (MonthItemLabel) clickedWidget;
int endX = event.getClientX();
int endY = event.getClientY();
int xDiff = 0, yDiff = 0;
if (startX != -1 && startY != -1) {
xDiff = startX - endX;
yDiff = startY - endY;
}
startX = -1;
startY = -1;
prevDayDiff = 0;
prevWeekDiff = 0;
if (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3) {
itemMoved(movingItem);
} else if (calendar.getItemClickListener() != null) {
CalendarItem e = getItemByWidget(mel);
if(e.isClickable())
calendar.getItemClickListener().itemClick(e);
}
movingItem = null;
} else if (w == this) {
getMonthGrid().setSelectionReady();
} else if (w instanceof Label && labelMouseDown) {
if (calendar.getDateClickListener() != null) {
calendar.getDateClickListener().dateClick(DateConstants.toRPCDate(date));
}
}
monthEventMouseDown = false;
labelMouseDown = false;
clickedWidget = null;
}
示例3: cancelItemDrag
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
protected void cancelItemDrag(MonthItemLabel label) {
if (moveRegistration != null) {
// reset position
if (movingItem == null) {
movingItem = getItemByWidget(label);
}
movingItem.setStart(dndSourceDateFrom);
movingItem.setEnd(dndSourceDateTo);
movingItem.setStartTime(dndSourceStartDateTime);
movingItem.setEndTime(dndSourceEndDateTime);
calendar.updateItemToMonthGrid(movingItem);
// reset drag-related properties
Event.releaseCapture(getElement());
moveRegistration.removeHandler();
moveRegistration = null;
keyDownHandler.removeHandler();
keyDownHandler = null;
setFocus(false);
monthEventMouseDown = false;
startY = -1;
startX = -1;
movingItem = null;
labelMouseDown = false;
clickedWidget = null;
}
}
示例4: cancelMouseMove
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
private void cancelMouseMove() {
mouseMoveCanceled = true;
// reset and remove everything related to the event handling
Event.releaseCapture(getElement());
setFocus(false);
if (moveRegistration != null) {
moveRegistration.removeHandler();
moveRegistration = null;
}
mouseMoveStarted = false;
removeGlobalResizeStyle();
Style s = getElement().getStyle();
s.setZIndex(1);
// reset the position of the event
int dateCellWidth = getDateCellWidth();
int dayOffset = startXrelative / dateCellWidth;
s.clearLeft();
calendarItem.setStartTime(startDatetimeFrom);
calendarItem.setEndTime(startDatetimeTo);
long startFromMinutes = (startDatetimeFrom.getHours() * 60)
+ startDatetimeFrom.getMinutes();
long range = calendarItem.getRangeInMinutes();
startFromMinutes = calculateStartFromMinute(startFromMinutes,
startDatetimeFrom, startDatetimeTo, dayOffset);
if (startFromMinutes < 0) {
range += startFromMinutes;
}
updatePosition(startFromMinutes, range);
startY = -1;
startX = -1;
// to reset the event width
((DateCell) getParent()).recalculateItemWidths();
}
示例5: onMouseUp
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
@Override
@SuppressWarnings("deprecation")
public void onMouseUp(MouseUpEvent event) {
if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
return;
}
Event.releaseCapture(getElement());
setFocus(false);
// Drag initialized?
int dragDistance = Math.abs(eventRangeStart - event.getY());
if (dragDistance > 0 && eventRangeStart >= 0) {
Element main = getElement();
if (eventRangeStart > eventRangeStop) {
if (eventRangeStop <= -1) {
eventRangeStop = 0;
}
int temp = eventRangeStart;
eventRangeStart = eventRangeStop;
eventRangeStop = temp;
}
NodeList<Node> nodes = main.getChildNodes();
int slotStart = -1;
int slotEnd = -1;
// iterate over all child nodes, until we find first the start,
// and then the end
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.getItem(i);
boolean isRangeElement = element.getClassName().contains("v-daterange");
if (isRangeElement && slotStart == -1) {
slotStart = i;
slotEnd = i; // to catch one-slot selections
} else if (isRangeElement) {
slotEnd = i;
} else if (slotStart != -1 && slotEnd != -1) {
break; // FIXME ! is 'else if' right
}
}
clearSelectionRange();
int startMinutes = firstHour * 60 + slotStart * 30;
int endMinutes = (firstHour * 60) + (slotEnd + 1) * 30;
Date currentDate = getDate();
if (weekgrid.getCalendar().getRangeSelectListener() != null) {
SelectionRange weekSelection = new SelectionRange();
weekSelection.sMin = startMinutes;
weekSelection.eMin = endMinutes;
weekSelection.setStartDay(DateConstants.toRPCDate(
currentDate.getYear(),
currentDate.getMonth(),
currentDate.getDate()));
weekgrid.getCalendar().getRangeSelectListener().rangeSelected(weekSelection);
}
eventRangeStart = -1;
} else {
// Click event
eventRangeStart = -1;
cancelRangeSelect();
}
}
示例6: cancelRangeSelect
import com.google.gwt.user.client.Event; //導入方法依賴的package包/類
public void cancelRangeSelect() {
Event.releaseCapture(getElement());
setFocus(false);
clearSelectionRange();
}