Package com.google.web.bindery.event.shared

Examples of com.google.web.bindery.event.shared.HandlerRegistration


   * Deprecated, use {@link #addChosenChangeHandler(ChosenChangeHandler)} instead
   */
  @Override
  @Deprecated
  public com.google.gwt.event.shared.HandlerRegistration addChangeHandler(final com.google.gwt.event.dom.client.ChangeHandler handler) {
    final HandlerRegistration registration = addChosenChangeHandler(new ChosenChangeHandler() {
      public void onChange(ChosenChangeEvent event) {
        handler.onChange(null);
      }
    });
   
    return new com.google.gwt.event.shared.HandlerRegistration(){
      public void removeHandler() {
        registration.removeHandler();
      }
    };
  }
View Full Code Here


   */
  @Override
  @Deprecated
  public com.google.gwt.event.shared.HandlerRegistration addChangeHandler(
      final com.google.gwt.event.dom.client.ChangeHandler handler) {
    final HandlerRegistration registration = addChosenChangeHandler(new ChosenChangeHandler() {
      public void onChange(ChosenChangeEvent event) {
        handler.onChange(null);
      }
    });

    return new com.google.gwt.event.shared.HandlerRegistration() {
      public void removeHandler() {
        registration.removeHandler();
      }
    };
  }
View Full Code Here

         * onPlaceChange(PlaceChangeEvent event) { Place newPlace =
         * event.getNewPlace();
         * historian.newItem(tokenForPlace(newPlaceRequest), false); } });
         */

        final HandlerRegistration historyReg =
                historian.addValueChangeHandler( new ValueChangeHandler<String>() {
                    public void onValueChange( ValueChangeEvent<String> event ) {
                        String token = event.getValue();
                        handleHistoryToken( token );
                    }
                } );

        return new HandlerRegistration() {
            public void removeHandler() {
                PlaceHistoryHandler.this.defaultPlaceRequest = DefaultPlaceRequest.NOWHERE;
                PlaceHistoryHandler.this.placeManager = null;
                //placeReg.removeHandler();
                historyReg.removeHandler();
            }
        };
    }
View Full Code Here

  public HandlerRegistration register(PlaceController placeController, EventBus eventBus,
      Place defaultPlace) {
    this.placeController = placeController;
    this.defaultPlace = defaultPlace;

    final HandlerRegistration placeReg =
        eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {
          public void onPlaceChange(PlaceChangeEvent event) {
            Place newPlace = event.getNewPlace();
            historian.newItem(tokenForPlace(newPlace), false);
          }
        });

    final HandlerRegistration historyReg =
        historian.addValueChangeHandler(new ValueChangeHandler<String>() {
          public void onValueChange(ValueChangeEvent<String> event) {
            String token = event.getValue();
            handleHistoryToken(token);
          }
        });

    return new HandlerRegistration() {
      public void removeHandler() {
        PlaceHistoryHandler.this.defaultPlace = Place.NOWHERE;
        PlaceHistoryHandler.this.placeController = null;
        placeReg.removeHandler();
        historyReg.removeHandler();
      }
    };
  }
View Full Code Here

    return caughtOnStop;
  }

  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();
View Full Code Here

  }

  @Override
  public <H> HandlerRegistration addHandler(Type<H> type, H handler) {
    increment(type);
    final HandlerRegistration superReg = wrapped.addHandler(type, handler);
    return makeReg(type, superReg);
  }
View Full Code Here

  }

  @Override
  public <H> HandlerRegistration addHandlerToSource(final Type<H> type, Object source, H handler) {
    increment(type);
    final HandlerRegistration superReg = wrapped.addHandlerToSource(type, source, handler);
    return makeReg(type, superReg);
  }
View Full Code Here

  private <H> void increment(final Type<H> type) {
    counts.put(type, getCount(type) + 1);
  }

  private <H> HandlerRegistration makeReg(final Type<H> type, final HandlerRegistration superReg) {
    return new HandlerRegistration() {
      public void removeHandler() {
        decrement(type);
        superReg.removeHandler();
      }
    };
View Full Code Here

TOP

Related Classes of com.google.web.bindery.event.shared.HandlerRegistration

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.