コード例 #1
0
ファイル: EncodeFileBrowser.java プロジェクト: philres/IGV
  private void init(final EncodeTableModel model) {
    setModal(true);
    setTitle("Encode Production Data");

    table.setAutoCreateRowSorter(true);
    table.setModel(model);
    table.setRowSorter(model.getSorter());
    try {
      rowCountLabel.setText(numberFormatter.valueToString(table.getRowCount()) + " rows");
    } catch (ParseException e) {

    }

    table.setRowSelectionAllowed(false);
    table.setColumnSelectionAllowed(false);

    filterTextField
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(DocumentEvent e) {
                updateFilter();
              }

              public void insertUpdate(DocumentEvent e) {
                updateFilter();
              }

              public void removeUpdate(DocumentEvent e) {
                updateFilter();
              }
            });
  }
コード例 #2
0
ファイル: EncodeFileBrowser.java プロジェクト: philres/IGV
  /**
   * @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;
  }
コード例 #3
0
ファイル: EncodeFileBrowser.java プロジェクト: philres/IGV
  /** Update the row filter regular expression from the expression in the text box. */
  private void updateFilter() {

    RowFilter<EncodeTableModel, Object> rf = null;
    // If current expression doesn't parse, don't update.
    try {
      rf = new RegexFilter(filterTextField.getText());
    } catch (java.util.regex.PatternSyntaxException e) {
      return;
    }
    model.getSorter().setRowFilter(rf);

    try {
      rowCountLabel.setText(numberFormatter.valueToString(table.getRowCount()) + " rows");
    } catch (ParseException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
  }