use of net.sf.mzmine.parameters.parametertypes.OptionalParameterComponent in project mzmine2 by mzmine.
the class GraphicsExportDialog method renewPreview.
/**
* renew chart preview with specified size
*/
protected void renewPreview() {
// set dimensions to chartpanel
try {
// update param
updateParameterSetFromComponents();
//
if (parameters.isUseOnlyWidth()) {
double height = (ChartLogics.calcHeightToWidth(chartPanel, parameters.getWidthPixel(), false));
DoubleParameter p = parameters.getParameter(GraphicsExportParameters.height).getEmbeddedParameter();
DoubleComponent c = ((OptionalParameterComponent<DoubleComponent>) parametersAndComponents.get(p.getName())).getEmbeddedComponent();
p.setValueToComponent(c, height);
p.setValueFromComponent(c);
chartPanel.setSize((int) parameters.getWidthPixel(), (int) parameters.getHeightPixel());
getPnChartPreview().repaint();
} else {
chartPanel.setSize((int) parameters.getWidthPixel(), (int) parameters.getHeightPixel());
chartPanel.repaint();
}
} catch (Exception ex) {
ex.printStackTrace();
LOG.log(Level.SEVERE, "Error while renewing preview of graphics export dialog ", ex);
}
}
use of net.sf.mzmine.parameters.parametertypes.OptionalParameterComponent in project mzmine2 by mzmine.
the class SpectraIdentificationSpectralDatabaseParameters method showSetupDialog.
@Override
public ExitCode showSetupDialog(Window parent, boolean valueCheckRequired) {
if ((getParameters() == null) || (getParameters().length == 0))
return ExitCode.OK;
ParameterSetupDialog dialog = new ParameterSetupDialog(parent, valueCheckRequired, this);
// only enable precursor mz tolerance if precursor mz is used
OptionalParameterComponent usePreComp = (OptionalParameterComponent) dialog.getComponentForParameter(usePrecursorMZ);
JComponent mzTolPrecursor = dialog.getComponentForParameter(mzTolerancePrecursor);
mzTolPrecursor.setEnabled(getParameter(usePrecursorMZ).getValue());
usePreComp.addItemListener(e -> {
mzTolPrecursor.setEnabled(usePreComp.isSelected());
});
dialog.setVisible(true);
return dialog.getExitCode();
}
Aggregations