Hello, not sure if this is the right thread for this question but I am trying to wrap my head around how Ignition Vision handles some basic operations in the background.
I am looking to understand how opening windows works. For example, when I call system.gui.openWindow(), what's happening in the background? How does it take the window I created in the designer and turn it java swing component. Additionally, at what point in the process does it set the custom properties on the root container for scenarios where the developer chooses to pass in parameters to the openWindow function? I have poked around in the java docs and found classes like WindowOpener and WindowInitializer but it's not clear to me exactly how they work.
If you hold shift and right click on the root window object, you can 'Copy XML to Clipboard', which sheds some light on our custom XML serialization format for Vision resources (there's also a project property to always store windows as xml files on disk).
The gist of it is that for every Swing component, we serialize a constructor call, then a series of Java-bean property mutator calls afterwards.
Then on deserialize (when you open the window), we just replay those; find the constructor for the given class name on the classpath, create a new instance of it, and then reflectively call all the various customization methods on it in order.
Off the top of my head, I would guess it's either:
Window opens, components are deserialized using saved values
Bindings are walked and started and being to evaluate
Property values delivered by openWindow are set on component
/**
* Implementors of this class will be used to initialize a window right before its bindings are
* connected and started up. This was added for the fpmi.gui functions that open windows with
* 'parameters'. These parameters need to be set before the bindings are started up, otherwise you
* get a race condition
*
* @author Carl
*/
public interface WindowInitializer {
"fpmi.gui" is an archaeological reference to what is nowadays system.vision