Problem with the singleton pattern of the node

Yes
I have reference problems on my node. There is the possibility of removing the singleton pattern from the node.
Greetings.

Hi,
What do you mean by that? A Node should not be a singleton. KNIME uses the factory pattern for the node instances.
Kind regards
Alexander

2 Likes

I have in the NodeDialog class java swing components like JTextArea and stuff. And when adding my node twice, only the components in the last node I added are shown. That’s why I assumed he used a singleton pattern.
Could you give me some advice.
Greetings Taday.

Hi,
In the node factory you have to instantiate a new node model and node dialog every time the corresponding method is called. Can you share the code?
Kind regards
Alexander

1 Like

If I think that is done in the nodeFactory. The original components of the node do load, but those of java swing do not.
It refers to the complete code or only to the NodeFactory class?

In the NodeFactory class.

@Override
public AdjustFMNodeModel createNodeModel () {
return new AdjustFMNodeModel ();
}
@Override
public NodeDialogPane createNodeDialogPane () {
return new AdjustNodeDialog ();
}

Hi,
Maybe you can attach th whole code for the node (factory, dialog, model) in a zip file?
Kind regards
Alexander

1 Like

I already solved it was that I had the JavaSwing components created static. Thanks anyway.
Taday

1 Like