Beispiel #1
0
  /**
   * Adds this instance to a VisAD display. This method is package private because it is expected
   * that only the constructor's DisplayAdapter argument will invoke this method.
   *
   * @throws VisADException VisAD failure.
   * @throws RemoteException Java RMI failure.
   */
  void addTo() throws VisADException, RemoteException {

    display.addReferences(
        dataRenderer,
        dataReference,
        (constantMaps == null) ? null : constantMaps.getConstantMaps());
  }
Beispiel #2
0
    /**
     * Remove a set of ConstantMaps
     *
     * @param constantMaps ConstantMaps to remove
     * @throws RemoteException Java RMI error
     * @throws VisADException problem creating VisAD object
     */
    public final synchronized void remove(ConstantMaps constantMaps)
        throws VisADException, RemoteException {

      constantMaps.removePropertyChangeListener(ConstantMaps.CONSTANT_MAP, listener);
      maps.remove(constantMaps);

      changed = true;

      updater.update();
    }
Beispiel #3
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();
    }
Beispiel #4
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);
  }