use of org.knime.base.data.aggregation.AggregationOperator in project knime-core by knime.
the class AggregationSettingsDialog method onHelp.
/**
* @param method
* @since 2.12
*/
protected void onHelp(final AggregationFunction method) {
final String help;
if (method instanceof AggregationOperator) {
final AggregationOperator op = (AggregationOperator) method;
help = op.getDetailedDescription();
} else {
help = method.getDescription();
}
final HelpDialog helpDialog = new HelpDialog(this, help);
Point location = this.getLocation();
Dimension size = this.getSize();
helpDialog.setLocation((int) (location.getX() + size.getWidth() + 10), location.y);
// helpDialog.setLocationRelativeTo(this);
helpDialog.setVisible(true);
}
use of org.knime.base.data.aggregation.AggregationOperator in project knime-core by knime.
the class SettingsModelAggregationMethod method loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
final NodeSettingsRO subSettings = settings.getNodeSettings(m_configName);
final String methodId = subSettings.getString(CFG_METHOD_ID);
final AggregationOperator method = (AggregationOperator) AggregationMethods.getMethod4Id(methodId);
final boolean includeMissing = subSettings.getBoolean(CFG_INCL_MISSING, method.inclMissingCells());
// update the missing value option in the method based on the settings
method.getOperatorColumnSettings().setInclMissing(includeMissing);
if (method.hasOptionalSettings()) {
final NodeSettingsRO methodSettings = subSettings.getNodeSettings(CFG_METHOD_SETTINGS);
method.loadValidatedSettings(methodSettings);
}
// no default value, throw an exception instead
setValues(method, subSettings.getString(CFG_VALUE_SEPARATOR), subSettings.getInt(CFG_MAX_UNIQUE_VALUES));
} catch (final IllegalArgumentException iae) {
throw new InvalidSettingsException(iae.getMessage());
}
}
use of org.knime.base.data.aggregation.AggregationOperator in project knime-core by knime.
the class SettingsModelAggregationMethod method createClone.
/**
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
protected SettingsModelAggregationMethod createClone() {
AggregationOperator operator = (AggregationOperator) m_method;
final AggregationMethod clone;
if (!operator.hasOptionalSettings()) {
clone = operator;
} else {
clone = operator.createInstance(operator.getGlobalSettings(), operator.getOperatorColumnSettings());
}
return new SettingsModelAggregationMethod(m_configName, m_inputPortIndex, m_valueDelimiter, m_maxUniqueValues, clone);
}
use of org.knime.base.data.aggregation.AggregationOperator in project knime-core by knime.
the class SettingsModelAggregationMethod method loadSettingsForDialog.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
try {
DataTableSpec spec;
if (m_inputPortIndex < 0 || specs == null || specs.length < m_inputPortIndex || specs[m_inputPortIndex] == null) {
// we do not have a data table spec available this might be the reason if
// the dialog component is used in a node that does not aggregate an input
// data table
spec = new DataTableSpec();
} else {
spec = (DataTableSpec) specs[m_inputPortIndex];
}
final NodeSettingsRO subSettings = settings.getNodeSettings(m_configName);
final String methodId = subSettings.getString(CFG_METHOD_ID);
final AggregationOperator method = (AggregationOperator) AggregationMethods.getMethod4Id(methodId);
final boolean includeMissing = subSettings.getBoolean(CFG_INCL_MISSING, method.inclMissingCells());
// update the missing value option in the method based on the settings
method.getOperatorColumnSettings().setInclMissing(includeMissing);
if (method.hasOptionalSettings()) {
final NodeSettingsRO methodSettings = subSettings.getNodeSettings(CFG_METHOD_SETTINGS);
method.loadSettingsFrom(methodSettings, spec);
}
// no default value, throw an exception instead
setValues(method, subSettings.getString(CFG_VALUE_SEPARATOR), subSettings.getInt(CFG_MAX_UNIQUE_VALUES));
} catch (final Exception iae) {
throw new NotConfigurableException(iae.getMessage());
}
}
use of org.knime.base.data.aggregation.AggregationOperator in project knime-core by knime.
the class DialogComponentAggregationMethod method updateModel.
/**
* Transfers the current value from the component into the model.
* @throws InvalidSettingsException
*/
private void updateModel() throws InvalidSettingsException {
// we transfer the value from the field into the model
final SettingsModelAggregationMethod model = getMethodModel();
model.removeChangeListener(this);
final AggregationOperator method = (AggregationOperator) getSelectedAggregationMethod();
// copy the include missing information from the select box into the method instance prior passing the method
// to the model
method.getOperatorColumnSettings().setInclMissing(getIncludeMissing());
model.setValues(method, getValueDelimiter(), getMaxUniqueValues());
model.prependChangeListener(this);
}
Aggregations