Esempio n. 1
0
 /**
  * Remove this control. Call the parent class doRemove and clears references to gridLocs, etc.
  *
  * @throws RemoteException
  * @throws VisADException
  */
 public void doRemove() throws VisADException, RemoteException {
   super.doRemove();
   gridLocs = null;
   dataNode = null;
   probe = null;
   widget = null;
 }
Esempio n. 2
0
  /**
   * Add any macro name/value pairs.
   *
   * @param template template
   * @param patterns The macro names
   * @param values The macro values
   */
  protected void addLabelMacros(String template, List patterns, List values) {
    super.addLabelMacros(template, patterns, values);

    if (getLocation() != null) {
      patterns.add(MACRO_POSITION);
      values.add(getDisplayConventions().formatLatLonPoint(getLocation()));
    }
  }
Esempio n. 3
0
 /**
  * Add the relevant edit menu items into the list
  *
  * @param items List of menu items
  * @param forMenuBar Is this for the menu in the window's menu bar or for a popup menu in the
  *     legend
  */
 protected void getEditMenuItems(List items, boolean forMenuBar) {
   if (probe != null) {
     JMenuItem mi = new JMenuItem("Reset Probe Position");
     mi.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent ae) {
             resetProbePosition();
           }
         });
     items.add(mi);
   }
   super.getEditMenuItems(items, forMenuBar);
 }
Esempio n. 4
0
 /** Update the location label, subclasses can override. */
 protected void updateHeaderLabel() {
   Data d = getDisplayListData();
   if (d == null) {
     super.updateHeaderLabel();
   }
   Text text = null;
   if (d instanceof FieldImpl) {
     int index = getCurrentIndex();
     if (index >= 0) {
       try {
         text = (Text) ((FieldImpl) d).getSample(index, false);
       } catch (Exception ve) {
       }
     }
   } else {
     text = (Text) d;
   }
   if (text != null) {
     headerLabel.setText(text.toString());
   } else {
     super.updateHeaderLabel();
   }
 }
Esempio n. 5
0
 /** Called by the parent class after all initialization has been done. */
 public void initDone() {
   try {
     // communicate the probe's initial position
     // Run this in a thread to get around possible deadlock issues.
     Misc.runInABit(
         10,
         new Runnable() {
           public void run() {
             lineProbeWasMoved();
           }
         });
   } catch (Exception ex) {
     logException(ex);
   }
   super.initDone();
 }
Esempio n. 6
0
  /**
   * Receive shared-data updates.
   *
   * @param from The {@link ucar.unidata.collab.Sharable} object from which this event originates.
   * @param dataId The shared data identifier.
   * @param data The shared data.
   */
  public void receiveShareData(Sharable from, Object dataId, Object[] data) {

    if (!(dataId.equals(SHARE_POSITION))) {
      super.receiveShareData(from, dataId, data); // pass it up
    } else {
      if (probe == null) {
        return;
      }

      try {

        /*
         * The following fires a PropertyChangeEvent for the
         * probe position.
         */
        probe.setPosition((RealTuple) data[0]);
      } catch (Exception ex) {
        logException("receiveShareData:" + dataId, ex);
      }
    }
  }
Esempio n. 7
0
  /**
   * Respond to a timeChange event
   *
   * @param time new time
   */
  protected void timeChanged(Real time) {
    try {
      super.timeChanged(time);
      dataNode.setTime(new DateTime(time));
      if (getProfilesVisibility()) {
        AnimationWidget aniWidget = this.getAnimationWidget();
        int idx = 0;
        if (aniWidget.getTimes() != null) {
          int n = aniWidget.getTimes().length;
          for (int i = 0; i < n; i++) {
            if ((new DateTime(time)).equals(aniWidget.getTimeAtIndex(i))) {
              idx = i;
              continue;
            }
          }
        }
        aeroDisplay.setProfilesVisibility(true, idx);
        // display list update
        Set s = getDataTimeSet();
        if (s != null) {
          double[][] samples = s.getDoubles();
          DateTime dt = new DateTime(samples[0][idx + 1], s.getSetUnits()[0]);
          DateTime dt1 = new DateTime(samples[0][idx], s.getSetUnits()[0]);
          listlabel =
              dt1.dateString()
                  + ":"
                  + dt1.timeString()
                  + " and "
                  + dt.dateString()
                  + ":"
                  + dt.timeString();
        }

        updateDisplayList();
        updateHeaderLabel();
      }
    } catch (Exception ex) {
      logException("timeValueChanged", ex);
    }
  }
Esempio n. 8
0
 /**
  * Add any macro name/label pairs
  *
  * @param names List of macro names
  * @param labels List of macro labels
  */
 protected void getMacroNames(List names, List labels) {
   super.getMacroNames(names, labels);
   names.addAll(Misc.newList(MACRO_POSITION));
   labels.addAll(Misc.newList("Probe Position"));
 }