use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class ParameterSetupDialog method updateParameterSetFromComponents.
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void updateParameterSetFromComponents() {
for (Parameter<?> p : parameterSet.getParameters()) {
if (!(p instanceof UserParameter) && !(p instanceof HiddenParameter))
continue;
UserParameter up;
if (p instanceof UserParameter)
up = (UserParameter) p;
else
up = (UserParameter) ((HiddenParameter) p).getEmbeddedParameter();
JComponent component = parametersAndComponents.get(p.getName());
// if a parameter is a HiddenParameter it does not necessarily have component
if (component != null)
up.setValueFromComponent(component);
}
}
use of net.sf.mzmine.parameters.UserParameter in project mzmine2 by mzmine.
the class HeatmapSetupDialog method parametersChanged.
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void parametersChanged() {
// Get the current value of the "Sample parameter" combo
UserParameter<?, ?> currentParameterSelection = (UserParameter<?, ?>) selDataCombo.getSelectedItem();
if (currentParameterSelection == null)
return;
// If the value has changed, update the "Reference group" combo
if (currentParameterSelection != previousParameterSelection) {
ArrayList<Object> values = new ArrayList<Object>();
// Obtain all possible values
for (RawDataFile dataFile : MZmineCore.getProjectManager().getCurrentProject().getDataFiles()) {
Object paramValue = MZmineCore.getProjectManager().getCurrentProject().getParameterValue(currentParameterSelection, dataFile);
if (paramValue == null)
continue;
if (!values.contains(paramValue))
values.add(paramValue);
}
// Update the parameter and combo model
Object[] newValues = values.toArray();
super.parameterSet.getParameter(HeatMapParameters.referenceGroup).setChoices(newValues);
refGroupCombo.setModel(new DefaultComboBoxModel(newValues));
previousParameterSelection = currentParameterSelection;
}
this.updateParameterSetFromComponents();
}
Aggregations