This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 92570 - Cannot show a dialog before main window is shown
Summary: Cannot show a dialog before main window is shown
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: PC All
: P3 blocker (vote)
Assignee: issues@platform
URL:
Keywords: API, UI
Depends on:
Blocks:
 
Reported: 2007-01-15 15:45 UTC by Jaroslav Tulach
Modified: 2011-02-24 10:58 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Possible implementation (6.39 KB, patch)
2007-01-15 15:46 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2007-01-15 15:45:48 UTC
API users writing applications that require login complain a lot that they are 
unable to show a modal dialog immediatelly after the splash screen is gone, 
but just before the main window shows.
Comment 1 Jaroslav Tulach 2007-01-15 15:46:54 UTC
Created attachment 37381 [details]
Possible implementation
Comment 2 Jaroslav Tulach 2007-01-15 15:48:42 UTC
This is the code to show such dialog (when the patch is applied):

import java.awt.event.ActionListener;
import org.openide.modules.ModuleInstall;
import org.openide.*;

public class Installer extends ModuleInstall {
    public void restored() {
        NotifyDescriptor nd = new NotifyDescriptor.Message("Ok");
        DialogDisplayer.getDefault().notifyLater(nd);
    }
}

Comment 3 Jaroslav Tulach 2007-01-18 10:25:17 UTC
Do we want to integrate this for 6.0?
Comment 4 David Simonek 2007-01-18 17:07:41 UTC
I have no strong objections, just few comments:
- please add some basic javadoc to methods, code is not that self-explaining
(clearing of list etc)
- why extra runnables and "noParent" is used? and not just list of
NotifyDescriptors? Maybe i'm missing smt but it looks like noParent will be
always true in the 'run' list
- theoretically show/hide can be called multiple times on winsys... 
Comment 5 Jaroslav Tulach 2007-01-19 07:14:19 UTC
Thanks for watching over me, Dafe.

I'll fix javadoc.

The noParent is there because all of these dialogs are supposed to be shown 
after splash screen is hidden and before main window is open. In fact that 
means there is actually no parent then. But the original code in the Displayer 
searches for owner of previous selection, which exists - it is the splash 
screen. Moreover my dialogs are created a few moments before the splash screen 
is hidden, and as a result the dialogs used to appear and immediately 
disappear. That is why I introduced the noParent. If you know a better 
solution, please advice.

Second call to show/hide has no effect, as the notifyLater descriptors are 
gathered just while the system has not been shown for the first time. Then the 
dialogs are shown immediately. I hope this is exactly what people want and 
expect. 
Comment 6 Jaroslav Tulach 2007-01-19 13:56:13 UTC
Dafe will integrate this functionality next week.
Comment 7 David Simonek 2007-02-06 12:19:07 UTC
reassigning to me and trying to integrate...
Comment 8 David Simonek 2007-02-06 15:51:42 UTC
Javadocs added, apichanges added, integrated into main trunk:

Checking in openide/dialogs/manifest.mf;
/cvs/openide/dialogs/manifest.mf,v  <--  manifest.mf
new revision: 1.11; previous revision: 1.10
done
Checking in openide/dialogs/apichanges.xml;
/cvs/openide/dialogs/apichanges.xml,v  <--  apichanges.xml
new revision: 1.10; previous revision: 1.9
done
Checking in openide/dialogs/src/org/openide/DialogDisplayer.java;
/cvs/openide/dialogs/src/org/openide/DialogDisplayer.java,v  <-- 
DialogDisplayer.java
new revision: 1.7; previous revision: 1.6
done
Checking in
core/windows/src/org/netbeans/core/windows/services/DialogDisplayerImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/services/DialogDisplayerImpl.java,v
 <--  DialogDisplayerImpl.java
new revision: 1.14; previous revision: 1.13
done
Checking in
core/windows/test/unit/src/org/netbeans/core/windows/services/DialogDisplayerImplTest.java;
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/services/DialogDisplayerImplTest.java,v
 <--  DialogDisplayerImplTest.java
new revision: 1.6; previous revision: 1.5
done
Checking in core/windows/src/org/netbeans/core/windows/WindowSystemImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/WindowSystemImpl.java,v  <-- 
WindowSystemImpl.java
new revision: 1.15; previous revision: 1.14
done
Comment 9 Jaroslav Tulach 2007-02-07 20:26:46 UTC
Thanks Dafe.
Comment 10 javaprog 2010-01-13 03:26:14 UTC
Reopening because this seems to have stopped working in 6.7:

A few days ago I decided to migrate my Platform application from 6.5.1 over to 6.7.1 but the dialog shown between the splash screen and the main window stopped displaying correctly. I tried different things, such as showing a simple message as in comment #2 instead of my own dialog but the result is the same: the dialog windows shows up and is correctly decorated, but the content remains gray. It seems (though this is just an idea) that the EDT is somehow blocked preventing the content from being displayed. I also tried the same with 6.7 but to no avail - the problem seems to have been introduced there.

The system configuration here is SuSE Linux 11.2, Sun JDK/JRE 1.5.0_22-b03.
Comment 11 Stanislav Aubrecht 2010-10-21 13:45:20 UTC
works fine in:

Product Version: NetBeans IDE Dev (Build 101013-8104f1cf7d80)
Java: 1.6.0_20; Java HotSpot(TM) Client VM 16.3-b01
System: Windows Vista version 6.0 running on x86; Cp1250; cs_CZ (nb)
Comment 12 snookiex 2010-12-10 19:05:26 UTC
I reopen this issue because it's easy to bypass the login form by pressing the close button (X) or hitting "ESC". I came up with a workaround for the close button, but I can't get rid of the ESC key action. Here is my code:

//AuthenticationPanel is my custom panel
AuthenticationPanel pnlAuthentication = new AuthenticationPanel();
DialogDescriptor dd = new DialogDescriptor(pnlAuthentication, "Login Window", true, pnlAuthentication.getOptions(), null, DialogDescriptor.BOTTOM_ALIGN, null, null);
JDialog dialog = (JDialog) DialogDisplayer.getDefault().createDialog(dd);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.setVisible(true);
Comment 13 Stanislav Aubrecht 2011-02-24 10:58:45 UTC
(In reply to comment #12)
> I reopen this issue because it's easy to bypass the login form by pressing the
> close button (X) or hitting "ESC". I came up with a workaround for the close
> button, but I can't get rid of the ESC key action. Here is my code:
> 
> //AuthenticationPanel is my custom panel
> AuthenticationPanel pnlAuthentication = new AuthenticationPanel();
> DialogDescriptor dd = new DialogDescriptor(pnlAuthentication, "Login Window",
> true, pnlAuthentication.getOptions(), null, DialogDescriptor.BOTTOM_ALIGN,
> null, null);
> JDialog dialog = (JDialog) DialogDisplayer.getDefault().createDialog(dd);
> dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
> dialog.setVisible(true);

just check which button was pressed in the dialog and exit the application if it wasn't ok button...