Example #1
0
  /**
   * The animation changed. Handle the change.
   *
   * @param evt The event
   */
  private void handleAnimationPropertyChange(PropertyChangeEvent evt) {
    //        System.err.println ("Handlechange:" +evt.getPropertyName());
    if (evt.getPropertyName().equals(Animation.ANI_VALUE)) {
      debug("handleAnimationPropertyChange value :" + evt.getPropertyName());
      Real eventValue = (Real) evt.getNewValue();
      // if there's nothing to do, return;
      if ((eventValue == null) || eventValue.isMissing()) {
        return;
      }

      /** The Animation associated with this widget */
      DateTime time = null;
      try {
        time = new DateTime(eventValue);
      } catch (VisADException ve) {;
      }
      final DateTime theDateTime = time;
      final int theIndex = ((anime != null) ? anime.getCurrent() : -1);
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              boolean oldValue = ignoreTimesCbxEvents;
              try {
                ignoreTimesCbxEvents = true;
                //                        synchronized (timesCbxMutex) {
                xcnt++;

                timesCbx.setSelectedItem(theDateTime);
                //                        }
                if ((boxPanel != null) && (theIndex >= 0)) {
                  boxPanel.setOnIndex(theIndex);
                }
                timesCbx.repaint();
              } finally {
                ignoreTimesCbxEvents = oldValue;
              }
            }
          });
      shareValue();
    } else if (evt.getPropertyName().equals(Animation.ANI_SET)) {
      if (ignoreAnimationSetChange) {
        return;
      }
      updateIndicatorInner((Set) evt.getNewValue(), true);
    }
  }
Example #2
0
  /**
   * _more_
   *
   * @param timeSet _more_
   * @param timeSetChange _more_
   */
  private void updateIndicatorInner(Set timeSet, boolean timeSetChange) {
    //      timeSet  = checkAnimationSet(timeSet);
    timesArray = Animation.getDateTimeArray(timeSet);

    // Stop running if there are no times
    if ((timesArray.length == 0) && timeSetChange) {
      setRunning(false);
    }

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            // Only set the list data if we have created the gui contents
            if (madeContents) {
              setTimesInTimesBox();
              updateRunButton();
            }
          }
        });
    updateBoxPanel(timesArray);
  }