Package com.google.gwt.event.shared

Examples of com.google.gwt.event.shared.SimpleEventBus


  public void testAttributeAddedEvent() {

    ProjectRpcAsync mockProjService = EasyMock.createMock(ProjectRpcAsync.class);
    AttributesView mockView = EasyMock.createMock(AttributesView.class);
    // Since HandlerManager is a concrete type, must import 'org.easymock.EasyMock'
    SimpleEventBus mockEventBus = EasyMock.createMock(SimpleEventBus.class);
    UserRpcAsync securityService = EasyMock.createMock(UserRpcAsync.class);
    DataRpcAsync dataService = EasyMock.createMock(DataRpcAsync.class);
    ArrayList<Signoff> signoffs = new ArrayList<Signoff>();
    Collection<String> labels = Lists.newArrayList();

    ArrayList<Attribute> attributes = new ArrayList<Attribute>();
    Attribute att = new Attribute();
    att.setParentProjectId(42L);
    attributes.add(att);

    Project parentProject = new Project();
    parentProject.setProjectId(42L);

    securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(false);
    mockProjService.getProjectAttributes(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(attributes);
    dataService.getSignoffsByType(EasyMock.eq(42L), EasyMock.eq(AccElementType.ATTRIBUTE),
        EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(signoffs);
    mockProjService.getLabels(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(labels);

    AttributesPresenter testPresenter = new AttributesPresenter(
      parentProject, mockProjService, securityService, dataService, mockView,
      mockEventBus);

    EasyMock.reset(mockEventBus, mockProjService, securityService, dataService);

    Attribute newAttribute = new Attribute();
    newAttribute.setParentProjectId(42L);
    mockProjService.createAttribute(EasyMock.eq(newAttribute), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(1L);

    mockEventBus.fireEvent(EasyMock.isA(ProjectElementAddedEvent.class));

    // Attributes queried due to the view refresh.
    securityService.hasEditAccess(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
    EasyMockUtils.setLastAsyncCallbackSuccessWithResult(false);
    mockProjService.getProjectAttributes(EasyMock.eq(42L), EasyMock.isA(AsyncCallback.class));
View Full Code Here


  protected boolean validateModel(M model) {
    return true;
  }

  SimpleEventBus ensureHandlers() {
    return eventBus == null ? eventBus = new SimpleEventBus() : eventBus;
  }
View Full Code Here

    assertEquals(defaultPlace, placeController.getWhere());
  }

  @Override
  protected void setUp() {
    EventBus eventBus = new SimpleEventBus();
    historian = new MockHistorian();
    placeController = new PlaceController(eventBus,
        new MockPlaceControllerDelegate()) {
      @Override
      Logger log() {
View Full Code Here

     * to identify the view to show: If the path contains
     * "StandaloneEditor.html" then the StandaloneGuidedEditorManager is used to
     * render the view. If not, the default view is shown.
     */
    private void createMain() {
        EventBus eventBus = new SimpleEventBus();
        SuggestionCompletionCache.getInstance().setEventBus(eventBus);
        ClientFactory clientFactory = new ClientFactoryImpl(eventBus);
        appController = new AppControllerImpl(clientFactory, eventBus);

        if (Window.Location.getPath().contains("StandaloneEditor.html")) {
View Full Code Here

    @Override
    public void gwtSetUp() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cache = new VolatileQueueableCacheStorage();
       
        final CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        final CallbackFactory callbackFactory = new RetryingCallbackFactory(cachingCallbackFilter,
                new ModelChangeCallbackFilter(eventBus));
View Full Code Here

     * everything is okay...
     *
     */
    public void testIfCachingWorks() {
        //configure RESTY to use cache:
        final EventBus eventBus = new SimpleEventBus();
        QueueableCacheStorage cache = new VolatileQueueableCacheStorage();
        CallbackFilter cachingCallbackFilter = new CachingCallbackFilter(cache);
        CallbackFactory callbackFactory = new DefaultCallbackFactory(cachingCallbackFilter,
                    new ModelChangeCallbackFilter(eventBus));
        DispatcherFilter cachingDispatcherFilter = new CachingDispatcherFilter(cache, callbackFactory);
View Full Code Here

    public void testDefaultFunction() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cacheStorage = new VolatileQueueableCacheStorage();
        final FilterawareDispatcher dispatcher = new DefaultFilterawareDispatcher();

        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
                new CallbackFactory() {
                    public FilterawareRequestCallback createCallback(Method method) {
                        final FilterawareRequestCallback retryingCallback = new DefaultFilterawareRequestCallback(
                                method);

                        retryingCallback.addFilter(new CachingCallbackFilter(cacheStorage));
                        retryingCallback.addFilter(new ModelChangeCallbackFilter(eventBus));
                        return retryingCallback;
                    }
                }));

        Defaults.setDispatcher(dispatcher);

        /*
         *  setup the service, usually done in gin
         */
        Resource resource = new Resource(GWT.getModuleBaseURL());
        final ModelChangeAnnotatedService service = GWT.create(ModelChangeAnnotatedService.class);
        ((RestServiceProxy) service).setResource(resource);

        final ModelChangedEventHandlerImpl handler = new ModelChangedEventHandlerImpl();
        eventBus.addHandler(ModelChangeEvent.TYPE, handler);


        /*
         * first we create a client GET request to prepare all things as it
         * would be when displaying a list of items in the client.
View Full Code Here

    @Override
    public void gwtSetUp() {
        /*
         * configure RESTY to use cache, usually done in gin
         */
        final EventBus eventBus = new SimpleEventBus();
        final QueueableCacheStorage cacheStorage = new VolatileQueueableCacheStorage();
        final FilterawareDispatcher dispatcher = new DefaultFilterawareDispatcher();

        dispatcher.addFilter(new CachingDispatcherFilter(
                cacheStorage,
View Full Code Here

     * to identify the view to show: If the path contains
     * "StandaloneEditor.html" then the StandaloneGuidedEditorManager is used to
     * render the view. If not, the default view is shown.
     */
    private void createMain() {
        EventBus eventBus = new SimpleEventBus();
        SuggestionCompletionCache.getInstance().setEventBus(eventBus);
        ClientFactory clientFactory = new ClientFactoryImpl(eventBus);
        appController = new AppControllerImpl(clientFactory,eventBus);

        if (Window.Location.getPath().contains("StandaloneEditor.html")) {
View Full Code Here

     * to identify the view to show: If the path contains
     * "StandaloneEditor.html" then the StandaloneGuidedEditorManager is used to
     * render the view. If not, the default view is shown.
     */
    private void createMain() {
        EventBus eventBus = new SimpleEventBus();
        ClientFactory clientFactory = new ClientFactoryImpl(eventBus);
        appController = new AppController(clientFactory,eventBus);

        if (Window.Location.getPath().contains("StandaloneEditor.html")) {
            RootLayoutPanel.get().add(new StandaloneEditorManager(clientFactory, eventBus).getBaseLayout());
View Full Code Here

TOP

Related Classes of com.google.gwt.event.shared.SimpleEventBus

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.