Esempio n. 1
0
    /**
     * Set the display for the data
     *
     * @param isEmpty true if the data is null
     * @throws RemoteException Java RMI error
     * @throws VisADException problem creating VisAD object
     */
    public synchronized void setDisplay(boolean isEmpty) throws VisADException, RemoteException {

      if (isEmpty) {
        for (Iterator iter = extantDatums.iterator(); iter.hasNext(); ) {
          ((DataAdapter) iter.next()).addTo();
        }
      } else {
        for (Iterator iter = obsoleteDatums.iterator(); iter.hasNext(); ) {
          ((DataAdapter) iter.next()).removeFrom();
        }
      }

      obsoleteDatums.clear();

      for (Iterator iter = changedDatums.iterator(); iter.hasNext(); ) {
        DataAdapter adapter = (DataAdapter) iter.next();

        adapter.addTo();
        iter.remove();
        extantDatums.add(adapter);
      }

      for (Iterator iter = newDatums.iterator(); iter.hasNext(); ) {
        DataAdapter adapter = (DataAdapter) iter.next();

        adapter.addTo();
        iter.remove();
        extantDatums.add(adapter);

        // Add listener now so fewest notifications.
        adapter.addPropertyChangeListener(adapter.CONSTANT_MAP, listener);
      }

      changed = false;
    }
Esempio n. 2
0
    /**
     * Set that this data is obsolete or not
     *
     * @param adapter adapted data
     */
    public synchronized void setObsolete(DataAdapter adapter) {

      if (newDatums.contains(adapter)) {
        newDatums.remove(adapter);
      } else {
        java.util.Set set =
            extantDatums.contains(adapter)
                ? extantDatums
                : changedDatums.contains(adapter) ? changedDatums : null;

        if (set != null) {

          // Remove listener now so fewest notifications.
          adapter.removePropertyChangeListener(adapter.CONSTANT_MAP, listener);
          set.remove(adapter);
          obsoleteDatums.add(adapter);

          changed = true;

          updater.update();
        }
      }
    }