Package com.google.gwt.event.shared

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


  @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

                    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

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

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

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

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

   }

   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

   }

   @Override
   public HandlerRegistration addEnsureVisibleHandler(EnsureVisibleHandler handler)
   {
      return new HandlerRegistration()
      {
         public void removeHandler()
         {
         }
      };
View Full Code Here

      };
   }
  
   public HandlerRegistration addEnsureHeightHandler(EnsureHeightHandler handler)
   {
      return new HandlerRegistration()
      {
         public void removeHandler()
         {
         }
      };
View Full Code Here

TOP

Related Classes of com.google.gwt.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.