Sorry for all these very specific questions but I try to implement a node where the user can select a single column. If this column does have domain values a checkbox should be enabled (not set). Is that possible? I did not succeed whatever I tried.
This is what I tried so far:
@Widget(title = "Select Column", description = "...")
@ValueReference(value = ColumnNameRef.class)
@ChoicesProvider(DoubleStringColumnsProvider.class)
String m_inputColumn;
interface ColumnNameRef extends ParameterReference<String> {
}
@Widget(title = "checkbox", description = "...")
@Effect(predicate = HasDomainValues.class, type = EffectType.ENABLE)
boolean m_option = false;
static final class HasDomainValues implements EffectPredicateProvider {
@Override
public EffectPredicate init(PredicateInitializer i) {
return i.getConstant(
(NodeParametersInput context) -> {
String selectedColumn = i.getString(ColumnNameRef.class).toString(); //cannot get the name of the selected column this way!
DataColumnDomain domain = context.getInTableSpec(0).map(tSpec -> tSpec.getColumnSpec(selectedColumn).getDomain()).get();
return domain.hasValues() || domain.hasBounds();
});
}
}
Thanks a lot in advance!