Example #1
0
    /**
     * @param source
     * @param oldScalarMap The previous ScalarMap of the ScalarMapAdapter. May be <code>null</code>.
     * @return The controlling ScalarMapAdapter of the display.
     * @throws RemoteException
     * @throws VisADException
     */
    protected final synchronized ScalarMapAdapter accept(
        ScalarMapAdapter source, ScalarMap oldScalarMap) throws VisADException, RemoteException {

      ScalarMapAdapter adapter;

      if (oldScalarMap != null) {
        adapter = (ScalarMapAdapter) map.get(oldScalarMap);

        if ((adapter != null) && (adapter == source)) {
          map.remove(oldScalarMap);

          changed = true;
        }
      }

      ScalarMap newScalarMap = source.getScalarMap();

      adapter = (ScalarMapAdapter) map.get(newScalarMap);

      if (adapter != null) {
        source.duplicate(adapter);
      } else {
        adapter = source;

        map.put(newScalarMap, source);

        changed = true;
      }

      if (changed) {
        updater.update();
      }

      return adapter;
    }
Example #2
0
    /**
     * Remove an adapter
     *
     * @param adapter adapter to remove
     */
    public final synchronized void remove(ScalarMapAdapter adapter) {

      adapter.removePropertyChangeListener(adapter.SCALAR_MAP, listener);

      ScalarMap scalarMap = adapter.getScalarMap();
      ScalarMapAdapter source = (ScalarMapAdapter) map.get(scalarMap);

      if ((source != null) && (source == adapter)) {
        map.remove(scalarMap);

        changed = true;

        updater.update();
      }
    }
Example #3
0
    /**
     * Set the display.
     *
     * @throws RemoteException Java RMI error
     * @throws VisADException problem creating VisAD object
     */
    protected synchronized void setDisplay() throws VisADException, RemoteException {

      for (Iterator iter = map.values().iterator(); iter.hasNext(); ) {
        ((ScalarMapAdapter) iter.next()).setDisplay();
      }

      changed = false;
    }