Exemplo n.º 1
0
 @Test
 public void test_canRemoveFormItemClickHandlerWithHandlerRegistration() {
   final FormItemClickHandler handler = mock(FormItemClickHandler.class);
   final HandlerRegistration registration = formItemIcon.addFormItemClickHandler(handler);
   registration.removeHandler();
   assertFalse(formItemIcon.getFormItemClickHandlers().contains(handler));
 }
 @Override
 public void removeHandler() {
   for (com.google.web.bindery.event.shared.HandlerRegistration handlerRegistration :
       collectedHandlers) {
     handlerRegistration.removeHandler();
   }
   collectedHandlers.clear();
 }
Exemplo n.º 3
0
 @Override
 public void hide() {
   super.hide();
   for (HandlerRegistration hr : handlerRegistrations) {
     hr.removeHandler();
   }
   Window.enableScrolling(false);
 }
Exemplo n.º 4
0
 @Override
 protected void onUnbind() {
   super.onUnbind();
   if (handlerRegistration != null) {
     handlerRegistration.removeHandler();
   }
 }
Exemplo n.º 5
0
 private void resetScrollHandler() {
   if (isPaused) {
     if (scrollHandler != null) scrollHandler.removeHandler();
     scrollHandler = null;
     return;
   } else if (scrollHandler != null) {
     return;
   }
   scrollHandler =
       scroller.addScrollHandler(
           new ScrollHandler() {
             @Override
             public void onScroll(ScrollEvent event) {
               Scheduler.get()
                   .scheduleDeferred(
                       new ScheduledCommand() {
                         @Override
                         public void execute() {
                           if (isPaused) return;
                           int newPosition = scroller.getVerticalScrollPosition();
                           if (lastPosition > newPosition) {
                             isTemplePaused = true;
                           } else if (newPosition == scroller.getMaximumVerticalScrollPosition()) {
                             isTemplePaused = false;
                           }
                           lastPosition = newPosition;
                         }
                       });
             }
           });
 }
Exemplo n.º 6
0
  /** Force the Tooltip to be destroyed */
  public void destroy() {
    call(widget.getElement(), DESTROY);

    if (clickHandler != null) {
      clickHandler.removeHandler();
      clickHandler = null;
    }
  }
 @Override
 public void setOnLeaveConfirmation(String question) {
   if (question == null && onLeaveQuestion == null) {
     return;
   }
   if (question != null && onLeaveQuestion == null) {
     windowClosingHandlerRegistration = Window.addWindowClosingHandler(this);
   }
   if (question == null && onLeaveQuestion != null) {
     windowClosingHandlerRegistration.removeHandler();
   }
   onLeaveQuestion = question;
 }
Exemplo n.º 8
0
  protected void release() {
    if (updateEventHandlerRegistration != null) {
      updateEventHandlerRegistration.removeHandler();
      updateEventHandlerRegistration = null;
    }
    // empty the searchResult to speed up the container.remove()
    if (searchResults != null) {
      searchResults.html("");
    }

    // remove method clean listener and cie
    container.remove();

    $selectElement.removeClass(css.chznDone(), "chzn-done").show();
  }
Exemplo n.º 9
0
  @Override
  public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
    ComponentConnector oldChild = null;
    ComponentConnector newChild = getContent();

    for (ComponentConnector c : event.getOldChildren()) {
      if (!(c instanceof WindowConnector)) {
        oldChild = c;
        break;
      }
    }

    if (oldChild != newChild) {
      if (childStateChangeHandlerRegistration != null) {
        childStateChangeHandlerRegistration.removeHandler();
        childStateChangeHandlerRegistration = null;
      }
      if (newChild != null) {
        getWidget().setWidget(newChild.getWidget());
        childStateChangeHandlerRegistration =
            newChild.addStateChangeHandler(childStateChangeHandler);
        // Must handle new child here as state change events are already
        // fired
        onChildSizeChange();
      } else {
        getWidget().setWidget(null);
      }
    }

    for (ComponentConnector c : getChildComponents()) {
      if (c instanceof WindowConnector) {
        WindowConnector wc = (WindowConnector) c;
        wc.setWindowOrderAndPosition();
      }
    }

    // Close removed sub windows
    for (ComponentConnector c : event.getOldChildren()) {
      if (c.getParent() != this && c instanceof WindowConnector) {
        ((WindowConnector) c).getWidget().hide();
      }
    }
  }
Exemplo n.º 10
0
  private void updateHandlers(boolean activate) {
    if (activate) {
      final HandlerRegistration placeReg = eventBus.addHandler(PlaceChangeEvent.TYPE, this);
      final HandlerRegistration placeRequestReg =
          eventBus.addHandler(PlaceChangeRequestEvent.TYPE, this);

      this.handlerRegistration =
          new HandlerRegistration() {
            public void removeHandler() {
              placeReg.removeHandler();
              placeRequestReg.removeHandler();
            }
          };
    } else {
      if (handlerRegistration != null) {
        handlerRegistration.removeHandler();
        handlerRegistration = null;
      }
    }
  }
Exemplo n.º 11
0
 @Override
 protected void onUnload() {
   handler.removeHandler();
   handler = null;
 }
Exemplo n.º 12
0
 @Override
 protected void onUnload() {
   for (HandlerRegistration r : registrations) r.removeHandler();
   registrations.clear();
   super.onUnload();
 }
Exemplo n.º 13
0
 @Override
 protected void onHide() {
   super.onHide();
   handlerRegistration.removeHandler();
 }
Exemplo n.º 14
0
 private void cleanUpEvents() {
   for (HandlerRegistration hr : handlers) {
     hr.removeHandler();
   }
   handlers.clear();
 }
 private void unregisterNavigationHandler() {
   if (handlerRegistration != null) {
     handlerRegistration.removeHandler();
     handlerRegistration = null;
   }
 }