No TopComponents after LifecycleManager.exit() in ModuleInstall

View: New views
4 Messages — Rating Filter:   Alert me  

No TopComponents after LifecycleManager.exit() in ModuleInstall

by Guido Lütke Wöstmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

Greetz, G.


maxi-minimized.PNG (3K) Download Attachment

Re: No TopComponents after LifecycleManager.exit() in ModuleInstall

by Tonny Kohar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Re: No TopComponents after LifecycleManager.exit() in ModuleInstall

by Fabrizio Giudici :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

--
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 ModuleInstall

by Guido Lütke Wöstmann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank 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
>