/** * 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)); } }