Package com.google.gwt.user.client

Examples of com.google.gwt.user.client.EventListener


   * @return the containing element, or null if there is no widget
   */
  public static Widget getWidgetWithElement(Element element) {
    assert element != null : "Cannot find a widget for a null element";
    do {
      EventListener eventListener = DOM.getEventListener((com.google.gwt.user.client.Element) element);
      if (eventListener instanceof Widget) {
        return (Widget) eventListener;
      }
      element = element.getParentElement();
    } while (element != null);
View Full Code Here


    Element implNodelet = element.getImplNodelet();
    final EventHandler handler =
        eventHandlerId == null ? null : AnnotationPaint.eventHandlerRegistry.get(eventHandlerId);
    if (handler != null) {
      DOM.sinkEvents(DomHelper.castToOld(implNodelet), MOUSE_LISTENER_EVENTS);
      DOM.setEventListener(DomHelper.castToOld(implNodelet), new EventListener() {
        @Override
        public void onBrowserEvent(Event event) {
          handler.onEvent(element, event);
        }
      });
View Full Code Here

            innerDiv.getStyle().setMarginLeft( (icon.getWidth() / 2) * -1,
                                               Unit.PX );

            // Setup event handling
            DOM.setEventListener( icon.getElement(),
                                  new EventListener() {

                                      public void onBrowserEvent(Event event) {
                                          if ( event.getType().equals( "click" ) ) {
                                              setIconImage( grid.getGridWidget().toggleMerging() );
                                          }
View Full Code Here

    overlayDiv.getStyle().setBackgroundColor("#000");
   
    Document.get().getBody().appendChild(overlayDiv);
   
    DOM.sinkEvents(overlayDiv, Event.ONCLICK);
    DOM.setEventListener(overlayDiv, new EventListener() {
     
      @Override
      public void onBrowserEvent(Event event) {
        switch (event.getTypeInt()) {
        case Event.ONCLICK:
          cleanUp(overlayDiv, dialog, onButton, offButton, closeButton);
          break;
        default:
          break;
        }
      }
    });
   
   
    dialog.getStyle().setZIndex(1001);
    dialog.getStyle().setPosition(Position.FIXED);
    dialog.getStyle().setTop(20, Unit.PT);
    dialog.getStyle().setLeft(20, Unit.PT);
    dialog.getStyle().setBackgroundColor("white");
   
    dialog.getStyle().setBorderColor("#ccc");
    dialog.getStyle().setBorderStyle(BorderStyle.SOLID);
    dialog.getStyle().setBorderWidth(4, Unit.PX);
    dialog.getStyle().setPadding(1, Unit.EM);
   
    Document.get().getBody().appendChild(dialog);
   
   
    DOM.sinkEvents(onButton, Event.ONCLICK);
    DOM.setEventListener(onButton, new EventListener() {
     
      @Override
      public void onBrowserEvent(Event event) {
        cleanUp(overlayDiv, dialog, onButton, offButton, closeButton);
        devModeOn();
      }
    });
   
    dialog.appendChild(onButton);
   
    dialog.appendChild(DOM.createElement("br"));
    dialog.appendChild(DOM.createElement("br"));
    dialog.appendChild(DOM.createElement("br"));
   
   
    DOM.sinkEvents(offButton, Event.ONCLICK);
    DOM.setEventListener(offButton, new EventListener() {
     
      @Override
      public void onBrowserEvent(Event event) {
        cleanUp(overlayDiv, dialog, onButton, offButton, closeButton);
        devModeOff();
      }
    });
   
    dialog.appendChild(offButton);
   
    dialog.appendChild(DOM.createElement("br"));
    dialog.appendChild(DOM.createElement("br"));
    dialog.appendChild(DOM.createElement("br"));
   
   
    DOM.sinkEvents(closeButton, Event.ONCLICK);
    DOM.setEventListener(closeButton, new EventListener() {
     
      @Override
      public void onBrowserEvent(Event event) {
        cleanUp(overlayDiv, dialog, onButton, offButton, closeButton);
       
View Full Code Here

          startEvents();
        }
      }
    }));

    DOM.setEventListener(widget.getElement(), new EventListener() {
      @Override
      public void onBrowserEvent(Event event) {
        if (event.getTypeInt() == Event.ONPASTE) {
          final String before = (String) entity.getState().get();
          new Timer() {
View Full Code Here

     */
    public static <T> T findWidget(Element element,
            Class<? extends Widget> class1) {
        if (element != null) {
            /* First seek for the first EventListener (~Widget) from dom */
            EventListener eventListener = null;
            while (eventListener == null && element != null) {
                eventListener = Event.getEventListener(element);
                if (eventListener == null) {
                    element = (Element) element.getParentElement();
                }
View Full Code Here

    cell.setInnerText("Not Urgent");
    createMatrixCell(css.ml());

    // Add click listener to Red cell
    DomUtils.addEventListener("click", createMatrixCell(css.mm()),
        new EventListener() {
          public void onBrowserEvent(Event event) {
            setLabelPriority(Label.URGENT_IMPORTANT);
          }
        });

    // Add click listener to Orange cell
    DomUtils.addEventListener("click", createMatrixCell(css.mr()),
        new EventListener() {
          public void onBrowserEvent(Event event) {
            setLabelPriority(Label.NOT_URGENT_IMPORTANT);
          }
        });

    createMatrixCell(css.bl());

    // Add click listener to Yellow cell
    DomUtils.addEventListener("click", createMatrixCell(css.bm()),
        new EventListener() {
          public void onBrowserEvent(Event event) {
            setLabelPriority(Label.URGENT_NOT_IMPORTANT);
          }
        });

    // Add click listener to Green cell
    DomUtils.addEventListener("click", createMatrixCell(css.br()),
        new EventListener() {
          public void onBrowserEvent(Event event) {
            setLabelPriority(Label.NOT_URGENT_NOT_IMPORTANT);
          }
        });

    DomUtils.addEventListener("click", selectedColor, new EventListener() {
      public void onBrowserEvent(Event event) {
        showColorChooser();
      }
    });
View Full Code Here

    TaskDetails.Css css = resources.taskDetailsCss();

    // Setup the controls that will be added to the top bar of the TaskDetails
    // page.
    Controls controls = new Controls(resources);
    controls.addControl(css.back(), new EventListener() {
      public void onBrowserEvent(Event event) {
        controller.goToTaskList();
      }
    });
View Full Code Here

    return fieldGroup;
  }

  private void hookEventListeners() {
    DomUtils.addEventListener("click", cancelButton, new EventListener() {

      public void onBrowserEvent(Event event) {
        controller.goToTaskList();
      }

    });

    DomUtils.addEventListener("click", saveButton, new EventListener() {
      public void onBrowserEvent(Event event) {
        if (currentTask == null) {
          // We have a new Task
          currentTask = new Task("", titleField.getValue(),
              detailsField.getValue(), labelMatrix.getCurrentLabelPriority(),
View Full Code Here

  /**
   * Attaches an EventListener to the resize event on the Window.
   */
  private void hookResizeListener() {
    DomUtils.getWindow().addResizeListener(new EventListener() {
      public void onBrowserEvent(Event event) {
        doResize();
      }
    });
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.EventListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.