GWTApplication.client
Class FaultDBForm

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
All Implemented Interfaces:
com.google.gwt.user.client.EventListener
Direct Known Subclasses:
ChangePasswordDialogBox, FaultAddition, LinkFaultDialog, LoginPanel, ManageSystem, ModifyFault, ModifyFaultSubscriptionListDialog, ModifyFormPanel, NewFaultForm, PrintFaultDialog, QuickHelpDialog, QuickViewReport, SearchForm, SearchResultFormatter

 class FaultDBForm
extends com.google.gwt.user.client.ui.Composite

This is a base class which supports the forms which are to be displayed by the application. Most of the forms in the application subclass this class.

Version:
$Id: FaultDBForm.java,v 1.11 2007/12/14 12:18:50 cb Exp $
Author:
Craige Bevil

Field Summary
protected  BusyIndicator busyIndicator
          This is a panel which will be used to indicate to the user that we are busy at the moment doing something
private static java.util.ArrayList CurrentInstrumentList
          This is the list of current instruments which can be selected
private static java.util.ArrayList DEList
          This is a list static list of the DEs.
private static java.util.ArrayList FaultStateList
          This is the list of fault states
private static java.util.ArrayList FaultTypeList
          This is the list of faults
private static java.util.ArrayList FullDEList
          This is a list static list of the DEs.
private static java.util.ArrayList FullSAList
          This is a list static list of the SAs.
private static java.util.ArrayList FullStaffMemberList
          This is a list static list of the staff.
private static java.util.ArrayList FullTOList
          This is a list static list of the TOs.
private static java.util.ArrayList InstrumentList
          This is the list of all instruments which can be selected
protected  InternationalizationConstants internationalizationConstants
          This class will be used for internationalization so that we can flick between the locales of English and Spanish.
static int NOLENGTHCHECK
          Indicates that we should not check the length of the string
protected static java.util.ArrayList PrinterList
          Holds a list of the printers that the servlet knows about.
private static java.util.ArrayList SAList
          This is a list static list of the SAs.
private static java.util.ArrayList SeverityList
          This is the list of severities
private static java.util.ArrayList SiteList
          This is the list of sites which can be selected
private static java.util.ArrayList StaffMemberList
          This is a list of all of the staff members
protected  FaultServiceAsync svc
          This is the service which will be used to access the servlet which is running in the tomcat container
private static java.util.ArrayList SystemList
          This is the list of systems which can be selected
private static java.util.ArrayList TOList
          This is a list static list of the TOs.
protected  AuthenticationDetails UserAuthentication
          This is the user authentication details which were provided by the user
 
Constructor Summary
FaultDBForm()
           
 
Method Summary
private  void createDropDownList(java.util.ArrayList staffList, java.lang.String defaultUser, com.google.gwt.user.client.ui.ListBox listBox)
          Adds the names of the people into the list provided.
static java.lang.String createEmailLink(java.lang.String emailAddress, int faultId, java.lang.String faultTitle, java.lang.String linkText)
          This method will be used to return a HTML which can be clicked on to create an email.
protected  void fillListBoxWithCurrentInstruments(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of only the current instruments (not decommissioned) from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithDutyTechnicians(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String defaultUser, boolean IncludeStaffWhichHaveLeft)
          Gets a list of the duty technician from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithFaultType(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the fault types from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithInstruments(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the all instruments from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithSeverity(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the severities from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithSites(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the sites from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithStaffMembers(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String defaultUser, boolean IncludeStaffWhichHaveLeft)
          Gets a list of the staff members from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithStates(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the fault states from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithSupportAstronomers(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String defaultUser, boolean IncludeStaffWhichHaveLeft)
          Gets a list of the support astronomer from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
protected  void fillListBoxWithSystems(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String CurrentLocale)
          Gets a list of the systems from the tomcat faultdb servlet and initialises the list box which was provided by the caller.
(package private)  void fillListBoxWithTelescopeOperators(com.google.gwt.user.client.ui.ListBox listBox, java.lang.String defaultUser, boolean IncludeStaffWhichHaveLeft)
          Gets a list of the telescope operators from the tomcat faultdb servlet and initialises the list of the telescope operators in the list box which was provided by the caller.
protected  java.lang.String getCurrentDate()
          Get current date in the format DD/MM/YYYY and return it to the caller.
protected  java.lang.String getCurrentTime()
          Get current time in the format HH:MM and return it to the caller
protected  java.lang.String getFullUserNameFromEmailAddress(java.lang.String emailAddress)
          Take an email address and return the full name of the person.
 void selectDefaultListOption(java.lang.String KeyValue, com.google.gwt.user.client.ui.ListBox TargetList)
          Called to set the default option in a list box widget.
protected  boolean setSelectedItemInListbox(com.google.gwt.user.client.ui.ListBox list, java.lang.String value)
          This method will be used to set the selected value in the listbox specified to the value which has been provided by the caller.
protected  boolean stringContainsText(java.lang.String stringToCheck)
          Check to see if the string which has been specified is actually empty after being stripped of HTML markup and   symbols.
protected  boolean verifyDateFormat(java.lang.String DateToVerify)
          Used to verify that a field which represents the date has been entered in the correct format of DD/MM/YYYY
protected  boolean verifyDateNotInFuture(java.lang.String DateToTest)
          Verify that the date that has been specified is not after the current date
protected  boolean verifyText(java.lang.String FieldName, int MaxLength, java.lang.String TextToVerify)
          This will verify that the text field is not empty or too full to fit in the database.
protected  boolean verifyTimeFormat(java.lang.String TimeToVerify)
          Used to verify that a field which represents the time has been entered in the correct format of HH:MM in 24 hour clock
 
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

busyIndicator

protected BusyIndicator busyIndicator
This is a panel which will be used to indicate to the user that we are busy at the moment doing something


NOLENGTHCHECK

public static final int NOLENGTHCHECK
Indicates that we should not check the length of the string

See Also:
Constant Field Values

FaultStateList

private static java.util.ArrayList FaultStateList
This is the list of fault states


FaultTypeList

private static java.util.ArrayList FaultTypeList
This is the list of faults


StaffMemberList

private static java.util.ArrayList StaffMemberList
This is a list of all of the staff members


SeverityList

private static java.util.ArrayList SeverityList
This is the list of severities


SystemList

private static java.util.ArrayList SystemList
This is the list of systems which can be selected


InstrumentList

private static java.util.ArrayList InstrumentList
This is the list of all instruments which can be selected


CurrentInstrumentList

private static java.util.ArrayList CurrentInstrumentList
This is the list of current instruments which can be selected


SiteList

private static java.util.ArrayList SiteList
This is the list of sites which can be selected


TOList

private static java.util.ArrayList TOList
This is a list static list of the TOs. We cache the list of the TOs so we do not have to get the list from the servlet all of the time


SAList

private static java.util.ArrayList SAList
This is a list static list of the SAs. We cache the list of the SAs so we do not have to get the list from the servlet all of the time


DEList

private static java.util.ArrayList DEList
This is a list static list of the DEs. We cache the list of the DEs so we do not have to get the list from the servlet all of the time


FullTOList

private static java.util.ArrayList FullTOList
This is a list static list of the TOs. We cache the list of the TOs so we do not have to get the list from the servlet all of the time. This includes everybody who has been part of this group whether they are in the organisation or not.


FullSAList

private static java.util.ArrayList FullSAList
This is a list static list of the SAs. We cache the list of the SAs so we do not have to get the list from the servlet all of the time. This includes everybody who has been part of this group whether they are in the organisation or not.


FullDEList

private static java.util.ArrayList FullDEList
This is a list static list of the DEs. We cache the list of the DEs so we do not have to get the list from the servlet all of the time. This includes everybody who has been part of this group whether they are in the organisation or not.


FullStaffMemberList

private static java.util.ArrayList FullStaffMemberList
This is a list static list of the staff. We cache the list of the staff so we do not have to get the list from the servlet all of the time. This includes everybody who has been part of this group whether they are in the organisation or not.


UserAuthentication

protected AuthenticationDetails UserAuthentication
This is the user authentication details which were provided by the user


internationalizationConstants

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


svc

protected FaultServiceAsync svc
This is the service which will be used to access the servlet which is running in the tomcat container


PrinterList

protected static java.util.ArrayList PrinterList
Holds a list of the printers that the servlet knows about. This variable is shared amongst the instances of this class to save continually having to refer to the servlet for the information.

Constructor Detail

FaultDBForm

FaultDBForm()
Method Detail

fillListBoxWithTelescopeOperators

void fillListBoxWithTelescopeOperators(com.google.gwt.user.client.ui.ListBox listBox,
                                       java.lang.String defaultUser,
                                       boolean IncludeStaffWhichHaveLeft)
Gets a list of the telescope operators from the tomcat faultdb servlet and initialises the list of the telescope operators in the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated
defaultUser - This is the default value in the list to be selected.
IncludeStaffWhichHaveLeft - Include all of the staff in this group which have left the organisation. =

fillListBoxWithSupportAstronomers

protected void fillListBoxWithSupportAstronomers(com.google.gwt.user.client.ui.ListBox listBox,
                                                 java.lang.String defaultUser,
                                                 boolean IncludeStaffWhichHaveLeft)
Gets a list of the support astronomer from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated
defaultUser - This is the default value in the list to be selected.
IncludeStaffWhichHaveLeft - Whether to include staff that have already left the ING in the list

createDropDownList

private void createDropDownList(java.util.ArrayList staffList,
                                java.lang.String defaultUser,
                                com.google.gwt.user.client.ui.ListBox listBox)
Adds the names of the people into the list provided. If the defaultUser cannot be found then if the option FaultDatabaseConstants.DEFAULTUSER can be found in the list then that is selected instead.

Parameters:
staffList - An array of type person which is to be included in the list.
defaultUser - This is the default value in the list to be
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithDutyTechnicians

protected void fillListBoxWithDutyTechnicians(com.google.gwt.user.client.ui.ListBox listBox,
                                              java.lang.String defaultUser,
                                              boolean IncludeStaffWhichHaveLeft)
Gets a list of the duty technician from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated
defaultUser - This is the default value in the list to be selected.
IncludeStaffWhichHaveLeft - Include all of the staff in this group which have left the organisation.

selectDefaultListOption

public void selectDefaultListOption(java.lang.String KeyValue,
                                    com.google.gwt.user.client.ui.ListBox TargetList)
Called to set the default option in a list box widget.

Parameters:
KeyValue - This is the option which is to be selected
TargetList - This is the list in which the option is to be selected

fillListBoxWithStaffMembers

protected void fillListBoxWithStaffMembers(com.google.gwt.user.client.ui.ListBox listBox,
                                           java.lang.String defaultUser,
                                           boolean IncludeStaffWhichHaveLeft)
Gets a list of the staff members from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated
defaultUser - This is the default value in the list to be selected.
IncludeStaffWhichHaveLeft - Include all of the staff in this group which have left the organisation.

fillListBoxWithInstruments

protected void fillListBoxWithInstruments(com.google.gwt.user.client.ui.ListBox listBox,
                                          java.lang.String CurrentLocale)
Gets a list of the all instruments from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithCurrentInstruments

protected void fillListBoxWithCurrentInstruments(com.google.gwt.user.client.ui.ListBox listBox,
                                                 java.lang.String CurrentLocale)
Gets a list of only the current instruments (not decommissioned) from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithSites

protected void fillListBoxWithSites(com.google.gwt.user.client.ui.ListBox listBox,
                                    java.lang.String CurrentLocale)
Gets a list of the sites from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithSystems

protected void fillListBoxWithSystems(com.google.gwt.user.client.ui.ListBox listBox,
                                      java.lang.String CurrentLocale)
Gets a list of the systems from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithSeverity

protected void fillListBoxWithSeverity(com.google.gwt.user.client.ui.ListBox listBox,
                                       java.lang.String CurrentLocale)
Gets a list of the severities from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

verifyTimeFormat

protected boolean verifyTimeFormat(java.lang.String TimeToVerify)
Used to verify that a field which represents the time has been entered in the correct format of HH:MM in 24 hour clock

Parameters:
TimeToVerify - This is a string which contains the time which is to be verified
Returns:
boolean True if the time is in the correct format, false otherwise

verifyDateNotInFuture

protected boolean verifyDateNotInFuture(java.lang.String DateToTest)
Verify that the date that has been specified is not after the current date

Parameters:
DateToTest - This is the date to test specified in the format DD/MM/YYYY
Returns:
boolean True if the date is valid and not after the current date

verifyDateFormat

protected boolean verifyDateFormat(java.lang.String DateToVerify)
Used to verify that a field which represents the date has been entered in the correct format of DD/MM/YYYY

Parameters:
DateToVerify - This is a string which contains the time which is to be verified
Returns:
boolean True if the time is in the correct format, false otherwise

getCurrentDate

protected java.lang.String getCurrentDate()
Get current date in the format DD/MM/YYYY and return it to the caller.


getCurrentTime

protected java.lang.String getCurrentTime()
Get current time in the format HH:MM and return it to the caller


fillListBoxWithFaultType

protected void fillListBoxWithFaultType(com.google.gwt.user.client.ui.ListBox listBox,
                                        java.lang.String CurrentLocale)
Gets a list of the fault types from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

fillListBoxWithStates

protected void fillListBoxWithStates(com.google.gwt.user.client.ui.ListBox listBox,
                                     java.lang.String CurrentLocale)
Gets a list of the fault states from the tomcat faultdb servlet and initialises the list box which was provided by the caller.

Parameters:
listBox - This is the listbox widget which is to have it's list populated

setSelectedItemInListbox

protected boolean setSelectedItemInListbox(com.google.gwt.user.client.ui.ListBox list,
                                           java.lang.String value)
This method will be used to set the selected value in the listbox specified to the value which has been provided by the caller.

Parameters:
list - This is the list widget which contains the value which is to be selected.
value - This is the value which is to be selected in the list.
Returns:
boolean True if we managed to select the value in the list which was specified by the value parameter.

stringContainsText

protected boolean stringContainsText(java.lang.String stringToCheck)
Check to see if the string which has been specified is actually empty after being stripped of HTML markup and   symbols.

Parameters:
stringToCheck - This is the string to be checked
Returns:
boolean True if the string contains some text otherwise false.

verifyText

protected boolean verifyText(java.lang.String FieldName,
                             int MaxLength,
                             java.lang.String TextToVerify)
                      throws FieldInvalidException
This will verify that the text field is not empty or too full to fit in the database.

Parameters:
FieldName - This is the name of the field
MaxLength - This is the maximum number of characters that are allowed in the field. If this is set to NOLENGTHCHECK then we do not perform the check.
TextToVerify - This is the text which is to be verified
Returns:
True if the field is okay
Throws:
FieldInvalidException - Throw if the field is not valid

getFullUserNameFromEmailAddress

protected java.lang.String getFullUserNameFromEmailAddress(java.lang.String emailAddress)
Take an email address and return the full name of the person. It does this by going through the <@link #StaffMemberList> array.

Parameters:
emailAddress -
Returns:
String The full name of the person. It returns unknown if the name is not known.

createEmailLink

public static java.lang.String createEmailLink(java.lang.String emailAddress,
                                               int faultId,
                                               java.lang.String faultTitle,
                                               java.lang.String linkText)
This method will be used to return a HTML which can be clicked on to create an email.

Parameters:
emailAddress - Email address of recipient
faultId - Defect number of fault which the email is associated
faultTitle - This is the title of the fault
linkText - This is the text of the link
Returns:
This is the link which can then be dropped into some HTML