wt.clients.gui
Class YesNoDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended bywt.clients.gui.YesNoDialog
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class YesNoDialog
extends Dialog

Class YesNoDialog is used to display a message to which the user can respond with one of two reponses (i.e. "YES" or "NO". For example, this dialog is useful for prompting a user: Eg.

    if( hasUnsavedChanges() ) {
       YesNoDialog confirm_save = 
                   new YesNoDialog( my_frame, true, "Save Changes?" );
       confirm_save.show();
       if( confirm_save.getAction() == YesNoDialog.YES ) {
          saveChanges();
       }
    }
  


Supported API:true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private)  class YesNoDialog.SymAction
           
(package private)  class YesNoDialog.SymKey
           
(package private)  class YesNoDialog.SymWindow
           
 
Nested classes inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  int action
           
(package private)  Panel buttonPanel
           
private  ThreadGroup contextGroup
           
(package private)  boolean fComponentsAdjusted
           
(package private)  symantec.itools.awt.shape.HorizontalLine horizontalLine1
           
private  Vector listeners
           
(package private)  symantec.itools.awt.WrappingLabel messageLabel
           
static int NO
          Defined constant which indicates a negative response by the user to the displayed message
static String NO_COMMAND
          Defined constant which indicates a negative response by the user to the displayed message
(package private)  Button noButton
           
private static ResourceBundle resources
           
private static String RESOURCES
           
private static String versionID
           
static int YES
          Defined constant which indicates a positive response by the user to the displayed message
static String YES_COMMAND
          Defined constant which indicates a positive response by the user to the displayed message
(package private)  Button yesButton
           
 
Fields inherited from class java.awt.Dialog
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
YesNoDialog(Component component, boolean modal)
           
YesNoDialog(Component component, boolean modal, String message)
           
YesNoDialog(Component component, String title, boolean modal)
           
YesNoDialog(Component component, String title, boolean modal, String message)
           
YesNoDialog(Frame parent, boolean modal)
          Constructor for YesNoDialog.
YesNoDialog(Frame parent, boolean modal, String message)
          Constructor for class YesNoDialog
YesNoDialog(Frame parent, String title, boolean modal)
          Constructor for class YesNoDialog
YesNoDialog(Frame parent, String title, boolean modal, String message)
          Constructor for class YesNoDialog
 
Method Summary
 void addActionListener(ActionListener l)
          Method addActionListener adds listeners to receive notification of ActionEvents on this dialog.
 void addNotify()
           
(package private)  void Dialog1_WindowClosing(WindowEvent event)
           
 int getAction()
          Method getAction returns the action invoked by the user on this dialog.
private static Frame getComponentFrame(Component component)
           
private  WTContext getContext()
           
private static Frame getFrame(Component component)
          Traverse the parent hierarchy of the given Component until a frame is found.
private  void initResources()
          Method initResource initializes the ResourceBundle used for localizing the dialog labels and text.
private  void localize()
          Method to translate the field labels and button labels of the dialog according to the Locale of the client.
(package private)  void noButton_Action(ActionEvent event)
           
(package private)  void noButton_KeyPress(KeyEvent event)
           
private  void notifyActionListeners(ActionEvent evt)
           
private  void processNoAction()
           
private  void processYesAction()
           
 void removeActionListener(ActionListener l)
          Method removeActionListener removes the given listener from receiving notification of ActionEvents on this dialog.
private  void setContext(boolean context_on)
           
protected  void setDisplayLocation()
           
 void setNoButtonLabel(String label)
          Method to set the label of the button on this dialog which represents the NO action.
 void setYesButtonLabel(String label)
          Method to set the label of the button on this dialog which represents the YES action.
 void show()
           
(package private)  void yesButton_Action(ActionEvent event)
           
(package private)  void yesButton_KeyPress(KeyEvent event)
           
 
Methods inherited from class java.awt.Dialog
dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

versionID

private static final String versionID
See Also:
Constant Field Values

fComponentsAdjusted

boolean fComponentsAdjusted

messageLabel

symantec.itools.awt.WrappingLabel messageLabel

buttonPanel

Panel buttonPanel

yesButton

Button yesButton

noButton

Button noButton

horizontalLine1

symantec.itools.awt.shape.HorizontalLine horizontalLine1

YES

public static int YES
Defined constant which indicates a positive response by the user to the displayed message


NO

public static int NO
Defined constant which indicates a negative response by the user to the displayed message


YES_COMMAND

public static String YES_COMMAND
Defined constant which indicates a positive response by the user to the displayed message


NO_COMMAND

public static String NO_COMMAND
Defined constant which indicates a negative response by the user to the displayed message


RESOURCES

private static String RESOURCES

resources

private static ResourceBundle resources

listeners

private Vector listeners

action

private int action

contextGroup

private ThreadGroup contextGroup
Constructor Detail

YesNoDialog

public YesNoDialog(Frame parent,
                   boolean modal)
Constructor for YesNoDialog.

Parameters:
parent - the owner of this Dialog
modal - if true, dialog blocks input to the parent window when shown
See Also:
Dialog

YesNoDialog

public YesNoDialog(Frame parent,
                   String title,
                   boolean modal)
Constructor for class YesNoDialog

Parameters:
parent - the owner of this dialog
title - the title of this dialog
modal - if true, dialog blocks input to the parent window when shown

YesNoDialog

public YesNoDialog(Frame parent,
                   String title,
                   boolean modal,
                   String message)
Constructor for class YesNoDialog

Parameters:
parent - the owner of this dialog
title - the title of this dialog
modal - if true, dialog blocks input to the parent window when shown
message - the message to be displayed by this dialog

YesNoDialog

public YesNoDialog(Frame parent,
                   boolean modal,
                   String message)
Constructor for class YesNoDialog

Parameters:
parent - the owner of this dialog
modal - if true, dialog blocks input to the parent window when shown
message - the message to be displayed by this dialog

YesNoDialog

public YesNoDialog(Component component,
                   boolean modal)

YesNoDialog

public YesNoDialog(Component component,
                   String title,
                   boolean modal)

YesNoDialog

public YesNoDialog(Component component,
                   boolean modal,
                   String message)

YesNoDialog

public YesNoDialog(Component component,
                   String title,
                   boolean modal,
                   String message)
Method Detail

initResources

private void initResources()
Method initResource initializes the ResourceBundle used for localizing the dialog labels and text.

See Also:
ResourceBundle

localize

private void localize()
Method to translate the field labels and button labels of the dialog according to the Locale of the client.

See Also:
initResources()

addNotify

public void addNotify()

show

public void show()

setDisplayLocation

protected void setDisplayLocation()

Dialog1_WindowClosing

void Dialog1_WindowClosing(WindowEvent event)

yesButton_Action

void yesButton_Action(ActionEvent event)

processYesAction

private void processYesAction()

addActionListener

public void addActionListener(ActionListener l)
Method addActionListener adds listeners to receive notification of ActionEvents on this dialog. ActionEvents are generated on this dialog when the user invokes the Yes or No buttons.

Parameters:
l - the ActionListener to be notified of ActionEvents on this dialog
See Also:
ActionListener, removeActionListener(java.awt.event.ActionListener)

removeActionListener

public void removeActionListener(ActionListener l)
Method removeActionListener removes the given listener from receiving notification of ActionEvents on this dialog. If the given listener is not found as a current listener, no changes are made.

Parameters:
l - the ActionListener to be removed from being notified of ActionEvents on this dialog
See Also:
ActionListener, addActionListener(java.awt.event.ActionListener)

getAction

public int getAction()
Method getAction returns the action invoked by the user on this dialog.

Returns:
YesNoDialog.YES, if the user invokes the YES action; or YesNoDialog.NO, if the user invokes the No action

notifyActionListeners

private void notifyActionListeners(ActionEvent evt)

noButton_Action

void noButton_Action(ActionEvent event)

processNoAction

private void processNoAction()

setYesButtonLabel

public void setYesButtonLabel(String label)
Method to set the label of the button on this dialog which represents the YES action.

Parameters:
label - the String label to be displayed on the button
See Also:
setNoButtonLabel(java.lang.String)

setNoButtonLabel

public void setNoButtonLabel(String label)
Method to set the label of the button on this dialog which represents the NO action.

Parameters:
label - the String label to be displayed on the button
See Also:
setYesButtonLabel(java.lang.String)

yesButton_KeyPress

void yesButton_KeyPress(KeyEvent event)

noButton_KeyPress

void noButton_KeyPress(KeyEvent event)

getContext

private WTContext getContext()

setContext

private void setContext(boolean context_on)

getFrame

private static Frame getFrame(Component component)
Traverse the parent hierarchy of the given Component until a frame is found. If no Frame is found, null is returned.

Parameters:
component - the Component for which an associated Frame is to be returned
Returns:
the Frame associated with the given component.

getComponentFrame

private static Frame getComponentFrame(Component component)