Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Dialog helper



The MDIDialogHelper and its default implementation DefaultMDIDialogHelper allows to open dialogs in a GUI application. Note that many of the methods provided by the MDIDialogHelper interface can be accessed directly through the GUIApplication itself.

Opening a dialog

Main Article: MDIDialog

The most simple way of opening a dialog is through the GUIApplication.showDialog(MDIDialog) method. The MDIDialog interface has only one method to open the dialog: Note that the MDIDialog instance must be a subclass of JComponent.

You can also use the GUIApplication.showDialog(MDIDialogBuilder) method. The MDIDialogBuilder interface handles the effective creation of the dialog itself.

Managing the way the dialog is opened

The MDIDialogType enumeration allows to specify how the dialog is opened:
  • UNIQUE_ALL: Unique dialog for all dialog classes
  • UNIQUE_INSTANCE: Unique dialog the dialog class
  • UNLIMITED: Unlimited dialogs for all dialog classes

UNIQUE_ALL

Unique dialog for all dialog classes. When opened through MDIDialogHelper.showDialog(MDIDialog, MDIDialogType) or MDIDialogHelper.showDialog(MDIDialogBuilder, MDIDialogType), only one dialog can be opened at the same time.

UNIQUE_INSTANCE

Unique dialog the dialog class. When opened through MDIDialogHelper.showDialog(MDIDialog, MDIDialogType) or MDIDialogHelper.showDialog(MDIDialogBuilder, MDIDialogType), only one dialog of the same class can be opened at the same time.

Note that in this case:
  • It will be by default impossible to open any instance of the JComponent sub-class used for the dialog (which must implement the {@link org.mdi.bootstrap.MDIDialog} interface)
  • If the JComponent used for the dialog has the MDIDialogID component property, it will be impossible to open any instance of the JComponent sub-class used for the dialog with the same MDIDialogID component property

Default opening of dialogs

By default opening dialogs by MDIDialog.showDialog(Component) will show a dialog with the UNLIMITED option. However it is possible to change the default option by MDIDialogHelper.setDefaultDialogOpenType(MDIDialogType).

See also


Categories: gui | swing

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences