I did not clearly understand when it would be useful to use SingleCDockableFactory.
I have a simple application with as root component a JFrame.
So I am doing:
JFrame frame = new JFrame(“myFrame”);
CControl control = new CControl( frame );
frame.destroyOnClose(control);
frame.add(control.getContentArea());
DefaultSingleCDockable myDockable = new DefaultSingleCDockable(“myId”, null);
control.addDockable(myDockable);
Finally via a menu (View/myDockable) on my JFrame “myDockable” is set to visible (true visibility) when the user wants to display it.
If I am not using a CGrid as illustrated in the tutorial (class tutorial.common.basics.SingleDockableFactoryExample), do I have any interest to use the SingleCDockableFactory?
If yes, why? and above all when/after which operation the Dockable is created?
The only time you may need a SingleCDockableFactory is when:
[ul]
[li]Your application does not show all Dockables at the same time
[/li][li]And your application has too many Dockables to load all of them at startup
[/li][li]And your application saves and loads the layout on shutdown/startup.
[/li][/ul]
In short: SingleCDockableFactory allows lazy creation of Dockables, that only is interesting when loading a layout from a file. But lazy creation is only an optimization, there is no case in which an application must use the factories.
Your application does not show all Dockables at the same time: YES
And your application has too many Dockables to load all of them at startup: NO
And your application saves and loads the layout on shutdown/startup: NO
Taken into account your three conditions, it sounds it is useless in my case,