Package java.util

Examples of java.util.Observer


    });        
        parentMenu.add(configureServerMenu);
       
        progress.setModal(true);
       
    ModelManager.getInstance().addObserver(new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        if (arg instanceof ObserverNotification) {
          final ObserverNotification notification = (ObserverNotification) arg;
          final NotificationType type = notification.getType();
         
          if (type.equals(NotificationType.elementAdded)) {
            if(arg instanceof ModelElement) {
              onModelElementAdded((ModelElement) arg);
            }
          }
        }
      }
    });
   
    ModelManager.getInstance().addObserver(new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        if (arg instanceof ObserverNotification) {
          final ObserverNotification notification = (ObserverNotification) arg;
          final NotificationType type = notification.getType();
View Full Code Here


      //on really large maps, the value specified here
      //may not be enough
      if (automaticImport)
        Thread.sleep(2000);
     
      dump.addObserver(new Observer() {
        @Override
        public void update(Observable o, Object arg) {
          if (arg instanceof ObserverNotification) {
            final ObserverNotification notification = (ObserverNotification) arg;
            final NotificationType type = notification.getType();
View Full Code Here

    lanesChangeListener = new ValueChangeListener(this);
    priorityChangeListener = new ValueChangeListener(this);
    maxSpeedChangeListener = new ValueChangeListener(this);
    poiDescriptionActionListener = new TextChangeListener(this);

    elementChangedObserver = new Observer() {
      @Override
      public void update(final Observable o, final Object arg) {
        if (arg instanceof ObserverNotification) {
          ObserverNotification notification = (ObserverNotification) arg;
          NotificationType type = notification.getType();
View Full Code Here

      public synchronized void deleteObserver(Observer o)
      {
         for(WeakReference<Observer> w : observer)
         {
            Observer tmp = w.get();
            if(tmp.equals(o))
            {
               observer.remove(o);
               break;
            }
View Full Code Here

      {
         if(hasChanged())
         {
            for(WeakReference<Observer> w : observer)
            {
               Observer tmp = w.get();
               tmp.update(this, arg);

            }
         }
      }
View Full Code Here

        }
    }

    @Test
    public void should_instantiate_type_if_resolver_provide_matching_types() throws Exception {
        Observer observer = mock(Observer.class);
        Map map = mock(Map.class);
        given(resolver.resolveTypeInstances(Matchers.<Class<?>[]>anyVararg())).willReturn(new Object[]{ observer, map });

        new ParameterizedConstructorInstantiator(this, field("withMultipleConstructor"), resolver).instantiate();
View Full Code Here

        assertNotNull(withMultipleConstructor.map);
    }

    @Test
    public void should_fail_if_an_argument_instance_type_do_not_match_wanted_type() throws Exception {
        Observer observer = mock(Observer.class);
        Set wrongArg = mock(Set.class);
        given(resolver.resolveTypeInstances(Matchers.<Class<?>[]>anyVararg())).willReturn(new Object[]{ observer, wrongArg });

        try {
            new ParameterizedConstructorInstantiator(this, field("withMultipleConstructor"), resolver).instantiate();
View Full Code Here

    }
   
    @Test
    public void should_report_argument_locations_when_argument_matchers_misused() {
        try {
          Observer observer = mock(Observer.class);
         
          misplaced_anyInt_argument_matcher();
          misplaced_anyObject_argument_matcher();
          misplaced_anyBoolean_argument_matcher();
         
          observer.update(null, null);
         
          validateMockitoUsage();
          fail();
        } catch (InvalidUseOfMatchersException e) {
            assertContains("DetectingMisusedMatchersTest.misplaced_anyInt_argument_matcher", e.getMessage());
View Full Code Here

        if ( o == null )
        {
            o = new RequestObservable();
        }
       
        o.addObserver( new Observer()
        {
            public void update( Observable o, Object arg )
            {
                listener.requestAbandoned( AbstractAbandonableRequest.this );
            }
View Full Code Here

        }
        if(observers == null) {
            observers = new Observer[1];
            observers[0] = o;
        } else {
            final Observer n[] = new Observer[observers.length + 1];
            System.arraycopy(observers, 0, n, 0, observers.length);
            n[observers.length] = o;
            observers = n;
        }
    }
View Full Code Here

TOP

Related Classes of java.util.Observer

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.