Search in sources :

Example 31 with FlowVariable

use of org.knime.core.node.workflow.FlowVariable in project knime-core by knime.

the class VariableLoopEndNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    FlowVariableFilterConfiguration config = new FlowVariableFilterConfiguration("selection");
    Map<String, FlowVariable> variables = getAvailableFlowVariables();
    config.loadConfigurationInDialog(settings, variables);
    m_selection.loadConfiguration(config, variables);
}
Also used : FlowVariableFilterConfiguration(org.knime.core.node.util.filter.variable.FlowVariableFilterConfiguration) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 32 with FlowVariable

use of org.knime.core.node.workflow.FlowVariable in project knime-core by knime.

the class ParameterizedDBQueryPanel method onSelectionInFlowVariableList.

private void onSelectionInFlowVariableList() {
    final FlowVariable selected = m_flowVariablesList.getSelectedValue();
    if (selected != null) {
        m_editor.replaceSelection(FlowVariableResolver.getPlaceHolderForVariable(selected));
        m_flowVariablesList.clearSelection();
        m_editor.requestFocus();
    }
}
Also used : FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 33 with FlowVariable

use of org.knime.core.node.workflow.FlowVariable in project knime-core by knime.

the class DBSQLExecutorNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    m_text.setText(settings.getString(DBSQLExecutorNodeModel.CFG_STATEMENT, ""));
    DefaultListModel<FlowVariable> listModel = (DefaultListModel<FlowVariable>) m_variables.getModel();
    listModel.removeAllElements();
    for (FlowVariable var : getAvailableFlowVariables().values()) {
        listModel.addElement(var);
    }
}
Also used : DefaultListModel(javax.swing.DefaultListModel) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 34 with FlowVariable

use of org.knime.core.node.workflow.FlowVariable in project knime-core by knime.

the class SQLInjectNodeDialog method loadAdditionalSettingsFrom.

/**
 * List of available string flow variables must be updated since it could
 * have changed.
 *
 * {@inheritDoc}
 */
@Override
public void loadAdditionalSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    super.loadAdditionalSettingsFrom(settings, specs);
    Map<String, FlowVariable> flowVars = getAvailableFlowVariables();
    // check for selected value
    String flowVar = "";
    try {
        flowVar = ((SettingsModelString) m_flowVarSettingsModel.createCloneWithValidatedValue(settings)).getStringValue();
    } catch (InvalidSettingsException e) {
        LOGGER.debug("Settings model could not be cloned with given settings!");
    } finally {
        m_flowVarSelection.replaceListItems(flowVars.values(), flowVar);
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 35 with FlowVariable

use of org.knime.core.node.workflow.FlowVariable in project knime-core by knime.

the class FeatureSelectionLoopEndNodeDialogPane method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    final FeatureSelectionLoopEndSettings cfg = new FeatureSelectionLoopEndSettings();
    cfg.loadInDialog(settings);
    final Collection<FlowVariable> flowVars = getAvailableFlowVariables().values();
    m_scoreVariableComboBox.removeAllItems();
    FlowVariable selected = null;
    final String scoreVariableName = cfg.getScoreVariableName();
    boolean compatibleFVexists = false;
    for (FlowVariable flowVar : flowVars) {
        FlowVariable.Type flowvarType = flowVar.getType();
        if (flowvarType == FlowVariable.Type.DOUBLE) {
            if (flowVar.getName().equals(scoreVariableName)) {
                selected = flowVar;
            }
            m_scoreVariableComboBox.addItem(flowVar);
            compatibleFVexists = true;
        }
    }
    if (!compatibleFVexists) {
        throw new NotConfigurableException("There is no compatible Flow Variable (Double) at the inport.");
    }
    m_scoreVariableComboBox.setSelectedItem(selected);
}
Also used : NotConfigurableException(org.knime.core.node.NotConfigurableException) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Aggregations

FlowVariable (org.knime.core.node.workflow.FlowVariable)93 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)24 DataColumnSpec (org.knime.core.data.DataColumnSpec)14 DataType (org.knime.core.data.DataType)13 DataTableSpec (org.knime.core.data.DataTableSpec)11 ArrayList (java.util.ArrayList)10 PortType (org.knime.core.node.port.PortType)8 DefaultListModel (javax.swing.DefaultListModel)7 Type (org.knime.core.node.workflow.FlowVariable.Type)7 IOException (java.io.IOException)6 Map (java.util.Map)6 PortObject (org.knime.core.node.port.PortObject)6 Optional (java.util.Optional)5 Collectors (java.util.stream.Collectors)5 OutVar (org.knime.base.node.jsnippet.util.field.OutVar)5 BufferedDataTable (org.knime.core.node.BufferedDataTable)5 URL (java.net.URL)4 ParseException (java.text.ParseException)4 Collection (java.util.Collection)4 HashSet (java.util.HashSet)4