Dear KNIME developers.
I'm actively working with KNIME SDK and I'm developing lot of custom nodes at the moment.
Currently I'm developing Node Dialog and I want to have access to input data table specs and input data itself.
Unfortunately, It's quite hard to get specs and input data together.
I've decided to open up source code and verify how It's possible to get both arrays of objects.
Base class NodeDialogPane has method which configures specs looks following:
void callDerivedLoadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs, final PortObject[] data) throws NotConfigurableException { NodeContext.pushContext(m_nodeContext); try { loadSettingsFrom(settings, specs); } finally { NodeContext.removeLastContext(); } }
Class DataAwareNodeDialogPane add ability to get data from input table. It extends previous one and looks following.
void callDerivedLoadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs, final PortObject[] data) throws NotConfigurableException { boolean someDataAvailable = false; for (int i = 0; data != null && i < data.length; i++) { if (data[i] != null) { someDataAvailable = true; } } if (someDataAvailable) { loadSettingsFrom(settings, data); } else { loadSettingsFrom(settings, specs); } }
But It actually not really what I need. I would like to have something like
void callDerivedLoadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs, final PortObject[] data) throws NotConfigurableException { loadSettingsFrom(settings, data); loadSettingsFrom(settings, specs); }
This code will load settings for date and specs.
But, unfortunately, I can't override this method because It has package modifier. Moreover, If I add in my project custom class with same package name (org.knime.core.node) and extend this method It won't help.
So, I have next question for all of you.
1. Is there any simple way how to get input table data and specs in Node Dialog simultaneously?
2. Is it possible to override callDerivedLoadSettingsFrom or Is there any possibility to make it at least protected in next KNIME releases?
Thanks in advance for your help.
Regards,
Roman