Class ProteinTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
javax.swing.table.DefaultTableModel
com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
eu.isas.peptideshaker.gui.tablemodels.ProteinTableModel
All Implemented Interfaces:
Serializable, TableModel

public class ProteinTableModel extends com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
Model for the protein table.
Author:
Marc Vaudel, Harald Barsnes
See Also:
  • Constructor Details

    • ProteinTableModel

      public ProteinTableModel()
      Constructor for an empty table
    • ProteinTableModel

      public ProteinTableModel(com.compomics.util.experiment.identification.Identification identification, com.compomics.util.experiment.identification.features.IdentificationFeaturesGenerator identificationFeaturesGenerator, com.compomics.util.experiment.io.biology.protein.ProteinDetailsProvider proteinDetailsProvider, com.compomics.util.experiment.io.biology.protein.SequenceProvider sequenceProvider, com.compomics.util.experiment.biology.genes.GeneMaps geneMaps, DisplayFeaturesGenerator displayFeaturesGenerator, com.compomics.util.exceptions.ExceptionHandler exceptionHandler, long[] proteinKeys)
      Constructor.
      Parameters:
      identification - the identification containing the protein information
      identificationFeaturesGenerator - the identification features generator generating the features of the identification
      proteinDetailsProvider - the protein details provider
      sequenceProvider - the protein sequences provider
      geneMaps - the gene maps
      displayFeaturesGenerator - the display features generator generating the display elements
      exceptionHandler - an exception handler catching exceptions
      proteinKeys - the keys of the protein matches to display
  • Method Details

    • updateDataModel

      public void updateDataModel(com.compomics.util.experiment.identification.Identification identification, com.compomics.util.experiment.identification.features.IdentificationFeaturesGenerator identificationFeaturesGenerator, com.compomics.util.experiment.io.biology.protein.ProteinDetailsProvider proteinDetailsProvider, com.compomics.util.experiment.io.biology.protein.SequenceProvider sequenceProvider, com.compomics.util.experiment.biology.genes.GeneMaps geneMaps, DisplayFeaturesGenerator displayFeaturesGenerator, long[] proteinKeys)
      Update the data in the table model without having to reset the whole table model. This keeps the sorting order of the table.
      Parameters:
      identification - the identification containing the protein information
      identificationFeaturesGenerator - the identification features generator generating the features of the identification
      proteinDetailsProvider - the protein details provider
      sequenceProvider - the protein sequences provider
      geneMaps - the gene maps
      displayFeaturesGenerator - the display features generator generating the display elements
      proteinKeys - the keys of the protein matches to display
    • showScores

      public void showScores(boolean showScores)
      Sets whether the scores should be displayed.
      Parameters:
      showScores - a boolean indicating whether the scores should be displayed
    • reset

      public void reset()
      Reset the protein keys.
    • getRowCount

      public int getRowCount()
      Specified by:
      getRowCount in interface TableModel
      Overrides:
      getRowCount in class DefaultTableModel
    • getColumnCount

      public int getColumnCount()
      Specified by:
      getColumnCount in interface TableModel
      Overrides:
      getColumnCount in class DefaultTableModel
    • getColumnName

      public String getColumnName(int column)
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class DefaultTableModel
    • getValueAt

      public Object getValueAt(int row, int column)
      Specified by:
      getValueAt in interface TableModel
      Overrides:
      getValueAt in class DefaultTableModel
    • isInstantiated

      public boolean isInstantiated()
      Indicates whether the table content was instantiated.
      Returns:
      a boolean indicating whether the table content was instantiated.
    • getColumnClass

      public Class getColumnClass(int columnIndex)
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AbstractTableModel
    • isCellEditable

      public boolean isCellEditable(int rowIndex, int columnIndex)
      Specified by:
      isCellEditable in interface TableModel
      Overrides:
      isCellEditable in class DefaultTableModel
    • catchException

      protected void catchException(Exception e)
      Specified by:
      catchException in class com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
    • loadDataForRows

      protected int loadDataForRows(ArrayList<Integer> rows, com.compomics.util.waiting.WaitingHandler waitingHandler)
      Specified by:
      loadDataForRows in class com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
    • setProteinTableProperties

      public static void setProteinTableProperties(JTable proteinTable, Color sparklineColor, Color sparklineColorNotValidated, Color sparklineColorNotFound, Color sparklineColorDoubtful, DecimalFormat scoreAndConfidenceDecimalFormat, Class parentClass, Integer maxProteinKeyLength)
      Set up the properties of the protein table.
      Parameters:
      proteinTable - the protein table
      sparklineColor - the sparkline color to use
      sparklineColorNotValidated - the sparkline color for not validated stuffs
      sparklineColorNotFound - the sparkline color for not found stuffs
      sparklineColorDoubtful - the sparkline color for doubtful
      scoreAndConfidenceDecimalFormat - the decimal format for score and confidence
      parentClass - the parent class used to get icons
      maxProteinKeyLength - the longest protein key to display
    • getPreferredAccessionColumnWidth

      public static Integer getPreferredAccessionColumnWidth(JTable table, int colIndex, int margin, Integer maxProteinKeyLength)
      Gets the preferred width of the column specified by colIndex. The column will be just wide enough to show the column head and the widest cell in the column. Margin pixels are added to the left and right (resulting in an additional width of 2*margin pixels. Returns null if the max width cannot be set.
      Parameters:
      table - the table
      colIndex - the column index
      margin - the margin to add
      maxProteinKeyLength - the maximal protein key length
      Returns:
      the preferred width of the column