jwo.vfc.hub
Class JWDialogue

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
                          |
                          +--jwo.vfc.hub.JWDialogue
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
HubConfigBox

public abstract class JWDialogue
extends Dialog
implements ActionListener

Abstract class to use as basis for dialogue windows. Contains OK and Cancel return buttons. Uses the GridBag Layout manager for maximum portability with different window sizes.

Version:
1.2.3, 22nd November, 1999
Author:
Jo Wood
See Also:
Serialized Form

Nested Class Summary
 
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
 
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
JWDialogue(Frame parentFrame)
          Creates a simple modal dialogue window with, OK and Cancel buttons.
JWDialogue(Frame parentFrame, String winTitle)
          Creates a simple modal dialogue window with title, OK and Cancel buttons.
JWDialogue(Frame parentFrame, String winTitle, String mainTitle)
          Creates a simple modal dialogue window with titles, OK and Cancel buttons.
JWDialogue(Frame parentFrame, String winTitle, String mainTitle, boolean modal)
          Creates a simple dialogue window with titles, OK and Cancel buttons.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Looks for delegated events associated with the dialogue box.
 Component add(Component c)
          Adds a component to the dialogue above the return button if they are defined.
 void addDialogueListener(JWDialogueListener dialogueListener)
          Adds a dialogue listener.
 void addReturnButtons()
          Adds the return buttons to the dialogue box.
abstract  void checkActions(ActionEvent event)
          Method to allow delegated actions (other than OK or Cancel button press) to be processed.
abstract  void checkInput()
          Method to validate dialogue values.
 void closeDialogue()
          Closes down window.
 GridBagConstraints getGBConstraints()
          Retrieves the default GridBag layout constraints associated with this frame.
 GridBagLayout getGBLayout()
          Retrieves current GridBagLayout (needed to add new componets to the dialogue box.
 boolean isChanged()
          Notifies if contents of dialogue have changed
 void removeDialogueListener(JWDialogueListener dialogueListener)
          Removes a given listener from the list of objects to be informed when a dialogue message is sent.
 void setCancelAsDefault()
          Sets the default button to Cancel.
 void setChanged(boolean changed)
          Sets the changed state of the dialogue.
 void setOKAsDefault()
          Sets the default button to OK.
 void updateListener()
          Updates the DialogueListeners.
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated, show
 
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, 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
 

Constructor Detail

JWDialogue

public JWDialogue(Frame parentFrame)
Creates a simple modal dialogue window with, OK and Cancel buttons. Uses default colour schemes for window.

Parameters:
parentFrame - Frame with which associated modal dialogue.

JWDialogue

public JWDialogue(Frame parentFrame,
                  String winTitle)
Creates a simple modal dialogue window with title, OK and Cancel buttons. Uses default colour schemes for window.

Parameters:
parentFrame - Frame with which associated modal dialogue.
winTitle - Title placed on window bar.

JWDialogue

public JWDialogue(Frame parentFrame,
                  String winTitle,
                  String mainTitle)
Creates a simple modal dialogue window with titles, OK and Cancel buttons. Uses default colour schemes for window.

Parameters:
parentFrame - Frame with which associated modal dialogue.
winTitle - Title placed on window bar.
mainTitle - Main title displayed in dialogue window.

JWDialogue

public JWDialogue(Frame parentFrame,
                  String winTitle,
                  String mainTitle,
                  boolean modal)
Creates a simple dialogue window with titles, OK and Cancel buttons. Uses default colour schemes for window.

Parameters:
parentFrame - Frame with which associated modal dialogue.
winTitle - Title placed on window bar.
mainTitle - Main title displayed in dialogue window.
modal - Determines whether dialogue is modal or not.
Method Detail

isChanged

public boolean isChanged()
Notifies if contents of dialogue have changed

Returns:
Boolean indication of dialogue change.

add

public Component add(Component c)
Adds a component to the dialogue above the return button if they are defined.

Overrides:
add in class Container
Returns:
Component added.

setChanged

public void setChanged(boolean changed)
Sets the changed state of the dialogue.

Parameters:
changed - Boolean indication of dialogue change.

getGBConstraints

public GridBagConstraints getGBConstraints()
Retrieves the default GridBag layout constraints associated with this frame. Default assumes

Returns:
Default GridBagConstraints.

getGBLayout

public GridBagLayout getGBLayout()
Retrieves current GridBagLayout (needed to add new componets to the dialogue box.

Returns:
Current GridBagLayout.

addReturnButtons

public void addReturnButtons()
Adds the return buttons to the dialogue box.


setOKAsDefault

public void setOKAsDefault()
Sets the default button to OK.


setCancelAsDefault

public void setCancelAsDefault()
Sets the default button to Cancel.


actionPerformed

public void actionPerformed(ActionEvent event)
Looks for delegated events associated with the dialogue box. Always deals with return button presses, but includes a call to the abstract method checkActions to allow other actions to be processed.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - Any action event associated with dialogue.
See Also:
checkActions(java.awt.event.ActionEvent)

addDialogueListener

public void addDialogueListener(JWDialogueListener dialogueListener)
Adds a dialogue listener. This allows the non-modal version of this dialogue box to inform the lister to update changes.

Parameters:
dialogueListener - The object to listen for changes.

removeDialogueListener

public void removeDialogueListener(JWDialogueListener dialogueListener)
Removes a given listener from the list of objects to be informed when a dialogue message is sent.

Parameters:
dialogueListener - Object to be removed from listeners.

updateListener

public void updateListener()
Updates the DialogueListeners.


closeDialogue

public void closeDialogue()
Closes down window. This method should be called before closing the window (it is automatically called if the window is closed other than via the OK/Cancel buttons). dialogue is closed. May be overridden for clean exit behaviour. The default behaviour is to inform any listener that the window has closed.


checkInput

public abstract void checkInput()
Method to validate dialogue values. Must be implemented, and should dispose of window if dialogue is successfully validated.


checkActions

public abstract void checkActions(ActionEvent event)
Method to allow delegated actions (other than OK or Cancel button press) to be processed. Must be implemented, even if no other actions are performed (in which case, consider using JWMonologue instead.

Parameters:
event - Action event to be processed.