Package com.sun.javatest.tool
Class ToolDialog
java.lang.Object
com.sun.javatest.tool.ToolDialog
- Direct Known Subclasses:
ContextManager.TestManagerDialog
,InterviewEditor
,ServiceViewer
Lightweight wrapper class to provide standard support for tool dialogs.
Dialogs have a title, optional menu bar, a body, and an optional set of
buttons, including a default button.
The actual dialog displayed may be a JDialog, or a JInternalFrame,
depending on the current desktop.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Mask used for ToolDialog initialization.static final int
Mask used for ToolDialog initialization.static final int
Mask that allows free floating to dialog created with DIALOG mask.static final int
Mask that sets default modality (as JDialog.setModal(true)) to dialog created with DIALOG mask that blocks all AWT frames.static final int
Mask that enables blocking input to all top-level windows from the same Java application except those from its own child hierarchy..static final int
Mask that enables blocking input to all top-level windows (without any owner) from the same document except those from its own child hierarchy.static final int
Mask that enables blocking input to all top-level windows run from the same toolkit except those from its own child hierarchy.protected final Component
Parent component of this dialog.protected Tool
Parent tool of this dialog.protected final UIFactory
Factory associated with this dialog instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ToolDialog
(Component parent, UIFactory uif, String uiKey) Create standard ToolDialog.protected
ToolDialog
(Component parent, UIFactory uif, String uiKey, int type) Create a ToolDialog with specified type. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
By default disposing tool leads closing tool's ToolDialogs.void
dispose()
Dispose of any window system resources used by the dialog.protected Container
getBody()
Get the component for the main body of the dialog.protected JButton[]
Get the buttons from the button bar at the bottom of the dialog.protected JButton
Get the default button from the button bar at the bottom of the dialog.Get a parent component for a dialog to use.protected JMenuBar
Get the menu bar for the dialog.protected Point
Get the location of the dialog.protected ToolDialog.Restorer
protected Dimension
getSize()
Get the size of the dialog.protected String
getTitle()
Get the title for the dialog.getTool()
Get the tool for which this is a dialog.protected abstract void
initGUI()
Initialize the GUI, by calling the various setXXX methods.boolean
Check if the dialog is currently showing on the screen.boolean
Check if the dialog is currently showing on the screen.void
pack()
packs the dialog.protected void
Set the component for the main body of the dialog.protected void
setButtons
(JButton[] buttons, JButton defaultButton) Set the buttons to appear in a button bar at the bottom of the dialog.protected void
Set a ComponentListener to be registered on the dialog.protected void
setDefaultCloseOperation
(int operation) This method add to allow subclasses of ToolDialog to change default close operation.protected void
Set the help ID for the dialog.protected void
setI18NTitle
(String key) Specify the title for the dialog.protected void
setI18NTitle
(String key, Object arg) Specify the title for the dialog.protected void
setI18NTitle
(String key, Object... args) Specify the title for the dialog.protected void
setJMenuBar
(JMenuBar menuBar) Set the menu bar for the dialog.protected void
setLocation
(int x, int y) Set the location of the dialog.protected void
setLocation
(Point p) Set the location of the dialog.protected void
setRestorer
(ToolDialog.Restorer restorer) protected void
setSize
(int width, int height) Set the size of the dialog.protected void
Set the size of the dialog.protected void
void
void
setVisible
(boolean b) Specify whether the dialog should be made visible on the screen or not.protected void
this method invokes in Window/JInternalFrame listener (depends on dialog variable instance).
-
Field Details
-
DIALOG
public static final int DIALOGMask used for ToolDialog initialization. With this mask ToolDialog will create simple dialog without minimize and maximize buttons that can be modal.- See Also:
-
FRAME
public static final int FRAMEMask used for ToolDialog initialization. with this mask ToolDialog will create dialog with minimize and maximize buttons that can be used separately of main window and can't be modal.- See Also:
-
FREE
public static final int FREEMask that allows free floating to dialog created with DIALOG mask. Doesn't affect dialogs created withFRAME
mask.- See Also:
-
MODAL
public static final int MODALMask that sets default modality (as JDialog.setModal(true)) to dialog created with DIALOG mask that blocks all AWT frames. Doesn't affect dialogs created withFRAME
mask.- See Also:
-
MODAL_DOCUMENT
public static final int MODAL_DOCUMENTMask that enables blocking input to all top-level windows (without any owner) from the same document except those from its own child hierarchy.- See Also:
-
MODAL_APPLICATION
public static final int MODAL_APPLICATIONMask that enables blocking input to all top-level windows from the same Java application except those from its own child hierarchy..- See Also:
-
MODAL_TOOLKIT
public static final int MODAL_TOOLKITMask that enables blocking input to all top-level windows run from the same toolkit except those from its own child hierarchy.- See Also:
-
parent
Parent component of this dialog. -
uif
Factory associated with this dialog instance. -
tool
Parent tool of this dialog.
-
-
Constructor Details
-
ToolDialog
Create standard ToolDialog.- Parameters:
parent
- The parent component of this dialog.uif
- Factory instance associated with this dialoguiKey
- Key to use to get strings and other properties for this dialog.
-
ToolDialog
Create a ToolDialog with specified type.- Parameters:
parent
- The parent component of this dialog.uif
- Factory instance associated with this dialoguiKey
- Key to use to get strings and other properties for this dialog.type
- dialog type mask.- See Also:
-
-
Method Details
-
getTool
Get the tool for which this is a dialog.- Returns:
- the tool for which this is a dialog
-
setTool
-
setTool
-
isShowing
public boolean isShowing()Check if the dialog is currently showing on the screen.- Returns:
- True if this dialog is currently showing, false otherwise.
- See Also:
-
isVisible
public boolean isVisible()Check if the dialog is currently showing on the screen.- Returns:
- True if this dialog is currently visible, false otherwise.
- See Also:
-
setVisible
public void setVisible(boolean b) Specify whether the dialog should be made visible on the screen or not.- Parameters:
b
- True if the dialog should be made visible, false if is should be made invisible.- See Also:
-
pack
public void pack()packs the dialog. The method is useful when it's necessary to call pack separately fromsetVisible(boolean)
- See Also:
-
dispose
public void dispose()Dispose of any window system resources used by the dialog. The client-supplied components (menu bar, body, buttons) are not disposed, meaning the dialog can be made visible again, if desired. To dispose the client components, subtype this method. -
getDialogParent
Get a parent component for a dialog to use.- Returns:
- a component which can be used as a parent (JDialog or Frame), or null if none is available.
-
initGUI
protected abstract void initGUI()Initialize the GUI, by calling the various setXXX methods. -
getTitle
Get the title for the dialog.- Returns:
- The title string for this dialog (localized)
- See Also:
-
setI18NTitle
Specify the title for the dialog.- Parameters:
key
- key to use to retrieve the dialogs title- See Also:
-
setI18NTitle
Specify the title for the dialog.- Parameters:
key
- key to use to retrieve the dialogs titlearg
- item to substitute into the title from the resource bundle- See Also:
-
setI18NTitle
Specify the title for the dialog.- Parameters:
key
- key to use to retrieve the dialogs titleargs
- items to substitute into the title from the resource bundle- See Also:
-
setHelp
Set the help ID for the dialog. This must be called before the dialog is made visible.- Parameters:
helpID
- the help identifier for this dialog
-
getJMenuBar
Get the menu bar for the dialog.- Returns:
- the menu bar being used for this dialog, may be null
- See Also:
-
setJMenuBar
Set the menu bar for the dialog.- Parameters:
menuBar
- The menu bar for this dialog; should not be null.- See Also:
-
getBody
Get the component for the main body of the dialog.- Returns:
- the body container for this dialog
- See Also:
-
setBody
Set the component for the main body of the dialog. This should not include the button bar, which should be set separately. This method must be called before the dialog is made visible.- Parameters:
body
- the body container that should be used by this dialog- See Also:
-
getButtons
Get the buttons from the button bar at the bottom of the dialog.- Returns:
- array of buttons currently used in this dialog
- See Also:
-
getDefaultButton
Get the default button from the button bar at the bottom of the dialog.- Returns:
- the button currently set to be the default
- See Also:
-
setButtons
Set the buttons to appear in a button bar at the bottom of the dialog. A default button can also be specified. The default button gets the focus when the dialog is initially activated, and will be activated if the user clicks "Enter". The default button should not normally have a mnemonic, per JL&F.- Parameters:
buttons
- buttons to usedefaultButton
- button from the previous argument which should be used as the default- See Also:
-
setComponentListener
Set a ComponentListener to be registered on the dialog. This is useful for listening for events when the dialog is made visible and invisible.- Parameters:
l
- listener to attach to this component
-
getSize
Get the size of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Returns:
- the current size of this dialog
- See Also:
-
setSize
Set the size of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Parameters:
d
- the new size of this dialog- See Also:
-
setSize
protected void setSize(int width, int height) Set the size of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Parameters:
width
- the new width of this dialogheight
- the new height of this dialog- See Also:
-
getLocation
Get the location of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Returns:
- the current location of this dialog
- See Also:
-
setLocation
Set the location of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Parameters:
p
- the new location of this dialog- See Also:
-
setLocation
protected void setLocation(int x, int y) Set the location of the dialog. An exception will be thrown if the dialog has not yet been shown, or if it is has been disposed since it was shown on the screen.- Parameters:
x
- - the x-coordinate of the new location's top-left corner in the parent's coordinate spacey
- - the y-coordinate of the new location's top-left corner in the parent's coordinate space- See Also:
-
setDefaultCloseOperation
protected void setDefaultCloseOperation(int operation) This method add to allow subclasses of ToolDialog to change default close operation.- Parameters:
operation
- one of WindowConstants used by JDialog/JInternalFrame setDefaultCloseOperation method
-
windowClosingAction
this method invokes in Window/JInternalFrame listener (depends on dialog variable instance). Should be overwritten in subclass if you want to handle window closing event. You may need to change default close operation first for this event to be fired -
disableDefaultDisposeHandler
protected void disableDefaultDisposeHandler()By default disposing tool leads closing tool's ToolDialogs. This approach is wrong in some certain cases. QuickStartWizard can be example. Unlike most other cases QSW is a �parent� for its tool This method provides way to disable default behavior -
getRestorer
-
setRestorer
-