Search in sources :

Example 1 with CombinedXICComponent

use of net.sf.mzmine.util.components.CombinedXICComponent in project mzmine2 by mzmine.

the class PeakShapeCellRenderer method getTableCellRendererComponent.

/**
 * @see javax.swing.table.TableCellRenderer#getTableCellRendererComponent(javax.swing.JTable,
 *      java.lang.Object, boolean, boolean, int, int)
 */
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JPanel newPanel = new JPanel();
    newPanel.setLayout(new OverlayLayout(newPanel));
    Color bgColor;
    if (isSelected)
        bgColor = table.getSelectionBackground();
    else
        bgColor = table.getBackground();
    newPanel.setBackground(bgColor);
    if (value instanceof Feature) {
        Feature peak = (Feature) value;
        double maxHeight = 0;
        PeakShapeNormalization norm = parameters.getParameter(PeakListTableParameters.peakShapeNormalization).getValue();
        if (norm == null)
            norm = PeakShapeNormalization.ROWMAX;
        switch(norm) {
            case GLOBALMAX:
                maxHeight = peakList.getDataPointMaxIntensity();
                break;
            case ROWMAX:
                int rowNumber = peakList.getPeakRowNum(peak);
                maxHeight = peakList.getRow(rowNumber).getDataPointMaxIntensity();
                break;
            default:
                maxHeight = peak.getRawDataPointsIntensityRange().upperEndpoint();
                break;
        }
        PeakXICComponent xic = new PeakXICComponent(peak, maxHeight);
        newPanel.add(xic);
        newPanel.setToolTipText(xic.getToolTipText());
    }
    if (value instanceof PeakListRow) {
        PeakListRow plRow = (PeakListRow) value;
        RawDataFile[] dataFiles = peakList.getRawDataFiles();
        Feature[] peaks = new Feature[dataFiles.length];
        for (int i = 0; i < dataFiles.length; i++) {
            peaks[i] = plRow.getPeak(dataFiles[i]);
        }
        CombinedXICComponent xic = new CombinedXICComponent(peaks, plRow.getID());
        newPanel.add(xic);
        newPanel.setToolTipText(xic.getToolTipText());
    }
    return newPanel;
}
Also used : JPanel(javax.swing.JPanel) Color(java.awt.Color) Feature(net.sf.mzmine.datamodel.Feature) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) OverlayLayout(javax.swing.OverlayLayout) CombinedXICComponent(net.sf.mzmine.util.components.CombinedXICComponent) PeakShapeNormalization(net.sf.mzmine.modules.visualization.peaklisttable.PeakShapeNormalization) PeakXICComponent(net.sf.mzmine.util.components.PeakXICComponent)

Aggregations

Color (java.awt.Color)1 JPanel (javax.swing.JPanel)1 OverlayLayout (javax.swing.OverlayLayout)1 Feature (net.sf.mzmine.datamodel.Feature)1 PeakListRow (net.sf.mzmine.datamodel.PeakListRow)1 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)1 PeakShapeNormalization (net.sf.mzmine.modules.visualization.peaklisttable.PeakShapeNormalization)1 CombinedXICComponent (net.sf.mzmine.util.components.CombinedXICComponent)1 PeakXICComponent (net.sf.mzmine.util.components.PeakXICComponent)1