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:
-
Field Summary
Fields inherited from class com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
isScrollingFields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVectorFields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for an empty tableProteinTableModel(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidgetColumnClass(int columnIndex) intgetColumnName(int column) static IntegergetPreferredAccessionColumnWidth(JTable table, int colIndex, int margin, Integer maxProteinKeyLength) Gets the preferred width of the column specified by colIndex.intgetValueAt(int row, int column) booleanisCellEditable(int rowIndex, int columnIndex) booleanIndicates whether the table content was instantiated.protected intloadDataForRows(ArrayList<Integer> rows, com.compomics.util.waiting.WaitingHandler waitingHandler) voidreset()Reset the protein keys.static voidsetProteinTableProperties(JTable proteinTable, Color sparklineColor, Color sparklineColorNotValidated, Color sparklineColorNotFound, Color sparklineColorDoubtful, DecimalFormat scoreAndConfidenceDecimalFormat, Class parentClass, Integer maxProteinKeyLength) Set up the properties of the protein table.voidshowScores(boolean showScores) Sets whether the scores should be displayed.voidupdateDataModel(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.Methods inherited from class com.compomics.util.gui.tablemodels.SelfUpdatingTableModel
addScrollListeners, addSortListener, dataMissingAtRow, getRowNumber, getViewIndex, initiateSorter, isScrolling, isSelfUpdating, needsUpdate, resetSorting, setIsScrolling, setSelfUpdating, sortMethods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getDataVector, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAtMethods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
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 informationidentificationFeaturesGenerator- the identification features generator generating the features of the identificationproteinDetailsProvider- the protein details providersequenceProvider- the protein sequences providergeneMaps- the gene mapsdisplayFeaturesGenerator- the display features generator generating the display elementsexceptionHandler- an exception handler catching exceptionsproteinKeys- 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 informationidentificationFeaturesGenerator- the identification features generator generating the features of the identificationproteinDetailsProvider- the protein details providersequenceProvider- the protein sequences providergeneMaps- the gene mapsdisplayFeaturesGenerator- the display features generator generating the display elementsproteinKeys- 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:
getRowCountin interfaceTableModel- Overrides:
getRowCountin classDefaultTableModel
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCountin interfaceTableModel- Overrides:
getColumnCountin classDefaultTableModel
-
getColumnName
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classDefaultTableModel
-
getValueAt
- Specified by:
getValueAtin interfaceTableModel- Overrides:
getValueAtin classDefaultTableModel
-
isInstantiated
public boolean isInstantiated()Indicates whether the table content was instantiated.- Returns:
- a boolean indicating whether the table content was instantiated.
-
getColumnClass
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) - Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classDefaultTableModel
-
catchException
- Specified by:
catchExceptionin classcom.compomics.util.gui.tablemodels.SelfUpdatingTableModel
-
loadDataForRows
protected int loadDataForRows(ArrayList<Integer> rows, com.compomics.util.waiting.WaitingHandler waitingHandler) - Specified by:
loadDataForRowsin classcom.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 tablesparklineColor- the sparkline color to usesparklineColorNotValidated- the sparkline color for not validated stuffssparklineColorNotFound- the sparkline color for not found stuffssparklineColorDoubtful- the sparkline color for doubtfulscoreAndConfidenceDecimalFormat- the decimal format for score and confidenceparentClass- the parent class used to get iconsmaxProteinKeyLength- 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 tablecolIndex- the column indexmargin- the margin to addmaxProteinKeyLength- the maximal protein key length- Returns:
- the preferred width of the column
-