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:
          Object item = notification.getObj1();
          if (item instanceof WayView) {
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.sumoDumpThreadProgress)) {
            progressDialog.setProgressValue((Integer) arg);
          } else if(type.equals(NotificationType.sumoDumpThreadDone)) {
            threadDone();
          } else if(type.equals(NotificationType.sumoDumpThreadFailed)) {
            threadFailed();
          }
        }
      }
    });
View Full Code Here

    smm.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.displayInfoBox)) {
            showInfoBox((String) notification.getObj1(), (String) notification.getObj2());
          }
        }
      }
    });
   
    //setAllowedAreas(Qt.DockWidgetArea.RightDockWidgetArea, Qt.DockWidgetArea.LeftDockWidgetArea);
//    setTitle(title);
    tabWidget = new JPanel();
    tabWidget.setMinimumSize(new Dimension(150, 200));
    tabWidget.setMaximumSize(new Dimension(235,9999));

    // statDataWidget
    // ------------------------------------------------------------
    statDataWidget = new JPanel();
    GridBagLayout dataLayout = new GridBagLayout();

    listModel = new DefaultListModel<ListValue>();
    datasetsList = new JList<Object>();
   
    datasetsListPopup = new JPopupMenu();
    datasetsListPopup.addPopupMenuListener(new PopupMenuListener() {
      @Override
      public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
        displayDatasetItem((ListValue) e.getSource());
      }
     
      @Override
      public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {}
     
      @Override
      public void popupMenuCanceled(PopupMenuEvent e) {}
    });
   
    // context actions
    JMenuItem showPropertiesAction = new JMenuItem("Properties");
    showPropertiesAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        showProperties();
      }
    });
    datasetsListPopup.add(showPropertiesAction);
   
    JMenuItem showChartsAction = new JMenuItem("Show charts");
    showChartsAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        showCharts();
      }
    });
    datasetsListPopup.add(showChartsAction);
   
    showOnMapAction = new JMenuItem("Show on map");
    showOnMapAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        initShowOnMap();
      }
    });
    datasetsListPopup.add(showOnMapAction);
   
    JMenuItem showRawAction = new JMenuItem("Open data file");
    showRawAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        showRawData();
      }
    });
    datasetsListPopup.add(showRawAction);
   
    JMenuItem renameSetAction = new JMenuItem("Rename");
    renameSetAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        onRenameDataset();
      }
    });
    datasetsListPopup.add(renameSetAction);
   
    JMenuItem deleteSetAction = new JMenuItem("Remove");
    deleteSetAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        onDeleteDataset();
      }
    });
    datasetsListPopup.add(deleteSetAction);
   
    JMenuItem deleteAllAction = new JMenuItem("Remove all");
    deleteAllAction.addMouseListener(new MouseAdapter() {
      @Override
      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        onDeleteAllDatasets();
      }
    });
    datasetsListPopup.add(deleteAllAction);

    //datasetsList.setContextMenuPolicy(Qt.ContextMenuPolicy.NoContextMenu);
    datasetsList.addListSelectionListener(new ListSelectionListener() {
      @Override
      public void valueChanged(ListSelectionEvent e) {
        checkBelongingToMap();
      }
    });
   
    statAutoImport = new JCheckBox("Automatically import data");
    statAutoImport.setToolTipText("Import of the SUMO dump data will be triggered automatically when the simulation finishes");
    statAutoImport.setSelected(true);

    final GridBagConstraints datasetsListConstraints = new GridBagConstraints();
    datasetsListConstraints.gridx = 0;
    datasetsListConstraints.gridy = 0;
    datasetsListConstraints.fill = GridBagConstraints.HORIZONTAL;
    dataLayout.setConstraints(datasetsList, datasetsListConstraints);
    mainPanel.add(datasetsList);
   
    final GridBagConstraints statAutoImportConstraints = new GridBagConstraints();
    statAutoImportConstraints.gridx = 1;
    statAutoImportConstraints.gridy = 0;
    statAutoImportConstraints.gridwidth = 1;
    statAutoImportConstraints.fill = GridBagConstraints.HORIZONTAL;
    dataLayout.setConstraints(statAutoImport, statAutoImportConstraints);
    mainPanel.add(statAutoImport);

    statDataWidget.setLayout(dataLayout);


    //simulationDock.set(tabWidget.indexOf(statDataWidget));

    smm.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.datasetsChanged)) {
            onDatasetsChanged();
          }
        }
      }
    });
   
    smm.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.datasetsCleared)) {
            onDatasetsCleared();
          }
        }
      }
    });
View Full Code Here

    networkView.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.endBatchProcess)) {
            onBatchEnded();
          }
        }
      }
    });
   
    networkView.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.startBatchProcess)) {
            visualizeWidget.stopShowOnMap();
          }
        }
      }
    });
View Full Code Here

  @SuppressWarnings("rawtypes")
  @Override
  public void update(Observable o, Object arg) {
    if (arg instanceof ObserverNotification) {
      ObserverNotification notification = (ObserverNotification) arg;
      NotificationType type = notification.getType();
     
      // dispatch events to methods handling a special event
      switch (type) {
        case itemButtonClicked:
          onItemButtonClicked((AbstractView) notification.getObj1(), (AbstractButton)notification.getObj2());
View Full Code Here

  @Override
  public void update(Observable o, 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.
      switch (type) {
      case startBatchProcess:
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();

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

    simulationStatistic.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.simulationStatisticClosed)) {
            onSimulationStatisticClosed();
          }
        }
      }
    });
   
    dump = new SumoDump();
    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.importSuccessful)) {
            onNewImport();
          }
        }
      }
    });
   
    /*
    StatisticsDataManager.getInstance().sumoSimDone.connect(
        this, "onSimulationFinished(String)");
    */
    TriggerSumo.getInstance().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.sumoDone)) {
            onSimulationFinished((String) arg);
          }
        }
      }
    });
View Full Code Here

    this.visualizerPlugin.getSimControlToolbar().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.simulationFinished)) {
            onSimulationFinished((String) arg);
          }
        }
      }
    });
View Full Code Here

  @Override
  public synchronized 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

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.