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

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


    @Test
    public void unbindingRemoveHandlers(
            HandlerContainerImpl handlerContainer) {
        // Given
        HandlerRegistration mockHandlerRegistration1 = mock(HandlerRegistration.class);
        HandlerRegistration mockHandlerRegistration2 = mock(HandlerRegistration.class);
        handlerContainer.registerHandler(mockHandlerRegistration1);
        handlerContainer.registerHandler(mockHandlerRegistration2);

        // When
        handlerContainer.unbind();
View Full Code Here


        handler.handleInvalidationEvent(new ResultCacheInvalidationEvent(getActionClass(), invalidationKeys));
    }

    protected  <T> void registerProjectEventHandler(Event.Type<T> type, T handler) {
        final EventBusManager manager = EventBusManager.getManager();
        HandlerRegistration reg = manager.registerHandlerToProject(projectId, checkNotNull(type), checkNotNull(handler));
        handlerRegistrations.add(reg);
    }
View Full Code Here

        }
    }


    public <T extends EventHandler> HandlerRegistration addHandler(Event.Type<T> type, T handler) {
        final HandlerRegistration handlerRegistration = eventBus.addHandler(type, handler);
        registeredHandlers.add(handlerRegistration);
        return handlerRegistration;
    }
View Full Code Here

     * @param <T> The event type
     * @throws NullPointerException if any parameters are {@code null}.
     */
    public <T> void addProjectEventHandler(Event.Type<T> type, T handler) {
        final EventBusManager manager = EventBusManager.getManager();
        HandlerRegistration reg = manager.registerHandlerToProject(getProjectId(), checkNotNull(type), checkNotNull(handler));
        handlerRegistrations.add(reg);
    }
View Full Code Here

        handlerRegistrations.add(reg);
    }

    public <T> void addApplicationEventHandler(Event.Type<T> type, T handler) {
        EventBusManager manager = EventBusManager.getManager();
        HandlerRegistration reg = manager.registerHandler(checkNotNull(type), checkNotNull(handler));
        handlerRegistrations.add(reg);
    }
View Full Code Here

    }

    /**
     */
    public <H> void registerHandler(Event.Type<H> type, H handler) {
        HandlerRegistration registration = EventBusManager.getManager().registerHandler(type, handler);
        addHandlerRegistration(registration);
    }
View Full Code Here

        HandlerRegistration registration = EventBusManager.getManager().registerHandler(type, handler);
        addHandlerRegistration(registration);
    }

    public <H> void registerHandlerToProject(ProjectId projectId, Event.Type<H> type, H handler) {
        HandlerRegistration registration = EventBusManager.getManager().registerHandler(type, handler);
        addHandlerRegistration(registration);
    }
View Full Code Here

      @Override
      public int getDispatchOrder() {
        return 0;
      }
    });
    return new HandlerRegistration() {
      @Override
      public void removeHandler() {
        eventBus.unregister(handler);
      }
    };
View Full Code Here

  }

  @Override
  public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {

    HandlerRegistration addHandler = eventBus.addHandler(AnimationSelectedEvent.getType(), new AnimationSelectedEvent.Handler() {

      @Override
      public void onAnimationSelected(AnimationSelectedEvent event) {

        Animation animation = event.getAnimation();

        AnimationNames animationName = animation.getAnimationName();

        Place place = null;

        switch (animationName) {
        case SLIDE:
          place = new AnimationSlidePlace();

          break;
        case SLIDE_UP:
          place = new AnimationSlideUpPlace();

          break;
        case DISSOLVE:
          place = new AnimationDissolvePlace();

          break;
        case FADE:
          place = new AnimationFadePlace();

          break;
        case FLIP:
          place = new AnimationFlipPlace();

          break;
        case POP:
          place = new AnimationPopPlace();

          break;
        case SWAP:
          place = new AnimationSwapPlace();

          break;

        default:
          // TODO log
          place = new AnimationSlidePlace();
          break;
        }

        if (MGWT.getFormFactor().isTablet() || MGWT.getFormFactor().isDesktop()) {

          historyHandler.replaceCurrentPlace(place);
          historyHandler.goTo(place, true);
        } else {
          historyHandler.goTo(place);
        }

      }
    });
    HandlerRegistration register3 = UIEntrySelectedEvent.register(eventBus, new UIEntrySelectedEvent.Handler() {

      @Override
      public void onAnimationSelected(UIEntrySelectedEvent event) {

        UIEntry entry = event.getEntry();

        Place place = null;

        switch (entry) {
        case BUTTON_BAR:
          place = new ButtonBarPlace();
          break;
        case BUTTONS:
          place = new ButtonPlace();
          break;
        case ELEMENTS:
          place = new ElementsPlace();
          break;
        case FORMS:
          place = new FormsPlace();
          break;
        case POPUPS:
          place = new PopupPlace();
          break;
        case PROGRESS_BAR:
          place = new ProgressBarPlace();
          break;
        case PROGRESS_INDICATOR:
          place = new ProgressIndicatorPlace();
          break;
        case PULL_TO_REFRESH:
          place = new PullToRefreshPlace();
          break;
        case SCROLL_WIDGET:
          place = new ScrollWidgetPlace();
          break;
        case SEARCH_BOX:
          place = new SearchBoxPlace();
          break;
        case SLIDER:
          place = new SliderPlace();
          break;
        case TABBAR:
          place = new TabBarPlace();
          break;
        case CAROUSEL:
          place = new CarouselPlace();
          break;
        case GROUP_LIST:
          place = new GroupedCellListPlace();
          break;
        default:
          break;
        }

        if (MGWT.getFormFactor().isTablet() || MGWT.getFormFactor().isDesktop()) {

          historyHandler.replaceCurrentPlace(place);
          historyHandler.goTo(place, true);
        } else {
          historyHandler.goTo(place);
        }

      }
    });

    HandlerRegistration register2 = ActionEvent.register(eventBus, ActionNames.BACK, new ActionEvent.Handler() {

      @Override
      public void onAction(ActionEvent event) {

        History.back();

      }
    });

    HandlerRegistration register = ActionEvent.register(eventBus, ActionNames.ANIMATION_END, new ActionEvent.Handler() {

      @Override
      public void onAction(ActionEvent event) {
        if (MGWT.getFormFactor().isPhone()) {
          History.back();
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);
            }
        });

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.