Exemple #1
0
    /**
     * @param constantMaps
     * @throws BadMappingException A ConstantMap for the DisplayRealType already exists.
     * @throws RemoteException
     * @throws VisADException
     */
    public final synchronized void add(ConstantMaps constantMaps)
        throws BadMappingException, VisADException, RemoteException {

      maps.add(constantMaps);
      constantMaps.addPropertyChangeListener(ConstantMaps.CONSTANT_MAP, listener);

      changed = true;

      updater.update();
    }
Exemple #2
0
  /**
   * Constructs. This is the most general constructor.
   *
   * @param displayAdapter The adapted display.
   * @param dataReference The reference to the datum.
   * @param constantMaps The constant maps for the datum. May be <code>null</code>.
   * @param renderer The renderer for the data. May be <code>null</code>. If non-<code>null</code>,
   *     then must not have been used before.
   * @throws VisADException The DataRenderer is already in-use for other data.
   * @throws RemoteException Java RMI failure.
   */
  public DataAdapter(
      DisplayAdapter displayAdapter,
      DataReference dataReference,
      ConstantMaps constantMaps,
      DataRenderer renderer)
      throws VisADException, RemoteException {

    display = displayAdapter.getDisplay();

    if (renderer != null) {
      if (rendererTable.get(renderer) != null) {
        throw new VisADException(
            getClass().getName() + ".<init>: " + "DataRenderer already in-use for other data");
      }

      rendererTable.put(renderer, this);
    }

    if (constantMaps == null) {
      mapAdapterListener = null;
    } else {
      mapAdapterListener =
          new PropertyChangeListener() {

            public void propertyChange(PropertyChangeEvent event) {

              PropertyChangeEvent newEvent =
                  new PropertyChangeEvent(
                      DataAdapter.this, CONSTANT_MAP, event.getOldValue(), event.getNewValue());

              newEvent.setPropagationId(event.getPropagationId());
              firePropertyChange(newEvent);
            }
          };

      constantMaps.addPropertyChangeListener(constantMaps.CONSTANT_MAP, mapAdapterListener);
    }

    this.dataReference = dataReference;
    this.constantMaps = constantMaps;
    dataRenderer = renderer;

    displayAdapter.add(this);
  }