org.openjump.core.ui.swing.listener
Class OKCancelListener

java.lang.Object
  extended by org.openjump.core.ui.swing.listener.OKCancelListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class OKCancelListener
extends java.lang.Object
implements java.awt.event.ActionListener

Class that implements a default Action Listener behavior for an OKCancelButtonPanel. It remembers if ok was clicked and closes a given dialog.

Version:
$Rev: 856 $
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement

Field Summary
protected  javax.swing.JDialog dialog
           
protected  PersonalLogger logger
           
protected  boolean okWasClicked
           
protected  java.util.ArrayList valueCheckers
           
 
Constructor Summary
OKCancelListener(javax.swing.JDialog dialog)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent arg0)
           
 void addValueChecker(ValueChecker valChecker)
          The first invokation of this method enables value checking (enables/disables funtionality of the ok button)
protected  boolean valuesOk()
          asks the existent value checkers (if any), if the values are ok
 boolean wasOkClicked()
          Tells you, if ok was clicked to close the dialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

okWasClicked

protected boolean okWasClicked

dialog

protected javax.swing.JDialog dialog

logger

protected PersonalLogger logger

valueCheckers

protected java.util.ArrayList valueCheckers
Constructor Detail

OKCancelListener

public OKCancelListener(javax.swing.JDialog dialog)
Parameters:
dialog - dialog to be closed after ok or cancel was clicked.
Method Detail

addValueChecker

public void addValueChecker(ValueChecker valChecker)
The first invokation of this method enables value checking (enables/disables funtionality of the ok button)

Parameters:
valChecker - object that checks if the given value are ok or not

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent arg0)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)

valuesOk

protected boolean valuesOk()
asks the existent value checkers (if any), if the values are ok

Returns:
true if values are ok, else false

wasOkClicked

public boolean wasOkClicked()
Tells you, if ok was clicked to close the dialog

Returns:
Returns the okWasClicked.