Package de.hpi.eworld.observer

Examples of de.hpi.eworld.observer.NotificationType


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

      switch (type) {
        case itemClicked:
          clearSelection();
 
View Full Code Here


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

      switch (notificationType) {
        case itemClicked:
          Object item = notification.getObj1();
          if (item instanceof StreetBarrierView) {
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();
      final CardLayout propertyPaneLayout = (CardLayout) propertyPane
          .getLayout();

      switch (type) {
        case itemClicked:
View Full Code Here

  @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 '"
            + arg.getClass().getSimpleName() + "'.", e);
View Full Code Here

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

      // we're going to make some assumptions about the class of some
      // objects returned from the notification. those might be wrong,
      // hence the try/catch with ClassCastException.
      try {
        if (type.equals(NotificationType.elementAdded)) {
          if (!exportToVanetAction.isEnabled()) {
            exportToVanetAction.setEnabled(true);
          }
        } else if (type.equals(NotificationType.modelCleared)) {
          exportToVanetAction.setEnabled(false);
        }
      } catch (final ClassCastException e) {
        // if any of the class casts were illegal; complain.
        throw new IllegalArgumentException("ObserverNotification holds objects of unexpected type.", e);
View Full Code Here

  @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 (type.equals(NotificationType.loadFromFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          final Collection<?> items = (Collection<?>) notification.getObj2();
          if (this == plugin) {
            loadFromFile(items);
          }
        } else if (type.equals(NotificationType.clearModel)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          if (this == plugin) {
            clearModel();
          }
        }
        if (type.equals(NotificationType.saveToFile)) {
          final PersistenceProviderInterface plugin = (PersistenceProviderInterface) notification.getObj1();
          @SuppressWarnings("unchecked")
          final Collection<Object> items = (Collection<Object>) notification.getObj2();
          if (this == plugin) {
            saveToFile(items);
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 simulationError:
          handleSimulationException((Exception) notification.getObj1());
          break;
        case simulationStepping:
View Full Code Here

    if (!(arg instanceof ObserverNotification)) {
      return;
    }
    // cast notification and type.
    final ObserverNotification notification = (ObserverNotification) arg;
    final NotificationType type = notification.getType();
    if (!(type == NotificationType.itemButtonClicked
      ||type == NotificationType.itemDoubleClicked)) {
      return;
    }
    if (!(notification.getObj1() instanceof TrafficLightView)) {
View Full Code Here

  }

  @Override
  public void update(Observable o, Object arg) {
    final ObserverNotification notification = (ObserverNotification) arg;
    final NotificationType type = notification.getType();
   
    if (type.equals(NotificationType.updateSignal)) {
      if(arg instanceof Integer) {
        setProgressValue((Integer) arg);
      }
    }
  }
View Full Code Here

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

      // we're going to make some assumptions about the class of some
      // objects returned from the notification. those might be wrong,
      // hence the try/catch with ClassCastException.
      try {
        if (type.equals(NotificationType.elementAdded)) {
          if (!MainWindowActions.MAP_PROPERTIES.isEnabled()) {
            MainWindowActions.MAP_PROPERTIES.setEnabled(true);
          }
        } else if (type.equals(NotificationType.modelCleared)) {
          if (MainWindowActions.MAP_PROPERTIES.isEnabled()) {
            MainWindowActions.MAP_PROPERTIES.setEnabled(false);
          }
        }
      } catch (final ClassCastException e) {
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.