Ejemplo n.º 1
0
    /**
     * Set whether the data has changed
     *
     * @param adapter adapted data
     */
    public synchronized void setChanged(DataAdapter adapter) {

      if (extantDatums.contains(adapter)) {
        extantDatums.remove(adapter);
        changedDatums.add(adapter);

        changed = true;

        updater.update();
      }
    }
Ejemplo n.º 2
0
    /**
     * Add data
     *
     * @param adapter adapted data
     */
    public synchronized void add(DataAdapter adapter) {

      newDatums.add(adapter);

      changed = true;

      updater.update();
    }
Ejemplo n.º 3
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;
    }
Ejemplo n.º 4
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();
        }
      }
    }