wt.clients.gui
Class OkCancelDialog

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

public class OkCancelDialog
extends Dialog

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

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


Supported API:true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private)  class OkCancelDialog.SymAction
           
(package private)  class OkCancelDialog.SymKey
           
(package private)  class OkCancelDialog.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
           
static int CANCEL
          Defined constant which indicates a negative response by the user to the displayed message
static String CANCEL_COMMAND
          Defined constant which indicates a negative response by the user to the displayed message
(package private)  symantec.itools.awt.LabelButton cancelButton
           
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 OK
          Defined constant which indicates a positive response by the user to the displayed message
static String OK_COMMAND
          Defined constant which indicates a positive response by the user to the displayed message
(package private)  symantec.itools.awt.LabelButton okButton
           
private static ResourceBundle resources
           
private static String RESOURCES
           
private static String versionID
           
 
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
OkCancelDialog(Component component, boolean modal)
           
OkCancelDialog(Component component, boolean modal, String message)
           
OkCancelDialog(Component component, String title, boolean modal)
           
OkCancelDialog(Component component, String title, boolean modal, String message)
           
OkCancelDialog(Frame parent, boolean modal)
          Constructor for OkCancelDialog.
OkCancelDialog(Frame parent, boolean modal, String message)
          Constructor for class OkCancelDialog
OkCancelDialog(Frame parent, String title, boolean modal)
          Constructor for class OkCancelDialog
OkCancelDialog(Frame parent, String title, boolean modal, String message)
          Constructor for class OkCancelDialog
 
Method Summary
 void addActionListener(ActionListener l)
          Method addActionListener adds listeners to receive notification of ActionEvents on this dialog.
 void addNotify()
           
(package private)  void cancelButton_Action(ActionEvent event)
           
(package private)  void cancelButton_KeyPress(KeyEvent event)
           
(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.
private  void notifyActionListeners(ActionEvent evt)
           
(package private)  void okButton_Action(ActionEvent event)
           
(package private)  void okButton_KeyPress(KeyEvent event)
           
private  void processCancelAction()
           
private  void processOkAction()
           
 void removeActionListener(ActionListener l)
          Method removeActionListener removes the given listener from receiving notification of ActionEvents on this dialog.
 void setCancelButtonLabel(String label)
          Method to set the label of the button on this dialog which represents the Cancel action.
private  void setContext(boolean context_on)
           
protected  void setDisplayLocation()
           
 void setOkButtonLabel(String label)
          Method to set the label of the button on this dialog which represents the OK action.
 void show()
           
 
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

okButton

symantec.itools.awt.LabelButton okButton

cancelButton

symantec.itools.awt.LabelButton cancelButton

horizontalLine1

symantec.itools.awt.shape.HorizontalLine horizontalLine1

OK

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


CANCEL

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


OK_COMMAND

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


CANCEL_COMMAND

public static String CANCEL_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

OkCancelDialog

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

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

OkCancelDialog

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

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

OkCancelDialog

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

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

OkCancelDialog

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

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

OkCancelDialog

public OkCancelDialog(Component component,
                      boolean modal)

OkCancelDialog

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

OkCancelDialog

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

OkCancelDialog

public OkCancelDialog(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)

okButton_Action

void okButton_Action(ActionEvent event)

processOkAction

private void processOkAction()

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 OK or Cancel 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:
OkCancelDialog.OK, if the user invokes the OK action; or OkCancelDialog.CANCEL, if the user invokes the Cancel action

notifyActionListeners

private void notifyActionListeners(ActionEvent evt)

cancelButton_Action

void cancelButton_Action(ActionEvent event)

processCancelAction

private void processCancelAction()

setOkButtonLabel

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

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

setCancelButtonLabel

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

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

okButton_KeyPress

void okButton_KeyPress(KeyEvent event)

cancelButton_KeyPress

void cancelButton_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)