Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.jdevimpl.audit.swing
Class DialogFactory

java.lang.Object
  extended by oracle.jdevimpl.audit.swing.DialogFactory
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.WindowListener, java.util.EventListener

public class DialogFactory
extends java.lang.Object
implements java.awt.event.ComponentListener, java.awt.event.WindowListener

A factory for dialogs.

The client must supply the content and, usually, the command buttons. If no button is supplied, a Close button is displayed.

The content is supplied as a Component using the setContent(java.awt.Component) method.

Command buttons are supplied as JButtons using the add button methods: Apply, Cancel, Close, or Ok buttons are added with the addApplyButton(javax.swing.JButton), addCancelButton(javax.swing.JButton), addCloseButton(javax.swing.JButton), and addOkButton(javax.swing.JButton) methods, respectively. Adding a null button causes an appropriate default button to be created. The Cancel and Close buttons are mutually exclusive. The dialog dismisses itself when Cancel, Close, or Apply are clicked. The buttons are placed as appropriate for the look and feel.

Custom command buttons are added with the addCustomButton(javax.swing.JButton) method. These buttons are placed as appropriate for the look and feel, in the order in which they are added. To have a custom button dismiss the dialog, the client can use setTerminatingButton(javax.swing.JButton); to otherwise respond to the button, the client must add itself as an ActionListener to the button directly. A Help button is added by setting a help topic string using setHelpTopic(java.lang.String).

The show method returns the terminating button clicked by the user, or null if the user closed the dialog without choosing a button (i.e., by using the window close box).


Constructor Summary
DialogFactory()
          Creates a dialog.
 
Method Summary
 javax.swing.JButton addApplyAction(java.awt.event.ActionListener action)
          Adds a default apply button with a custom action to this dialog.
 javax.swing.JButton addApplyButton(javax.swing.JButton button)
          Adds the apply button to this dialog.
 javax.swing.JButton addCancelAction(java.awt.event.ActionListener action)
          Adds a default cancel button with a custom action to this dialog.
 javax.swing.JButton addCancelButton(javax.swing.JButton button)
          Adds the cancel button to this dialog.
 javax.swing.JButton addCloseAction(java.awt.event.ActionListener action)
          Adds a default close button with a custom action to this dialog.
 javax.swing.JButton addCloseButton(javax.swing.JButton button)
          Adds a close button to this dialog.
 javax.swing.JButton addCustomButton(javax.swing.JButton button)
          Adds a custom button to this dialog.
 javax.swing.JButton addOkAction(java.awt.event.ActionListener action)
          Adds a default ok button with a custom action to this dialog.
 javax.swing.JButton addOkButton(javax.swing.JButton button)
          Adds an ok button to this dialog.
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 javax.swing.JButton getApplyButton()
          Gets the apply button, or null if none.
 javax.swing.JButton getCancelButton()
          Gets the cancel button, or null if none.
 javax.swing.JButton getCloseButton()
          Gets the close button, or null if none.
 javax.swing.JButton getHelpButton()
          Gets the help button, or null if none.
 javax.swing.JButton getOkButton()
          Gets the ok button, or null if none.
 void hide()
          Hides the dialog.
 void setContent(java.awt.Component content)
          Sets the content of the dialog.
 void setDefaultButton(javax.swing.JButton button)
          Sets the default button of the dialog.
 void setDefaultCloseButtonIgnored(boolean ignored)
          Sets whether to ignore the default (title bar) close button.
 void setDescription(java.lang.String description)
          Sets the description text for this dialog.
 void setExpansionFactor(float factor)
          Sets the expansion factor of the contents of this dialog.
 void setHelpTopic(java.lang.String topic)
          Sets the help topic for and adds the help button to this dialog.
 void setInitialFocus(java.awt.Component component)
          Sets the component which should get the initial focus.
 void setLocationRelativeTo(javax.swing.JDialog dialog, java.awt.Component c)
           
 void setModal(boolean modal)
          Sets whether the dialog is modal.
 void setResizable(boolean resizable)
          Sets whether the dialog is resizable.
 void setTerminatingButton(javax.swing.JButton button)
          Sets a custom button to be a terminating button.
 void setTitle(java.lang.String title)
          Sets the title of this dialog.
 javax.swing.JButton show()
          Show the dialog with a default parent.
 javax.swing.JButton show(java.awt.Component parent)
          Show the dialog.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DialogFactory

public DialogFactory()
Creates a dialog.

Method Detail

addApplyButton

public javax.swing.JButton addApplyButton(javax.swing.JButton button)
Adds the apply button to this dialog. The default action for this button does nothing; use addApplyAction(java.awt.event.ActionListener) to add a custom action.

Parameters:
button - The customized apply button, or null to create a default apply button.
Returns:
The button added.

addApplyAction

public javax.swing.JButton addApplyAction(java.awt.event.ActionListener action)
Adds a default apply button with a custom action to this dialog. This method may, but need not, be used in conjunction with addApplyButton(javax.swing.JButton).

Parameters:
action - The action to add to the button.
Returns:
The button added.

addCancelButton

public javax.swing.JButton addCancelButton(javax.swing.JButton button)
Adds the cancel button to this dialog. The default action for this button dismisses the dialog; use addCancelAction(java.awt.event.ActionListener) to add a custom action. A cancel button cannot be added if a close button has been added.

Parameters:
button - The customized cancel button, or null to create a default cancel button.
Returns:
The button added.
Throws:
java.lang.IllegalStateException - if a close button has been added.

addCancelAction

public javax.swing.JButton addCancelAction(java.awt.event.ActionListener action)
Adds a default cancel button with a custom action to this dialog. The action can use hide() method to dismiss the dialog. This method may, but need not, be used in conjunction with addCancelButton(javax.swing.JButton).

Parameters:
action - The action to add to the button.
Returns:
The button added.

addCloseButton

public javax.swing.JButton addCloseButton(javax.swing.JButton button)
Adds a close button to this dialog. The default action for this button dismisses the dialog; use addCloseAction(java.awt.event.ActionListener) to add a custom action. A close button cannot be added if a cancel button has been added.

Parameters:
button - The customized close button, or null to create a default close button.
Returns:
The button added.
Throws:
java.lang.IllegalStateException - if a cancel button has been added.

addCloseAction

public javax.swing.JButton addCloseAction(java.awt.event.ActionListener action)
Adds a default close button with a custom action to this dialog. The action can use hide() method to dismiss the dialog. This method may, but need not, be used in conjunction with addCloseButton(javax.swing.JButton).

Parameters:
action - The action to add to the button.
Returns:
The button added.

addCustomButton

public javax.swing.JButton addCustomButton(javax.swing.JButton button)
Adds a custom button to this dialog. By default, the dialog is not dismissed when a custom button is clicked; invoke setTerminatingButton(javax.swing.JButton) for a custom button to make it dismiss the dialog.

Parameters:
button - The button to add.
Returns:
The button added.

addOkButton

public javax.swing.JButton addOkButton(javax.swing.JButton button)
Adds an ok button to this dialog. The default action for this button dismisses the dialog; use addOkAction(java.awt.event.ActionListener) to add a custom action.

Parameters:
button - The customized ok button, or null to create a default ok button.
Returns:
The button added.

addOkAction

public javax.swing.JButton addOkAction(java.awt.event.ActionListener action)
Adds a default ok button with a custom action to this dialog. The action can use hide() method to dismiss the dialog. This method may, but need not, be used in conjunction with addOkButton(javax.swing.JButton).

Parameters:
action - The action to add to the button.
Returns:
The button added.

getApplyButton

public javax.swing.JButton getApplyButton()
Gets the apply button, or null if none.


getCancelButton

public javax.swing.JButton getCancelButton()
Gets the cancel button, or null if none.


getCloseButton

public javax.swing.JButton getCloseButton()
Gets the close button, or null if none.


getHelpButton

public javax.swing.JButton getHelpButton()
Gets the help button, or null if none.


getOkButton

public javax.swing.JButton getOkButton()
Gets the ok button, or null if none.


hide

public void hide()
Hides the dialog.


setContent

public void setContent(java.awt.Component content)
Sets the content of the dialog.

Parameters:
content - The component to be placed in the dialog box.

setDefaultCloseButtonIgnored

public void setDefaultCloseButtonIgnored(boolean ignored)
Sets whether to ignore the default (title bar) close button. The default value is false.


setDefaultButton

public void setDefaultButton(javax.swing.JButton button)
Sets the default button of the dialog.

Parameters:
button - The default button for the dialog, or null if none.
Throws:
java.lang.IllegalArgumentException - if the button is in this dialog.
See Also:
addCustomButton(javax.swing.JButton), addApplyButton(javax.swing.JButton), addCancelButton(javax.swing.JButton), addCloseButton(javax.swing.JButton), addOkButton(javax.swing.JButton)

setDescription

public void setDescription(java.lang.String description)
Sets the description text for this dialog.

Parameters:
description - Text describing this dialog.

setExpansionFactor

public void setExpansionFactor(float factor)
Sets the expansion factor of the contents of this dialog. This property exists to support positioning initially collapsed expanding dialogs so that when expanded, they will still fit on the screen. The default value is one.


setInitialFocus

public void setInitialFocus(java.awt.Component component)
Sets the component which should get the initial focus.


setHelpTopic

public void setHelpTopic(java.lang.String topic)
Sets the help topic for and adds the help button to this dialog.

Parameters:
topic - The OHJ help topic identifier for this dialog.

setResizable

public void setResizable(boolean resizable)
Sets whether the dialog is resizable. By default, it is.


setModal

public void setModal(boolean modal)
Sets whether the dialog is modal. By default, it is.


setTerminatingButton

public void setTerminatingButton(javax.swing.JButton button)
Sets a custom button to be a terminating button.

Parameters:
button - A button for the dialog, or null if none.
Throws:
java.lang.IllegalArgumentException - if the button is not a custom button of this dialog.
See Also:
addCustomButton(javax.swing.JButton)

setTitle

public void setTitle(java.lang.String title)
Sets the title of this dialog.

Parameters:
title - The title of this dialog.

show

public javax.swing.JButton show()
Show the dialog with a default parent.

Returns:
The terminating button, or null if none.

show

public javax.swing.JButton show(java.awt.Component parent)
Show the dialog.

Parameters:
parent - The parent component of this dialog.
Returns:
The terminating button, or null if none.

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

setLocationRelativeTo

public void setLocationRelativeTo(javax.swing.JDialog dialog,
                                  java.awt.Component c)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

Copyright © 1997, 2013, Oracle. All rights reserved.