Examples of HandlerRegistration


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

  @Test
  public void testApplyScale() {
    Assert.assertEquals(4.0, viewPort.getScale());
    Assert.assertNull(event);

    HandlerRegistration reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowScalingHandler());

    viewPort.applyScale(2.0);
    Assert.assertEquals(2.0, viewPort.getScale());
    Assert.assertNotNull(event);
    Assert.assertTrue(event instanceof ViewPortScaledEvent);

    reg.removeHandler();
  }
View Full Code Here

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

  public void testApplyBounds() {
    Assert.assertEquals(4.0, viewPort.getScale());
    Assert.assertNull(event);
    GeometryFactory factory = new GeometryFactoryImpl();

    HandlerRegistration reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowChangedHandler());

    // Now a changed event should occur:
    viewPort.applyBounds(factory.createBbox(0, 0, 100, 100));
    Assert.assertEquals(8.0, viewPort.getScale());
    Assert.assertNotNull(event);
    Assert.assertTrue(event instanceof ViewPortChangedEvent);

    reg.removeHandler();
    reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowTranslationHandler());

    // Expect to end up at the same scale, so no changed event, but translation only:
    viewPort.applyBounds(factory.createBbox(-50, -50, 100, 100));
    Assert.assertEquals(8.0, viewPort.getScale());
    Assert.assertNotNull(event);
    Assert.assertTrue(event instanceof ViewPortTranslatedEvent);

    reg.removeHandler();
  }
View Full Code Here

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

  @Test
  public void testApplySameBounds() {
    Assert.assertEquals(4.0, viewPort.getScale());
    Assert.assertNull(event);

    HandlerRegistration reg = eventBus.addHandler(ViewPortChangedHandler.TYPE, new AllowNoEventsHandler());

    viewPort.applyBounds(viewPort.getBounds());
    Assert.assertNull(event);

    reg.removeHandler();
  }
View Full Code Here

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

                    if (unloadHandlerReg != null) {
                        unloadHandlerReg.removeHandler();
                    }

                    UnloadHandler handler = new UnloadHandler();
                    final HandlerRegistration reg1 = LoadRegister.addBeforeUnloadHandler(handler);
                    final HandlerRegistration reg2 = LoadRegister.addUnloadHandler(handler);
                    unloadHandlerReg = new HandlerRegistration() {
                        @Override
                        public void removeHandler() {
                            reg1.removeHandler();
                            reg2.removeHandler();
                        }
                    };

                    doConnect();
                }
View Full Code Here

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

  }
 
  @Override
  public HandlerRegistration addChangeHandler(final ChangeHandler handler) {
    changeHandlers.add(handler);
  return new HandlerRegistration() {
    @Override
    public void removeHandler() {
      changeHandlers.remove(handler);
    }
  };
View Full Code Here

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

  }
 
  @Override
  public HandlerRegistration addClickHandler(final ClickHandler handler) {
    clickHandlers.add(handler);
  return new HandlerRegistration() {
    @Override
    public void removeHandler() {
      clickHandlers.remove(handler);
    }
  };
View Full Code Here

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

  }
 
  @Override
  public HandlerRegistration addFocusHandler(final FocusHandler handler) {
    focusHandlers.add(handler);
  return new HandlerRegistration() {
    @Override
    public void removeHandler() {
      focusHandlers.remove(handler);
    }
  };
View Full Code Here

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

  }
 
  @Override
  public HandlerRegistration addLoadHandler(final LoadHandler handler) {
    loadHandlers.add(handler);
  return new HandlerRegistration() {
    @Override
    public void removeHandler() {
      loadHandlers.remove(handler);
    }
  };
View Full Code Here

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

   }

   public HandlerRegistration addVcsRefreshHandler(VcsRefreshHandler handler,
                                                   boolean fireOnAdd)
   {
      HandlerRegistration hreg = handlers_.addHandler(
            VcsRefreshEvent.TYPE, handler);

      if (fireOnAdd && isInitialized())
         handler.onVcsRefresh(new VcsRefreshEvent(Reason.VcsOperation));
View Full Code Here

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

   }

   @Override
   public HandlerRegistration addEnsureVisibleHandler(EnsureVisibleHandler handler)
   {
      return new HandlerRegistration()
      {
         public void removeHandler()
         {
         }
      };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.