use of org.jwildfire.create.tina.variation.Variation in project JWildfire by thargor6.
the class TinaController method nonlinearParamsCmbChanged.
public void nonlinearParamsCmbChanged(int pIdx) {
if (cmbRefreshing) {
return;
}
cmbRefreshing = true;
try {
String selected = (String) data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsCmb().getSelectedItem();
XForm xForm = getCurrXForm();
if (xForm != null && selected != null && selected.length() > 0) {
if (pIdx < xForm.getVariationCount()) {
Variation var = xForm.getVariation(pIdx);
// params
int idx;
if ((idx = var.getFunc().getParameterIndex(selected)) >= 0) {
enableNonlinearControls(data.TinaNonlinearControlsRows[pIdx], false);
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setOnlyIntegers(false);
Object val = var.getFunc().getParameterValues()[idx];
if (val instanceof Double) {
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(Tools.doubleToString((Double) val));
} else if (val instanceof Integer) {
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(val.toString());
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setOnlyIntegers(true);
} else {
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(val.toString());
}
} else // ressources
if ((idx = var.getFunc().getRessourceIndex(selected)) >= 0) {
enableNonlinearControls(data.TinaNonlinearControlsRows[pIdx], true);
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(null);
} else // empty
{
data.TinaNonlinearControlsRows[pIdx].getNonlinearParamsREd().setText(null);
}
}
}
} finally {
cmbRefreshing = false;
}
}
Aggregations