All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.EditableList.DefaultEditVerifier

java.lang.Object
   |
   +----com.sgi.sysadm.ui.EditableList.DefaultEditVerifier

public class DefaultEditVerifier
extends Object
implements EditVerifier
DefaultEditVerifier implements the default behavior when the version of EditableList.setEditor that does not take an EditVerifier argument is used.

For each of the asynchronous methods okToAdd, okToModify, and okToDelete, DefaultEditVerifier implements synchronous methods which return a boolean rather than taking a ResultListener. The asynchronous versions are all implemented in terms of their synchronous counterparts. For example, here is the implementation of the asynchronous version of okToAdd:

ResultEvent event = new ResultEvent(list);
if (okToAdd(list)) {
    listener.succeeded(event);
} else {
    listener.failed(event);
}
 
It is typically more convenient to extend DefaultEditVerifier than to implement EditVerifier because DefaultEditVerifier provides reasonable default implementations for each of the EditVerifier methods and if your okToAdd, okToModify, and okToDelete methods can be performed synchronously you can implement the synchronous versions instead of the asynchronous versions.


Constructor Index

 o DefaultEditVerifier()

Method Index

 o alreadyExists(EditableList)
Checks to see if there is already a row in the list has the same values for each column as the values in the editor.
 o changedSinceLastAdd(EditableList)
Called to determine whether user has made any changes.
 o okToAdd(EditableList)
This synchronous version of okToAdd is called by the asynchronous version.
 o okToAdd(EditableList, ResultListener)
Determine whether it's ok to let an "Add" operation proceed.
 o okToDelete(EditableList, int)
Called when the Delete button is pressed.
 o okToDelete(EditableList, int, ResultListener)
Determine whether it's ok to let a "Delete" operation proceed.
 o okToModify(EditableList, int)
Called when the Modify button is pressed.
 o okToModify(EditableList, int, ResultListener)
Determine whether it's ok to let a "Modify" operation proceed.
 o resetComponents(EditableList)
Called to reset the editor UI after an Add.
 o resetList(EditableList)
Called to reset the list when the Reset button is pressed.

Constructors

 o DefaultEditVerifier
 public DefaultEditVerifier()

Methods

 o okToAdd
 public void okToAdd(EditableList list,
                     ResultListener listener)
Determine whether it's ok to let an "Add" operation proceed. This version notifies listener of the result of the the synchronous okToAdd method.

Parameters:
list - The list whose Add button has been pressed.
listener - listener to notify of result.
 o okToAdd
 public boolean okToAdd(EditableList list)
This synchronous version of okToAdd is called by the asynchronous version. If all Add verification can be performed synchronously, this method can be overridden instead of the asynchronous version.

DefaultEditVerifier.okToAdd returns true if any columns have Strings in them other than "".

Parameters:
list - The list whose Add button has been pressed.
Returns:
true if add should happen, false otherwise.
 o alreadyExists
 public static boolean alreadyExists(EditableList list)
Checks to see if there is already a row in the list has the same values for each column as the values in the editor. This can be called from within okToAdd to determine whether the values in the editor are different from any rows already present.

Parameters:
list - Editable list to check.
Returns:
true if a row already exists in list having the same values as the editor, false otherwise.
 o okToModify
 public void okToModify(EditableList list,
                        int row,
                        ResultListener listener)
Determine whether it's ok to let a "Modify" operation proceed. This version notifies listener of the result of the the synchronous okToModify method.

Parameters:
list - The list whose Modify button has been pressed.
row - The row to modify.
listener - listener to notify of result.
 o okToModify
 public boolean okToModify(EditableList list,
                           int row)
Called when the Modify button is pressed. Return true if the modify should continue, false to stop it. DefaultEditVerifier.okToModify always returns true.

Parameters:
list - The list whose Modify button has been pressed.
row - The row that is being modified.
Returns:
true if the modify should happen, false otherwise.
 o okToDelete
 public void okToDelete(EditableList list,
                        int row,
                        ResultListener listener)
Determine whether it's ok to let a "Delete" operation proceed. This version notifies listener of the result of the the synchronous okToDelete method.

Parameters:
list - The list whose Delete button has been pressed.
row - The row to delete.
listener - listener to notify of result.
 o okToDelete
 public boolean okToDelete(EditableList list,
                           int row)
Called when the Delete button is pressed. Return true if the delete should continue, false to stop it. DefaultEditVerifier.okToDelete always returns true.

Parameters:
list - The list whose Delete button has been pressed.
row - The row that is to be deleted.
Returns:
true if the delete should happen, false otherwise.
 o resetComponents
 public void resetComponents(EditableList list)
Called to reset the editor UI after an Add. Sets the attribute for each column to "".

Parameters:
The - list whose editor should be reset.
 o resetList
 public void resetList(EditableList list)
Called to reset the list when the Reset button is pressed. DefaultEditVerifier method does nothing.

Parameters:
list - The list to reset.
 o changedSinceLastAdd
 public boolean changedSinceLastAdd(EditableList list)
Called to determine whether user has made any changes. DefaultEditVerifier method returns true if any columns have Strings in them other than "".

Parameters:
list - The list to check for changes.
Returns:
true if changes have been made.

All Packages  Class Hierarchy  This Package  Previous  Next  Index