예제 #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();
 }
예제 #3
0
 @Override
 public void hide() {
   super.hide();
   for (HandlerRegistration hr : handlerRegistrations) {
     hr.removeHandler();
   }
   Window.enableScrolling(false);
 }
예제 #4
0
 @Override
 protected void onUnbind() {
   super.onUnbind();
   if (handlerRegistration != null) {
     handlerRegistration.removeHandler();
   }
 }
예제 #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;
                         }
                       });
             }
           });
 }
예제 #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;
 }
예제 #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();
  }
예제 #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();
      }
    }
  }
예제 #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;
      }
    }
  }
 @Override
 protected void onUnload() {
   handler.removeHandler();
   handler = null;
 }
예제 #12
0
 @Override
 protected void onUnload() {
   for (HandlerRegistration r : registrations) r.removeHandler();
   registrations.clear();
   super.onUnload();
 }
예제 #13
0
 @Override
 protected void onHide() {
   super.onHide();
   handlerRegistration.removeHandler();
 }
예제 #14
0
파일: RowWidget.java 프로젝트: dastko/WIRA
 private void cleanUpEvents() {
   for (HandlerRegistration hr : handlers) {
     hr.removeHandler();
   }
   handlers.clear();
 }
 private void unregisterNavigationHandler() {
   if (handlerRegistration != null) {
     handlerRegistration.removeHandler();
     handlerRegistration = null;
   }
 }