edu.cmu.hcii.calo.view.SearchField Class Reference

Collaboration diagram for edu.cmu.hcii.calo.view.SearchField:

Collaboration graph
[legend]
List of all members.

Detailed Description

A text field for search/filter interfaces.

The extra functionality includes a placeholder string (when the user hasn't yet typed anything), and a button to clear the currently-entered text.

Largely undocumented due to the fact that I (Brian) did not write it.

Author:
Elliott Hughes

Brian Ellis (modifications)


Public Member Functions

 SearchField ()
 Constructs a search field with placeholder text of "Search".
 SearchField (String placeholderText)
 Constructs a search field with the given placeholder text.
void forceGrabFocus ()
 Forces the field to gain focus.
void setSendsNotificationForEachKeystroke (boolean eachKeystroke)
 Sets whether the field posts an action event after each keystroke, as opposed to just when the field loses focus or the user hits the return key.

Private Member Functions

void cancel ()
 Causes the search field to clear out its text.
void initBorder ()
 Initializes the field's border.
void initKeyListener ()
 Initializes the key listener for this field.
void maybeNotify ()
 Posts an action event if the field is not showing placeholder text.

Private Attributes

boolean sendsNotificationForEachKeystroke = false
 Whether the field posts action events every time the text changes (as opposed to just when the user unfocuses the field or hits return).
boolean showingPlaceholderText = false
 Whether the field is showing placeholder text.
boolean armed = false
 Whether the cancel button is armed.
PlaceholderText placeholderTextListener
 The placeholder text listener.

Static Private Attributes

static final long serialVersionUID = 8584952661844977286L
 Prevent serialization collisions.
static final Border CANCEL_BORDER = new CancelBorder()
 The border of this field.

Classes

class  CancelBorder
 Draws the cancel button as a gray circle with a white cross inside. More...
class  CancelListener
 Handles a click on the cancel button by clearing the text and notifying any ActionListeners. More...
class  PlaceholderText
 Replaces the entered text with a gray placeholder string when the search field doesn't have the focus. More...


Constructor & Destructor Documentation

edu.cmu.hcii.calo.view.SearchField.SearchField (  ) 

Constructs a search field with placeholder text of "Search".

edu.cmu.hcii.calo.view.SearchField.SearchField ( String  placeholderText  ) 

Constructs a search field with the given placeholder text.

Parameters:
placeholderText the placeholder text to use


Member Function Documentation

void edu.cmu.hcii.calo.view.SearchField.forceGrabFocus (  ) 

Forces the field to gain focus.

void edu.cmu.hcii.calo.view.SearchField.setSendsNotificationForEachKeystroke ( boolean  eachKeystroke  ) 

Sets whether the field posts an action event after each keystroke, as opposed to just when the field loses focus or the user hits the return key.

Parameters:
eachKeystroke true if the field should post an action event after each keystroke, false otherwise

void edu.cmu.hcii.calo.view.SearchField.cancel (  )  [private]

Causes the search field to clear out its text.

void edu.cmu.hcii.calo.view.SearchField.initBorder (  )  [private]

Initializes the field's border.

void edu.cmu.hcii.calo.view.SearchField.initKeyListener (  )  [private]

Initializes the key listener for this field.

void edu.cmu.hcii.calo.view.SearchField.maybeNotify (  )  [private]

Posts an action event if the field is not showing placeholder text.


Member Data Documentation

final long edu.cmu.hcii.calo.view.SearchField.serialVersionUID = 8584952661844977286L [static, private]

Prevent serialization collisions.

final Border edu.cmu.hcii.calo.view.SearchField.CANCEL_BORDER = new CancelBorder() [static, private]

The border of this field.

boolean edu.cmu.hcii.calo.view.SearchField.sendsNotificationForEachKeystroke = false [private]

Whether the field posts action events every time the text changes (as opposed to just when the user unfocuses the field or hits return).

boolean edu.cmu.hcii.calo.view.SearchField.showingPlaceholderText = false [private]

Whether the field is showing placeholder text.

boolean edu.cmu.hcii.calo.view.SearchField.armed = false [private]

Whether the cancel button is armed.

PlaceholderText edu.cmu.hcii.calo.view.SearchField.placeholderTextListener [private]

The placeholder text listener.


The documentation for this class was generated from the following file:
Generated on Mon Aug 13 15:06:23 2007 for CALO by  doxygen 1.5.2