Search in sources :

Example 1 with JSparklinesColorTableCellRenderer

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

the class SpectrumColorsDialog method setUpGui.

/**
 * Set up the GUI.
 */
private void setUpGui() {
    annotatedPeakColorPanel.setBackground(peptideShakerGUI.getUtilitiesUserParameters().getSpectrumAnnotatedPeakColor());
    backgroundPeakColorPanel.setBackground(peptideShakerGUI.getUtilitiesUserParameters().getSpectrumBackgroundPeakColor());
    mirroredPeakColorPanel.setBackground(peptideShakerGUI.getUtilitiesUserParameters().getSpectrumAnnotatedMirroredPeakColor());
    annotatedPeakWidthSpinner.setValue(peptideShakerGUI.getUtilitiesUserParameters().getSpectrumAnnotatedPeakWidth());
    backgroundPeakWidthSpinner.setValue(peptideShakerGUI.getUtilitiesUserParameters().getSpectrumBackgroundPeakWidth());
    colorsTable.getTableHeader().setReorderingAllowed(false);
    // make sure that the scroll panes are see-through
    colorsScrollPane.getViewport().setOpaque(false);
    colorsTable.getColumn(" ").setMaxWidth(50);
    colorsTable.getColumn(" ").setMinWidth(50);
    colorsTable.getColumn("  ").setMaxWidth(40);
    colorsTable.getColumn("  ").setMinWidth(40);
    // set the cell renderers
    colorsTable.getColumn("  ").setCellRenderer(new JSparklinesColorTableCellRenderer());
}
Also used : JSparklinesColorTableCellRenderer(no.uib.jsparklines.renderers.JSparklinesColorTableCellRenderer)

Example 2 with JSparklinesColorTableCellRenderer

use of no.uib.jsparklines.renderers.JSparklinesColorTableCellRenderer 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)

Aggregations

JSparklinesColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesColorTableCellRenderer)2 HashMap (java.util.HashMap)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 TrueFalseIconRenderer (no.uib.jsparklines.extra.TrueFalseIconRenderer)1 JSparklinesBarChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesBarChartTableCellRenderer)1 JSparklinesIntegerColorTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerColorTableCellRenderer)1 JSparklinesIntegerIconTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntegerIconTableCellRenderer)1 JSparklinesIntervalChartTableCellRenderer (no.uib.jsparklines.renderers.JSparklinesIntervalChartTableCellRenderer)1