Exemple #1
0
 public ResultHandler createResultHandler(
     final JComponent parent, StoragePolicy policy, TopcatModel inTcModel, StarTable inTable) {
   final String tname = service_.getLabel() + "s(" + inTcModel.getID() + ")";
   return new RandomResultHandler(parent, policy, service_) {
     protected void processRandomResult(final StarTable table) {
       addTable(tname, table);
     }
   };
 }
Exemple #2
0
 public ConeMatcher createConeMatcher(
     ConeSearcher coneSearcher,
     ConeErrorPolicy errAct,
     StarTable inTable,
     QuerySequenceFactory qsFact,
     Coverage coverage,
     int parallelism) {
   return new ConeMatcher(
       coneSearcher,
       errAct,
       toProducer(inTable),
       qsFact,
       best_,
       coverage,
       includeBlanks_,
       true,
       parallelism,
       "*",
       DIST_NAME,
       JoinFixAction.NO_ACTION,
       JoinFixAction.makeRenameDuplicatesAction("_" + service_.getLabel()));
 }
Exemple #3
0
  /**
   * Constructor.
   *
   * @param service defines type of service that queries will be carried out on
   */
  public DalMultiPanel(DalMultiService service, JProgressBar progBar) {
    super(new BorderLayout());
    service_ = service;
    progBar_ = progBar;
    progBar.setStringPainted(true);
    JComponent main = Box.createVerticalBox();
    List cList = new ArrayList();
    add(main);

    /* Field for service URL. */
    urlField_ = new JTextField();
    JLabel urlLabel = new JLabel(service.getName() + " URL: ");
    Box urlLine = Box.createHorizontalBox();
    cList.add(urlField_);
    cList.add(urlLabel);
    urlLine.add(urlLabel);
    urlLine.add(urlField_);
    main.add(urlLine);
    main.add(Box.createVerticalStrut(10));

    /* Field for input table. */
    final JComboBox tableSelector = new TablesListComboBox();
    tableSelector.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent evt) {
            setInputTable((TopcatModel) tableSelector.getSelectedItem());
          }
        });
    JLabel tableLabel = new JLabel("Input Table: ");
    cList.add(tableLabel);
    cList.add(tableSelector);
    Box tableLine = Box.createHorizontalBox();
    tableLine.add(tableLabel);
    tableLine.add(new ShrinkWrapper(tableSelector));
    tableLine.add(Box.createHorizontalGlue());
    main.add(tableLine);
    main.add(Box.createVerticalStrut(5));

    /* Fields for position parameters. */
    raSelector_ = new ColumnSelector(Tables.RA_INFO, true);
    Box raLine = Box.createHorizontalBox();
    raLine.add(raSelector_);
    JLabel raSysLabel = new JLabel(" (J2000)");
    raLine.add(raSysLabel);
    raLine.add(Box.createHorizontalGlue());
    main.add(raLine);
    main.add(Box.createVerticalStrut(5));
    cList.add(raSelector_);
    cList.add(raSysLabel);
    decSelector_ = new ColumnSelector(Tables.DEC_INFO, true);
    Box decLine = Box.createHorizontalBox();
    decLine.add(decSelector_);
    JLabel decSysLabel = new JLabel(" (J2000)");
    decLine.add(decSysLabel);
    decLine.add(Box.createHorizontalGlue());
    main.add(decLine);
    main.add(Box.createVerticalStrut(5));
    cList.add(decSelector_);
    cList.add(decSysLabel);
    srSelector_ = new ColumnSelector(service.getSizeInfo(), true);
    service.setSizeDefault(srSelector_);
    Box srLine = Box.createHorizontalBox();
    srLine.add(srSelector_);
    JLabel srSysLabel = new JLabel("");
    srLine.add(srSysLabel);
    srLine.add(Box.createHorizontalGlue());
    main.add(srLine);
    cList.add(srSelector_);
    cList.add(srSysLabel);

    /* Align the positional fields. */
    alignLabels(
        new JLabel[] {
          raSelector_.getLabel(), decSelector_.getLabel(), srSelector_.getLabel(),
        });
    alignLabels(
        new JLabel[] {
          raSysLabel, decSysLabel, srSysLabel,
        });

    /* Custom service controls. */
    JComponent servicePanel = service_.getControlPanel();
    if (servicePanel != null) {
      JComponent serviceLine = Box.createHorizontalBox();
      serviceLine.add(servicePanel);
      serviceLine.add(Box.createHorizontalGlue());
      main.add(Box.createVerticalStrut(5));
      main.add(serviceLine);
      cList.add(servicePanel);
    }

    /* Multicone output mode selector. */
    main.add(Box.createVerticalStrut(10));
    modeSelector_ = new JComboBox(getMulticoneModes());
    Box modeLine = Box.createHorizontalBox();
    JLabel modeLabel = new JLabel("Output Mode: ");
    modeLine.add(modeLabel);
    modeLine.add(new ShrinkWrapper(modeSelector_));
    modeLine.add(Box.createHorizontalGlue());
    cList.add(modeLabel);
    cList.add(modeSelector_);
    main.add(modeLine);
    main.add(Box.createVerticalStrut(5));

    /* Set up coverage icons. */
    hasCoverage_ = service_.hasCoverages();
    if (hasCoverage_) {

      /* Service coverage icon. */
      serviceCoverageView_ = new CoverageView(service_.getLabel() + " service");
      serviceCoverageView_.setForeground(new Color(0x0000ff));
      serviceCoverageView_.setBackground(new Color(0xc0c0ff));
      urlField_.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              updateServiceCoverage();
            }
          });
      urlField_.addFocusListener(
          new FocusListener() {
            public void focusLost(FocusEvent evt) {
              updateServiceCoverage();
            }

            public void focusGained(FocusEvent evt) {}
          });
      urlLine.add(Box.createHorizontalStrut(5));
      urlLine.add(serviceCoverageView_);

      /* Table coverage icon. */
      queryCoverageView_ = new CoverageView("table");
      queryCoverageView_.setForeground(new Color(0xff0000));
      queryCoverageView_.setBackground(new Color(0xffc0c0));
      ActionListener tableListener =
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              updateQueryCoverage();
            }
          };
      tableSelector.addActionListener(tableListener);
      raSelector_.addActionListener(tableListener);
      decSelector_.addActionListener(tableListener);
      srSelector_.addActionListener(tableListener);
      tableLine.add(new ShrinkWrapper(queryCoverageView_));
      tcListener_ =
          new TopcatListener() {
            public void modelChanged(TopcatEvent evt) {
              if (evt.getCode() == TopcatEvent.CURRENT_SUBSET) {
                updateQueryCoverage();
              }
            }
          };

      /* Overlap coverage icon. */
      overlapCoverageView_ = new CoverageView("potential matches");
      overlapCoverageView_.setForeground(new Color(0xd000d0));
      overlapCoverageView_.setBackground(new Color(0xffc0ff));
      modeLine.add(new ShrinkWrapper(overlapCoverageView_));
    } else {
      tcListener_ = null;
      queryCoverageView_ = null;
      serviceCoverageView_ = null;
      overlapCoverageView_ = null;
    }

    /* Configure coverage display toggle. */
    coverageModel_ =
        new ToggleButtonModel(
            "Use Service Coverage",
            ResourceIcon.FOOTPRINT,
            "Use service coverage information (MOCs) "
                + "where available to avoid unnecessary "
                + "queries");
    coverageModel_.setSelected(hasCoverage_);
    coverageModel_.setEnabled(hasCoverage_);
    coverageModel_.addChangeListener(
        new ChangeListener() {
          private boolean wasSelected_ = coverageModel_.isSelected();

          public void stateChanged(ChangeEvent evt) {
            boolean isSelected = coverageModel_.isSelected();
            if (isSelected ^ wasSelected_) {
              updateServiceCoverage();
              updateQueryCoverage();
              updateOverlapCoverage();
              wasSelected_ = isSelected;
            }
          }
        });

    /* Service access parameters. */
    int maxpar = ParallelResultRowSequence.getMaxParallelism();
    parallelModel_ = new SpinnerNumberModel(Math.min(5, maxpar), 1, maxpar, 1);
    JLabel parallelLabel = new JLabel("Parallelism: ");
    JSpinner parallelSpinner = new JSpinner(parallelModel_);
    cList.add(parallelLabel);
    cList.add(parallelSpinner);
    erractSelector_ = new JComboBox(getConeErrorPolicies(service));
    JLabel erractLabel = new JLabel(ERRACT_LABEL + ": ");
    cList.add(erractLabel);
    cList.add(erractSelector_);
    Box accessLine = Box.createHorizontalBox();
    accessLine.add(parallelLabel);
    accessLine.add(new ShrinkWrapper(parallelSpinner));
    accessLine.add(Box.createHorizontalStrut(10));
    accessLine.add(erractLabel);
    accessLine.add(new ShrinkWrapper(erractSelector_));
    accessLine.add(Box.createHorizontalGlue());
    main.add(accessLine);

    /* Action to initiate multicone. */
    startAction_ =
        new BasicAction("Go", null, "Start multiple query running") {
          public void actionPerformed(ActionEvent evt) {
            startMatch();
          }
        };

    /* Action to interrupt processing. */
    stopAction_ =
        new BasicAction(
            "Stop", null, "Interrupt running multiple query; " + "results will be discarded") {
          public void actionPerformed(ActionEvent evt) {
            setActive(null);
          }
        };

    /* Initialise enabledness of controls etc. */
    components_ = (JComponent[]) cList.toArray(new JComponent[0]);
    updateState();
  }