protected void internalDoubleClick(MouseEvent e) {
    if (!(e.getComponent() instanceof JComponent)) return;
    JComponent inComponent = (JComponent) e.getComponent();

    if (inComponent instanceof JTable) {
      JTable thisTable = (JTable) inComponent;
      int rowPoint = thisTable.rowAtPoint(new Point(e.getX(), e.getY()));
      Searcher whichSearch = (Searcher) thisTable.getValueAt(rowPoint, -1);

      whichSearch.execute();
    }
  }
 private void doSingle(Searcher s, int cmd) {
   switch (cmd) {
     case EXECUTE:
       s.execute();
       break;
     case ENABLE:
       s.enable();
       break;
     case DISABLE:
       s.disable();
       break;
     case EDIT:
       showEdit(s);
       break;
     case NEW:
       showEdit(s);
       break;
     default:
       break;
   }
 }
  private void DoDelete(Searcher chosenSearch) {
    Searcher s = chosenSearch;
    int[] rows = getPossibleRows();
    String prompt;

    if ((rows.length <= 1) && s != null) {
      if (rows.length == 1) s = (Searcher) _inTable.getValueAt(rows[0], -1);

      prompt =
          "<HTML><BODY>Are you sure you want to remove this search?<br><b>"
              + s.getName()
              + "</b></body></html>";
      //  Use the right parent!  FIXME -- mrs: 17-February-2003 23:53
      if (confirmDeletion(null, prompt)) {
        SearchManager.getInstance().deleteSearch(s);
      }
    } else {
      if (rows.length == 0) {
        JOptionPane.showMessageDialog(
            _inTable,
            "You must select what searches to delete first.",
            "No search",
            JOptionPane.INFORMATION_MESSAGE);
      } else {
        prompt = "Are you sure you want to remove all selected searches?";
        //  Use the right parent!  FIXME -- mrs: 17-February-2003 23:53
        if (confirmDeletion(null, prompt)) {
          ArrayList<Searcher> delList = new ArrayList<Searcher>();
          for (int row : rows) {
            s = (Searcher) _inTable.getValueAt(row, -1);
            delList.add(s);
          }
          for (Searcher del : delList) {
            SearchManager.getInstance().deleteSearch(del);
          }
        }
      }
    }
    changeTable();
  }
Example #4
0
 private void testSearching() {
   Searcher sm =
       SearchManager.getInstance().addSearch("Title", "zarf", "zarf", "ebay", -1, 12345678);
   sm.execute();
 }