Using DefaultNodeSettingsPane and JDialog together for UI?

To make long story short, I have the main UI in DefaultNodeSettingsPane and I added a button to, when clicking on it, opens a dialog menu which is made of JDialog.

The opening of JDialog is fine, but I don't know how I could preserve the settings from JDialog so that when I click ok on main KNIME configuration window, it takes all the settings I chose from JDialog window as well and run the node.

Can anyone guide me to the easy way?

Thank you very much.

To make it more detailed, I have my dialog that extends DefaultNodeSettingsPane and my option menu which extends JDialog. Any idea on how to connect these to make settings saved?

The reason I can't give up on DefaultNodeSettingsPane is because I like the column filter UI.

Hi js0823,

When you start combining your own GUI components with the predefined KNIME dialog fields, you might want to override #loadAdditionalSettingsFrom and #saveAdditionalSettingsTo form the mentioned class in order to load/save your GUI components.

Regards, Thomas

Thank you gabriel I got it :D

The constructor of JDialog take a Frame in argument, where I can find in the dialog of Knime the frame I must provide to this constructor ?

You can use null here since the dialog is modal anyway. Not the most beautiful way, but it works. (The problem is, there is no JFrame since the dialog is embedded in a SWT window).


Ok when I used :

JDialog d = new JDialog((JFrame) null);

the dialog is visible but is not modal.

But the dialog is modal if I use this code :

Window window = SwingUtilities.windowForComponent(getPanel());
JDialog d = new JDialog(window);

Thanks for your answer !