use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class IntensityPlotModule method showIntensityPlot.
public static void showIntensityPlot(@Nonnull MZmineProject project, PeakList peakList, PeakListRow[] rows) {
ParameterSet parameters = MZmineCore.getConfiguration().getModuleParameters(IntensityPlotModule.class);
parameters.getParameter(IntensityPlotParameters.peakList).setValue(PeakListsSelectionType.SPECIFIC_PEAKLISTS, new PeakList[] { peakList });
parameters.getParameter(IntensityPlotParameters.dataFiles).setChoices(peakList.getRawDataFiles());
parameters.getParameter(IntensityPlotParameters.dataFiles).setValue(peakList.getRawDataFiles());
parameters.getParameter(IntensityPlotParameters.selectedRows).setValue(rows);
UserParameter<?, ?>[] projectParams = project.getParameters();
Object[] xAxisSources = new Object[projectParams.length + 1];
xAxisSources[0] = IntensityPlotParameters.rawDataFilesOption;
for (int i = 0; i < projectParams.length; i++) {
xAxisSources[i + 1] = new ParameterWrapper(projectParams[i]);
}
parameters.getParameter(IntensityPlotParameters.xAxisValueSource).setChoices(xAxisSources);
ExitCode exitCode = parameters.showSetupDialog(null, true);
if (exitCode == ExitCode.OK) {
PeakListRow[] selectedRows = parameters.getParameter(IntensityPlotParameters.selectedRows).getMatchingRows(peakList);
if (selectedRows.length == 0) {
MZmineCore.getDesktop().displayErrorMessage(null, "No rows selected");
return;
}
IntensityPlotWindow newFrame = new IntensityPlotWindow(parameters.cloneParameterSet());
newFrame.setVisible(true);
}
}
use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class GraphicsExportDialog method updateComponentsFromParameters.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void updateComponentsFromParameters() {
for (Parameter<?> p : parameters.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent component = parametersAndComponents.get(p.getName());
up.setValueToComponent(component, up.getValue());
}
for (Parameter<?> p : chartParam.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent component = parametersAndComponents.get(p.getName());
if (component instanceof JFontSpecs) {
// stop listeners from changing all fonts to master
JFontSpecs f = (JFontSpecs) component;
setListenersEnabled(false);
up.setValueToComponent(f, up.getValue());
f.stopListener();
setListenersEnabled(true);
} else
up.setValueToComponent(component, up.getValue());
}
}
use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class MSMSLibrarySubmissionWindow method createMetaDataPanel.
private void createMetaDataPanel() {
// Main panel which holds all the components in a grid
pnMetaData = new GridBagPanel();
scrollMeta = new JScrollPane(pnMetaData);
scrollMeta.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollMeta.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
pnSideMenu.add(scrollMeta, BorderLayout.CENTER);
int rowCounter = 0;
int vertWeightSum = 0;
// Create labels and components for each parameter
for (Parameter p : paramMeta.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent comp = up.createEditingComponent();
comp.setToolTipText(up.getDescription());
// Set the initial value
Object value = up.getValue();
if (value != null)
up.setValueToComponent(comp, value);
// By calling this we make sure the components will never be resized
// smaller than their optimal size
comp.setMinimumSize(comp.getPreferredSize());
comp.setToolTipText(up.getDescription());
JLabel label = new JLabel(p.getName());
pnMetaData.add(label, 0, rowCounter);
label.setLabelFor(comp);
parametersAndComponents.put(p.getName(), comp);
JComboBox t = new JComboBox();
int comboh = t.getPreferredSize().height;
int comph = comp.getPreferredSize().height;
// Multiple selection will be expandable, other components not
int verticalWeight = comph > 2 * comboh ? 1 : 0;
vertWeightSum += verticalWeight;
pnMetaData.add(comp, 1, rowCounter, 1, 1, 1, verticalWeight, GridBagConstraints.VERTICAL);
rowCounter++;
}
}
use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class MSMSLibrarySubmissionWindow method createSubmitParamPanel.
private void createSubmitParamPanel() {
// Main panel which holds all the components in a grid
pnSubmitParam = new GridBagPanel();
pnSideMenu.add(pnSubmitParam, BorderLayout.NORTH);
int rowCounter = 0;
// Create labels and components for each parameter
for (Parameter p : paramSubmit.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent comp = up.createEditingComponent();
comp.setToolTipText(up.getDescription());
// Set the initial value
Object value = up.getValue();
if (value != null)
up.setValueToComponent(comp, value);
// By calling this we make sure the components will never be resized
// smaller than their optimal size
comp.setMinimumSize(comp.getPreferredSize());
comp.setToolTipText(up.getDescription());
// add separator
if (p.getName().equals(LibrarySubmitParameters.LOCALFILE.getName())) {
pnSubmitParam.addSeparator(0, rowCounter, 2);
rowCounter++;
}
JLabel label = new JLabel(p.getName());
pnSubmitParam.add(label, 0, rowCounter);
label.setLabelFor(comp);
parametersAndComponents.put(p.getName(), comp);
JComboBox t = new JComboBox();
int comboh = t.getPreferredSize().height;
int comph = comp.getPreferredSize().height;
int verticalWeight = comph > 2 * comboh ? 1 : 0;
pnSubmitParam.add(comp, 1, rowCounter, 1, 1, 1, verticalWeight, GridBagConstraints.VERTICAL);
rowCounter++;
}
}
use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class MSMSLibrarySubmissionWindow method updateParameterSetFromComponents.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void updateParameterSetFromComponents() {
for (Parameter<?> p : paramSubmit.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent component = parametersAndComponents.get(p.getName());
up.setValueFromComponent(component);
}
for (Parameter<?> p : paramMeta.getParameters()) {
if (!(p instanceof UserParameter))
continue;
UserParameter up = (UserParameter) p;
JComponent component = parametersAndComponents.get(p.getName());
up.setValueFromComponent(component);
}
}
Aggregations