use of org.knime.core.node.util.filter.variable.FlowVariableFilterConfiguration in project knime-core by knime.
the class VariableLoopEndNodeModel method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
FlowVariableFilterConfiguration config = new FlowVariableFilterConfiguration("selection");
config.loadConfigurationInModel(settings);
m_selection = config;
} catch (InvalidSettingsException e) {
// stay with defaults
}
}
use of org.knime.core.node.util.filter.variable.FlowVariableFilterConfiguration in project knime-core by knime.
the class VirtualSubNodeInputNodeDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
String prefix;
if (m_variablePrefixChecker.isSelected()) {
String text = StringUtils.trimToEmpty(m_variablePrefixTextField.getText());
if (text.isEmpty()) {
throw new InvalidSettingsException("Prefix string must not be empty");
}
prefix = text;
} else {
prefix = null;
}
VirtualSubNodeInputConfiguration configuration = new VirtualSubNodeInputConfiguration(m_portDescriptionPanels.length);
configuration.setFlowVariablePrefix(prefix);
FlowVariableFilterConfiguration f = VirtualSubNodeInputConfiguration.createFilterConfiguration();
m_variableFilterPanel.saveConfiguration(f);
configuration.setFilterConfiguration(f);
String[] portNames = new String[m_portDescriptionPanels.length];
String[] portDescriptions = new String[m_portDescriptionPanels.length];
for (int i = 0; i < m_portDescriptionPanels.length; i++) {
portNames[i] = m_portDescriptionPanels[i].getPortName();
portDescriptions[i] = m_portDescriptionPanels[i].getPortDescription();
}
configuration.setSubNodeDescription(m_subNodeDescription.getText());
configuration.setPortNames(portNames);
configuration.setPortDescriptions(portDescriptions);
configuration.saveConfiguration(settings);
}
use of org.knime.core.node.util.filter.variable.FlowVariableFilterConfiguration in project knime-core by knime.
the class VirtualSubNodeInputNodeModel method pushFlowVariables.
/**
* @throws Exception
*/
private void pushFlowVariables() throws InvalidSettingsException {
String prefix = m_configuration.getFlowVariablePrefix() == null ? "" : m_configuration.getFlowVariablePrefix();
FlowVariableFilterConfiguration filterConfiguration = m_configuration.getFilterConfiguration();
Map<String, FlowVariable> availableVariables = getSubNodeContainerFlowObjectStack().getAvailableFlowVariables(Type.values());
FilterResult filtered = filterConfiguration.applyTo(availableVariables);
for (String include : filtered.getIncludes()) {
FlowVariable f = availableVariables.get(include);
switch(f.getScope()) {
case Global:
// ignore global flow vars
continue;
case Flow:
case Local:
default:
}
final String name = prefix + f.getName();
Node.invokePushFlowVariable(this, f.withNewName(name));
}
}
use of org.knime.core.node.util.filter.variable.FlowVariableFilterConfiguration in project knime-core by knime.
the class VirtualSubNodeOutputNodeDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
String prefix;
if (m_variablePrefixChecker.isSelected()) {
String text = StringUtils.trimToEmpty(m_variablePrefixTextField.getText());
if (text.isEmpty()) {
throw new InvalidSettingsException("Prefix string must not be empty");
}
prefix = text;
} else {
prefix = null;
}
VirtualSubNodeInputConfiguration configuration = new VirtualSubNodeInputConfiguration(m_portDescriptionPanels.length);
configuration.setFlowVariablePrefix(prefix);
FlowVariableFilterConfiguration f = VirtualSubNodeInputConfiguration.createFilterConfiguration();
m_variableFilterPanel.saveConfiguration(f);
configuration.setFilterConfiguration(f);
String[] portNames = new String[m_portDescriptionPanels.length];
String[] portDescriptions = new String[m_portDescriptionPanels.length];
for (int i = 0; i < m_portDescriptionPanels.length; i++) {
portNames[i] = m_portDescriptionPanels[i].getPortName();
portDescriptions[i] = m_portDescriptionPanels[i].getPortDescription();
}
configuration.setPortNames(portNames);
configuration.setPortDescriptions(portDescriptions);
configuration.saveConfiguration(settings);
}
Aggregations