Invalid settings: Config for key "columnName" not found

Hi!

I'm having a really hard time implementing a node dialog of selecting the column to process.

I can select the column in the node but when clicking apply or ok it returns the following eror message:

Invalid settings: Config for key "columnName" not found.

My Code is listed below, am I missing something?

THanks and cheers

chris

 

NodeDialog:

public class MydummyNodeDialog extends DefaultNodeSettingsPane {

    /**
     * New pane for configuring Mydummy node dialog. This is just a suggestion
     * to demonstrate possible default dialog components.
     */
    @SuppressWarnings("unchecked")
    protected MydummyNodeDialog() {
        super();

            addDialogComponent(new DialogComponentColumnNameSelection(
                new SettingsModelString(MydummyNodeModel.CFGKEY_COLUMN_NAME,
                        ""), "Select a column:", 0, org.knime.core.data.StringValue.class));
    }

}

 

 

NodeModel excerpt:

    public static final String CFGKEY_COLUMN_NAME = "columnName";

    private final SettingsModelColumnName m_column = new SettingsModelColumnName(
            MydummyNodeModel.CFGKEY_COLUMN_NAME, "");
 

protected DataTableSpec[] configure(final DataTableSpec[] inSpecs)
            throws InvalidSettingsException {

             return new DataTableSpec[] { null };
    }

  
    protected void saveSettingsTo(final NodeSettingsWO settings) {

        m_column.saveSettingsTo(settings);
    }

    protected void loadValidatedSettingsFrom(final NodeSettingsRO settings)
            throws InvalidSettingsException {

         m_column.loadSettingsFrom(settings);
    }

  
    protected void validateSettings(final NodeSettingsRO settings)
            throws InvalidSettingsException {

              m_column.validateSettings(settings);
    }

   
 

 

I have the exact same problem.

I used to have static SettingsModels (which was how the template generated the code) but tried to switch to non-static ones to be able to have more than one instance of a node in a workflow.

Has anyone come up with a solution?

@Chris,

You probably resolved it by now. Your code looks good to me - except for, you should use the exact same SettingsModel in the NodeDialog and the NodeModel.

@Edgar,

You should never use static variables to store user settings (for the reason you mentioned, you can't have different settings in multiple nodes then). The templates generated by the NewNodeWizard have static methods to create the models, but you should store these SettingsModels created by the static methods in a non-static private member variable (in the NodeModel and in the NodeDialog) and use the save/validate/load methods in the NodeModel to get the values transfered (from the dialog to the model and the disk to the model). And by using these static methods to generate the SettingsModels you always use the exact same type of SettingsModel with the exact same key in the NodeDialog and in the NodeModel - which is crucial.

 - Peter.

Hi Peter,

thank you for your answer. I had the types of settings models mixed up and thus they would not be loaded and stored correctly.