How to get the node settings within NodeDialog?

I have a custom node that uses a dialog class derived from DefaultNodeSettingsPane to configure
the node settings. I need to use some of the settings to update a string list in the dialog.

How can I read the node settings (NodeSettingsRO settings) within the dialog class?

I tried to override the loadSettingsFrom() and loadAdditionalSettingsFrom() methods, but both
methods don’t get called at all.

thanks in advance.
James

Hi James,

the loadAdditionalSettingsFrom should give you access to the NodeSettingRO object. It is called after all DefaultComponents have successfully loaded their values (and only then). If one of the components throws a “'NotConfigurableExcpetion” the method is not called though (e.g. if a component expects a double column in the input spec, but the incoming spec doesn’t contain one).
I’m not quite sure why it is not working for you, or what you are trying to achieve.
Can you explain in more detail?
Best,

  • Peter.

Hi, Peter,
thanks for the response. My dialog panel basically contains two fields: the url of a server and drop-down list of available data tables on that server. So, the drop-down list is dependent on the value in the first field (if it is set). During my test with loadAddtionalSettingsFrom() I have commented out all code except a popup message (with JOptionPane.showMessageDialog()). So the method shouldn’t throw any exception.

I have solved the problem by changing my base class to NodeDialogPane() where loadSettingsFrom()
and saveSettingsTo() get called as expected. I actually prefer this way of implementation as NodeDialogPane() gives you more direct control over the styles of the components.
regards,
James

Hi James,
NodeDialogPane is the way to go if you have a more complicated dialog and the default components can’t do what you need.
Just as a side note though: If you need to react on changes to the entered value in a default component you could register a ChangeListener with the SettingsModel of that component. This way you could get the data-tables from your server after the URL is entered and set them in the drop-down list of the component.
Anyway, glad you have a working solution.
Best,

  • Peter.