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 37083 - DialogDisplayer ignores DialogDescriptor's initial value
Summary: DialogDisplayer ignores DialogDescriptor's initial value
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 3.x
Hardware: Sun SunOS
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks: 37110
  Show dependency tree
 
Reported: 2003-11-07 08:42 UTC by Marian Petras
Modified: 2008-12-22 18:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Petras 2003-11-07 08:42:02 UTC
I have created a Dialog using method

    DialogDisplayer.createDialog(DialogDescriptor)

The DialogDescriptor I provided contained an array
of JButtons as options and one of the buttons in
place of 'initialValue'.

When the dialog is displayed, the button passed as
the 'initialValue' is not displayed as the default
button of the dialog.
Comment 1 Marian Petras 2003-11-07 09:01:19 UTC
I looked into the source code of class
org.netbeans.core.windows.NbPresenter whose instance is (I guess)
created by the above mentioned method 'createDialog(...)'.

The key part of the code is method 'initializeButtons()', specifically
its part below comment "// explicitly provided options (AKA buttons)".
What I read in the code is that:

 - options passed as instances of (i.e. implementing interface) Icon
   cannot be used as default options (although they are displayed
   as buttons in the resulting dialog)
 - for options passed as instances of JButton, DialogDescriptor's
   property 'initialValue' is ignored and the first button is used
   as the default button (unless setDefaultCapable(false) had been
   called on it before the dialog was created)

Property 'initialValue' is thus used only for standard options or
for options which are passed as objects which neither implement
javax.swing.Icon nor are instances of JButton.

Is there any reason for such rules?
Comment 2 pzajac 2003-11-07 09:46:14 UTC
reassigned to core/window system
Comment 3 Marian Petras 2003-11-09 12:23:37 UTC
It would be good if it was possible to specify that no button is to be
default (e.g. by specifying <null> in place of DialogDescriptor
constructor's parameter 'initialValue').
Comment 4 Peter Zavadsky 2003-11-13 09:44:22 UTC
I didn't implement it. Have seen that code before, but don't
understand those rules, assigning to dialogs
Comment 5 Jiri Rechtacek 2003-11-16 21:59:21 UTC
fixed in
core/windows/src/org/netbeans/core/windows/services/NbPresenter.java,
rev 1.4.
Bugfix should respect DialogDescriptor's initial value.
Comment 6 Marian Petras 2003-11-18 10:14:09 UTC
Reopening - the fix is wrong. I think that a "return" statement is
missing after the "getRootPane ().setDefaultButton (b)" statement you
added.
Comment 7 Jiri Rechtacek 2003-11-18 10:26:03 UTC
Thanks for your notice. The return clause was really missed. It's
changed new.
Comment 8 Marian Petras 2003-11-18 13:25:18 UTC
Verified in a custom build from 18 November 2003 (sources updated
around 10 minutes after Jiri Rechtacek's last message).