com.ccg.swing
Class OkCancelHandler

java.lang.Object
  extended by com.ccg.swing.OkCancelHandler
All Implemented Interfaces:
OkCancelModel

public class OkCancelHandler
extends Object
implements OkCancelModel

Default implementation of the OkCancelModel interface.

This default implementation for the OkCancelModel interface should work for most developers. It provides the following features:

NOTE: It is possible that neither the OK or Cancel button will indicate that they were pressed (if the user disposed of the window via the window manaager). Most programmers will treat this as a "Cancel" action and will use the wasOkPressed() method.

Since:
1.0
Version:
$Revision: 1.1 $
Author:
$Author: pkb $

Constructor Summary
OkCancelHandler()
           
 
Method Summary
 void cancelAction()
          Method to invoke if the user chooses the "Cancel" path.
 void okAction()
          Method to invoke if the user chooses the "OK" path.
 void setDisposeOnAction(Window val)
          Set the component (typically a dialog box) to "dispose" of when one of the buttons is pressed.
 boolean wasCancelPressed()
          Get Was the Cancel button pressed by the user?
 boolean wasOkPressed()
          Get Was the OK button pressed by the user?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OkCancelHandler

public OkCancelHandler()
Method Detail

setDisposeOnAction

public void setDisposeOnAction(Window val)
Set the component (typically a dialog box) to "dispose" of when one of the buttons is pressed.

Parameters:
val - New Window value to assign.

okAction

public void okAction()
Method to invoke if the user chooses the "OK" path.

Once invoked in this fashion, the wasOkPressed method will return true, and any associated component will be disposed of.

Specified by:
okAction in interface OkCancelModel
Since:
1.0

wasOkPressed

public boolean wasOkPressed()
Get Was the OK button pressed by the user?

Returns:
true if the user has pressed the "OK" button.

cancelAction

public void cancelAction()
Method to invoke if the user chooses the "Cancel" path.

Once invoked in this fashion, the wasCancelPressed method will return true, and any associated component will be disposed of.

Specified by:
cancelAction in interface OkCancelModel
Since:
1.0

wasCancelPressed

public boolean wasCancelPressed()
Get Was the Cancel button pressed by the user?

Returns:
true if the user has pressed the "Cancel" button.


Copyright 1998-1998-2006 null. All Rights Reserved.