Search in sources :

Example 1 with ChromosomeTableCellRenderer

use of no.uib.jsparklines.extra.ChromosomeTableCellRenderer in project peptide-shaker by compomics.

the class OverviewPanel method enableDarkTheme.

/**
 * Enable or disable the dark theme.
 *
 * @param darkTheme enable or disable the dark theme
 */
public void enableDarkTheme(boolean darkTheme) {
    if (darkTheme) {
        proteinTable.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinTable.setForeground(new Color(240, 240, 240));
        proteinTable.setSelectionBackground(Color.DARK_GRAY);
        proteinTable.setSelectionForeground(new Color(240, 240, 240));
        proteinTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), "FEFFFF"));
        ((ChromosomeTableCellRenderer) proteinTable.getColumn("Chr").getCellRenderer()).setFontColors(new Color(240, 240, 240), new Color(240, 240, 240));
        peptideTable.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        peptideTable.setForeground(new Color(240, 240, 240));
        peptideTable.setSelectionBackground(Color.DARK_GRAY);
        peptideTable.setSelectionForeground(new Color(240, 240, 240));
        ((JSparklinesMultiIntervalChartTableCellRenderer) peptideTable.getColumn("Start").getCellRenderer()).showReferenceLine(true, 0.03, Color.WHITE);
        psmTable.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        psmTable.setForeground(new Color(240, 240, 240));
        psmTable.setSelectionBackground(Color.DARK_GRAY);
        psmTable.setSelectionForeground(new Color(240, 240, 240));
        spectrumPanel.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        spectrumPanel.getGraphics().setColor(Color.WHITE);
        ptmChart.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        ptmSequencePanel.getChartPanel().setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        ptmSequencePanel.getChartPanel().getChart().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        ptmSequencePanel.getChartPanel().getChart().getPlot().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().setRangeGridlinePaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setLabelPaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().setDomainGridlinePaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setLabelPaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.WHITE);
        coverageChart.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinSequencePanel.getChartPanel().setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinSequencePanel.getChartPanel().getChart().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinSequencePanel.getChartPanel().getChart().getPlot().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().setRangeGridlinePaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setLabelPaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().setDomainGridlinePaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setLabelPaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.WHITE);
        proteinSequencePanel.setReferenceLine(0.03, Color.WHITE);
        massErrorBubblePlot.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorBubblePlot.getChartPanel().setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorBubblePlot.getChartPanel().getChart().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorBubblePlot.getChartPanel().getChart().getPlot().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.WHITE);
        massErrorPlot.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorPlot.getChartPanel().setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorPlot.getChartPanel().getChart().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorPlot.getChartPanel().getChart().getPlot().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        massErrorPlot.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.WHITE);
        intensityHistogram.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        intensityHistogram.getChartPanel().setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        intensityHistogram.getChartPanel().getChart().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        intensityHistogram.getChartPanel().getChart().getPlot().setBackgroundPaint(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        intensityHistogram.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.WHITE);
        proteinSequencePanel.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
        proteinSequencePanel.setReferenceLine(0.03, Color.WHITE);
        ((TitledBorder) proteinsLayeredPanel.getBorder()).setTitleColor(new Color(240, 240, 240));
        ((TitledBorder) peptidesPanel.getBorder()).setTitleColor(new Color(240, 240, 240));
        ((TitledBorder) psmsPanel.getBorder()).setTitleColor(new Color(240, 240, 240));
        ((TitledBorder) spectrumMainPanel.getBorder()).setTitleColor(new Color(240, 240, 240));
        ((TitledBorder) sequenceCoverageTitledPanel.getBorder()).setTitleColor(new Color(240, 240, 240));
        sequenceFragmentationPanel.setFontColor(new Color(240, 240, 240));
        sequenceFragmentationPanel.setFont(new Font("Segoe UI", Font.BOLD, 14));
        sequenceFragmentationPanel.setBackground(PeptideShakerGUI.DARK_THEME_BACKGROUND_COLOR);
    } else {
        proteinTable.setBackground(Color.WHITE);
        proteinTable.setForeground(Color.BLACK);
        proteinTable.setSelectionBackground(new Color(57, 105, 138));
        proteinTable.setSelectionForeground(Color.WHITE);
        proteinTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
        ((ChromosomeTableCellRenderer) proteinTable.getColumn("Chr").getCellRenderer()).setFontColors(Color.WHITE, Color.BLACK);
        peptideTable.setBackground(Color.WHITE);
        peptideTable.setForeground(Color.BLACK);
        peptideTable.setSelectionBackground(new Color(57, 105, 138));
        peptideTable.setSelectionForeground(Color.WHITE);
        ((JSparklinesMultiIntervalChartTableCellRenderer) peptideTable.getColumn("Start").getCellRenderer()).showReferenceLine(true, 0.02, Color.BLACK);
        psmTable.setBackground(Color.WHITE);
        psmTable.setForeground(Color.BLACK);
        psmTable.setSelectionBackground(new Color(57, 105, 138));
        psmTable.setSelectionForeground(Color.WHITE);
        spectrumPanel.setBackground(Color.WHITE);
        spectrumPanel.getGraphics().setColor(Color.BLACK);
        ptmChart.setBackground(Color.WHITE);
        ptmSequencePanel.getChartPanel().setBackground(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().setBackgroundPaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getPlot().setBackgroundPaint(Color.WHITE);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().setRangeGridlinePaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setLabelPaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setAxisLinePaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().setDomainGridlinePaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setLabelPaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setAxisLinePaint(Color.BLACK);
        ptmSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.BLACK);
        coverageChart.setBackground(Color.WHITE);
        proteinSequencePanel.getChartPanel().setBackground(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().setBackgroundPaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getPlot().setBackgroundPaint(Color.WHITE);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().setRangeGridlinePaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setLabelPaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setAxisLinePaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().setDomainGridlinePaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setLabelPaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setAxisLinePaint(Color.BLACK);
        proteinSequencePanel.getChartPanel().getChart().getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.BLACK);
        proteinSequencePanel.setReferenceLine(0.03, Color.BLACK);
        proteinSequencePanel.setBackground(Color.WHITE);
        proteinSequencePanel.setReferenceLine(0.03, Color.BLACK);
        massErrorBubblePlot.setBackground(Color.WHITE);
        massErrorBubblePlot.getChartPanel().setBackground(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().setBackgroundPaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getPlot().setBackgroundPaint(Color.WHITE);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.BLACK);
        massErrorBubblePlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.BLACK);
        massErrorPlot.setBackground(Color.WHITE);
        massErrorPlot.getChartPanel().setBackground(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().setBackgroundPaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getPlot().setBackgroundPaint(Color.WHITE);
        massErrorPlot.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.BLACK);
        massErrorPlot.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.BLACK);
        intensityHistogram.setBackground(Color.WHITE);
        intensityHistogram.getChartPanel().setBackground(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().setBackgroundPaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getPlot().setBackgroundPaint(Color.WHITE);
        intensityHistogram.getChartPanel().getChart().getXYPlot().setRangeGridlinePaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setLabelPaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setAxisLinePaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getRangeAxis().setTickLabelPaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().setDomainGridlinePaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setLabelPaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setAxisLinePaint(Color.BLACK);
        intensityHistogram.getChartPanel().getChart().getXYPlot().getDomainAxis().setTickLabelPaint(Color.BLACK);
        ((TitledBorder) proteinsLayeredPanel.getBorder()).setTitleColor(Color.BLACK);
        ((TitledBorder) peptidesPanel.getBorder()).setTitleColor(Color.BLACK);
        ((TitledBorder) psmsPanel.getBorder()).setTitleColor(Color.BLACK);
        ((TitledBorder) spectrumMainPanel.getBorder()).setTitleColor(Color.BLACK);
        ((TitledBorder) sequenceCoverageTitledPanel.getBorder()).setTitleColor(Color.BLACK);
        sequenceFragmentationPanel.setFontColor(Color.BLACK);
        sequenceFragmentationPanel.setFont(new Font("Segoe UI", Font.BOLD, 14));
        sequenceFragmentationPanel.setBackground(Color.WHITE);
    }
    proteinTable.repaint();
}
Also used : ChromosomeTableCellRenderer(no.uib.jsparklines.extra.ChromosomeTableCellRenderer) TitledBorder(javax.swing.border.TitledBorder) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Example 2 with ChromosomeTableCellRenderer

use of no.uib.jsparklines.extra.ChromosomeTableCellRenderer 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 3 with ChromosomeTableCellRenderer

use of no.uib.jsparklines.extra.ChromosomeTableCellRenderer 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)

Example 4 with ChromosomeTableCellRenderer

use of no.uib.jsparklines.extra.ChromosomeTableCellRenderer in project peptide-shaker by compomics.

the class ProteinTableModel method setProteinTableProperties.

/**
 * Set up the properties of the protein table.
 *
 * @param proteinTable the protein table
 * @param sparklineColor the sparkline color to use
 * @param sparklineColorNotValidated the sparkline color for not validated
 * stuffs
 * @param parentClass the parent class used to get icons
 * @param sparklineColorNotFound the sparkline color for not found stuffs
 * @param sparklineColorDoubtful the sparkline color for doubtful
 * @param scoreAndConfidenceDecimalFormat the decimal format for score and
 * confidence
 * @param maxProteinKeyLength the longest protein key to display
 */
public static void setProteinTableProperties(JTable proteinTable, Color sparklineColor, Color sparklineColorNotValidated, Color sparklineColorNotFound, Color sparklineColorDoubtful, DecimalFormat scoreAndConfidenceDecimalFormat, Class parentClass, Integer maxProteinKeyLength) {
    // @TODO: find a better location for this method?
    // the index column
    proteinTable.getColumn(" ").setMaxWidth(50);
    proteinTable.getColumn(" ").setMinWidth(50);
    proteinTable.getColumn("Chr").setMaxWidth(50);
    proteinTable.getColumn("Chr").setMinWidth(50);
    try {
        proteinTable.getColumn("Confidence").setMaxWidth(90);
        proteinTable.getColumn("Confidence").setMinWidth(90);
    } catch (IllegalArgumentException w) {
        proteinTable.getColumn("Score").setMaxWidth(90);
        proteinTable.getColumn("Score").setMinWidth(90);
    }
    // the validated column
    proteinTable.getColumn("").setMaxWidth(30);
    proteinTable.getColumn("").setMinWidth(30);
    // the selected columns
    proteinTable.getColumn("  ").setMaxWidth(30);
    proteinTable.getColumn("  ").setMinWidth(30);
    // the protein inference column
    proteinTable.getColumn("PI").setMaxWidth(37);
    proteinTable.getColumn("PI").setMinWidth(37);
    // set up the protein inference color map
    HashMap<Integer, Color> proteinInferenceColorMap = new HashMap<>();
    proteinInferenceColorMap.put(PSParameter.NOT_GROUP, sparklineColor);
    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
    HashMap<Integer, String> proteinInferenceTooltipMap = new HashMap<>();
    proteinInferenceTooltipMap.put(PSParameter.NOT_GROUP, "Single Protein");
    proteinInferenceTooltipMap.put(PSParameter.RELATED, "Related Proteins");
    proteinInferenceTooltipMap.put(PSParameter.RELATED_AND_UNRELATED, "Related and Unrelated Proteins");
    proteinInferenceTooltipMap.put(PSParameter.UNRELATED, "Unrelated Proteins");
    proteinTable.getColumn("Accession").setCellRenderer(new HtmlLinksRenderer(TableProperties.getSelectedRowHtmlTagFontColor(), TableProperties.getNotSelectedRowHtmlTagFontColor()));
    proteinTable.getColumn("PI").setCellRenderer(new JSparklinesIntegerColorTableCellRenderer(sparklineColor, proteinInferenceColorMap, proteinInferenceTooltipMap));
    // use a gray color for no decoy searches
    Color nonValidatedColor = sparklineColorNotValidated;
    ArrayList<Color> sparklineColors = new ArrayList<>(4);
    sparklineColors.add(sparklineColor);
    sparklineColors.add(sparklineColorDoubtful);
    sparklineColors.add(nonValidatedColor);
    sparklineColors.add(sparklineColorNotFound);
    JSparklinesArrayListBarChartTableCellRenderer coverageCellRendered = new JSparklinesArrayListBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, sparklineColors, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumExceptLastNumber);
    coverageCellRendered.showNumberAndChart(true, TableProperties.getLabelWidth(), new DecimalFormat("0.00"));
    proteinTable.getColumn("Coverage").setCellRenderer(coverageCellRendered);
    JSparklinesArrayListBarChartTableCellRenderer peptidesCellRenderer = new JSparklinesArrayListBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, sparklineColors, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumOfNumbers);
    peptidesCellRenderer.showNumberAndChart(true, TableProperties.getLabelWidth(), new DecimalFormat("0"));
    proteinTable.getColumn("#Peptides").setCellRenderer(peptidesCellRenderer);
    JSparklinesArrayListBarChartTableCellRenderer spectraCellRenderer = new JSparklinesArrayListBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, sparklineColors, JSparklinesArrayListBarChartTableCellRenderer.ValueDisplayType.sumOfNumbers);
    spectraCellRenderer.showNumberAndChart(true, TableProperties.getLabelWidth(), new DecimalFormat("0"));
    proteinTable.getColumn("#Spectra").setCellRenderer(spectraCellRenderer);
    JSparklinesBarChartTableCellRenderer spectrumCountingCellRenderer = new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10.0, sparklineColor);
    spectrumCountingCellRenderer.showNumberAndChart(true, TableProperties.getLabelWidth() + 20, new DecimalFormat("0.00E00"));
    proteinTable.getColumn("MS2 Quant.").setCellRenderer(spectrumCountingCellRenderer);
    JSparklinesBarChartTableCellRenderer mwCellRenderer = new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 10.0, sparklineColor);
    mwCellRenderer.showNumberAndChart(true, TableProperties.getLabelWidth());
    proteinTable.getColumn("MW").setCellRenderer(mwCellRenderer);
    proteinTable.getColumn("Chr").setCellRenderer(new ChromosomeTableCellRenderer(Color.WHITE, Color.BLACK));
    try {
        proteinTable.getColumn("Confidence").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, sparklineColor));
        ((JSparklinesBarChartTableCellRenderer) proteinTable.getColumn("Confidence").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, scoreAndConfidenceDecimalFormat);
    } catch (IllegalArgumentException e) {
        proteinTable.getColumn("Score").setCellRenderer(new JSparklinesBarChartTableCellRenderer(PlotOrientation.HORIZONTAL, 100.0, sparklineColor));
        ((JSparklinesBarChartTableCellRenderer) proteinTable.getColumn("Score").getCellRenderer()).showNumberAndChart(true, TableProperties.getLabelWidth() - 20, scoreAndConfidenceDecimalFormat);
    }
    proteinTable.getColumn("").setCellRenderer(new JSparklinesIntegerIconTableCellRenderer(MatchValidationLevel.getIconMap(parentClass), MatchValidationLevel.getTooltipMap()));
    proteinTable.getColumn("  ").setCellRenderer(new TrueFalseIconRenderer(new ImageIcon(parentClass.getResource("/icons/star_yellow.png")), new ImageIcon(parentClass.getResource("/icons/star_grey.png")), new ImageIcon(parentClass.getResource("/icons/star_grey.png")), "Starred", null, null));
    // set the preferred size of the accession column
    if (maxProteinKeyLength != null) {
        Integer width = getPreferredAccessionColumnWidth(proteinTable, proteinTable.getColumn("Accession").getModelIndex(), 6, maxProteinKeyLength);
        if (width != null) {
            proteinTable.getColumn("Accession").setMinWidth(width);
            proteinTable.getColumn("Accession").setMaxWidth(width);
        } else {
            proteinTable.getColumn("Accession").setMinWidth(15);
            proteinTable.getColumn("Accession").setMaxWidth(Integer.MAX_VALUE);
        }
    }
}
Also used : ImageIcon(javax.swing.ImageIcon) ChromosomeTableCellRenderer(no.uib.jsparklines.extra.ChromosomeTableCellRenderer) HashMap(java.util.HashMap) Color(java.awt.Color) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) JSparklinesIntegerIconTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer) JSparklinesArrayListBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesArrayListBarChartTableCellRenderer) TrueFalseIconRenderer(no.uib.jsparklines.extra.TrueFalseIconRenderer) JSparklinesIntegerColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer) JSparklinesBarChartTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer) HtmlLinksRenderer(no.uib.jsparklines.extra.HtmlLinksRenderer)

Aggregations

ChromosomeTableCellRenderer (no.uib.jsparklines.extra.ChromosomeTableCellRenderer)4 HtmlLinksRenderer (no.uib.jsparklines.extra.HtmlLinksRenderer)4 ImageIcon (javax.swing.ImageIcon)3 JSparklinesIntegerIconTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer)3 HashMap (java.util.HashMap)2 TitledBorder (javax.swing.border.TitledBorder)2 TrueFalseIconRenderer (no.uib.jsparklines.extra.TrueFalseIconRenderer)2 JSparklinesBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)2 AlignedListCellRenderer (com.compomics.util.gui.renderers.AlignedListCellRenderer)1 Color (java.awt.Color)1 DecimalFormat (java.text.DecimalFormat)1 ArrayList (java.util.ArrayList)1 NimbusCheckBoxRenderer (no.uib.jsparklines.extra.NimbusCheckBoxRenderer)1 JSparklinesArrayListBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesArrayListBarChartTableCellRenderer)1 JSparklinesIntegerColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer)1