Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest.tool
Class ToolDialog

    java.lang.Object
      com.sun.javatest.tool.ToolDialog

Direct Known Subclasses:
  ContextManager.TestManagerDialog, InterviewEditor, ServiceViewer

    public abstract class ToolDialog

extends java.lang.Object

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
`class` | `ToolDialog.Restorer`

Field Summary
`static int` | `DIALOG` Mask used for ToolDialog initialization.
`static int` | `FRAME` Mask used for ToolDialog initialization.
`static int` | `FREE` Mask that allows free floating to dialog created with DIALOG mask.
`static int` | `MODAL` Mask that sets default modality (as JDialog.setModal(true)) to dialog created with DIALOG mask that blocks all AWT frames.
`static int` | `MODAL_APPLICATION` Mask that enables blocking input to all top-level windows from the same Java application except those from its own child hierarchy..
`static int` | `MODAL_DOCUMENT` 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 int` | `MODAL_TOOLKIT` Mask that enables blocking input to all top-level windows run from the same toolkit except those from its own child hierarchy.
`protected java.awt.Component` | `parent` Parent component of this dialog.
`protected Tool` | `tool` Parent tool of this dialog.
`protected UIFactory` | `uif` Factory associated with this dialog instance.

Constructor Summary
`protected` | `ToolDialog(java.awt.Component parent, UIFactory uif, java.lang.String uiKey)` Create standard ToolDialog.
`protected` | `ToolDialog(java.awt.Component parent, UIFactory uif, java.lang.String uiKey, int type)` Create a ToolDialog with specified type.

Method Summary
`protected void` | `disableDefaultDisposeHandler()` By default disposing tool leads closing tool's ToolDialogs.
`void` | `dispose()` Dispose of any window system resources used by the dialog.
`protected java.awt.Container` | `getBody()` Get the component for the main body of the dialog.
`protected javax.swing.JButton[]` | `getButtons()` Get the buttons from the button bar at the bottom of the dialog.
`protected javax.swing.JButton` | `getDefaultButton()` Get the default button from the button bar at the bottom of the dialog.
`java.awt.Container` | `getDialogParent()` Get a parent component for a dialog to use.
`protected javax.swing.JMenuBar` | `getJMenuBar()` Get the menu bar for the dialog.
`protected java.awt.Point` | `getLocation()` Get the location of the dialog.
`protected ToolDialog.Restorer` | `getRestorer()`
`protected java.awt.Dimension` | `getSize()` Get the size of the dialog.
`protected java.lang.String` | `getTitle()` Get the title for the dialog.
`Tool` | `getTool()` Get the tool for which this is a dialog.
`protected abstract void` | `initGUI()` Initialize the GUI, by calling the various setXXX methods.
`boolean` | `isShowing()` Check if the dialog is currently showing on the screen.
`boolean` | `isVisible()` Check if the dialog is currently showing on the screen.
`void` | `pack()` packs the dialog.
`protected void` | `setBody(java.awt.Container body)` Set the component for the main body of the dialog.
`protected void` | `setButtons(javax.swing.JButton[] buttons, javax.swing.JButton defaultButton)` Set the buttons to appear in a button bar at the bottom of the dialog.
`protected void` | `setComponentListener(java.awt.event.ComponentListener l)` 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` | `setHelp(java.lang.String helpID)` Set the help ID for the dialog.
`protected void` | `setI18NTitle(java.lang.String key)` Specify the title for the dialog.
`protected void` | `setI18NTitle(java.lang.String key, java.lang.Object arg)` Specify the title for the dialog.
`protected void` | `setI18NTitle(java.lang.String key, java.lang.Object[] args)` Specify the title for the dialog.
`protected void` | `setJMenuBar(javax.swing.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(java.awt.Point p)` Set the location of the dialog.
`protected void` | `setRestorer(ToolDialog.Restorer restorer)`
`protected void` | `setSize(java.awt.Dimension d)` Set the size of the dialog.
`protected void` | `setSize(int width, int height)` Set the size of the dialog.
`void` | `setTool(java.awt.Component parent)`
`protected void` | `setTool(Tool t)`
`void` | `setVisible(boolean b)` Specify whether the dialog should be made visible on the screen or not.
`protected void` | `windowClosingAction(java.awt.AWTEvent e)` this method invokes in Window/JInternalFrame listener (depends on dialog variable instance).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### parent

    protected final java.awt.Component parent

  Parent component of this dialog.

### uif

    protected final UIFactory uif

  Factory associated with this dialog instance.

### tool

    protected Tool tool

  Parent tool of this dialog.

### DIALOG

    public static final int DIALOG

  Mask used for ToolDialog initialization. With this mask ToolDialog will create simple dialog without minimize and maximize buttons that can be modal.

  See Also:
    `DIALOG`, `FREE`, `MODAL`, `ToolDialog(java.awt.Component, com.sun.javatest.tool.UIFactory, java.lang.String, int)`, Constant Field Values

### FRAME

    public static final int FRAME

  Mask 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:
    `DIALOG`, `ToolDialog(java.awt.Component, com.sun.javatest.tool.UIFactory, java.lang.String, int)`, Constant Field Values

### FREE

    public static final int FREE

  Mask that allows free floating to dialog created with DIALOG mask. Doesn't affect dialogs created with `FRAME` mask.

  See Also:
    `FRAME`, `DIALOG`, `ToolDialog(java.awt.Component, com.sun.javatest.tool.UIFactory, java.lang.String, int)`, Constant Field Values

### MODAL

    public static final int MODAL

  Mask that sets default modality (as JDialog.setModal(true)) to dialog created with DIALOG mask that blocks all AWT frames. Doesn't affect dialogs created with `FRAME` mask.

  See Also:
    `FRAME`, `DIALOG`, `ToolDialog(java.awt.Component, com.sun.javatest.tool.UIFactory, java.lang.String, int)`, Constant Field Values

### MODAL_DOCUMENT

    public static final int MODAL_DOCUMENT

  Mask 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:
    `Dialog.ModalityType.DOCUMENT_MODAL`, Constant Field Values

### MODAL_APPLICATION

    public static final int MODAL_APPLICATION

  Mask that enables blocking input to all top-level windows from the same Java application except those from its own child hierarchy..

  See Also:
    `Dialog.ModalityType.APPLICATION_MODAL`, Constant Field Values

### MODAL_TOOLKIT

    public static final int MODAL_TOOLKIT

  Mask that enables blocking input to all top-level windows run from the same toolkit except those from its own child hierarchy.

  See Also:
    `Dialog.ModalityType.TOOLKIT_MODAL`, Constant Field Values

Constructor Detail

### ToolDialog

    protected ToolDialog(java.awt.Component parent,
                         UIFactory uif,
                         java.lang.String uiKey)

  Create standard ToolDialog.

  Parameters:
    `parent` - The parent component of this dialog.
    `uif` - Factory instance associated with this dialog
    `uiKey` - Key to use to get strings and other properties for this dialog.

### ToolDialog

    protected ToolDialog(java.awt.Component parent,
                         UIFactory uif,
                         java.lang.String uiKey,
                         int type)

  Create a ToolDialog with specified type.

  Parameters:
    `parent` - The parent component of this dialog.
    `uif` - Factory instance associated with this dialog
    `uiKey` - Key to use to get strings and other properties for this dialog.
    `type` - dialog type mask.
  See Also:
    `DIALOG`, `FRAME`, `FREE`, `MODAL`

Method Detail

### setTool

    public void setTool(java.awt.Component parent)

### setTool

    protected void setTool(Tool t)
                    throws java.lang.IllegalStateException

  Throws:
    `java.lang.IllegalStateException`

### getTool

    public Tool getTool()

  Get the tool for which this is a dialog.

  Returns:
    the tool for which this is a dialog

### 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()`, `setVisible(boolean)`

### 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(boolean)`

### pack

    public void pack()

  packs the dialog. The method is useful when it's necessary to call pack separately from `setVisible(boolean)`

  See Also:
    `setVisible(boolean)`

### 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:
    `isVisible()`

### 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

    public java.awt.Container 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

    protected java.lang.String getTitle()

  Get the title for the dialog.

  Returns:
    The title string for this dialog (localized)
  See Also:
    `setI18NTitle(java.lang.String)`

### setI18NTitle

    protected void setI18NTitle(java.lang.String key)

  Specify the title for the dialog.

  Parameters:
    `key` - key to use to retrieve the dialogs title
  See Also:
    `getTitle()`

### setI18NTitle

    protected void setI18NTitle(java.lang.String key,
                                java.lang.Object arg)

  Specify the title for the dialog.

  Parameters:
    `key` - key to use to retrieve the dialogs title
    `arg` - item to substitute into the title from the resource bundle
  See Also:
    `getTitle()`

### setI18NTitle

    protected void setI18NTitle(java.lang.String key,
                                java.lang.Object[] args)

  Specify the title for the dialog.

  Parameters:
    `key` - key to use to retrieve the dialogs title
    `args` - items to substitute into the title from the resource bundle
  See Also:
    `getTitle()`

### setHelp

    protected void setHelp(java.lang.String helpID)

  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

    protected javax.swing.JMenuBar getJMenuBar()

  Get the menu bar for the dialog.

  Returns:
    the menu bar being used for this dialog, may be null
  See Also:
    `setJMenuBar(javax.swing.JMenuBar)`

### setJMenuBar

    protected void setJMenuBar(javax.swing.JMenuBar menuBar)

  Set the menu bar for the dialog.

  Parameters:
    `menuBar` - The menu bar for this dialog; should not be null.
  See Also:
    `getJMenuBar()`

### getBody

    protected java.awt.Container getBody()

  Get the component for the main body of the dialog.

  Returns:
    the body container for this dialog
  See Also:
    `setBody(java.awt.Container)`

### setBody

    protected void setBody(java.awt.Container body)

  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:
    `getBody()`

### getButtons

    protected javax.swing.JButton[] 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:
    `setButtons(javax.swing.JButton[], javax.swing.JButton)`

### getDefaultButton

    protected javax.swing.JButton 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(javax.swing.JButton[], javax.swing.JButton)`

### setButtons

    protected void setButtons(javax.swing.JButton[] buttons,
                              javax.swing.JButton defaultButton)

  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 use
    `defaultButton` - button from the previous argument which should be used as the default
  See Also:
    `getButtons()`, `getDefaultButton()`

### setComponentListener

    protected void setComponentListener(java.awt.event.ComponentListener l)

  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

    protected java.awt.Dimension 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(java.awt.Dimension)`

### setSize

    protected void setSize(java.awt.Dimension d)

  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:
    `getSize()`

### 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 dialog
    `height` - the new height of this dialog
  See Also:
    `getSize()`

### getLocation

    protected java.awt.Point 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(java.awt.Point)`

### setLocation

    protected void setLocation(java.awt.Point p)

  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:
    `getLocation()`

### 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 space
    `y` - - the y-coordinate of the new location's top-left corner in the parent's coordinate space
  See Also:
    `getLocation()`

### 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

    protected void windowClosingAction(java.awt.AWTEvent e)

  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

    protected ToolDialog.Restorer getRestorer()

### setRestorer

    protected void setRestorer(ToolDialog.Restorer restorer)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.