if (minValue == null)
minValue = 0;
Number maxValue = ((Number) maxSearchField.getValue());
if (maxValue == null)
maxValue = 0;
Range searchRange = new Range(minValue.doubleValue(),
maxValue.doubleValue());
try {
SearchDefinition newSearch = new SearchDefinition(searchType,
searchRegex, searchRange);
chart.updateSearchDefinition(newSearch);
} catch (PatternSyntaxException pe) {
MZmineCore.getDesktop().displayErrorMessage(
"The regular expression's syntax is invalid: " + pe);
}
return;
}
if (command.equals("SEARCH_DATA_TYPE")) {
SearchDefinitionType searchType = (SearchDefinitionType) comboSearchDataType
.getSelectedItem();
switch (searchType) {
case MASS :
minSearchField.setVisible(true);
maxSearchField.setVisible(true);
labelRange.setVisible(true);
txtSearchField.setVisible(false);
NumberFormat mzFormatter = MZmineCore.getConfiguration()
.getMZFormat();
Range mzRange = peakList.getRowsMZRange();
DefaultFormatterFactory mzFormatFac = new DefaultFormatterFactory(
new NumberFormatter(mzFormatter));
minSearchField.setFormatterFactory(mzFormatFac);
minSearchField.setValue(mzRange.getMin());
maxSearchField.setFormatterFactory(mzFormatFac);
maxSearchField.setValue(mzRange.getMax());
break;
case RT :
minSearchField.setVisible(true);
maxSearchField.setVisible(true);
labelRange.setVisible(true);
txtSearchField.setVisible(false);
NumberFormat rtFormatter = MZmineCore.getConfiguration()
.getRTFormat();
Range rtRange = peakList.getRowsRTRange();
DefaultFormatterFactory rtFormatFac = new DefaultFormatterFactory(
new NumberFormatter(rtFormatter));
minSearchField.setFormatterFactory(rtFormatFac);
minSearchField.setValue(rtRange.getMin());
maxSearchField.setFormatterFactory(rtFormatFac);
maxSearchField.setValue(rtRange.getMax());
break;
case NAME :
minSearchField.setVisible(false);
maxSearchField.setVisible(false);