Examples of ObserverNotification


Examples of de.hpi.eworld.observer.ObserverNotification

   *            The new position as double[] (index 0 = x, index 1 = y)
   */
  public void setPosition(final double[] position) {
    this.position = position;
    setChanged();
    notifyObservers(new ObserverNotification(NotificationType.elementChanged, this));
    clearChanged();
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

   * Creates a graphics item and adds it to the network view
   *
   * @param builder
   */
  public void addVolatileModelElement(final VolatileModelElement modelElement) {
    substituteObservable.fireNotifyObservers(new ObserverNotification(NotificationType.volatileModelElementAdded, modelElement));
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

   * Removes the model element from the network view
   *
   * @param builder
   */
  public void removeVolatileModelElement(final VolatileModelElement modelElement) {
    substituteObservable.fireNotifyObservers(new ObserverNotification(NotificationType.volatileModelElementRemoved, modelElement));
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

  }

  @Override
  public void update(final Observable o, final Object arg) {
    if (arg instanceof ObserverNotification) {
      final ObserverNotification notification = (ObserverNotification) arg;
      final NotificationType type = notification.getType();

      try {
        if (!(notification.getObj1() instanceof GraphicsView<?>))
          return;
        if (type.equals(NotificationType.itemClicked)) {

          timeline.onViewItemClicked((GraphicsView<?>) notification.getObj1());
        } else if (type.equals(NotificationType.itemMousePressed)) {
          timeline.onMousePressed((GraphicsView<?>) notification.getObj1());
        } else if (type.equals(NotificationType.freeSpaceClicked)) {
          timeline.onFreeSpaceClicked();
        }
      } catch (final ClassCastException e) {
        throw new IllegalArgumentException("ObserverNotification holds objects of unexpected type '"
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    } catch( SAXException e ) {
      throw new RuntimeException(e);
    } finally {
      modelManager.setChanged();
      modelManager.notifyObservers(
        new ObserverNotification(
          NotificationType.endBatchProcess,
          new Boolean(true),
          new Boolean(missingData)
        )
      );
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

      if(interrupted) {
        throw new ImportInterruptedException("Process stopped by user");
      }
      setChanged();
      int progressValue = (int)(currentStream.progress() * 100);
      notifyObservers(new ObserverNotification(NotificationType.progress, progressValue));
      //
      // node
      //
      if( qualifiedName.equals( "node" ) ) {
        currentAttributes.clear();
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    exportToSumoAction.setEnabled(false);

    ModelManager.getInstance().addObserver(new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        ObserverNotification notification = (ObserverNotification) arg;
       
        if( notification.getType() == NotificationType.elementAdded ) {
          onModelElementAdded((ModelElement) notification.getObj1());
        }
      }
    });

    ModelManager.getInstance().addObserver(new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        ObserverNotification notification = (ObserverNotification) arg;
       
        if( notification.getType() == NotificationType.modelCleared ) {
          onModelCleared();
        }
      }
    });   
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    logger.debug("now try to import");
    try {
      final ModelManager modelManager = ModelManager.getInstance();
      modelManager.setChanged();
      modelManager.notifyObservers(new ObserverNotification(NotificationType.startBatchProcess));
      osm = new Osm2Model(pedestrian, filterCyclic);
      osm.addObserver(this);

      boolean missingData = false;
      if (length >= 0) {
        logger.debug("parse file");
        osm.parseFile(inputStream, length);
      } else {
        missingData = osm.parseFile(inputStream);
      }

      setChanged();
      if (osm.somethingImported()) {
        logger.debug("osm.somethingImported() true");
        notifyObservers(new ObserverNotification(NotificationType.done, null));
        logger.debug("notified");
      } else {
        logger.debug("osm.somethingImported() false");
        notifyObservers(new ObserverNotification(NotificationType.nothing, null));
        logger.debug("notified");
      }

      if (!osm.wasInterrupted()) {
        logger.debug("!osm.wasInterrupted()");
        modelManager.setChanged();
        modelManager.notifyObservers(
          new ObserverNotification(
            NotificationType.endBatchProcess,
            new Boolean(filterDuplicateEdges),
            new Boolean(missingData)
          )
        );
      }
      logger.debug("end reached");

    } catch (final IOException e) {
      logger.error("Error occured during OSM file import", e);
      notifyObservers(new ObserverNotification(NotificationType.failed));
    }
    logger.debug("leave run");
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

    if (osm != null) {
      osm.interrupt();
    }

    setChanged();
    notifyObservers(new ObserverNotification(NotificationType.failed, failure));
  }
View Full Code Here

Examples of de.hpi.eworld.observer.ObserverNotification

      exportToSumoAction.setEnabled(false);
     
      elementAddedObserver = new Observer() {
      @Override
      public void update(Observable o, Object arg) {
        ObserverNotification notification = (ObserverNotification) arg;
       
        if( notification.getType() == NotificationType.elementAdded ) {
          onModelElementAdded((ModelElement) notification.getObj1());
        }
      }
    };
     
      ModelManager.getInstance().addObserver(elementAddedObserver);
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.