Code to execute just after a NodeDialogPane is shown

#1

Hi Team,

I have a time consuming code which runs in order to populate a combobox in my node dialog.
Currently I have kept this logic in NodeDialogPane::loadSettingsFrom(), but the issue is, when I click on ‘Configure’, it take more time before it opens the dialog. So the user doesn’t have any clue about this delay.
What I want is, just after the dialog is shown, I need to execute this time consuming code to populate the combobox.

Is there a way to do that?

Thanks
Ravikiran

0 Likes

#2

Hi Ravikiran,

I am not from the team but can help you. First, you should never run intensive tasks on the UI thread. Like you said is delaying the creation of the dialog. Usually all the long tasks are moved to a separate thread that updates the UI later.
I had this problem once, with a combobox too. Instead of creating your own Thread class/object it is easier to use the SwingWorker, do your task there and update the combo box via its data model. In the end, you would create your dialog immediately and a few seconds later the combo box would be populated.

Best,
Miguel

2 Likes

#3

Thanks a lot Miguel. I will check this.

0 Likes