GWTApplication.client
Class SearchForm

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by GWTApplication.client.FaultDBForm
                  extended by GWTApplication.client.SearchForm
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.ClickListener, com.google.gwt.user.client.ui.KeyboardListener

public class SearchForm
extends FaultDBForm
implements com.google.gwt.user.client.ui.ClickListener, com.google.gwt.user.client.ui.KeyboardListener

This class will be used to build a form which may subsequently be used to search through the fault management system. There are two searches associated with this form. The first is a simple search which allows the user to enter and a start and end date. The second is an advanced search which allows the user much finer control over the search parameters. The results of the search will be displayed in the search view.

Version:
$Id: SearchForm.java,v 1.22 2008/01/15 11:08:15 cb Exp $
Author:
Craige Bevil

Nested Class Summary
(package private)  class SearchForm.InputField
          This is an inner class which is used to represent a field within the search form
 
Field Summary
private static java.lang.String ADVANCED
          A constant used to index the SearchFormatters hash map
(package private)  java.util.HashMap AdvancedSearchFieldsHash
          This is a hashtable which will be used to index the fields in the advanced search
(package private)  SearchForm.InputField[] AdvancedSearchInputFieldData
          The generation of the search form is data-driven and this is done through the use of the following array
static java.lang.String ASSIGNEDTO
          A constant which will be used to index the search data structure and will be used across the client and the server
(package private) static int BUTTON
          A static which is used to indicate that a widget is a button
(package private) static int CHECKBOX
          A static which is used to indicate that a widget is a checkbox
static java.lang.String CHECKED
          Used for indicating the state of chcek boxes which are included in the interface
static java.lang.String DATEOCCURED
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String DEFECTNUMBER
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String DUTYENGINEER
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String ENDDATE
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String FAULTNUMBER
          The fault number of the fault
static java.lang.String FAULTTYPE
          A constant which will be used to index the search data structure and will be used across the client and the server
private  FaultUpdateMonitor faultUpdateMonitor
          Used to check the database intermittingly and report back to listeners which faults they are displaying have changed so that they may update their view accordingly.
(package private) static int FULLWIDTH
          A static to indicate that the widget should occupy the full width of the table into which it is positioned.
static java.lang.String INSTRUMENT
          A constant which will be used to index the search data structure and will be used across the client and the server
(package private)  InternationalizationConstants internationalizationConstants
          This class will be used for internationalization so that we can flick between the locales of English and Spanish.
static java.lang.String KEYWORDS
          A constant which will be used to index the search data structure and will be used across the client and the server
(package private) static int LISTBOX
          A static which is used to indicate that a widget is a list box
private  com.google.gwt.user.client.ui.TabPanel MainTabPanel
          This is the main tab panel for the application
private  ModifyFormPanel ModifyFormPage
          This is the object which will be used to allow the user to modify faults should he be entitled to
static java.lang.String NOTCHECKED
          Used for indicating the state of chcek boxes which are included in the interface
static java.lang.String OBSERVER
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String ORIGINATOR
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String PRIORITY
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String RESET
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String SA
          A constant which will be used to index the search data structure and will be used across the client and the server
private  java.util.HashMap SearchFormatters
          This hash map will contain the formatters which will be used for creating the search result table.
(package private)  com.google.gwt.user.client.ui.TabPanel SearchTabPanel
          This is the tabbed panel which contains two panels.
static java.lang.String SEVERITY
          A constant which will be used to index the search data structure and will be used across the client and the server
private static java.lang.String SIMPLE
          A constant used to index the SearchFormatters hash map
(package private)  java.util.HashMap SimpleSearchFieldsHash
          This is a hashtable which will be used to index the fields in the simple search
(package private)  SearchForm.InputField[] SimpleSearchInputFieldData
           
static java.lang.String SITE
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String STARTDATE
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String STATUSTYPE
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String SUBMIT
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String SYSTEM
          A constant which will be used to index the search data structure and will be used across the client and the server
(package private) static int TEXTBOX
          A static which is used to indicate that a widget is a text box
static java.lang.String TIMELOST
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String TO
          A constant which will be used to index the search data structure and will be used across the client and the server
static java.lang.String USEAND
          This is used by the user to indicate that he wants an boolean and applied to the terms in the search query for the advanced search
static java.lang.String USEOR
          Used to indicate that we should use OR as the conjungating operator in the advanced search query
static java.lang.String USEORKEYWORDS
          Used to indicate that we should use OR as the conjungating operator in the keywords of the search
 
Fields inherited from class GWTApplication.client.FaultDBForm
busyIndicator, NOLENGTHCHECK, PrinterList, svc, UserAuthentication
 
Fields inherited from interface com.google.gwt.user.client.ui.KeyboardListener
KEY_ALT, KEY_BACKSPACE, KEY_CTRL, KEY_DELETE, KEY_DOWN, KEY_END, KEY_ENTER, KEY_ESCAPE, KEY_HOME, KEY_LEFT, KEY_PAGEDOWN, KEY_PAGEUP, KEY_RIGHT, KEY_SHIFT, KEY_TAB, KEY_UP, MODIFIER_ALT, MODIFIER_CTRL, MODIFIER_META, MODIFIER_SHIFT
 
Constructor Summary
SearchForm(com.google.gwt.user.client.ui.TabPanel MainTabPanel, FaultServiceAsync svc, AuthenticationDetails UserAuthentication, ModifyFormPanel ModifyFormPage, FaultUpdateMonitor faultUpdateMonitor)
          This is used to create the form which will be used to enter the details of a search.
 
Method Summary
(package private)  void createSearchTabPanel(java.lang.String SearchType, java.lang.String TabText, SearchForm.InputField[] SearchTabPanelData, int TableWidth, boolean IncludeVisibilityCheckBoxes)
          This method will create a search panel within the parent tab panel.
 void onClick(com.google.gwt.user.client.ui.Widget sender)
          This implements part of the ClickListener interface and is called when the user clicks on the button to activate the search
 void onKeyDown(com.google.gwt.user.client.ui.Widget sender, char keyCode, int modifiers)
          An obligation to the KeyboardListener interface.
 void onKeyPress(com.google.gwt.user.client.ui.Widget sender, char keyCode, int modifiers)
          Called when the user presses the return key on the search panel interface.
 void onKeyUp(com.google.gwt.user.client.ui.Widget sender, char keyCode, int modifiers)
          An obligation to the KeyboardListener interface.
private  void processAdvancedSearch()
          Method called to invoke the advanced search on the servlet in tomcat container.
private  void processSimpleSearch()
          Perform the basic search.
private  void resetFields(SearchForm.InputField[] FormFields)
          This will be used to reset the fields in the search form which is provided.
 
Methods inherited from class GWTApplication.client.FaultDBForm
createEmailLink, fillListBoxWithCurrentInstruments, fillListBoxWithDutyTechnicians, fillListBoxWithFaultType, fillListBoxWithInstruments, fillListBoxWithSeverity, fillListBoxWithSites, fillListBoxWithStaffMembers, fillListBoxWithStates, fillListBoxWithSupportAstronomers, fillListBoxWithSystems, fillListBoxWithTelescopeOperators, getCurrentDate, getCurrentTime, getFullUserNameFromEmailAddress, selectDefaultListOption, setSelectedItemInListbox, stringContainsText, verifyDateFormat, verifyDateNotInFuture, verifyText, verifyTimeFormat
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, getWidget, initWidget, isAttached, onAttach, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

faultUpdateMonitor

private FaultUpdateMonitor faultUpdateMonitor
Used to check the database intermittingly and report back to listeners which faults they are displaying have changed so that they may update their view accordingly.


CHECKED

public static final java.lang.String CHECKED
Used for indicating the state of chcek boxes which are included in the interface

See Also:
Constant Field Values

NOTCHECKED

public static final java.lang.String NOTCHECKED
Used for indicating the state of chcek boxes which are included in the interface

See Also:
Constant Field Values

KEYWORDS

public static final java.lang.String KEYWORDS
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

DATEOCCURED

public static final java.lang.String DATEOCCURED
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

TIMELOST

public static final java.lang.String TIMELOST
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

OBSERVER

public static final java.lang.String OBSERVER
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

DEFECTNUMBER

public static final java.lang.String DEFECTNUMBER
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

SEVERITY

public static final java.lang.String SEVERITY
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

INSTRUMENT

public static final java.lang.String INSTRUMENT
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

SITE

public static final java.lang.String SITE
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

SYSTEM

public static final java.lang.String SYSTEM
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

ORIGINATOR

public static final java.lang.String ORIGINATOR
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

FAULTNUMBER

public static final java.lang.String FAULTNUMBER
The fault number of the fault

See Also:
Constant Field Values

TO

public static final java.lang.String TO
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

DUTYENGINEER

public static final java.lang.String DUTYENGINEER
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

SA

public static final java.lang.String SA
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

PRIORITY

public static final java.lang.String PRIORITY
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

ASSIGNEDTO

public static final java.lang.String ASSIGNEDTO
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

FAULTTYPE

public static final java.lang.String FAULTTYPE
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

STATUSTYPE

public static final java.lang.String STATUSTYPE
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

SUBMIT

public static final java.lang.String SUBMIT
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

STARTDATE

public static final java.lang.String STARTDATE
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

ENDDATE

public static final java.lang.String ENDDATE
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

RESET

public static final java.lang.String RESET
A constant which will be used to index the search data structure and will be used across the client and the server

See Also:
Constant Field Values

USEAND

public static final java.lang.String USEAND
This is used by the user to indicate that he wants an boolean and applied to the terms in the search query for the advanced search

See Also:
Constant Field Values

USEOR

public static final java.lang.String USEOR
Used to indicate that we should use OR as the conjungating operator in the advanced search query

See Also:
Constant Field Values

USEORKEYWORDS

public static final java.lang.String USEORKEYWORDS
Used to indicate that we should use OR as the conjungating operator in the keywords of the search

See Also:
Constant Field Values

MainTabPanel

private final com.google.gwt.user.client.ui.TabPanel MainTabPanel
This is the main tab panel for the application


ADVANCED

private static final java.lang.String ADVANCED
A constant used to index the SearchFormatters hash map

See Also:
Constant Field Values

SIMPLE

private static final java.lang.String SIMPLE
A constant used to index the SearchFormatters hash map

See Also:
Constant Field Values

ModifyFormPage

private final ModifyFormPanel ModifyFormPage
This is the object which will be used to allow the user to modify faults should he be entitled to


SearchFormatters

private final java.util.HashMap SearchFormatters
This hash map will contain the formatters which will be used for creating the search result table.


internationalizationConstants

InternationalizationConstants internationalizationConstants
This class will be used for internationalization so that we can flick between the locales of English and Spanish.


TEXTBOX

static final int TEXTBOX
A static which is used to indicate that a widget is a text box

See Also:
Constant Field Values

LISTBOX

static final int LISTBOX
A static which is used to indicate that a widget is a list box

See Also:
Constant Field Values

BUTTON

static final int BUTTON
A static which is used to indicate that a widget is a button

See Also:
Constant Field Values

CHECKBOX

static final int CHECKBOX
A static which is used to indicate that a widget is a checkbox

See Also:
Constant Field Values

FULLWIDTH

static final int FULLWIDTH
A static to indicate that the widget should occupy the full width of the table into which it is positioned.

See Also:
Constant Field Values

SearchTabPanel

final com.google.gwt.user.client.ui.TabPanel SearchTabPanel
This is the tabbed panel which contains two panels. One represents the advanced search and the other represents the simple search.


SimpleSearchFieldsHash

final java.util.HashMap SimpleSearchFieldsHash
This is a hashtable which will be used to index the fields in the simple search


AdvancedSearchFieldsHash

final java.util.HashMap AdvancedSearchFieldsHash
This is a hashtable which will be used to index the fields in the advanced search


AdvancedSearchInputFieldData

final SearchForm.InputField[] AdvancedSearchInputFieldData
The generation of the search form is data-driven and this is done through the use of the following array


SimpleSearchInputFieldData

final SearchForm.InputField[] SimpleSearchInputFieldData
Constructor Detail

SearchForm

SearchForm(com.google.gwt.user.client.ui.TabPanel MainTabPanel,
           FaultServiceAsync svc,
           AuthenticationDetails UserAuthentication,
           ModifyFormPanel ModifyFormPage,
           FaultUpdateMonitor faultUpdateMonitor)
This is used to create the form which will be used to enter the details of a search.

Parameters:
MainTabPanel - This is the tabbed panel into which we should build the search panels.
svc - This is used to communicate with the servlet in the Tomcat container.
UserAuthentication - Contains the details of the users authentication.
ModifyFormPage - The tab which is used for updating the faults in the database. This is so that we can link from the search page to the update form panel.
faultUpdateMonitor - This will be used to track updates of faults in the system.
Method Detail

onKeyDown

public void onKeyDown(com.google.gwt.user.client.ui.Widget sender,
                      char keyCode,
                      int modifiers)
An obligation to the KeyboardListener interface. Not Used.

Specified by:
onKeyDown in interface com.google.gwt.user.client.ui.KeyboardListener

onKeyPress

public void onKeyPress(com.google.gwt.user.client.ui.Widget sender,
                       char keyCode,
                       int modifiers)
Called when the user presses the return key on the search panel interface. We check to see if the key that was pressed was the return key and if so, we call the search depending on which of the search tabs was selected

Specified by:
onKeyPress in interface com.google.gwt.user.client.ui.KeyboardListener

onKeyUp

public void onKeyUp(com.google.gwt.user.client.ui.Widget sender,
                    char keyCode,
                    int modifiers)
An obligation to the KeyboardListener interface. Not Used.

Specified by:
onKeyUp in interface com.google.gwt.user.client.ui.KeyboardListener

onClick

public void onClick(com.google.gwt.user.client.ui.Widget sender)
This implements part of the ClickListener interface and is called when the user clicks on the button to activate the search

Specified by:
onClick in interface com.google.gwt.user.client.ui.ClickListener
Parameters:
sender - This is the widget which was the source of the click event.

processSimpleSearch

private void processSimpleSearch()
Perform the basic search. Verify that the user has filled in the search terms correctly and then perform the search on the java servlet. The results which come back will be displayed in a SearchResultFormatter


processAdvancedSearch

private void processAdvancedSearch()
Method called to invoke the advanced search on the servlet in tomcat container. It will validate the data which has been entered by the user in order to make sure it is correct and then execute the search command


resetFields

private void resetFields(SearchForm.InputField[] FormFields)
This will be used to reset the fields in the search form which is provided.

Parameters:
FormFields - This is an array of all of the fields in the form which is to be reset

createSearchTabPanel

void createSearchTabPanel(java.lang.String SearchType,
                          java.lang.String TabText,
                          SearchForm.InputField[] SearchTabPanelData,
                          int TableWidth,
                          boolean IncludeVisibilityCheckBoxes)
This method will create a search panel within the parent tab panel. The operation is data-driven and the method uses the information which is located in the SearchTabPanelData input parameter in order to determine how the panel should be constructed. This method is woefully inflexible but serves the required purpose.

Parameters:
SearchType - This the type of the search which can be ADVANCED or SIMPLE.
TabText - This is the text which should be associated with the tab. Should be either simple or advanced
SearchTabPanelData - this variable contains the data which will be used to generate the form from.
TableWidth - This is the expected widths in columns of the table into which we will generate the search form
IncludeVisibilityCheckBoxes - This indicates whether or not we should add checkboxes associated with each of the input fields. The semantic of the checkbox is to include the selected fields in the search results.