public MsMsVisualizerWindow( RawDataFile dataFile, Range<Double> rtRange, Range<Double> mzRange, IntensityType intensityType, NormalizationType normalizationType, Double minPeakInt, ParameterSet parameters) { super("MS/MS visualizer: [" + dataFile.getName() + "]"); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setBackground(Color.white); this.dataFile = dataFile; this.tooltipMode = true; dataset = new MsMsDataSet( dataFile, rtRange, mzRange, intensityType, normalizationType, minPeakInt, this); toolBar = new MsMsToolBar(this); add(toolBar, BorderLayout.EAST); IDAPlot = new MsMsPlot(this, dataFile, this, dataset, rtRange, mzRange); add(IDAPlot, BorderLayout.CENTER); bottomPanel = new MsMsBottomPanel(this, dataFile, parameters); add(bottomPanel, BorderLayout.SOUTH); updateTitle(); // After we have constructed everything, load the peak lists into the // bottom panel bottomPanel.rebuildPeakListSelector(); MZmineCore.getDesktop().addPeakListTreeListener(bottomPanel); // Add the Windows menu JMenuBar menuBar = new JMenuBar(); menuBar.add(new WindowsMenu()); setJMenuBar(menuBar); pack(); // get the window settings parameter ParameterSet paramSet = MZmineCore.getConfiguration().getModuleParameters(MsMsVisualizerModule.class); WindowSettingsParameter settings = paramSet.getParameter(MsMsParameters.windowSettings); // update the window and listen for changes settings.applySettingsToWindow(this); this.addComponentListener(settings); }
public void createColumns() { // clear column groups ColumnGroup groups[] = header.getColumnGroups(); if (groups != null) { for (ColumnGroup group : groups) { header.removeColumnGroup(group); } } // clear the column model while (getColumnCount() > 0) { TableColumn col = getColumn(0); removeColumn(col); } // create the "average" group ColumnGroup averageGroup = new ColumnGroup("Average"); header.addColumnGroup(averageGroup); JTextField editorField = new JTextField(); editorField.setFont(editFont); DefaultCellEditor defaultEditor = new DefaultCellEditor(editorField); ColumnSettingParameter<CommonColumnType> csPar = parameters.getParameter(PeakListTableParameters.commonColumns); CommonColumnType visibleCommonColumns[] = csPar.getValue(); // This is a workaround for a bug - we need to always show the ID, m/z // and RT columns, otherwise manual editing of peak identities does not // work. ArrayList<CommonColumnType> commonColumnsList = new ArrayList<>(Arrays.asList(visibleCommonColumns)); commonColumnsList.remove(CommonColumnType.ROWID); commonColumnsList.remove(CommonColumnType.AVERAGEMZ); commonColumnsList.remove(CommonColumnType.AVERAGERT); commonColumnsList.add(0, CommonColumnType.ROWID); commonColumnsList.add(1, CommonColumnType.AVERAGEMZ); commonColumnsList.add(2, CommonColumnType.AVERAGERT); visibleCommonColumns = commonColumnsList.toArray(visibleCommonColumns); ColumnSettingParameter<DataFileColumnType> dfPar = parameters.getParameter(PeakListTableParameters.dataFileColumns); DataFileColumnType visibleDataFileColumns[] = dfPar.getValue(); for (int i = 0; i < visibleCommonColumns.length; i++) { CommonColumnType commonColumn = visibleCommonColumns[i]; int modelIndex = Arrays.asList(CommonColumnType.values()).indexOf(commonColumn); TableColumn newColumn = new TableColumn(modelIndex); newColumn.setHeaderValue(commonColumn.getColumnName()); newColumn.setIdentifier(commonColumn); switch (commonColumn) { case AVERAGEMZ: newColumn.setCellRenderer(mzRenderer); break; case AVERAGERT: newColumn.setCellRenderer(rtRenderer); break; case IDENTITY: newColumn.setCellRenderer(identityRenderer); break; case COMMENT: newColumn.setCellRenderer(defaultRendererLeft); newColumn.setCellEditor(defaultEditor); break; case PEAKSHAPE: newColumn.setCellRenderer(peakShapeRenderer); break; default: newColumn.setCellRenderer(defaultRenderer); } this.addColumn(newColumn); newColumn.setPreferredWidth(csPar.getColumnWidth(modelIndex)); if ((commonColumn == CommonColumnType.AVERAGEMZ) || (commonColumn == CommonColumnType.AVERAGERT)) { averageGroup.add(newColumn); } } for (int i = 0; i < peakList.getNumberOfRawDataFiles(); i++) { RawDataFile dataFile = peakList.getRawDataFile(i); ColumnGroup fileGroup = new ColumnGroup(dataFile.getName()); header.addColumnGroup(fileGroup); for (int j = 0; j < visibleDataFileColumns.length; j++) { DataFileColumnType dataFileColumn = visibleDataFileColumns[j]; int dataFileColumnIndex = Arrays.asList(DataFileColumnType.values()).indexOf(dataFileColumn); int modelIndex = CommonColumnType.values().length + (i * DataFileColumnType.values().length) + dataFileColumnIndex; TableColumn newColumn = new TableColumn(modelIndex); newColumn.setHeaderValue(dataFileColumn.getColumnName()); newColumn.setIdentifier(dataFileColumn); switch (dataFileColumn) { case MZ: newColumn.setCellRenderer(mzRenderer); break; case PEAKSHAPE: newColumn.setCellRenderer(peakShapeRenderer); break; case STATUS: newColumn.setCellRenderer(peakStatusRenderer); break; case RT: newColumn.setCellRenderer(rtRenderer); break; case RT_START: newColumn.setCellRenderer(rtRenderer); break; case RT_END: newColumn.setCellRenderer(rtRenderer); break; case DURATION: newColumn.setCellRenderer(rtRenderer); break; case HEIGHT: newColumn.setCellRenderer(intensityRenderer); break; case AREA: newColumn.setCellRenderer(intensityRenderer); break; default: newColumn.setCellRenderer(defaultRenderer); break; } this.addColumn(newColumn); newColumn.setPreferredWidth(dfPar.getColumnWidth(dataFileColumnIndex)); fileGroup.add(newColumn); } } }
void updateTitle() { StringBuffer title = new StringBuffer(); title.append("Time vs. m/z for precursor ions\n"); title.append(dataFile.getName()); IDAPlot.setTitle(title.toString()); }