How to add add Dialog Component dynamically in DefaultNodeSettingsPane

Hi, I am trying to add addDialogComponent dynamically after changing the value in the dropdown.

As of now code is working but it not reflecting, I have to manually minimize and maximize it too see the changes, and also it is updating not adding.

Please suggest

Hi All,

Please do reply, it needs to be done in an urgent basis.

Hi @Ripul,

You need to call the repaint method on the Panel of the added Dialogcomponent, to update the dialog window after you have done the changes:

DialogComponentBoolean b = new DialogComponentBoolean(booleanModel, "label");
b.getComponentPanel().repaint();

best,
Gabriel

1 Like

Or you add the dialog component right away and set it visible when needed.

Best
Mark

Hi Thanks, i just tried this solution but it didn’t work.

Thanks for your response, i tried by below code

DialogComponentGridTableOne dialogComponentGridTableOne = new DialogComponentGridTableOne(
new SettingsModelString("Name ", "Table Name "));
dialogComponentGridTableOne.getComponentPanel().setVisible(true);

		addDialogComponent(dialogComponentGridTableOne);

didnt worked , still i need to minimise and maximise to see the changes.

Hi i tried the below code

addDialogComponent(new DialogComponentGridTableOne(new SettingsModelString("Name ", "Table Name ")));

		DialogComponentBoolean b = new DialogComponentBoolean(new SettingsModelBoolean(DemoNodeModel.BOOL, true), "Table Name ");
		b.getComponentPanel().repaint();

@Ripul,

here’s an example how it can be done.

final class ExampleDialog extends DefaultNodeSettingsPane {
    ExampleDialog() {
        final DialogComponentString diaComp =
            new DialogComponentString(new SettingsModelString("foo", "hello world"), "42");

        final DialogComponentBoolean visTrigger =
            new DialogComponentBoolean(new SettingsModelBoolean("bar", true), "Set visible");

        visTrigger.getModel().addChangeListener(e -> diaComp.getComponentPanel()
            .setVisible(((SettingsModelBoolean)visTrigger.getModel()).getBooleanValue()));

        addDialogComponent(visTrigger);
        addDialogComponent(diaComp);
    }

}

Best
Mark

1 Like

Hi Mark,

Thanks for your response, can you please update the for DialogComponentStringSelection (DropDown)
and hide and show two text box accordingly.

Thanks a lot for your response again.