Java 类com.google.gwt.user.client.Event 实例源码

项目:empiria.player    文件:AbstractMediaScroll.java   
@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);
}
项目:empiria.player    文件:AbstractMediaButton.java   
@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;
    }
}
项目:empiria.player    文件:AccessibleCheckBox.java   
/**
 * 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);
    }
}
项目:unitimes    文件:SimpleEditPage.java   
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);
}
项目:unitimes    文件:CurriculumProjectionRulesPage.java   
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();
        }
    };
}
项目:unitimes    文件:ImageButton.java   
@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;
        }
    }
}
项目:unitimes    文件:TimetableGrid.java   
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);
}
项目:unitimes    文件:UniTimeTable.java   
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());
}
项目:unitimes    文件:HorizontalPanelWithHint.java   
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();
        }
    };
}
项目:unitimes    文件:HorizontalPanelWithHint.java   
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;
    }
}
项目:unitimes    文件:TimeGrid.java   
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);
}
项目:unitimes    文件:TimeGrid.java   
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);
}
项目:unitimes    文件:SessionDatesSelector.java   
@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);
}
项目:unitimes    文件:InfoPanelImpl.java   
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;
    }
}
项目:appinventor-extensions    文件:Icon.java   
/**
 * 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");
}
项目:appinventor-extensions    文件:MockComponent.java   
/**
 * Sets the components widget representation and initializes its properties.
 *
 * <p>To be called from implementing constructor.
 *
 * @param widget  components visual representation in designer
 */
void initComponent(Widget widget) {
  // Widget needs to be initialized before the component itself so that the component properties
  // can be reflected by the widget
  initWidget(widget);

  // Capture mouse and click events in onBrowserEvent(Event)
  sinkEvents(Event.MOUSEEVENTS | Event.ONCLICK);

  // Add the special name property and set the tooltip
  String name = componentName();
  setTitle(name);
  addProperty(PROPERTY_NAME_NAME, name, null, new TextPropertyEditor());

  // TODO(user): Ensure this value is unique within the project using a list of
  // already used UUIDs
  // Set the component's UUID
  // The default value here can be anything except 0, because YoungAndroidProjectServce
  // creates forms with an initial Uuid of 0, and Properties.java doesn't encode
  // default values when it generates JSON for a component.
  addProperty(PROPERTY_NAME_UUID, "-1", null, new TextPropertyEditor());
  changeProperty(PROPERTY_NAME_UUID, "" + Random.nextInt());

  editor.getComponentPalettePanel().configureComponent(this);
}
项目:appinventor-extensions    文件:MockComponent.java   
/**
 * Invoked by GWT whenever a browser event is dispatched to this component.
 */
@Override
public final void onBrowserEvent(Event event) {
  switch (event.getTypeInt()) {
    case Event.ONMOUSEDOWN:
    case Event.ONMOUSEUP:
    case Event.ONMOUSEMOVE:
    case Event.ONMOUSEOVER:
    case Event.ONMOUSEOUT:
      cancelBrowserEvent(event);
      mouseListeners.fireMouseEvent(this, event);
      break;

    case Event.ONCLICK:
      cancelBrowserEvent(event);
      select();
      break;

    default:
      // Ignore unexpected events
      break;
  }
}
项目:cuba    文件:CubaSideMenuWidget.java   
public CubaSideMenuWidget() {
    setStylePrimaryName(CLASS_NAME);

    sinkEvents(Event.ONMOUSEOVER | Event.ONMOUSEOUT);

    // Navigation is only handled by the root bar
    addFocusHandler(this);
    addBlurHandler(this);

    /*
     * Firefox auto-repeat works correctly only if we use a key press
     * handler, other browsers handle it correctly when using a key down handler
     */
    if (BrowserInfo.get().isGecko()) {
        addKeyPressHandler(this);
    } else {
        addKeyDownHandler(this);
    }
}
项目:vaadin-combobox-multiselect    文件:VComboBoxMultiselect.java   
@Override
public void onBrowserEvent(Event event) {
    debug("VComboBoxMultiselect.SP: onBrowserEvent()");

    if (event.getTypeInt() == Event.ONCLICK) {
        final Element target = DOM.eventGetTarget(event);
        if (target == this.up || target == DOM.getChild(this.up, 0)) {
            this.lazyPageScroller.scrollUp();
        } else if (target == this.down || target == DOM.getChild(this.down, 0)) {
            this.lazyPageScroller.scrollDown();
        }

    }

    /*
     * Prevent the keyboard focus from leaving the textfield by
     * preventing the default behaviour of the browser. Fixes #4285.
     */
    handleMouseDownEvent(event);
}
项目:LAS    文件:WindowBox.java   
@Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
    if (this.resizable) {
        // We need to preventDefault() on mouseDown events (outside of the
        // DialogBox content) to keep text from being selected when it
        // is dragged.
        NativeEvent nativeEvent = event.getNativeEvent();

        if (!event.isCanceled()
                && (event.getTypeInt() == Event.ONMOUSEDOWN)
                && calcDragMode(nativeEvent.getClientX(),nativeEvent.getClientY()) >= 0) {
            nativeEvent.preventDefault();
        }
    }

    super.onPreviewNativeEvent(event);
}
项目:document-management-system    文件:ExtendedScrollTable.java   
/**
 * ExtendedScrollTable
 */
public ExtendedScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable,
                           ScrollTableImages scrollTableImages) {
    super(dataTable, headerTable, scrollTableImages);
    this.dataTable = dataTable;
    this.headerTable = headerTable;

    dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
    setResizePolicy(ResizePolicy.UNCONSTRAINED);
    setScrollPolicy(ScrollPolicy.BOTH);

    dataTable.setColumnSorter(new ExtendedColumnSorter());

    // Sets some events
    DOM.sinkEvents(getDataWrapper(), Event.ONCLICK | Event.ONDBLCLICK | Event.ONMOUSEDOWN);
}
项目:document-management-system    文件:ExtendedFlexTable.java   
/**
 * Method originally copied from HTMLTable superclass where it was defined private
 * Now implemented differently to only return target cell if it'spart of 'this' table
 */
private Element getMouseEventTargetCell(Event event) {
    Element td = DOM.eventGetTarget(event);
    //locate enclosing td element
    while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) {
        // If we run out of elements, or run into the table itself, then give up.
        if ((td == null) || td == getElement())
            return null;
        td = DOM.getParent(td);
    }
    //test if the td is actually from this table
    Element tr = DOM.getParent(td);
    Element body = DOM.getParent(tr);
    if (body == this.getBodyElement()) {
        return td;
    }
    //Didn't find appropriate cell
    return null;
}
项目:document-management-system    文件:ExtendedFlexTable.java   
/**
 * ExtendedFlexTable
 */
public ExtendedFlexTable() {
    super();

    // Adds double click event control to table ( on default only has CLICK )
    sinkEvents(Event.ONDBLCLICK | Event.MOUSEEVENTS);
    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Mark selected row or orders rows if header row (0) is clicked 
            // And row must be other than the selected one
            markSelectedRow(getCellForEvent(event).getRowIndex());
            MessagingToolBarBox.get().messageDashboard.messageStack.messageSent.refreshMessagesSent();
        }
    });
}
项目:document-management-system    文件:ExtendedFlexTable.java   
/**
 * ExtendedFlexTable
 */
public ExtendedFlexTable() {
    super();

    // Adds double click event control to table ( on default only has CLICK )
    sinkEvents(Event.ONDBLCLICK | Event.MOUSEEVENTS);
    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Mark selected row or orders rows if header row (0) is clicked 
            // And row must be other than the selected one
            markSelectedRow(getCellForEvent(event).getRowIndex());
            MessagingToolBarBox.get().messageDashboard.messageStack.proposedQueryReceived.refreshProposedQueries();
        }
    });
}
项目:cuba    文件:Tools.java   
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
    super.onPreviewNativeEvent(event);

    NativeEvent nativeEvent = event.getNativeEvent();
    Element target = Element.as(nativeEvent.getEventTarget());

    if (Event.ONCLICK == event.getTypeInt()) {
        final Widget hoveredButton = WidgetUtil.findWidget(target, null);
        if (getElement().isOrHasChild(target)) {
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    hide();

                    if (BrowserInfo.get().isIE9()) {
                        if (hoveredButton instanceof CubaButtonWidget) {
                            hoveredButton.removeStyleName("ie9-hover");
                        }
                    }
                }
            });
        }
    }
}
项目:document-management-system    文件:ExtendedFlexTable.java   
/**
 * ExtendedFlexTable
 */
public ExtendedFlexTable() {
    super();

    // Adds double click event control to table ( on default only has CLICK )
    sinkEvents(Event.ONDBLCLICK | Event.MOUSEEVENTS);
    addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            // Mark selected row or orders rows if header row (0) is clicked 
            // And row must be other than the selected one
            markSelectedRow(getCellForEvent(event).getRowIndex());
            MessagingToolBarBox.get().messageDashboard.messageStack.proposedSubscriptionReceived.refreshProposedSubscriptions();
        }
    });
}
项目:document-management-system    文件:ExtendedScrollTable.java   
/**
 * @param dataTable
 * @param headerTable
 * @param scrollTableImages
 */
public ExtendedScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable,
                           ScrollTableImages scrollTableImages) {
    super(dataTable, headerTable, scrollTableImages);
    formManager = new FormManager(); // Used to draw extended columns

    this.dataTable = dataTable;
    this.headerTable = headerTable;

    // Table data SortableFixedWidthGrid.HOVERING_POLICY_CELL
    dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
    setResizePolicy(ResizePolicy.FILL_WIDTH);
    setScrollPolicy(ScrollPolicy.BOTH);

    columnSorter = new ExtendedColumnSorter();
    dataTable.setColumnSorter(columnSorter);

    // Sets some events
    DOM.sinkEvents(getDataWrapper(), Event.ONCLICK | Event.ONDBLCLICK | Event.ONMOUSEDOWN | Event.ONMOUSEUP
            | Event.ONMOUSEMOVE | Event.ONMOUSEUP);
}
项目:document-management-system    文件:ExtendedScrollTable.java   
/**
 * ExtendedScrollTable
 */
public ExtendedScrollTable(FixedWidthGrid dataTable, FixedWidthFlexTable headerTable, ScrollTableImages scrollTableImages) {
    super(dataTable, headerTable, scrollTableImages);
    this.dataTable = dataTable;
    this.headerTable = headerTable;

    formManager = new FormManager(); // Used to draw extended columns

    dataTable.setSelectionPolicy(SelectionGrid.SelectionPolicy.ONE_ROW);
    setResizePolicy(ResizePolicy.FILL_WIDTH);
    setScrollPolicy(ScrollPolicy.BOTH);

    columnSorter = new ExtendedColumnSorter();
    dataTable.setColumnSorter(columnSorter);

    // Sets some events
    DOM.sinkEvents(getDataWrapper(), Event.ONDBLCLICK | Event.ONMOUSEDOWN);
}
项目:Wiab.pro    文件:SignalEventImpl.java   
private static <T extends SignalEventImpl> T createInner(
    SignalEventFactory<T> factory, Event event) {

  SignalKeyLogic.Result keySignalResult;
  if (isKeyEvent(event)) {
    keySignalResult = computeKeySignalTypeResult;
    logic.computeKeySignalType(keySignalResult,
        event.getType(), getNativeKeyCode(event), getWhich(event), getKeyIdentifier(event),
        event.getMetaKey(), event.getCtrlKey(), event.getAltKey(), event.getShiftKey());

  } else {
    keySignalResult = null;
  }

  return createInner(createFor(factory, event), event.<JsoNativeEvent>cast(), keySignalResult);
}
项目:cuba    文件:CubaResizableTextAreaWrapperWidget.java   
protected void captureEvents(Event event) {
    event.preventDefault();
    if (isEnabled() && event.getButton() == Event.BUTTON_LEFT) {
        if (!dragDrop) {
            dragDrop = true;
            DOM.setCapture(resizeElement);

            ComputedStyle cs = new ComputedStyle(getElement());
            setWidth(cs.getProperty("width"));
            setHeight(cs.getProperty("height"));

            getTextArea().getStyle().setProperty("width", "100%");
            getTextArea().getStyle().setProperty("height", "100%");
        }
    }
}
项目:document-management-system    文件:ExtendedFlexTable.java   
/**
 * Method originally copied from HTMLTable superclass where it was defined private
 * Now implemented differently to only return target cell if it'spart of 'this' table
 */
private Element getMouseEventTargetCell(Event event) {
    Element td = DOM.eventGetTarget(event);
    //locate enclosing td element
    while (!DOM.getElementProperty(td, "tagName").equalsIgnoreCase("td")) {
        // If we run out of elements, or run into the table itself, then give up.
        if ((td == null) || td == getElement())
            return null;
        td = DOM.getParent(td);
    }
    //test if the td is actually from this table
    Element tr = DOM.getParent(td);
    Element body = DOM.getParent(tr);
    if (body == this.getBodyElement()) {
        return td;
    }
    //Didn't find appropriate cell
    return null;
}
项目:document-management-system    文件:UserNews.java   
/**
 * UserNews
 */
public UserNews() {
    data = new HashMap<Integer, GWTQueryParams>();
    table = new ExtendedFlexTable();
    menuPopup = new MenuPopup();
    menuPopup.setStyleName("okm-MenuPopup");
    status = new Status();
    status.setStyleName("okm-StatusPopup");

    table.setBorderWidth(0);
    table.setCellSpacing(0);
    table.setCellSpacing(0);

    table.sinkEvents(Event.ONDBLCLICK | Event.ONMOUSEDOWN);

    initWidget(table);

}
项目:Wiab.pro    文件:KeyBindingRegistryIntegrationGwtTest.java   
/**
 * Ensure that an action bound to ORDER_G is executed when the appropriate JS keypress
 * event is fired at the editor.
 */
public void testKeyBinding() {
  KeyBindingRegistry bindings = new KeyBindingRegistry();
  callTracker = 0;
  EditorAction testAction =
      new EditorAction() {

        @Override
        public void execute(EditorContext context) {
          callTracker++;
        }
      };
  bindings.registerAction(KeyCombo.CTRL_G, testAction);
  EditorImpl editor = createEditor(bindings);

  // 103 = g, this event = CTRL_G which is bound to ORDER_G by the EventWrapper
  Event rawEvent = Document.get().createKeyPressEvent(
      true, false, false, false, G_CODE, G_CODE).cast();
  editor.onJavaScriptEvent(JsEvents.KEY_PRESS, rawEvent);
  assertEquals("Callback action not called on registered keypress", callTracker, 1);
}
项目:dangchat-sdk    文件:JsFacade.java   
@UsedByApp
public void handleLinkClick(Event event) {
    Element target = Element.as(event.getEventTarget());
    String href = target.getAttribute("href");
    if (href.startsWith("send:")) {
        String msg = href.substring("send:".length());
        msg = URL.decode(msg);
        if (lastVisiblePeer != null) {
            messenger.sendMessage(lastVisiblePeer, msg);
            event.preventDefault();
        }
    } else {
        if (JsElectronApp.isElectron()) {
            JsElectronApp.openUrlExternal(href);
            event.preventDefault();
        }
    }
}
项目:cuba    文件:CubaScrollBoxLayoutWidget.java   
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    if (DOM.eventGetType(event) == Event.ONSCROLL) {
        Element element = getElement();

        int scrollTop = element.getScrollTop();
        int scrollLeft = element.getScrollLeft();

        if (this.scrollTop != scrollTop || this.scrollLeft != scrollLeft) {
            if (onScrollHandler != null) {
                onScrollHandler.accept(scrollTop, scrollLeft);
            }

            this.scrollTop = scrollTop;
            this.scrollLeft = scrollLeft;
        }
    }
}
项目:cuba    文件:CubaCheckBoxConnector.java   
@Override
public void onStateChanged(StateChangeEvent stateChangeEvent) {
    getWidget().captionManagedByLayout = getState().captionManagedByLayout;

    super.onStateChanged(stateChangeEvent);

    if (!getWidget().captionManagedByLayout
            && isContextHelpIconEnabled()) {
        if (getWidget().contextHelpIcon == null) {
            getWidget().contextHelpIcon = DOM.createSpan();
            getWidget().contextHelpIcon.setInnerHTML("?");
            getWidget().contextHelpIcon.setClassName(CONTEXT_HELP_CLASSNAME);
            Roles.getTextboxRole().setAriaHiddenState(getWidget().contextHelpIcon, true);

            getWidget().getElement().appendChild(getWidget().contextHelpIcon);
            DOM.sinkEvents(getWidget().contextHelpIcon, VTooltip.TOOLTIP_EVENTS | Event.ONCLICK);
        } else {
            getWidget().contextHelpIcon.getStyle().clearDisplay();
        }
    } else if (getWidget().contextHelpIcon != null) {
        getWidget().contextHelpIcon.getStyle()
                .setDisplay(Style.Display.NONE);

        getWidget().setAriaInvalid(false);
    }
}
项目:cuba    文件:CubaTreeWidget.java   
@Override
protected void prepareToFireClick(int eventType) {
    if (eventType == Event.ONDBLCLICK && doubleClickHandling) {
        if (selectable) {
            CubaTreeWidget.this.deselectAll();

            TreeNode targetNode = getNodeByKey(key);
            targetNode.setFocused(true);

            targetNode.setSelected(true);
            selectedIds.add(targetNode.key);

            client.updateVariable(paintableId, "selected",
                    selectedIds.toArray(new String[selectedIds.size()]),
                    false);
            selectionHasChanged = false;
        }
    }
}
项目:empiria.player    文件:ItemBodyView.java   
public ItemBodyView(WidgetWorkflowListener wwl) {
    widgetWorkflowListener = wwl;

    setStyleName("qp-text-module");
    this.sinkEvents(Event.ONCHANGE);
    this.sinkEvents(Event.ONMOUSEDOWN);
    this.sinkEvents(Event.ONMOUSEUP);
    this.sinkEvents(Event.ONMOUSEMOVE);
    this.sinkEvents(Event.ONMOUSEOUT);
}
项目:empiria.player    文件:AssessmentBodyView.java   
@Inject
public AssessmentBodyView(@Assisted WidgetWorkflowListener wwl, ModeStyleNameConstants modeStyleNameConstants, StyleNameConstants styleNameConstants, PlayerWorkModeService playerWorkModeService) {
    widgetWorkflowListener = wwl;
    this.modeStyleNameConstants = modeStyleNameConstants;
    this.playerWorkModeService = playerWorkModeService;
    this.styleNameConstants = styleNameConstants;
    setStyleName(styleNameConstants.QP_ASSESSMENT_VIEW());
    this.sinkEvents(Event.ONCHANGE);
    this.sinkEvents(Event.ONMOUSEDOWN);
    this.sinkEvents(Event.ONMOUSEUP);
    this.sinkEvents(Event.ONMOUSEMOVE);
    this.sinkEvents(Event.ONMOUSEOUT);
}
项目:empiria.player    文件:AccessibleRadioButton.java   
/**
 * Creates a new radio associated with a particular group name. All radio buttons associated with the same group name belong to a mutually-exclusive set.
 * <p/>
 * Radio buttons are grouped by their name attribute, so changing their name using the setName() method will also change their associated group.
 *
 * @param name the group name with which to associate the radio button
 */
public AccessibleRadioButton(String name) {
    super(DOM.createInputRadio(name));
    setStyleName("gwt-RadioButton");

    sinkEvents(Event.ONCLICK);
    sinkEvents(Event.ONMOUSEUP);
    sinkEvents(Event.ONBLUR);
    sinkEvents(Event.ONKEYDOWN);
}