Bug 207120 - Allow options Dialog to be modal
Allow options Dialog to be modal
Status: RESOLVED FIXED
Product: platform
Classification: Unclassified
Component: Options&Settings
7.1
PC Windows 7
: P3 (vote)
: 7.4
Assigned To: Theofanis Oikonomou
issues@platform
: API, API_REVIEW_FAST, PLAN, UI, UI_REVIEW
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-10 11:06 UTC by tim_sa
Modified: 2013-02-27 16:11 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
Modal Options Displayer Patch (5.97 KB, application/octet-stream)
2012-01-10 11:06 UTC, tim_sa
Details
a patch (2.83 KB, patch)
2013-02-19 16:40 UTC, Theofanis Oikonomou
Details | Diff
proposed patch (6.46 KB, patch)
2013-02-25 09:54 UTC, Theofanis Oikonomou
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tim_sa 2012-01-10 11:06:43 UTC
Created attachment 114764 [details]
Modal Options Displayer Patch

When writing non-GUI NetBeans platform applications the current implementation of the OptionsDisplayer does not allow the Options Dialog to be displayed in a modal manner.

This behavior is fine for GUI applications, but does not work for console applications, were you often want to wait for the window to close before continuing.

I've created a patch that overloads OptionsDisplayer.open() and OptionsDisplayer.open(String path) with a boolean waitUntilClosed parameter.

The patch also makes some associated changes in OptionsDisplayerImpl in order to use the boolean waituntilClosed parameter.
Most notably it removes the boolean 'modal' class field as it is no longer used. 

I've checked that normal functioning of the NetBeans IDE is not affected (IE the options dialog still pops up as it should) and that it produces the desired effect when the waituntilClosed parameter is set to true (the options dialog becomes modal)
Comment 1 Theofanis Oikonomou 2013-02-19 16:40:52 UTC
Created attachment 131578 [details]
a patch

I think this patch gives a simpler solution. I someone wants the options window to be modal he can use

OptionsDisplayer.getDefault().setIsModal(true);
OptionsDisplayer.getDefault().open();

The default behaviour is for the options window to be non-modal.
Comment 2 Theofanis Oikonomou 2013-02-19 16:45:02 UTC
The proposed patch allows for a user to set the options window in a modal mode. Please review. Thank you
Comment 3 Jaroslav Tulach 2013-02-25 05:16:37 UTC
Y01 Setters don't belong to singletons[1]. The modal window needs to be different JDialog instance.

[1] http://wiki.apidesign.org/wiki/Singleton
Comment 4 Theofanis Oikonomou 2013-02-25 09:54:35 UTC
Created attachment 131822 [details]
proposed patch

Updated the patch based on Y01 comments. Also added a test. If there are no more objections I will integrate tomorrow. Thank you.
Comment 5 Theofanis Oikonomou 2013-02-26 10:29:09 UTC
Changeset: d6e7d2e46060
Author:    Theofanis Oikonomou <theofanis@netbeans.org>
Date:      2013-02-26 11:27
Message:
Comment 6 Tomas Mysik 2013-02-26 11:03:22 UTC
Perhaps I am wrong but I miss setModal(false) for the original open() methods - if one opens modal Options dialog and then calls just open(), would the Options dialog be non-modal?

Thanks.
Comment 7 Theofanis Oikonomou 2013-02-26 11:53:01 UTC
(In reply to comment #6)
> if one opens modal Options dialog and then calls just open(), would the Options
> dialog be non-modal?

if you use open(true) and then at some point open() or whatever for that matter the dialog would remain modal. Once the dialog is opened the modality is set until the dialog closes.
Comment 8 Tomas Mysik 2013-02-26 12:27:03 UTC
(In reply to comment #7)
> if you use open(true) and then at some point open() or whatever for that matter
> the dialog would remain modal. Once the dialog is opened the modality is set
> until the dialog closes.

OK, I meant:
- set modal
- open (-> modal),
- close
- open (-> modal or not?)

I will try it once the change is propagated to our team repo.

Thanks.
Comment 9 Quality Engineering 2013-02-27 16:11:46 UTC
Integrated into 'main-golden', will be available in build *201302270948* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/d6e7d2e46060
User: Theofanis Oikonomou <theofanis@netbeans.org>
Log: Issue #207120 - Allow options Dialog to be modal


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo