@Override
    public void valueChanged(ListSelectionEvent e) {

      if (!e.getValueIsAdjusting()) {
        int rowNum = table.getSelectedRow();
        if (rowNum >= 0) {
          // get table model
          PeptideSpeciesPSMTableModel pepTableModel =
              (PeptideSpeciesPSMTableModel) table.getModel();

          // get spectrum reference column
          int identColNum =
              pepTableModel.getColumnIndex(PeptideTableHeader.IDENTIFICATION_ID.getHeader());
          int peptideColNum =
              pepTableModel.getColumnIndex(PeptideTableHeader.PEPTIDE_ID.getHeader());

          // get spectrum id
          int modelRowIndex = table.convertRowIndexToModel(rowNum);
          Comparable identId = (Comparable) pepTableModel.getValueAt(modelRowIndex, identColNum);
          Comparable peptideId =
              (Comparable) pepTableModel.getValueAt(modelRowIndex, peptideColNum);

          logger.debug(
              "Peptide table selection:  Protein id: " + identId + " Peptide Id: " + peptideId);

          // fire a background task to retrieve peptide
          if (peptideId != null && identId != null) {
            // publish the event to local event bus
            EventService eventBus =
                ContainerEventServiceFinder.getEventService(PeptidePSMPane.this);
            eventBus.publish(new PSMEvent(PeptidePSMPane.this, controller, identId, peptideId));
          }
        }
      }
    }
      @SuppressWarnings("unchecked")
      private Object initDynamicDefinitionComponent() {
        final String selectedPrimitiveFormName =
            _dotDefinitionDialogFrame.getSelectedPrimitiveForm();
        final DOTProperty currentProperty = _dotDefinitionDialogFrame.getSelectedProperty();
        PrimitiveFormPropertyPair pfpPair =
            new PrimitiveFormPropertyPair(selectedPrimitiveFormName, currentProperty);
        final JTable workWithThisTable = _dynamicTables.get(pfpPair);

        int selectedRow = workWithThisTable.getSelectedRow();
        if (selectedRow == -1) {
          if (workWithThisTable.getModel().getRowCount() > 0) {
            selectedRow = 0;
          } else {
            return null;
          }
        }
        selectedRow = workWithThisTable.convertRowIndexToModel(selectedRow);
        final TableModel model = workWithThisTable.getModel();
        DynamicDOTItemManager dynamicDOTItemManager = (DynamicDOTItemManager) model;
        final DisplayObjectTypeItemWithInterval dotItemWithInterval =
            dynamicDOTItemManager.get(selectedRow);
        _dynamicDefinitionComponent.fillComponents(dotItemWithInterval);
        return dotItemWithInterval.getItem().getPropertyValue();
      }
Example #3
0
 public void secureDelete() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   if (JOptionPane.showConfirmDialog(
           frm,
           "Delete " + store.plainName(idx) + "?",
           "Confirm Delete",
           JOptionPane.YES_NO_OPTION)
       != JOptionPane.YES_OPTION) return;
   File del = store.delete(idx);
   store.fireTableDataChanged();
   if (del != null) {
     if (del.delete()) {
       // successful
       needsSave = true;
     } else {
       System.err.println("Delete " + del.getAbsolutePath() + " failed");
     }
   }
   updateStatus();
 }
Example #4
0
 @Override
 public void actionPerformed(ActionEvent e) {
   // Object o = table.getModel().getValueAt(table.getSelectedRow(), 0);
   int row = table.convertRowIndexToModel(table.getEditingRow());
   Object o = table.getModel().getValueAt(row, 0);
   JOptionPane.showMessageDialog(table, "Editing: " + o);
 }
Example #5
0
 public void secureAnalysis() {
   int rw = tblItems.getSelectedRow();
   if (rw != -1) {
     int idx = tblItems.convertRowIndexToModel(rw);
     String desc = store.describe(idx);
     if (JOptionPane.showConfirmDialog(frm, desc, "Details", JOptionPane.OK_CANCEL_OPTION)
         == JOptionPane.CANCEL_OPTION) return;
   }
   if (JOptionPane.showConfirmDialog(frm, store.tagDesc(), "Tags", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
   if (JOptionPane.showConfirmDialog(
           frm, store.storeDesc(), "Storage", JOptionPane.OK_CANCEL_OPTION)
       == JOptionPane.CANCEL_OPTION) return;
 }
Example #6
0
  /**
   * @return the list of VISIBLE selected records. Filtered records are not returned even if
   *     record.selected == true
   * @throws IOException
   */
  public List<EncodeFileRecord> getSelectedRecords() throws IOException {

    List<EncodeFileRecord> selectedRecords = new ArrayList<EncodeFileRecord>();
    List<EncodeFileRecord> allRecords = model.getRecords();

    int rowCount = table.getRowCount();
    for (int i = 0; i < rowCount; i++) {
      int modelIdx = table.convertRowIndexToModel(i);
      EncodeFileRecord record = allRecords.get(modelIdx);
      if (record.isSelected()) {
        selectedRecords.add(record);
      }
    }

    return selectedRecords;
  }
 @Override
 public void mouseClicked(MouseEvent e) {
   int col = table.columnAtPoint(new Point(e.getX(), e.getY()));
   String header = table.getColumnName(col);
   if (columnHeader.contains(header)) {
     int row = table.rowAtPoint(new Point(e.getX(), e.getY()));
     TableModel tableModel = table.getModel();
     Object val =
         tableModel.getValueAt(
             table.convertRowIndexToModel(row), table.convertColumnIndexToModel(col));
     if (val != null) {
       String text = val.toString();
       textDialog.setText(text);
       textDialog.setVisible(true);
     }
   }
 }
Example #8
0
 public void secureMove() {
   int rw = tblItems.getSelectedRow();
   if (rw == -1) {
     JOptionPane.showMessageDialog(frm, "No item selected", "Error", JOptionPane.ERROR_MESSAGE);
     return;
   }
   int idx = tblItems.convertRowIndexToModel(rw);
   String[] opts = new String[storeLocs.size()];
   for (int i = 0; i < opts.length; i++) opts[i] = storeLocs.get(i).getAbsolutePath();
   JComboBox cmbMove = new JComboBox(opts);
   cmbMove.setSelectedIndex(store.curStore(idx));
   if (JOptionPane.showConfirmDialog(frm, cmbMove, "Move item", JOptionPane.OK_CANCEL_OPTION)
       != JOptionPane.OK_OPTION) return;
   File newLoc = store.move(idx, cmbMove.getSelectedIndex());
   if (newLoc == null) System.err.println("move " + store.plainName(idx) + " unsuccessful");
   else needsSave = true;
 }
 public void setSwingFocus(ICFLibAnyObj value) {
   final String S_ProcName = "setSwingFocus";
   if ((value == null) || (value instanceof ICFSecurityISOCountryObj)) {
     super.setSwingFocus(value);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(
             getClass(), S_ProcName, "value", value, "ICFSecurityISOCountryObj");
   }
   if (dataTable == null) {
     return;
   }
   if (value == null) {
     dataTable.clearSelection();
   } else {
     ICFInternetISOCountryObj curSelected;
     PickerTableModel tblDataModel = getDataModel();
     int selectedRow = dataTable.getSelectedRow();
     int modelIndex = dataTable.convertRowIndexToModel(selectedRow);
     if (selectedRow >= 0) {
       Object selectedRowData = tblDataModel.getValueAt(modelIndex, COLID_ROW_HEADER);
       curSelected = (ICFInternetISOCountryObj) selectedRowData;
     } else {
       curSelected = null;
     }
     if (curSelected != value) {
       int len = tblDataModel.getRowCount();
       int idx = 0;
       while ((idx < len) && (tblDataModel.getValueAt(idx, COLID_ROW_HEADER) != value)) {
         idx++;
       }
       if (idx < len) {
         int viewRow = dataTable.convertRowIndexToView(idx);
         dataTable.clearSelection();
         dataTable.addRowSelectionInterval(viewRow, viewRow);
       }
     }
   }
 }