Closed stbusch closed 3 years ago
The idea is as follows: implementing classes implement createEditorComponent which adds GUI to change properties of the implemented node. The Node base class handles for you some generic properties (such as node color, name, etc.) and also the ability to accept GUI changes or to cancel them, depending on which button the user finally presses (Okay vs. Cancel).
For this, it's necessary that you do not change the node's properties directly from the GUI elements that you add in createEditorComponent (neither by calling this.properties.set(some_key, some_value), nor by calling this.setProperty(some_key, some_value)). Instead, createEditorComponent receives a copy of the node's components as argument (unfortunately, this one is also called properties, just like the corresponding object field). Your GUI elements should then manipulate this properties copy and once the user closes the dialog, Node either accepts the changes to the main copy, or ignores them (depending on Okay/Cancel being pressed).
Hello, the comment to the
createEditorComponent
method in theNode
class says:What exactly is the option the sentence
is referring to? Does it mean calling
setProperties
again? The last sentence could be understood as discouraging just that. Thanks for some clarification.