Dialog refuses to open: Need input table spec to configure dialog

Hello,

I have a problem with DialogComponentColumnNameSelection in the node dialog.  I have an optional port, and when the input port is not connected, the dialog won't start with an error message: "need input table spec to configure dialog".

I already tried to check, whether the port is connected or not, see the following code snippet:

public class SeesarViewerNodeDialog extends DefaultNodeSettingsPane {

    private final SettingsModelString m_moleculeColumnName;
    private final SettingsModelString m_proteinColumnName;

    protected SeesarViewerNodeDialog() {
        super();

        m_moleculeColumnName = SeesarViewerNodeModel.createSettingsMoleculeColumnName();
        addDialogComponent(new DialogComponentColumnNameSelection(
                m_moleculeColumnName,
                "Molecule column", 0,
                SeesarViewerNodeModel.ACCEPTED_MOLECULE_COLUMN_CLASSES) {

                    @Override
                    protected void checkConfigurabilityBeforeLoad(
                            PortObjectSpec[] specs)
                            throws NotConfigurableException {
                        super.checkConfigurabilityBeforeLoad(specs);
                        m_moleculeColumnName.setEnabled(specs[0] != null);
                    }
                });
        :

But the error message remains when trying to open the dialog.  Can anyone help here?

Best regards, Frank

I think if override the loadAdditionalSettingsFrom() method with something like:

@Override
	public void loadAdditionalSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs)
			throws NotConfigurableException {
		m_moleculeColumnName.setEnabled(specs[0] != null);
}

and then remove the override of checkConfigurabilityBeforeLoad (or set it to return 'true' - not sure which in this case) then that should do what you want.

Steve

Hi Steve,

thanks for this proposal, but unfortunately the same problem.

I think, there are 2 sub-problems here.

  1. I'm not quite sure, if it is really sufficient to disable the SettingsModel in order to disable the dialog component.  I double-checked, and the dialog opens when I comment out the creation of the component.  When only disabling the SettingsModel directly in the constructor, also the dialog won't open with the same message, see code snippet below.
    But the documentation advises to do so, as disabling the component itself is deprecated.
            addDialogComponent(new DialogComponentColumnNameSelection(
                    m_moleculeColumnName,
                    "Molecule column", 0,
                    SeesarViewerNodeModel.ACCEPTED_MOLECULE_COLUMN_CLASSES));
            m_moleculeColumnName.setEnabled(false);
  2. I would guess that the execution order of the implicitly called methods like loadAdditionalSettingsFrom() or checkConfigurabilityBeforeLoad() is important here - and whether they get called at all.

Best, Frank

@knime-team

Could you reproduce this?  Is this a known issue or some general misunderstanding on my side of the team play between dialog components and setting models?

Sorry that didnt help - Maybe worth trying to disable the settings model before creating the component?

Steve

Hi Sonnenburg,

there is another constructor with two booleans available:

DialogComponentColumnNameSelection(SettingsModelString model, String label, int specIndex, boolean isRequired, boolean addNoneCol, Class<? extends DataValue>... classFilter)

The first one (isrequired) you need to set to false. And the second one (addnonecol) I would propose to set to true. Than the node doesn't require a column exists and it can select none as this column in case it doesn't exist.

Does this help? I would need to double check with our developers, as I am not 100% sure myself. As far as I understood, the NodeDialog does not know this port is optional, only the NodeModel knows this.

Cheers, Iris

1 Like

Dear Iris,

yes indeed, this really helps!  I would say, double hit!

First, it was an issue of wrong expectations on my side.  In fact, I expected that the dialog knows, that the port is optional.

Second, I have to apologize that I did not see these two constructor arguments "isRequired" and "addNoneCol".  Now the dialog opens without a problem, when having set isRequired to false.

To make it perfect I would like to disable the component in case that the port is not connected, but now as I managed to let the dialog open with your help, all the rest is only cosmetics.

So, thanks again!

Frank

2 Likes