eTextReader
Class HighlightPrefsBox.ButtonHandler

java.lang.Object
  extended by eTextReader.HighlightPrefsBox.ButtonHandler
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Enclosing class:
HighlightPrefsBox

 class HighlightPrefsBox.ButtonHandler
extends java.lang.Object
implements java.awt.event.ActionListener

Handles events generated by the OK, Cancel and Restore Defaults buttons

Author:
mcfall

Field Summary
private static java.lang.String DUPLICATE_HIGHLIGHTER_MESSAGE
           
 
Constructor Summary
HighlightPrefsBox.ButtonHandler()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
private  boolean allFieldNamesAreValid()
          Determines whether or not all of the field names in the dialog box are valid.
private  java.util.List<HighlighterUpdateInfo> findUpdatedHighlighters()
          Creates a list of records describing which of the highlighter names/colors have been changed
private  void highlightDefaults()
           
 void highlightPrefsOK()
          Handles when the user clicks the OK button in the dialog box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUPLICATE_HIGHLIGHTER_MESSAGE

private static final java.lang.String DUPLICATE_HIGHLIGHTER_MESSAGE
See Also:
Constant Field Values
Constructor Detail

HighlightPrefsBox.ButtonHandler

HighlightPrefsBox.ButtonHandler()
Method Detail

actionPerformed

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

highlightDefaults

private void highlightDefaults()

highlightPrefsOK

public void highlightPrefsOK()
Handles when the user clicks the OK button in the dialog box. Iterates through the highlighter color textfields, ensuring that all the names are unique. And, keeping track of those that have been changed from their original values. If any have indeed been changed, then the User method updateHighlighters is called.


findUpdatedHighlighters

private java.util.List<HighlighterUpdateInfo> findUpdatedHighlighters()
Creates a list of records describing which of the highlighter names/colors have been changed

Returns:
a (possibly empty) list of User.HighlighterUpdateInfo objects describing the changes that have been made

allFieldNamesAreValid

private boolean allFieldNamesAreValid()
Determines whether or not all of the field names in the dialog box are valid. They must be non empty, and no duplicate names can exist; case is not important in this determination.

Returns:
false if any field name is empty, or if one or more duplicates exist