  public boolean prepareData() throws VisADException, RemoteException {
    int[] indices;
    int[] display_indices;
    int[] value_indices;
    int levelOfDifficulty;
    data = ((DataReference) ref).getData();
    if (data == null) {
      renderer.addException(
        new DisplayException("DataDisplayLink.prepareData: Data is null"));
      return false;
    }
    MathType type = data.getType();
    SelectedMapVector.removeAllElements();
    int n = ((DisplayImpl) local_action).getDisplayScalarCount();
    defaultValues = new float[n];
    for (int i=0; i<n; i++) {
      defaultValues[i] = (float) (((DisplayRealType)
        ((DisplayImpl) local_action).getDisplayScalar(i)).getDefaultValue());
    }
    Vector temp =
      (Vector) ((DisplayImpl) local_action).getConstantMapVector().clone();
    Enumeration maps = temp.elements();
    while(maps.hasMoreElements()) {
      ConstantMap map = (ConstantMap) maps.nextElement();
      defaultValues[map.getDisplayScalarIndex()] = (float) map.getConstant();
    }
    maps =((Vector) ConstantMapVector.clone()).elements();
    while(maps.hasMoreElements()) {
      ConstantMap map = (ConstantMap) maps.nextElement();
      defaultValues[map.getDisplayScalarIndex()] = (float) map.getConstant();
    }
    try {
      renderer.clearExceptions();
      shadow = type.buildShadowType(this, null);
      ShadowType adaptedShadow = shadow.getAdaptedShadowType();
      indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getScalarCount());
      display_indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getDisplayScalarCount());
      value_indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getValueArrayLength());
      Vector controls = ((DisplayImpl) local_action).getControlVector();
      isTransform = new boolean[controls.size()];
      for (int i=0; i<controls.size(); i++) isTransform[i] = false;
      levelOfDifficulty =
        shadow.checkIndices(indices, display_indices, value_indices,
                              isTransform, ShadowType.NOTHING_MAPPED);
      if (levelOfDifficulty == ShadowType.LEGAL) {
        for (int i=0; i<controls.size(); i++) isTransform[i] = true;
      }
      renderer.checkDirect();
    }
    catch (BadMappingException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    catch (UnimplementedException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    catch (RemoteException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    return true;
  }

  public boolean prepareData() throws VisADException, RemoteException {
    int[] indices;
    int[] display_indices;
    int[] value_indices;
    int levelOfDifficulty;
    data = ((DataReference) ref).getData();
    if (data == null) {
      renderer.clearExceptions();
      renderer.addException(
        new DisplayException("DataDisplayLink.prepareData: Data is null"));
      return false;
    }
    MathType type = data.getType();
    SelectedMapVector.removeAllElements();
    int n = ((DisplayImpl) local_action).getDisplayScalarCount();
    defaultValues = new float[n];
    for (int i=0; i<n; i++) {
      defaultValues[i] = (float) (((DisplayRealType)
        ((DisplayImpl) local_action).getDisplayScalar(i)).getDefaultValue());
    }
    Vector temp =
      (Vector) ((DisplayImpl) local_action).getConstantMapVector().clone();
    Enumeration maps = temp.elements();
    while(maps.hasMoreElements()) {
      ConstantMap map = (ConstantMap) maps.nextElement();
      defaultValues[map.getDisplayScalarIndex()] = (float) map.getConstant();
    }
    maps =((Vector) ConstantMapVector.clone()).elements();
    while(maps.hasMoreElements()) {
      ConstantMap map = (ConstantMap) maps.nextElement();
      defaultValues[map.getDisplayScalarIndex()] = (float) map.getConstant();
    }
    try {
      renderer.clearExceptions();
      shadow = type.buildShadowType(this, null);
      ShadowType adaptedShadow = shadow.getAdaptedShadowType();
      indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getScalarCount());
      display_indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getDisplayScalarCount());
      value_indices = ShadowType.zeroIndices(
                  ((DisplayImpl) local_action).getValueArrayLength());
      Vector controls = ((DisplayImpl) local_action).getControlVector();
      isTransform = new boolean[controls.size()];
      for (int i=0; i<controls.size(); i++) isTransform[i] = false;
      levelOfDifficulty =
        shadow.checkIndices(indices, display_indices, value_indices,
                              isTransform, ShadowType.NOTHING_MAPPED);
      if (levelOfDifficulty == ShadowType.LEGAL) {
        for (int i=0; i<controls.size(); i++) isTransform[i] = true;
      }
      renderer.checkDirect();
    }
    catch (BadMappingException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    catch (UnimplementedException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    catch (RemoteException e) {
      data = null;
      renderer.addException(e);
      return false;
    }
    return true;
  }
