Пример #1
0
    /**
     * Set the display for the data
     *
     * @param isEmpty true if the data is null
     * @throws RemoteException Java RMI error
     * @throws VisADException problem creating VisAD object
     */
    public synchronized void setDisplay(boolean isEmpty) throws VisADException, RemoteException {

      if (isEmpty) {
        for (Iterator iter = extantDatums.iterator(); iter.hasNext(); ) {
          ((DataAdapter) iter.next()).addTo();
        }
      } else {
        for (Iterator iter = obsoleteDatums.iterator(); iter.hasNext(); ) {
          ((DataAdapter) iter.next()).removeFrom();
        }
      }

      obsoleteDatums.clear();

      for (Iterator iter = changedDatums.iterator(); iter.hasNext(); ) {
        DataAdapter adapter = (DataAdapter) iter.next();

        adapter.addTo();
        iter.remove();
        extantDatums.add(adapter);
      }

      for (Iterator iter = newDatums.iterator(); iter.hasNext(); ) {
        DataAdapter adapter = (DataAdapter) iter.next();

        adapter.addTo();
        iter.remove();
        extantDatums.add(adapter);

        // Add listener now so fewest notifications.
        adapter.addPropertyChangeListener(adapter.CONSTANT_MAP, listener);
      }

      changed = false;
    }
 /** Requests the list of all lost packages */
 private void buttonShowLostActionPerformed(ActionEvent event) {
   this.packages = DataAdapter.getLostPackages();
   this.jListPackages.setListData(new Vector(this.packages));
   jButtonSetLost.setEnabled(false);
   jButtonSetFound.setEnabled(this.packages.size() > 0);
   jListScans.setListData(new Vector());
 }
 /** Requests and displays all packages older than the date in the text field */
 private void buttonOldPackagesActionPerformed(ActionEvent event) {
   try {
     queryTime.setTime(dateFormatter.parse(jTextDate.getText().replace("-", "") + "2359"));
     this.packages = DataAdapter.getOlderPackages(queryTime);
     jListPackages.setListData(new Vector(this.packages));
     jButtonSetLost.setEnabled(this.packages.size() > 0);
     jButtonSetFound.setEnabled(false);
     jListScans.setListData(new Vector());
   } catch (Exception ex) {
     JOptionPane.showMessageDialog(this, "Invalid date entered");
   }
 }
Пример #4
0
    /**
     * Set that this data is obsolete or not
     *
     * @param adapter adapted data
     */
    public synchronized void setObsolete(DataAdapter adapter) {

      if (newDatums.contains(adapter)) {
        newDatums.remove(adapter);
      } else {
        java.util.Set set =
            extantDatums.contains(adapter)
                ? extantDatums
                : changedDatums.contains(adapter) ? changedDatums : null;

        if (set != null) {

          // Remove listener now so fewest notifications.
          adapter.removePropertyChangeListener(adapter.CONSTANT_MAP, listener);
          set.remove(adapter);
          obsoleteDatums.add(adapter);

          changed = true;

          updater.update();
        }
      }
    }