Пример #1
0
  /**
   * Creates the Control for the associated DisplayScalar. This method invokes the method {@link
   * ScalarMapListener#controlChanged(ScalarMapControlEvent)} on all registered {@link
   * ScalarMapListener}s with this instance as the event source and {@link
   * ScalarMapEvent#CONTROL_ADDED} or {@link ScalarMapEvent#CONTROL_REPLACED} as the event ID --
   * depending on whether this is the first control or not. The event control is the previous
   * control if the event ID is {@link ScalarMapEvent#CONTROL_REPLACED}. If the event ID is {@link
   * ScalarMapEvent#CONTROL_ADDED}, then the event control is the created control or <code>null
   * </code> -- depending on whether or not the control was successfully created.
   *
   * @throws RemoteException Java RMI failure
   * @throws VisADException VisAD failure
   */
  synchronized void setControl() throws VisADException, RemoteException {
    int evtID;
    Control evtCtl;
    if (control != null) {
      evtID = ScalarMapEvent.CONTROL_REPLACED;
      evtCtl = control;
    } else {
      evtID = ScalarMapEvent.CONTROL_ADDED;
      evtCtl = null;
    }

    if (display == null) {
      throw new DisplayException("ScalarMap.setControl: not part of " + "any Display");
    }
    control = display.getDisplayRenderer().makeControl(this);
    if (control != null) {
      display.addControl(control);

      if (evtCtl == null) {
        evtCtl = control;
      }
    }

    if (control != null || evtCtl != null) {
      notifyCtlListeners(new ScalarMapControlEvent(this, evtID, evtCtl));
    }
  }
Пример #2
0
 /**
  * Create the scale that is displayed. This is called automatically when <CODE>setRange(lo, hi)
  * </CODE> and <CODE>setDisplay</CODE> are called. It makes a call to <CODE>AxisScale.makeScale()
  * </CODE> where the actual hard work is done.
  *
  * @throws VisADException VisAD error.
  */
 public void makeScale() throws VisADException {
   if (axisScale != null) {
     DisplayRenderer displayRenderer = null;
     if (display == null) return;
     displayRenderer = display.getDisplayRenderer();
     if (displayRenderer == null) return;
     boolean scaleMade = axisScale.makeScale();
     if (scaleMade) {
       // displayRenderer.setScale(axis, axis_ordinal, array, scale_color);
       if (scale_on) {
         displayRenderer.setScale(axisScale);
       } else {
         displayRenderer.clearScale(axisScale);
       }
       scale_flag = false;
     }
   }
 }