本文整理汇总了Java中com.google.gwt.user.client.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于com.google.gwt.user.client包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HorizontalPanelWithHint
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public HorizontalPanelWithHint(Widget hint) {
super();
iHint = new PopupPanel();
iHint.setWidget(hint);
iHint.setStyleName("unitime-PopupHint");
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONMOUSEMOVE);
iShowHint = new Timer() {
@Override
public void run() {
iHint.show();
}
};
iHideHint = new Timer() {
@Override
public void run() {
iHint.hide();
}
};
}
示例2: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
@Override
public void onBrowserEvent(com.google.gwt.user.client.Event event) {
switch (event.getTypeInt()) {
case Event.ONMOUSEDOWN:
case Event.ONTOUCHSTART:
// rezerwujemy touch dla siebie nic innego nie powinno obslugiwac tego zdarzenia np TouchPageSwitch
eventsBus.fireEvent(new PlayerEvent(PlayerEventTypes.TOUCH_EVENT_RESERVATION));
pressed = true;
setPosition(event);
break;
case Event.ONTOUCHEND:
case Event.ONMOUSEUP:
pressed = false;
setPosition(event);
break;
case Event.ONTOUCHMOVE:
case Event.ONMOUSEMOVE:
setPosition(event);
default:
break;
}
super.onBrowserEvent(event);
}
示例3: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
event.preventDefault();
int eventType = event.getTypeInt();
switch (eventType) {
case ONMOUSEDOWN:
case ONTOUCHSTART:
onClick();
break;
case ONMOUSEUP:
if (!singleClick) {
onClick();
}
break;
case ONMOUSEOVER:
onMouseOver();
break;
case ONTOUCHEND:
case ONMOUSEOUT:
onMouseOut();
break;
}
}
示例4: replaceInputElement
import com.google.gwt.user.client.Event; //导入依赖的package包/类
/**
* Replace the current input element with a new one. Preserves all state except for the name property, for nasty reasons related to radio button grouping.
* (See implementation of {@link RadioButton#setName}.)
*
* @param elem the new input element
*/
protected void replaceInputElement(Element elem) {
InputElement newInputElem = InputElement.as(elem);
// Collect information we need to set
int tabIndex = getTabIndex();
boolean checked = getValue();
boolean enabled = isEnabled();
String formValue = getFormValue();
String uid = inputElem.getId();
String accessKey = inputElem.getAccessKey();
int sunkEvents = Event.getEventsSunk(inputElem);
// Clear out the old input element
setEventListener(asOld(inputElem), null);
getElement().replaceChild(newInputElem, inputElem);
// Sink events on the new element
Event.sinkEvents(elem, Event.getEventsSunk(inputElem));
Event.sinkEvents(inputElem, 0);
inputElem = newInputElem;
// Setup the new element
Event.sinkEvents(inputElem, sunkEvents);
inputElem.setId(uid);
if (!"".equals(accessKey)) {
inputElem.setAccessKey(accessKey);
}
setTabIndex(tabIndex);
setValue(checked);
setEnabled(enabled);
setFormValue(formValue);
// Set the event listener
if (isAttached()) {
setEventListener(asOld(inputElem), this);
}
}
示例5: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public void onBrowserEvent(final Event event) {
Element td = getEventTargetCell(event);
if (td==null) return;
final Element tr = DOM.getParent(td);
int col = DOM.getChildIndex(tr, td);
Element body = DOM.getParent(tr);
int row = DOM.getChildIndex(body, tr);
Widget widget = getWidget(row, col);
if (widget != null && widget instanceof UniTimeHeaderPanel) {
super.onBrowserEvent(event);
return;
}
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
getRowFormatter().addStyleName(row, "hover");
break;
case Event.ONMOUSEOUT:
getRowFormatter().removeStyleName(row, "hover");
break;
}
super.onBrowserEvent(event);
}
示例6: MyFlexTable
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public MyFlexTable() {
super();
setCellPadding(2);
setCellSpacing(0);
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONCLICK);
sinkEvents(Event.ONKEYDOWN);
setStylePrimaryName("unitime-MainTable");
iTimer = new Timer() {
@Override
public void run() {
saveOrder();
}
};
}
示例7: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (!isEnabled()) return;
super.onBrowserEvent(event);
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
int type = DOM.eventGetType(event);
char keyCode = (char) event.getKeyCode();
switch (type) {
case Event.ONKEYDOWN:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
if (iDown != null) setResource(iDown);
}
break;
case Event.ONKEYUP:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
setResource(iUp);
onClick();
}
break;
}
}
}
示例8: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public void onBrowserEvent(Event event) {
EventTarget related = event.getRelatedEventTarget();
switch (DOM.eventGetType(event)) {
case Event.ONCLICK:
if (getCell().hasId() && getCell().getType() == TimetableGridCell.Type.Class) {
UniTimeFrameDialog.openDialog(MESSAGES.dialogSuggestions(), "suggestions.do?id=" + getCell().getId() + "&op=Reset","900","90%");
select(false);
}
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;
}
super.onBrowserEvent(event);
}
示例9: UniTimeTable
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public UniTimeTable() {
setCellPadding(2);
setCellSpacing(0);
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
sinkEvents(Event.ONCLICK);
sinkEvents(Event.ONKEYDOWN);
sinkEvents(Event.ONDBLCLICK);
setStylePrimaryName("unitime-MainTable");
iHintPanel = new PopupPanel();
iHintPanel.setStyleName("unitime-PopupHint");
Roles.getGridRole().set(getElement());
}
示例10: 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;
}
}
示例11: SelectionLayer
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public SelectionLayer() {
setStyleName("selection-layer");
iPopup = new PopupPanel();
iPopup.setStyleName("unitime-TimeGridSelectionPopup");
iHint = new P("content");
iPopup.setWidget(iHint);
iSelection = new SelectionPanel();
iSelection.setVisible(false);
add(iSelection, 0, 0);
sinkEvents(Event.ONMOUSEDOWN);
sinkEvents(Event.ONMOUSEUP);
sinkEvents(Event.ONMOUSEMOVE);
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
}
示例12: SelectionPanel
import com.google.gwt.user.client.Event; //导入依赖的package包/类
public SelectionPanel(boolean fixed) {
setStyleName(fixed ? "selection" : "active-selection");
if (fixed) {
iRemove = new P("x"); iRemove.setHTML("×");
iRemove.addMouseDownHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
iSelections.remove(SelectionPanel.this);
if (iSelection != null)
iAllSelections.remove(iSelection);
}
});
iRemove.getElement().getStyle().setRight(2, Unit.PX);
iRemove.getElement().getStyle().setTop(2, Unit.PX);
iRemove.getElement().getStyle().setPosition(Position.ABSOLUTE);
add(iRemove);
iText = new P("text");
add(iText, 0, 0);
}
sinkEvents(Event.ONMOUSEDOWN);
sinkEvents(Event.ONMOUSEUP);
sinkEvents(Event.ONMOUSEMOVE);
}
示例13: onBrowserEvent
import com.google.gwt.user.client.Event; //导入依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN:
SelectionMode mode = null;
for (SelectionMode m: SelectionMode.values())
if (hasUnselectedDays(m)) {
mode = m; break;
}
if (mode != null)
setAllSelected(true, mode);
else
setAllSelected(false, SelectionMode.All);
if (iCursor != null) iPanel.getWidget().setCursor(iCursor);
event.preventDefault();
break;
}
super.onBrowserEvent(event);
}
示例14: 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;
}
}
示例15: Icon
import com.google.gwt.user.client.Event; //导入依赖的package包/类
/**
* Creates a new icon with the specified caption.
*
* @param image image shown on icon (preferably 16 x 16px)
* @param caption caption shown below image
*/
public Icon(Image image, String caption) {
panel = new VerticalPanel() {
@Override
public void onBrowserEvent(Event event) {
Icon.this.onBrowserEvent(event);
}
};
panel.add(image);
panel.setCellHorizontalAlignment(image, VerticalPanel.ALIGN_CENTER);
captionLabel = new Label(caption);
panel.add(captionLabel);
initWidget(panel);
setStylePrimaryName("ode-Icon");
}