Flow variable to control NodeDialog code

Hi Team,

I have a code section in my NodeDialog::loadSettingsFrom(), which access one of the GUI component’s value and takes action based on that. Now, in my workflow, if I control this particular GUI component using a flow variable, then will this component’s value be the one set in loadSettingsFrom() or the one from the flow variable which controls it?

In the below code example, in populateProtocols(), will m_LDhost.getText() return me the one set in loadSettingsFrom() or the flow variable’s value, as m_LDhost textfield is controlled by the flow variable?

void populateProtocols() {
    String host = m_LDhost.getText();
    // code logic based on 'host' value
}

protected void loadSettingsFrom(NodeSettingsRO settings,
        final DataTableSpec[] specs) throws NotConfigurableException {
    m_LDhost.setText(settings.getString(UploadToLDNodeModel.CFG_LD_HOST));
    populateProtocols();
}

Actually, m_LDhost.getText() in populateProtocols() gives the value of the one set in loadSettingsFrom() and not the one from flow variable. What should I do if I need the flow variable’s value?

Hi @ravikiran,

what you are trying to achieve should be possible with a FlowVariableModel you can create via NodeDialogPane#createFlowVariableModel(…) from within your NodeDialogPane-implementation. By adding a change listener to it you can then act on flow variable changes.
(to be taken with a grain of salt since I never used it so far)

Best,
Martin