Search in sources :

Example 1 with PeakListTableColumnModel

use of net.sf.mzmine.modules.visualization.peaklisttable.table.PeakListTableColumnModel in project mzmine2 by mzmine.

the class PeakListTableWindow method openManualIntegrationDialog.

private void openManualIntegrationDialog(@Nonnull MouseEvent e) {
    PeakListTableColumnModel model = (PeakListTableColumnModel) table.getColumnModel();
    final Point clickedPoint = e.getPoint();
    if (e.getClickCount() >= 2 && model.getSelectedColumnCount() == 1) {
        // int selectedColumn = table.columnAtPoint(clickedPoint);
        final int selectedColumn = model.getColumn(table.columnAtPoint(clickedPoint)).getModelIndex();
        if (selectedColumn > CommonColumnType.values().length) {
            if (model.getColumnByModelIndex(selectedColumn).getIdentifier() == DataFileColumnType.AREA) {
                final int clickedRow = table.rowAtPoint(clickedPoint);
                final RawDataFile clickedDataFile = table.getPeakList().getRawDataFile((selectedColumn - CommonColumnType.values().length) / DataFileColumnType.values().length);
                XICManualPickerModule.runManualDetection(clickedDataFile, table.getPeakList().getRow(table.convertRowIndexToModel(clickedRow)), table.getPeakList(), table);
            }
        }
    }
}
Also used : RawDataFile(net.sf.mzmine.datamodel.RawDataFile) PeakListTableColumnModel(net.sf.mzmine.modules.visualization.peaklisttable.table.PeakListTableColumnModel) Point(java.awt.Point) Point(java.awt.Point)

Example 2 with PeakListTableColumnModel

use of net.sf.mzmine.modules.visualization.peaklisttable.table.PeakListTableColumnModel in project mzmine2 by mzmine.

the class PeakListTableWindow method actionPerformed.

/**
 * Methods for ActionListener interface implementation
 */
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (command.equals("PROPERTIES")) {
        ExitCode exitCode = parameters.showSetupDialog(this, true);
        if (exitCode == ExitCode.OK) {
            int rowHeight = parameters.getParameter(PeakListTableParameters.rowHeight).getValue();
            table.setRowHeight(rowHeight);
            PeakListTableColumnModel cm = (PeakListTableColumnModel) table.getColumnModel();
            cm.createColumns();
        }
    }
    if (command.equals("AUTOCOLUMNWIDTH")) {
        // Auto size column width based on data
        for (int column = 0; column < table.getColumnCount(); column++) {
            TableColumn tableColumn = table.getColumnModel().getColumn(column);
            if (tableColumn.getHeaderValue() != "Peak shape" && tableColumn.getHeaderValue() != "Status") {
                TableCellRenderer renderer = tableColumn.getHeaderRenderer();
                if (renderer == null) {
                    renderer = table.getTableHeader().getDefaultRenderer();
                }
                Component component = renderer.getTableCellRendererComponent(table, tableColumn.getHeaderValue(), false, false, -1, column);
                int preferredWidth = component.getPreferredSize().width + 20;
                tableColumn.setPreferredWidth(preferredWidth);
            }
        }
    }
    if (command.equals("PRINT")) {
        try {
            table.print(PrintMode.FIT_WIDTH);
        } catch (PrinterException e) {
            MZmineCore.getDesktop().displayException(this, e);
        }
    }
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) PeakListTableColumnModel(net.sf.mzmine.modules.visualization.peaklisttable.table.PeakListTableColumnModel) ExitCode(net.sf.mzmine.util.ExitCode) PrinterException(java.awt.print.PrinterException) Component(java.awt.Component) TableColumn(javax.swing.table.TableColumn) Point(java.awt.Point)

Aggregations

Point (java.awt.Point)2 PeakListTableColumnModel (net.sf.mzmine.modules.visualization.peaklisttable.table.PeakListTableColumnModel)2 Component (java.awt.Component)1 PrinterException (java.awt.print.PrinterException)1 TableCellRenderer (javax.swing.table.TableCellRenderer)1 TableColumn (javax.swing.table.TableColumn)1 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)1 ExitCode (net.sf.mzmine.util.ExitCode)1