Examples of Observer


Examples of java.util.Observer

    }
   
    this.radioMedium = radioMedium;
   
    // Register as radio medium observer
    radioMedium.addRadioMediumObserver(new Observer() {
      public void update(Observable obs, Object obj) {
        handleRadioMediumChange();
      }
    });
  }

Examples of java.util.Observer

    }

    // Forward serial interface to out pipe
    serialInterface = mote.getInterfaces().getInterfaceOfType(
        ContikiRS232.class);
    serialInterface.addObserver(serialObserver = new Observer() {
      public void update(Observable obs, Object obj) {
        // Start shell process which forwards the data
        try {
          Runtime.getRuntime().exec(
              new String[] {

Examples of java.util.Observer

            Runtime.getRuntime().addShutdownHook( m_hook );
        }

        // If an Observer is present in the data object, then add it as an observer for
        //  m_observable
        Observer observer = (Observer)data.get( Observer.class.getName() );
        if( null != observer )
        {
            addObserver( observer );
        }

Examples of java.util.Observer

        throws ContextException
    {
        m_context = context;
        try
        {
            final Observer observer = (Observer)context.get( Observer.class.getName() );
            m_observable.addObserver( observer );
        }
        catch( final ContextException ce )
        {
            final String message = REZ.getString( "embeddor.notice.no-restart" );

Examples of java.util.Observer

   
    mainPanel = new JPanel();
   
    this.logger = Logger.getLogger(this.getClass());
    StatisticsDataManager smm = StatisticsDataManager.getInstance();
    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();

Examples of java.util.Observer

   * @param networkView
   */
  public void setNetworkView(GraphController networkView) {
    visualizeWidget.setNetworkView(networkView);
   
    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();

Examples of java.util.Observer

        getClass().getClassLoader(), "export.png", 16));
    menu.add(exportToSumoAction);
    exportToSumoAction.addActionListener(new ExportItemListener(this));
    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 ) {

Examples of lib.patterns.observer.Observer

    subscribers.remove(observer);
  }

  public void notifyObservers() {
    for (Iterator it = subscribers.iterator(); it.hasNext();) {
      Observer observer = (Observer) it.next();
      try {
        observer.notify(this);
      } catch (RemoteException e) {
        e.printStackTrace();
      } catch (ObjectNotValidException e) {
        e.printStackTrace();
      } catch (ObjectNotFoundException e) {

Examples of lib.patterns.observer.Observer

    subscribers.remove(observer);
  }

  public void notifyObservers() {
    for (Iterator it = subscribers.iterator(); it.hasNext();) {
      Observer observer = (Observer) it.next();
      try {
        observer.notify(this);
      } catch (RemoteException e) {
        e.printStackTrace();
      } catch (ObjectNotValidException e) {
        e.printStackTrace();
      } catch (ObjectNotFoundException e) {

Examples of lib.patterns.observer.Observer

    subscribers.remove(observer);
  }

  public void notifyObservers() {
    for (Iterator<Observer> it = subscribers.iterator(); it.hasNext();) {
      Observer observer = (Observer) it.next();
      try {
        observer.notify(this);
      } catch (RemoteException e) {
        e.printStackTrace();
      } catch (ObjectNotValidException e) {
        e.printStackTrace();
      } catch (ObjectNotFoundException e) {
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.