Package de.hpi.eworld.observer

Examples of de.hpi.eworld.observer.NotificationType


    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.modelCleared)) {
            onNewModel();
          }
        }
      }
    });
View Full Code Here


    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();
         
          if (type.equals(NotificationType.modelCleared)) {
            onModelCleared();
          }
        }
      }
    });
View Full Code Here

  @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);
        }
      }
    }
View Full Code Here

    if (arg instanceof ObserverNotification) {

      // cast notification and type.
      final ObserverNotification notification = (ObserverNotification) arg;
      final NotificationType type = notification.getType();

      logger.debug("Received notification: " + type.toString());
      switch (type) {
      case configFinished:
        storeSimulationSettings((SimulationSettings) notification.getObj1());
        break;
      case simulationError:
View Full Code Here

    if (arg instanceof ObserverNotification) {

      // cast notification and type.
      final ObserverNotification notification = (ObserverNotification) arg;
      final NotificationType type = notification.getType();

      logger.debug("Received notification: " + type.toString());
      switch (type) {
      case exportSuccessful:
        exportSuccessful();
        finished();
      case convertSuccessful:
        convertSuccessful();
        break;
      case convertFailed:
        convertFailed((String) notification.getObj1());
        break;
      case netFileSuccessful:
        netFileSuccessful();
        break;
      case netFileFailed:
        netFileFailed((String) notification.getObj1());
        break;
      case rouFileSuccessful:
        rouFileSuccessful();
        break;
      case rouFileFailed:
        rouFileFailed((String) notification.getObj1());
        break;
      case cfgFileSuccessful:
        cfgFileSuccessful();
        break;
      case cfgFileFailed:
        cfgFileFailed((String) notification.getObj1());
        break;
      case tlsFileSuccessful:
        tlsFileSuccessful();
        break;
      case tlsFileFailed:
        tlsFileFailed((String) notification.getObj1());
        break;
      case addFileSuccessful:
        addFileSuccessful();
        break;
      case addFileFailed:
        addFileFailed((String) notification.getObj1());
        break;
      case sumoFilesSavedTo:
        break;
      default:
        final Throwable stack = new RuntimeException();
        logger.warn("Recieved unexpected notification type: " + type.toString(), stack);
      }

    } else {

      // if argument was not handled until now, it is of unknown type.
View Full Code Here

    importThread.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.sumoDumpThreadDone)) {
            threadDone();
          }
        }
      }
    });
    importThread.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.sumoDumpThreadFailed)) {
            threadFailed();
          }
        }
      }
    });
View Full Code Here

    dialog.observable.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.dataImported)) {
            dialog.observable.notifyObservers(new ObserverNotification(NotificationType.importSuccessful));
          }
        }
      }
    });
View Full Code Here

      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();
           
            if (type.equals(NotificationType.sumoDump2ModelProgress)) {
              progress((Integer) arg);
            }
          }
        }
      });
View Full Code Here

   */
  @Override
  public void update(Observable o, Object arg) {
    if (arg != null && arg instanceof ObserverNotification) {
      ObserverNotification notification = (ObserverNotification) arg;
      NotificationType type = notification.getType();

      switch (type) {
        case modelCleared:
          createCity();
          break;
View Full Code Here

    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();
          Object notificationData = notification.getObj1();

          if (type.equals(NotificationType.elementChanged)) {
            displayInformation((ModelElement) notificationData);
          }
        }
      }
    };
View Full Code Here

TOP

Related Classes of de.hpi.eworld.observer.NotificationType

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.