Search in sources :

Example 1 with JSparklinesIntegerIconTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer in project peptide-shaker by compomics.

the class SpectrumIdentificationPanel method setTableProperties.

/**
 * Set up the properties of the tables.
 */
private void setTableProperties() {
    // correct the color for the upper right corner
    JPanel spectrumCorner = new JPanel();
    spectrumCorner.setBackground(spectrumTable.getTableHeader().getBackground());
    spectrumTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, spectrumCorner);
    JPanel idResultsCorner = new JPanel();
    idResultsCorner.setBackground(searchResultsTable.getTableHeader().getBackground());
    idResultsTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, idResultsCorner);
    peptideShakerJTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    searchResultsTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    peptideShakerJTable.getTableHeader().setReorderingAllowed(false);
    spectrumTable.getTableHeader().setReorderingAllowed(false);
    searchResultsTable.getTableHeader().setReorderingAllowed(false);
    spectrumTable.setAutoCreateRowSorter(true);
    // make sure that the user is made aware that the tool is doing something during sorting of the spectrum table
    spectrumTable.getRowSorter().addRowSorterListener(new RowSorterListener() {

        @Override
        public void sorterChanged(RowSorterEvent e) {
            if (e.getType() == RowSorterEvent.Type.SORT_ORDER_CHANGED) {
                peptideShakerGUI.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                spectrumTable.getTableHeader().setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                // change the peptide shaker icon to a "waiting version"
                peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker-orange.gif")));
            } else if (e.getType() == RowSorterEvent.Type.SORTED) {
                peptideShakerGUI.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
                spectrumTable.getTableHeader().setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
                // change the peptide shaker icon to a "waiting version"
                peptideShakerGUI.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/peptide-shaker.gif")));
            }
        }
    });
    spectrumTable.getTableHeader().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            spectrumTableMouseClicked(e);
        }
    });
    peptideShakerJTable.getColumn(" ").setMinWidth(30);
    peptideShakerJTable.getColumn(" ").setMaxWidth(30);
    peptideShakerJTable.getColumn("  ").setMinWidth(30);
    peptideShakerJTable.getColumn("  ").setMaxWidth(30);
    spectrumTable.getColumn(" ").setMinWidth(50);
    spectrumTable.getColumn(" ").setMaxWidth(50);
    spectrumTable.getColumn("  ").setMinWidth(30);
    spectrumTable.getColumn("  ").setMaxWidth(30);
    spectrumTable.getColumn("Confidence").setMaxWidth(90);
    spectrumTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn(" ").setMinWidth(30);
    searchResultsTable.getColumn(" ").setMaxWidth(30);
    searchResultsTable.getColumn("SE").setMinWidth(37);
    searchResultsTable.getColumn("SE").setMaxWidth(37);
    searchResultsTable.getColumn("Rnk").setMinWidth(37);
    searchResultsTable.getColumn("Rnk").setMaxWidth(37);
    searchResultsTable.getColumn("  ").setMinWidth(30);
    searchResultsTable.getColumn("  ").setMaxWidth(30);
    peptideShakerJTable.getColumn("ID").setMaxWidth(37);
    peptideShakerJTable.getColumn("ID").setMinWidth(37);
    spectrumTable.getColumn("ID").setMaxWidth(37);
    spectrumTable.getColumn("ID").setMinWidth(37);
    peptideShakerJTable.getColumn("Confidence").setMaxWidth(90);
    peptideShakerJTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn("Confidence").setMaxWidth(90);
    searchResultsTable.getColumn("Confidence").setMinWidth(90);
    searchResultsTable.getColumn("Charge").setMaxWidth(90);
    searchResultsTable.getColumn("Charge").setMinWidth(90);
    // set up the psm color map
    HashMap<Integer, java.awt.Color> softwareAgreementColorMap = new HashMap<>();
    // id softwares agree with PTM certainty
    softwareAgreementColorMap.put(AGREEMENT_WITH_MODS, peptideShakerGUI.getSparklineColor());
    // id softwares agree on peptide but not ptm certainty
    softwareAgreementColorMap.put(AGREEMENT, java.awt.Color.CYAN);
    // id softwares don't agree
    softwareAgreementColorMap.put(CONFLICT, java.awt.Color.YELLOW);
    // some id softwares id'ed some didn't
    softwareAgreementColorMap.put(PARTIALLY_MISSING, java.awt.Color.ORANGE);
    // set up the psm tooltip map
    HashMap<Integer, String> idSoftwareTooltipMap = new HashMap<>();
    idSoftwareTooltipMap.put(AGREEMENT_WITH_MODS, "ID Software Agree");
    idSoftwareTooltipMap.put(AGREEMENT, "ID Software Agree - PTM Certainty Issues");
    idSoftwareTooltipMap.put(CONFLICT, "ID Software Disagree");
    idSoftwareTooltipMap.put(PARTIALLY_MISSING, "ID Software(s) Missing");
    peptideShakerJTable.getColumn("ID").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, softwareAgreementColorMap, idSoftwareTooltipMap));
    peptideShakerJTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    peptideShakerJTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) peptideShakerJTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    searchResultsTable.getColumn("SE").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, Advocate.getAdvocateColorMap(), Advocate.getAdvocateToolTipMap()));
    searchResultsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    searchResultsTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10d, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    // set up the psm color map
    HashMap<Integer, java.awt.Color> idSoftwareSpectrumLevelColorMap = new HashMap<>();
    // id softwares agree with PTM certainty
    idSoftwareSpectrumLevelColorMap.put(AGREEMENT_WITH_MODS, peptideShakerGUI.getSparklineColor());
    // id softwares agree on peptide but not ptm certainty
    idSoftwareSpectrumLevelColorMap.put(AGREEMENT, java.awt.Color.CYAN);
    // id softwares don't agree
    idSoftwareSpectrumLevelColorMap.put(CONFLICT, java.awt.Color.YELLOW);
    // some id softwares id'ed some didn't
    idSoftwareSpectrumLevelColorMap.put(PARTIALLY_MISSING, java.awt.Color.ORANGE);
    // no psm
    idSoftwareSpectrumLevelColorMap.put(NO_ID, java.awt.Color.lightGray);
    // set up the psm tooltip map
    HashMap<Integer, String> idSoftwareSpectrumLevelTooltipMap = new HashMap<>();
    idSoftwareSpectrumLevelTooltipMap.put(AGREEMENT_WITH_MODS, "ID Software Agree");
    idSoftwareSpectrumLevelTooltipMap.put(AGREEMENT, "ID Software Agree - PTM Certainty Issues");
    idSoftwareSpectrumLevelTooltipMap.put(CONFLICT, "ID Software Disagree");
    idSoftwareSpectrumLevelTooltipMap.put(PARTIALLY_MISSING, "ID Software(s) Missing");
    idSoftwareSpectrumLevelTooltipMap.put(NO_ID, "(No PSM)");
    spectrumTable.getColumn("ID").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(java.awt.Color.lightGray, idSoftwareSpectrumLevelColorMap, idSoftwareSpectrumLevelTooltipMap));
    spectrumTable.getColumn("m/z").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 4d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("Int").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 1000d, peptideShakerGUI.getSparklineColor()));
    spectrumTable.getColumn("RT (min)").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 0d, 1000d, 10d, peptideShakerGUI.getSparklineColor(), peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("m/z").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Int").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth());
    ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    ((JSparklinesIntervalChartTableCellRenderer) spectrumTable.getColumn("RT (min)").getCellRenderer()).showReferenceLine(true, 0.02, java.awt.Color.BLACK);
    spectrumTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    spectrumTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    spectrumTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    // set up the table header tooltips
    idSoftwareTableToolTips = new ArrayList<>();
    idSoftwareTableToolTips.add(null);
    idSoftwareTableToolTips.add("Identification Software");
    idSoftwareTableToolTips.add("Validated Peptide Spectrum Matches");
    idSoftwareTableToolTips.add("Unique Pepttide-Spectrum Matches");
    idSoftwareTableToolTips.add("Unassigned Spectra");
    idSoftwareTableToolTips.add("Identificaiton Rate (%)");
    if (peptideShakerGUI.getDisplayParameters().showScores()) {
        spectrumTable.getColumn("Score").setMaxWidth(90);
        spectrumTable.getColumn("Score").setMinWidth(90);
        peptideShakerJTable.getColumn("Score").setMaxWidth(90);
        peptideShakerJTable.getColumn("Score").setMinWidth(90);
        searchResultsTable.getColumn("Score").setMaxWidth(90);
        searchResultsTable.getColumn("Score").setMinWidth(90);
        spectrumTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) spectrumTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        peptideShakerJTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) peptideShakerJTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        searchResultsTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, peptideShakerGUI.getSparklineColor()));
        ((JSparklinesBarChartTableCellRenderer) searchResultsTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
        spectrumTableToolTips = new ArrayList<>();
        spectrumTableToolTips.add(null);
        spectrumTableToolTips.add("ID Software Agreement");
        spectrumTableToolTips.add("Spectrum Title");
        spectrumTableToolTips.add("Precursor m/z");
        spectrumTableToolTips.add("Precursor Charge");
        spectrumTableToolTips.add("Precursor Intensity");
        spectrumTableToolTips.add("Precursor Retention Time in Minutes");
        spectrumTableToolTips.add("Peptide Sequence");
        spectrumTableToolTips.add("Mapping Protein(s)");
        spectrumTableToolTips.add("Peptide Spectrum Match Score");
        spectrumTableToolTips.add("Peptide Spectrum Match Confidence");
        spectrumTableToolTips.add("Validated");
        peptideShakerTableToolTips = new ArrayList<>();
        peptideShakerTableToolTips.add(null);
        peptideShakerTableToolTips.add("ID Software Agreement");
        peptideShakerTableToolTips.add("Peptide Sequence");
        peptideShakerTableToolTips.add("Mapping Protein(s)");
        peptideShakerTableToolTips.add("Peptide Spectrum Match score");
        peptideShakerTableToolTips.add("Peptide Spectrum Match Confidence");
        peptideShakerTableToolTips.add("Validated");
        idResultsTableToolTips = new ArrayList<>();
        idResultsTableToolTips.add("Peptide Rank");
        idResultsTableToolTips.add("Search Engine / Identification Software");
        idResultsTableToolTips.add("Search Engine Rank / Identification Software Rank");
        idResultsTableToolTips.add("Peptide Sequence");
        idResultsTableToolTips.add("Precursor Charge");
        idResultsTableToolTips.add("Peptide Spectrum Match Score");
        idResultsTableToolTips.add("Peptide Spectrum Match Confidence");
        idResultsTableToolTips.add("Validated");
    } else {
        // set up the table header tooltips
        spectrumTableToolTips = new ArrayList<>();
        spectrumTableToolTips.add(null);
        spectrumTableToolTips.add("ID Software Agreement");
        spectrumTableToolTips.add("Spectrum Title");
        spectrumTableToolTips.add("Precursor m/z");
        spectrumTableToolTips.add("Precursor Charge");
        spectrumTableToolTips.add("Precursor Intensity");
        spectrumTableToolTips.add("Precursor Retention Time in Minutes");
        spectrumTableToolTips.add("Peptide Sequence");
        spectrumTableToolTips.add("Mapping Protein(s)");
        spectrumTableToolTips.add("Peptide Spectrum Match Confidence");
        spectrumTableToolTips.add("Validated");
        peptideShakerTableToolTips = new ArrayList<>();
        peptideShakerTableToolTips.add(null);
        peptideShakerTableToolTips.add("ID Software Agreement");
        peptideShakerTableToolTips.add("Peptide Sequence");
        peptideShakerTableToolTips.add("Mapping Protein(s)");
        peptideShakerTableToolTips.add("Peptide Spectrum Match Confidence");
        peptideShakerTableToolTips.add("Validated");
        idResultsTableToolTips = new ArrayList<>();
        idResultsTableToolTips.add("Peptide Rank");
        idResultsTableToolTips.add("Search Engine / Identification Software");
        idResultsTableToolTips.add("Search Engine Rank / Identification Software Rank");
        idResultsTableToolTips.add("Peptide Sequence");
        idResultsTableToolTips.add("Precursor Charge");
        idResultsTableToolTips.add("Peptide Spectrum Match Confidence");
        idResultsTableToolTips.add("Validated");
    }
}
Also used : JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) HashMap(java.util.HashMap) MouseAdapter(java.awt.event.MouseAdapter) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) RowSorterEvent(javax.swing.event.RowSorterEvent) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) RowSorterListener(javax.swing.event.RowSorterListener) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Example 2 with JSparklinesIntegerIconTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer in project peptide-shaker by compomics.

the class ProteinStructurePanel method setPeptideTableProperties.

/**
 * Set up the properties of the peptide table.
 */
private void setPeptideTableProperties() {
    peptideTable.getColumn(" ").setMaxWidth(50);
    peptideTable.getColumn(" ").setMinWidth(50);
    peptideTable.getColumn("PDB").setMinWidth(50);
    peptideTable.getColumn("PDB").setMaxWidth(50);
    peptideTable.getColumn("Start").setMinWidth(50);
    // the validated column
    peptideTable.getColumn("").setMaxWidth(30);
    peptideTable.getColumn("").setMinWidth(30);
    // the selected columns
    peptideTable.getColumn("  ").setMaxWidth(30);
    peptideTable.getColumn("  ").setMinWidth(30);
    // the protein inference column
    peptideTable.getColumn("PI").setMaxWidth(37);
    peptideTable.getColumn("PI").setMinWidth(37);
    peptideTable.getTableHeader().setReorderingAllowed(false);
    // set up the peptide inference color map
    HashMap<Integer, Color> peptideInferenceColorMap = new HashMap<>();
    peptideInferenceColorMap.put(PSParameter.NOT_GROUP, peptideShakerGUI.getSparklineColor());
    peptideInferenceColorMap.put(PSParameter.RELATED, Color.YELLOW);
    peptideInferenceColorMap.put(PSParameter.RELATED_AND_UNRELATED, Color.ORANGE);
    peptideInferenceColorMap.put(PSParameter.UNRELATED, Color.RED);
    // set up the peptide inference tooltip map
    HashMap<Integer, String> peptideInferenceTooltipMap = new HashMap<>();
    peptideInferenceTooltipMap.put(PSParameter.NOT_GROUP, "Unique to a single protein");
    peptideInferenceTooltipMap.put(PSParameter.RELATED, "Belongs to a group of related proteins");
    peptideInferenceTooltipMap.put(PSParameter.RELATED_AND_UNRELATED, "Belongs to a group of related and unrelated proteins");
    peptideInferenceTooltipMap.put(PSParameter.UNRELATED, "Belongs to unrelated proteins");
    peptideTable.getColumn("PI").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(peptideShakerGUI.getSparklineColor(), peptideInferenceColorMap, peptideInferenceTooltipMap));
    peptideTable.getColumn("Start").setCellRenderer(new JSparklinesMultiIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100d, 100d, peptideShakerGUI.getSparklineColor()));
    peptideTable.getColumn("PDB").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/pdb.png")), null, "Mapped to PDB Structure", null));
    peptideTable.getColumn("").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    peptideTable.getColumn("  ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
}
Also used : JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) HashMap(java.util.HashMap) JSparklinesMultiIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesMultiIntervalChartTableCellRenderer) Color(java.awt.Color) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer)

Example 3 with JSparklinesIntegerIconTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer in project peptide-shaker by compomics.

the class ProteinInferenceDialog method setColumnProperies.

/**
 * Set the properties for the columns in the results tables.
 */
private void setColumnProperies() {
    proteinMatchTable.getTableHeader().setReorderingAllowed(false);
    uniqueHitsTable.getTableHeader().setReorderingAllowed(false);
    relatedHitsTable.getTableHeader().setReorderingAllowed(false);
    proteinMatchTable.getColumn("  ").setMinWidth(50);
    proteinMatchTable.getColumn("  ").setMaxWidth(50);
    proteinMatchTable.getColumn("Gene").setMinWidth(90);
    proteinMatchTable.getColumn("Gene").setMaxWidth(90);
    proteinMatchTable.getColumn("Chr").setMinWidth(90);
    proteinMatchTable.getColumn("Chr").setMaxWidth(90);
    proteinMatchTable.getColumn("Evidence").setMinWidth(90);
    proteinMatchTable.getColumn("Evidence").setMaxWidth(90);
    proteinMatchTable.getColumn("Enz").setMinWidth(50);
    proteinMatchTable.getColumn("Enz").setMaxWidth(50);
    // set the preferred size of the accession column
    Integer width = ProteinTableModel.getPreferredAccessionColumnWidth(proteinMatchTable, proteinMatchTable.getColumn("Accession").getModelIndex(), 6, peptideShakerGUI.getMetrics().getMaxProteinAccessionLength());
    if (width != null) {
        proteinMatchTable.getColumn("Accession").setMinWidth(width);
        proteinMatchTable.getColumn("Accession").setMaxWidth(width);
    } else {
        proteinMatchTable.getColumn("Accession").setMinWidth(15);
        proteinMatchTable.getColumn("Accession").setMaxWidth(Integer.MAX_VALUE);
    }
    // the validated column
    uniqueHitsTable.getColumn(" ").setMaxWidth(30);
    relatedHitsTable.getColumn(" ").setMaxWidth(30);
    uniqueHitsTable.getColumn(" ").setMinWidth(30);
    relatedHitsTable.getColumn(" ").setMinWidth(30);
    proteinMatchTable.getColumn("").setMaxWidth(50);
    uniqueHitsTable.getColumn("").setMaxWidth(50);
    relatedHitsTable.getColumn("").setMaxWidth(50);
    proteinMatchTable.getColumn("").setMinWidth(50);
    uniqueHitsTable.getColumn("").setMinWidth(50);
    relatedHitsTable.getColumn("").setMinWidth(50);
    // the score and confidence columns
    uniqueHitsTable.getColumn("Confidence").setMaxWidth(90);
    uniqueHitsTable.getColumn("Confidence").setMinWidth(90);
    relatedHitsTable.getColumn("Confidence").setMaxWidth(90);
    relatedHitsTable.getColumn("Confidence").setMinWidth(90);
    // change the cell renderer to fix a problem in Nimbus and alternating row colors
    proteinMatchTable.getColumn("  ").setCellRenderer(new NimbusCheckBoxRenderer());
    proteinMatchTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    proteinMatchTable.getColumn("Chr").setCellRenderer(new ChromosomeTableCellRenderer(Color.WHITE, Color.BLACK));
    proteinMatchTable.getColumn("Enz").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/selected_green-new.png")), null, "Enzymatic", "Not Enzymatic"));
    uniqueHitsTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    uniqueHitsTable.getColumn(" ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    uniqueHitsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) uniqueHitsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    relatedHitsTable.getColumn("Protein(s)").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    relatedHitsTable.getColumn(" ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    relatedHitsTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) relatedHitsTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    // set up the table header tooltips
    candidateProteinsTableToolTips = new ArrayList<>();
    candidateProteinsTableToolTips.add(null);
    candidateProteinsTableToolTips.add("Protein Group Representative");
    candidateProteinsTableToolTips.add("Protein Accession");
    candidateProteinsTableToolTips.add("Protein Description");
    candidateProteinsTableToolTips.add("Gene Name");
    candidateProteinsTableToolTips.add("Chromosome Number");
    candidateProteinsTableToolTips.add("Protein Evidence Level");
    candidateProteinsTableToolTips.add("Contains Enzymatic Peptides");
    uniqueHitsTableToolTips = new ArrayList<>();
    uniqueHitsTableToolTips.add(null);
    uniqueHitsTableToolTips.add("Protein Accession(s)");
    uniqueHitsTableToolTips.add("Protein Confidence");
    uniqueHitsTableToolTips.add("Validated");
    relatedHitsTableToolTips = new ArrayList<>();
    relatedHitsTableToolTips.add(null);
    relatedHitsTableToolTips.add("Protein Accession(s)");
    relatedHitsTableToolTips.add("Protein Confidence");
    relatedHitsTableToolTips.add("Validated");
}
Also used : ImageIcon(javax.swing.ImageIcon) ChromosomeTableCellRenderer(no.uib.jsparklines.extra.ChromosomeTableCellRenderer) NimbusCheckBoxRenderer(no.uib.jsparklines.extra.NimbusCheckBoxRenderer) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer)

Example 4 with JSparklinesIntegerIconTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer in project peptide-shaker by compomics.

the class ModificationsPanel method setTableProperties.

/**
 * Set up the properties of the tables.
 */
private void setTableProperties() {
    // correct the color for the upper right corner
    JPanel modificationCorner = new JPanel();
    modificationCorner.setBackground(modificationJTable.getTableHeader().getBackground());
    modificationJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, modificationCorner);
    JPanel modifiedPeptidesCorner = new JPanel();
    modifiedPeptidesCorner.setBackground(peptidesTable.getTableHeader().getBackground());
    peptidesTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, modifiedPeptidesCorner);
    JPanel relatedPeptidesCorner = new JPanel();
    relatedPeptidesCorner.setBackground(relatedPeptidesTable.getTableHeader().getBackground());
    relatedPeptidesTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, relatedPeptidesCorner);
    JPanel psmMatchesCorner = new JPanel();
    psmMatchesCorner.setBackground(selectedPsmsTable.getTableHeader().getBackground());
    psmsModifiedTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, psmMatchesCorner);
    JPanel psmRelatedMatchesCorner = new JPanel();
    psmRelatedMatchesCorner.setBackground(relatedPsmsTable.getTableHeader().getBackground());
    psmsRelatedTableJScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, psmRelatedMatchesCorner);
    JPanel aScoreTableCorner = new JPanel();
    aScoreTableCorner.setBackground(relatedPsmsTable.getTableHeader().getBackground());
    psmAScoresScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, aScoreTableCorner);
    JPanel deltaScoreTableCorner = new JPanel();
    deltaScoreTableCorner.setBackground(relatedPsmsTable.getTableHeader().getBackground());
    psmDeltaScrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, deltaScoreTableCorner);
    modificationJTable.getColumn("  ").setMaxWidth(35);
    modificationJTable.getColumn("  ").setMinWidth(35);
    modificationJTable.getColumn("#").setMaxWidth(50);
    modificationJTable.getColumn("#").setMinWidth(50);
    peptidesTable.getColumn("   ").setMaxWidth(30);
    peptidesTable.getColumn("   ").setMinWidth(30);
    peptidesTable.getColumn(" ").setMaxWidth(45);
    peptidesTable.getColumn(" ").setMinWidth(45);
    peptidesTable.getColumn("Modification").setMaxWidth(45);
    peptidesTable.getColumn("Modification").setMinWidth(45);
    peptidesTable.getColumn("  ").setMaxWidth(30);
    peptidesTable.getColumn("  ").setMinWidth(30);
    peptidesTable.getColumn("PI").setMaxWidth(37);
    peptidesTable.getColumn("PI").setMinWidth(37);
    peptidesTable.getColumn("Peptide").setMaxWidth(80);
    peptidesTable.getColumn("Peptide").setMinWidth(80);
    relatedPeptidesTable.getColumn("   ").setMaxWidth(30);
    relatedPeptidesTable.getColumn("   ").setMinWidth(30);
    relatedPeptidesTable.getColumn(" ").setMaxWidth(45);
    relatedPeptidesTable.getColumn(" ").setMinWidth(45);
    relatedPeptidesTable.getColumn("PI").setMaxWidth(37);
    relatedPeptidesTable.getColumn("PI").setMinWidth(37);
    relatedPeptidesTable.getColumn("  ").setMaxWidth(30);
    relatedPeptidesTable.getColumn("  ").setMinWidth(30);
    relatedPeptidesTable.getColumn("Modification").setMaxWidth(45);
    relatedPeptidesTable.getColumn("Modification").setMinWidth(45);
    relatedPeptidesTable.getColumn("Peptide").setMaxWidth(80);
    relatedPeptidesTable.getColumn("Peptide").setMinWidth(80);
    selectedPsmsTable.getColumn("   ").setMaxWidth(30);
    selectedPsmsTable.getColumn("   ").setMinWidth(30);
    selectedPsmsTable.getColumn(" ").setMaxWidth(45);
    selectedPsmsTable.getColumn(" ").setMinWidth(45);
    selectedPsmsTable.getColumn("Modification").setMaxWidth(45);
    selectedPsmsTable.getColumn("Modification").setMinWidth(45);
    selectedPsmsTable.getColumn("Charge").setMaxWidth(90);
    selectedPsmsTable.getColumn("Charge").setMinWidth(90);
    selectedPsmsTable.getColumn("  ").setMaxWidth(30);
    selectedPsmsTable.getColumn("  ").setMinWidth(30);
    relatedPsmsTable.getColumn("   ").setMaxWidth(30);
    relatedPsmsTable.getColumn("   ").setMinWidth(30);
    relatedPsmsTable.getColumn(" ").setMaxWidth(45);
    relatedPsmsTable.getColumn(" ").setMinWidth(45);
    relatedPsmsTable.getColumn("Modification").setMaxWidth(45);
    relatedPsmsTable.getColumn("Modification").setMinWidth(45);
    relatedPsmsTable.getColumn("Charge").setMaxWidth(90);
    relatedPsmsTable.getColumn("Charge").setMinWidth(90);
    relatedPsmsTable.getColumn("  ").setMaxWidth(30);
    relatedPsmsTable.getColumn("  ").setMinWidth(30);
    peptidesTable.getTableHeader().setReorderingAllowed(false);
    relatedPeptidesTable.getTableHeader().setReorderingAllowed(false);
    selectedPsmsTable.getTableHeader().setReorderingAllowed(false);
    relatedPsmsTable.getTableHeader().setReorderingAllowed(false);
    psmAScoresTable.getTableHeader().setReorderingAllowed(false);
    psmDeltaScoresTable.getTableHeader().setReorderingAllowed(false);
    // centrally align the column headers
    TableCellRenderer renderer = psmAScoresTable.getTableHeader().getDefaultRenderer();
    JLabel label = (JLabel) renderer;
    label.setHorizontalAlignment(JLabel.CENTER);
    renderer = psmDeltaScoresTable.getTableHeader().getDefaultRenderer();
    label = (JLabel) renderer;
    label.setHorizontalAlignment(JLabel.CENTER);
    // set up the protein inference color map
    HashMap<Integer, Color> proteinInferenceColorMap = new HashMap<>();
    proteinInferenceColorMap.put(PSParameter.NOT_GROUP, peptideShakerGUI.getSparklineColor());
    proteinInferenceColorMap.put(PSParameter.RELATED, Color.YELLOW);
    proteinInferenceColorMap.put(PSParameter.RELATED_AND_UNRELATED, Color.ORANGE);
    proteinInferenceColorMap.put(PSParameter.UNRELATED, Color.RED);
    // set up the protein inference tooltip map
    proteinInferenceTooltipMap = new HashMap<>();
    proteinInferenceTooltipMap.put(PSParameter.NOT_GROUP, "Unique to a single protein");
    proteinInferenceTooltipMap.put(PSParameter.RELATED, "Belongs to a group of related proteins");
    proteinInferenceTooltipMap.put(PSParameter.RELATED_AND_UNRELATED, "Belongs to a group of related and unrelated proteins");
    proteinInferenceTooltipMap.put(PSParameter.UNRELATED, "Belongs to unrelated proteins");
    peptidesTable.getColumn("PI").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, proteinInferenceColorMap, proteinInferenceTooltipMap));
    relatedPeptidesTable.getColumn("PI").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, proteinInferenceColorMap, proteinInferenceTooltipMap));
    peptidesTable.getColumn("   ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
    relatedPeptidesTable.getColumn("   ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
    // set up the modification confidence color map
    HashMap<Integer, Color> modificationConfidenceColorMap = new HashMap<>();
    modificationConfidenceColorMap.put(ModificationScoring.NOT_FOUND, Color.lightGray);
    modificationConfidenceColorMap.put(ModificationScoring.RANDOM, Color.RED);
    modificationConfidenceColorMap.put(ModificationScoring.DOUBTFUL, Color.ORANGE);
    modificationConfidenceColorMap.put(ModificationScoring.CONFIDENT, Color.YELLOW);
    modificationConfidenceColorMap.put(ModificationScoring.VERY_CONFIDENT, peptideShakerGUI.getSparklineColor());
    // set up the modification confidence tooltip map
    modificationConfidenceTooltipMap = new HashMap<>();
    modificationConfidenceTooltipMap.put(-1, "(No Modifications)");
    modificationConfidenceTooltipMap.put(ModificationScoring.RANDOM, "Random Assignment");
    modificationConfidenceTooltipMap.put(ModificationScoring.DOUBTFUL, "Doubtful Assignment");
    modificationConfidenceTooltipMap.put(ModificationScoring.CONFIDENT, "Confident Assignment");
    modificationConfidenceTooltipMap.put(ModificationScoring.VERY_CONFIDENT, "Very Confident Assignment");
    peptidesTable.getColumn("Modification").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, modificationConfidenceColorMap, modificationConfidenceTooltipMap));
    relatedPeptidesTable.getColumn("Modification").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, modificationConfidenceColorMap, modificationConfidenceTooltipMap));
    selectedPsmsTable.getColumn("Modification").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, modificationConfidenceColorMap, modificationConfidenceTooltipMap));
    relatedPsmsTable.getColumn("Modification").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(Color.lightGray, modificationConfidenceColorMap, modificationConfidenceTooltipMap));
    peptidesTable.getColumn("Peptide").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) peptidesTable.getColumn("Peptide").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    peptidesTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    relatedPeptidesTable.getColumn("Peptide").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) relatedPeptidesTable.getColumn("Peptide").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, peptideShakerGUI.getScoreAndConfidenceDecimalFormat());
    relatedPeptidesTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    selectedPsmsTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) selectedPsmsTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    selectedPsmsTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    selectedPsmsTable.getColumn("RT").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 0d, 1000d, 10d, peptideShakerGUI.getSparklineColor(), peptideShakerGUI.getSparklineColor()));
    ((JSparklinesIntervalChartTableCellRenderer) selectedPsmsTable.getColumn("RT").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    ((JSparklinesIntervalChartTableCellRenderer) selectedPsmsTable.getColumn("RT").getCellRenderer()).showReferenceLine(true, 0.02, java.awt.Color.BLACK);
    selectedPsmsTable.getColumn("   ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
    relatedPsmsTable.getColumn("Charge").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10.0, peptideShakerGUI.getSparklineColor()));
    ((JSparklinesBarChartTableCellRenderer) relatedPsmsTable.getColumn("Charge").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 30);
    relatedPsmsTable.getColumn("  ").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(this.getClass()), MatchValidationLevel.getTooltipMap()));
    relatedPsmsTable.getColumn("RT").setCellRenderer(new JSparklinesIntervalChartTableCellRenderer(PlotOrientation.HORIZONTAL, 0d, 1000d, 10d, peptideShakerGUI.getSparklineColor(), peptideShakerGUI.getSparklineColor()));
    ((JSparklinesIntervalChartTableCellRenderer) relatedPsmsTable.getColumn("RT").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() + 5);
    ((JSparklinesIntervalChartTableCellRenderer) relatedPsmsTable.getColumn("RT").getCellRenderer()).showReferenceLine(true, 0.02, java.awt.Color.BLACK);
    relatedPsmsTable.getColumn("   ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(this.getClass().getResource("/icons/star_yellow.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), new ImageIcon(this.getClass().getResource("/icons/star_grey.png")), "Starred", null, null));
    // modification color coding
    modificationJTable.getColumn("  ").setCellRenderer(new JSparklinesColorTableCellRenderer());
    // set up the table header tooltips
    selectedPeptidesTableToolTips = new ArrayList<>();
    selectedPeptidesTableToolTips.add(null);
    selectedPeptidesTableToolTips.add("Starred");
    selectedPeptidesTableToolTips.add("Peptide Inference Class");
    selectedPeptidesTableToolTips.add("Peptide Sequence");
    selectedPeptidesTableToolTips.add("Modification Location Confidence");
    selectedPeptidesTableToolTips.add("Peptide Confidence");
    selectedPeptidesTableToolTips.add("Peptide Validated");
    relatedPeptidesTableToolTips = new ArrayList<>();
    relatedPeptidesTableToolTips.add(null);
    relatedPeptidesTableToolTips.add("Starred");
    relatedPeptidesTableToolTips.add("Peptide Inference Class");
    relatedPeptidesTableToolTips.add("Peptide Sequence");
    relatedPeptidesTableToolTips.add("Modification Location Confidence");
    relatedPeptidesTableToolTips.add("Peptide Confidence");
    relatedPeptidesTableToolTips.add("Peptide Validated");
    selectedPsmsTableToolTips = new ArrayList<>();
    selectedPsmsTableToolTips.add(null);
    selectedPsmsTableToolTips.add("Starred");
    selectedPsmsTableToolTips.add("Peptide Sequence");
    selectedPsmsTableToolTips.add("Modification Location Confidence");
    selectedPsmsTableToolTips.add("Precursor Charge");
    selectedPsmsTableToolTips.add("Precursor Retention Time");
    selectedPsmsTableToolTips.add("PSM Validated");
    relatedPsmsTableToolTips = new ArrayList<>();
    relatedPsmsTableToolTips.add(null);
    relatedPsmsTableToolTips.add("Starred");
    relatedPsmsTableToolTips.add("Peptide Sequence");
    relatedPsmsTableToolTips.add("Modification Location Confidence");
    relatedPsmsTableToolTips.add("Precursor Charge");
    relatedPsmsTableToolTips.add("Precursor Retention Time");
    relatedPsmsTableToolTips.add("PSM Validated");
    modificationTableToolTips = new ArrayList<>();
    modificationTableToolTips.add("Color");
    modificationTableToolTips.add("Name");
    modificationTableToolTips.add("Frequency");
}
Also used : JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) TableCellRenderer(javax.swing.table.TableCellRenderer) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) JSparklinesColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesColorTableCellRenderer) HashMap(java.util.HashMap) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesColorTableCellRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) JSparklinesIntervalChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)

Example 5 with JSparklinesIntegerIconTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer in project peptide-shaker by compomics.

the class ProteinInferencePeptideLevelDialog method setUpGUI.

/**
 * Set up the GUI.
 */
private void setUpGUI() {
    // make the tabs go from right to left
    tabbedPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    protInferenceTypeCmb.setRenderer(new AlignedListCellRenderer(SwingConstants.CENTER));
    // make sure that the scroll panes are see-through
    proteinsJScrollPane.getViewport().setOpaque(false);
    otherProteinsJScrollPane.getViewport().setOpaque(false);
    // set up the table properties
    otherProteinJTable.getTableHeader().setReorderingAllowed(false);
    otherProteinJTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    retainedProteinJTable.getTableHeader().setReorderingAllowed(false);
    retainedProteinJTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    retainedProteinJTable.getColumn(" ").setMinWidth(50);
    retainedProteinJTable.getColumn(" ").setMaxWidth(50);
    retainedProteinJTable.getColumn("Gene").setMinWidth(90);
    retainedProteinJTable.getColumn("Gene").setMaxWidth(90);
    retainedProteinJTable.getColumn("Chr").setMinWidth(90);
    retainedProteinJTable.getColumn("Chr").setMaxWidth(90);
    retainedProteinJTable.getColumn("Evidence").setMinWidth(90);
    retainedProteinJTable.getColumn("Evidence").setMaxWidth(90);
    retainedProteinJTable.getColumn("Enz").setMinWidth(50);
    retainedProteinJTable.getColumn("Enz").setMaxWidth(50);
    otherProteinJTable.getColumn(" ").setMinWidth(50);
    otherProteinJTable.getColumn(" ").setMaxWidth(50);
    otherProteinJTable.getColumn("Gene").setMinWidth(90);
    otherProteinJTable.getColumn("Gene").setMaxWidth(90);
    otherProteinJTable.getColumn("Chr").setMinWidth(90);
    otherProteinJTable.getColumn("Chr").setMaxWidth(90);
    otherProteinJTable.getColumn("Evidence").setMinWidth(90);
    otherProteinJTable.getColumn("Evidence").setMaxWidth(90);
    otherProteinJTable.getColumn("Enz").setMinWidth(50);
    otherProteinJTable.getColumn("Enz").setMaxWidth(50);
    // set the preferred size of the accession column
    Integer width = ProteinTableModel.getPreferredAccessionColumnWidth(otherProteinJTable, otherProteinJTable.getColumn("Accession").getModelIndex(), 6, peptideShakerGUI.getMetrics().getMaxProteinAccessionLength());
    if (width != null) {
        otherProteinJTable.getColumn("Accession").setMinWidth(width);
        otherProteinJTable.getColumn("Accession").setMaxWidth(width);
    } else {
        otherProteinJTable.getColumn("Accession").setMinWidth(15);
        otherProteinJTable.getColumn("Accession").setMaxWidth(Integer.MAX_VALUE);
    }
    otherProteinJTable.getColumn("Chr").setCellRenderer(new ChromosomeTableCellRenderer(Color.WHITE, Color.BLACK));
    HashMap<Integer, ImageIcon> enzymeIcons = new HashMap<>();
    enzymeIcons.put(0, new ImageIcon(this.getClass().getResource("/icons/warning-red.png")));
    enzymeIcons.put(1, new ImageIcon(this.getClass().getResource("/icons/warning-new.png")));
    enzymeIcons.put(2, new ImageIcon(this.getClass().getResource("/icons/selected_green-new.png")));
    HashMap<Integer, String> enzymeIconTooltips = new HashMap<>();
    enzymeIconTooltips.put(0, "Non-enzymatic");
    enzymeIconTooltips.put(1, "Semi-enzymatic");
    enzymeIconTooltips.put(2, "Enzymatic");
    otherProteinJTable.getColumn("Enz").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(enzymeIcons, enzymeIconTooltips));
    // set the preferred size of the accession column
    width = ProteinTableModel.getPreferredAccessionColumnWidth(retainedProteinJTable, retainedProteinJTable.getColumn("Accession").getModelIndex(), 6, peptideShakerGUI.getMetrics().getMaxProteinAccessionLength());
    if (width != null) {
        retainedProteinJTable.getColumn("Accession").setMinWidth(width);
        retainedProteinJTable.getColumn("Accession").setMaxWidth(width);
    } else {
        retainedProteinJTable.getColumn("Accession").setMinWidth(15);
        retainedProteinJTable.getColumn("Accession").setMaxWidth(Integer.MAX_VALUE);
    }
    retainedProteinJTable.getColumn("Chr").setCellRenderer(new ChromosomeTableCellRenderer(Color.WHITE, Color.BLACK));
    retainedProteinJTable.getColumn("Enz").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(enzymeIcons, enzymeIconTooltips));
    // set up the table header tooltips
    retainedProteinsTableToolTips = new ArrayList<>();
    retainedProteinsTableToolTips.add(null);
    retainedProteinsTableToolTips.add("Protein Accession");
    retainedProteinsTableToolTips.add("Protein Description");
    retainedProteinsTableToolTips.add("Gene Name");
    retainedProteinsTableToolTips.add("Chromosome Number");
    retainedProteinsTableToolTips.add("Protein Evidence Level");
    retainedProteinsTableToolTips.add("Enzymatic Peptide");
    otherProteinsTableToolTips = new ArrayList<>();
    otherProteinsTableToolTips.add(null);
    otherProteinsTableToolTips.add("Protein Accession");
    otherProteinsTableToolTips.add("Protein Description");
    otherProteinsTableToolTips.add("Gene Name");
    otherProteinsTableToolTips.add("Chromosome Number");
    otherProteinsTableToolTips.add("Protein Evidence Level");
    otherProteinsTableToolTips.add("Enzymatic Peptide");
    // update the panel border with the nubmer of rows in the table
    ((TitledBorder) retainedProteinsPanel.getBorder()).setTitle("Retained Proteins (" + retainedProteinJTable.getRowCount() + ")");
    ((TitledBorder) otherProteinsPanel.getBorder()).setTitle("Other Proteins (" + otherProteinJTable.getRowCount() + ")");
}
Also used : AlignedListCellRenderer(com.compomics.util.gui.renderers.AlignedListCellRenderer) ImageIcon(javax.swing.ImageIcon) ChromosomeTableCellRenderer(no.uib.jsparklines.extra.ChromosomeTableCellRenderer) HashMap(java.util.HashMap) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) TitledBorder(javax.swing.border.TitledBorder) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Aggregations

JSparklinesIntegerIconTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer)7 HashMap (java.util.HashMap)5 HtmlLinksRenderer (no.uib.jsparklines.extra.HtmlLinksRenderer)5 JSparklinesBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)5 TrueFalseIconRenderer (no.uib.jsparklines.extra.TrueFalseIconRenderer)4 JSparklinesIntegerColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer)4 Color (java.awt.Color)3 ImageIcon (javax.swing.ImageIcon)3 ChromosomeTableCellRenderer (no.uib.jsparklines.extra.ChromosomeTableCellRenderer)3 DecimalFormat (java.text.DecimalFormat)2 RowSorterEvent (javax.swing.event.RowSorterEvent)2 RowSorterListener (javax.swing.event.RowSorterListener)2 JSparklinesArrayListBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesArrayListBarChartTableCellRenderer)2 JSparklinesIntervalChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer)2 AlignedListCellRenderer (com.compomics.util.gui.renderers.AlignedListCellRenderer)1 MouseAdapter (java.awt.event.MouseAdapter)1 MouseEvent (java.awt.event.MouseEvent)1 ArrayList (java.util.ArrayList)1 JPanel (javax.swing.JPanel)1 TitledBorder (javax.swing.border.TitledBorder)1