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);
}
}
}
}
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);
}
}
}
Aggregations