org.jurvis.util
Class JvErrorList

java.lang.Object
  extended by org.jurvis.util.JvErrorList
All Implemented Interfaces:
Serializable

public class JvErrorList
extends Object
implements Serializable

A instance of ErrorList maintains a list of user errors for a dialog. When an error is detected, the add(org.jurvis.util.JvErrorList.Entry) method is used to add the error to the list. After all error detection code is evaluated, showDialog(java.awt.Component, java.lang.String) may be used to display the errors to the user. TODO: showDialog() should be moved to a separate class, maybe ErrorListView.

Author:
Neil W. Weber
See Also:
Serialized Form

Nested Class Summary
static class JvErrorList.Entry
          An entry within a ErrorList.
 
Constructor Summary
JvErrorList()
          Construct an JvErrorList.
 
Method Summary
 void add(JComponent field, String label, String message)
          Add an error regarding the specified component to the errors list.
 void add(JvErrorList.Entry entry)
          Add an error entry to the end of the errors list.
 void add(String message)
          Add an error regarding the specified component to the errors list.
 List getErrors()
          Return the list of JvErrorList.Entry's in this ErrorList.
 boolean hasErrors()
          Return whether there are any errors in this list.
 Iterator iterator()
          Return an iterator over the list of JvErrorList.Entry's in this ErrorList.
 void merge(JvErrorList errorList)
          Merge the errors in this list with those in the specified list.
 void showDialog(Component owner, String name)
          Show the list of errors (if there are any) to the user in a dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JvErrorList

public JvErrorList()
Construct an JvErrorList.

Method Detail

add

public void add(JvErrorList.Entry entry)
Add an error entry to the end of the errors list.

Parameters:
entry - the entry to add

add

public void add(String message)
Add an error regarding the specified component to the errors list.

Parameters:
message - error message to display

add

public void add(JComponent field,
                String label,
                String message)
Add an error regarding the specified component to the errors list.

Parameters:
field - the field in error (to be used in the future for hyperlink)
label - label containing name of field; may be null
message - error message to display

hasErrors

public boolean hasErrors()
Return whether there are any errors in this list.

Returns:
whether there are any errors

getErrors

public List getErrors()
Return the list of JvErrorList.Entry's in this ErrorList.

Returns:
the list of errors or an empty list of there aren't any.

iterator

public Iterator iterator()
Return an iterator over the list of JvErrorList.Entry's in this ErrorList. If there are no entries, an iterator over an empty list is returned.

Returns:
an iterator over the list of errors

merge

public void merge(JvErrorList errorList)
Merge the errors in this list with those in the specified list.

Parameters:
errorList - list of errors to merge in

showDialog

public void showDialog(Component owner,
                       String name)
Show the list of errors (if there are any) to the user in a dialog. Currently, only the first error is shown and in a modal dialog. All errors should be displayed and in a non-modal dialog (so the user can correct each error).

Parameters:
owner - the owner of the dialog
name - the name of the dialog


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.