|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
No TopComponents after LifecycleManager.exit() in ModuleInstallHi,
I've created a Subclass of ModuleInstall. In that Class I call "LifecycleManager.getDefault().exit()". If I restart my App there are no TopComponents visible and the Window is minimized (see Screenshot). If I run "Windows->Reset Windows" my App will be restored correctly. Anybody an Idea how to prevent this behaviour? Greetz, G. |
|
|
Re: No TopComponents after LifecycleManager.exit() in ModuleInstallHi,
On Tue, May 6, 2008 at 8:44 PM, Guido Lütke Wöstmann <luetkewo@...> wrote: > Hi, > > I've created a Subclass of ModuleInstall. In that Class > I call "LifecycleManager.getDefault().exit()". > If I restart my App there are no TopComponents visible > and the Window is minimized (see Screenshot). > If I run "Windows->Reset Windows" my App will be restored > correctly. > > Anybody an Idea how to prevent this behaviour? This is only a guess. My guess is because if you exit when the application is not yet realized on the screen (ie visible), then it will become problem next time, because the persistence mechanism employed by Netbeans will serialize/write to disk the windows state during exit, and in this case it is empty windows (exit before ui realized). Maybe you could try this workaround (I haven' tried it yet, use at your own risk), do not call lifecycle.exit() in the moduleInstall.restored directly but do it inside listener for ui ready inside the moduleInstall.restored() to make sure the persistence does not serialize empty windows eg: public class YourModuleInstall extends ModuleInstall pubic void restored() { ..... // do your won stuff WindowManager.getDefault().invokeWhenUIReady(new Runnable() { public void run() { LifecycleManager.getDefault().exit(); } } Cheers Tonny Kohar -- Citra FX Photo Effects imagine, design, create ... http://www.kiyut.com |
|
|
Re: No TopComponents after LifecycleManager.exit() in ModuleInstallAbout that, I have to note that sometimes when I try to exit during
the initialization I get an exception such as "not allowed to do here" (I've to recreate the test case for more precise information) and the exit() method does nothing. For this reason I supposed it was illegal to exit early. On May 6, 2008, at 10:39 , Tonny Kohar wrote: > Hi, > > On Tue, May 6, 2008 at 8:44 PM, Guido Lütke Wöstmann > <luetkewo@...> wrote: >> Hi, >> >> I've created a Subclass of ModuleInstall. In that Class >> I call "LifecycleManager.getDefault().exit()". >> If I restart my App there are no TopComponents visible >> and the Window is minimized (see Screenshot). >> If I run "Windows->Reset Windows" my App will be restored >> correctly. >> >> Anybody an Idea how to prevent this behaviour? > > This is only a guess. > My guess is because if you exit when the application is not yet > realized on the screen (ie visible), then it will become problem next > time, because the persistence mechanism employed by Netbeans will > serialize/write to disk the windows state during exit, and in this > case it is empty windows (exit before ui realized). > > Maybe you could try this workaround (I haven' tried it yet, use at > your own risk), do not call lifecycle.exit() in the > moduleInstall.restored directly but do it inside listener for ui ready > inside the moduleInstall.restored() to make sure the persistence does > not serialize empty windows eg: > public class YourModuleInstall extends ModuleInstall > pubic void restored() { > ..... // do your won stuff > WindowManager.getDefault().invokeWhenUIReady(new Runnable() { > public void run() { > LifecycleManager.getDefault().exit(); > } > } > > > Cheers > Tonny Kohar > -- > Citra FX Photo Effects > imagine, design, create ... > http://www.kiyut.com -- Fabrizio Giudici, Ph.D. - Java Architect, Project Manager Tidalwave s.a.s. - "We make Java work. Everywhere." weblogs.java.net/blog/fabriziogiudici - www.tidalwave.it/blog Fabrizio.Giudici@... - mobile: +39 348.150.6941 |
|
|
Re: No TopComponents after LifecycleManager.exit() in ModuleInstallThank you for your Help!
The Code provided by Tonny K. works very fine. The App doesnt close immediatly, but thats OK. Fabrizio Giudici schrieb: > About that, I have to note that sometimes when I try to exit during the > initialization I get an exception such as "not allowed to do here" (I've > to recreate the test case for more precise information) and the exit() > method does nothing. For this reason I supposed it was illegal to exit > early. > > On May 6, 2008, at 10:39 , Tonny Kohar wrote: > >> Hi, >> >> On Tue, May 6, 2008 at 8:44 PM, Guido Lütke Wöstmann >> <luetkewo@...> wrote: >>> Hi, >>> >>> I've created a Subclass of ModuleInstall. In that Class >>> I call "LifecycleManager.getDefault().exit()". >>> If I restart my App there are no TopComponents visible >>> and the Window is minimized (see Screenshot). >>> If I run "Windows->Reset Windows" my App will be restored >>> correctly. >>> >>> Anybody an Idea how to prevent this behaviour? >> >> This is only a guess. >> My guess is because if you exit when the application is not yet >> realized on the screen (ie visible), then it will become problem next >> time, because the persistence mechanism employed by Netbeans will >> serialize/write to disk the windows state during exit, and in this >> case it is empty windows (exit before ui realized). >> >> Maybe you could try this workaround (I haven' tried it yet, use at >> your own risk), do not call lifecycle.exit() in the >> moduleInstall.restored directly but do it inside listener for ui ready >> inside the moduleInstall.restored() to make sure the persistence does >> not serialize empty windows eg: >> public class YourModuleInstall extends ModuleInstall >> pubic void restored() { >> ..... // do your won stuff >> WindowManager.getDefault().invokeWhenUIReady(new Runnable() { >> public void run() { >> LifecycleManager.getDefault().exit(); >> } >> } >> >> >> Cheers >> Tonny Kohar >> -- >> Citra FX Photo Effects >> imagine, design, create ... >> http://www.kiyut.com > |
| Free Forum Powered by Nabble | Forum Help |