edu.mayo.bsi.ngsportal.client
Class NGSPortal

java.lang.Object
  extended by edu.mayo.bsi.ngsportal.client.NGSPortal
All Implemented Interfaces:
com.google.gwt.core.client.EntryPoint, com.google.gwt.event.shared.EventHandler, com.google.gwt.user.client.rpc.AsyncCallback<ConnectionResponse>, com.smartgwt.client.widgets.events.ClickHandler

public class NGSPortal
extends Object
implements com.google.gwt.core.client.EntryPoint, com.smartgwt.client.widgets.events.ClickHandler, com.google.gwt.user.client.rpc.AsyncCallback<ConnectionResponse>

Entry point classes define onModuleLoad().


Field Summary
static int kCancelFollowUp
          Command to execute if caller clicks on the Cancel button
static int kLogLevelDebug
          Normal Debugging Log level
static int kLogLevelLogAllMessages
          Log level for the most detailed and normally never want to see it information
static int kLogLevelLogDeepDebug
          Debugging Log level when want to see almost all information
static int kLogLevelLogInfo
          Normal Log level
static int kNoSaveFollowUp
          Command to execute if caller clicks on the Don't Save button
static int kNumFollowUps
          Number of follow up commands to pass in
static int kSaveFollowUp
          Command to execute if caller clicks on the Save button
static int kServerWaitTime
          Amount of time, in milliseconds, to wait for the server before putting up a progress dialog
 
Constructor Summary
NGSPortal()
           
 
Method Summary
 void didLogin(ConnectionResponse result)
          Handle the servlet's response to a login attempt
 void displayRun(RunData result, String piName)
          Load the given run into the RunEditPanel
static void formfocus(String id)
          Javascript to give an ID'd element in a form the focus
static com.google.gwt.user.client.ui.Widget getBigSpacer()
          Return a big spacer to divide up sections
 String getLanID()
           
 NGSPortalServiceAsync getNgsPortalService()
          Get the connection to the Servlet
 ProjectExplorerPage getProjectExplorerPage()
           
 void getRun(String piName, String runID)
          Get a run from the server, that the user has access to, for the given PI, and populate the RunEditPanel with the information about that Run and PI
 void getSamples(String piName, String runID, String appType, com.google.gwt.user.client.rpc.AsyncCallback<List<SampleInfo>> callback)
          Get the samples from the server, that the user has access to, for the given run and PI
static com.google.gwt.user.client.ui.Widget getSpacer()
          Return a spacer to keep things from being too close
 String getUsersName()
           
 boolean handleFileLocationListResults(String callback, List<FileLocation> result)
          Handle the results of a call to the server that returns a list of FileLocation
 boolean handleSampleInfoListResults(String callback, List<SampleInfo> result)
          Handle the results of a call to the server that returns a list of SampleInfo
 boolean handleStringListResults(String callback, List<String> result)
          Handle the results of a call to the server that returns a list of Strings
static boolean isEmpty(String tested)
          Utility routine for the common String test
 void LogData(String newText, int level)
          Routine to Log data, and display it for the users.
 void lostConnection()
          Routine that handles regaining a connection to the servlet
static String objectToString(Object theObject)
          Utility routine to turn a potentially null Object into an empty string (if null) or else into the toString of the Object
 void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
           
 void onFailure(Throwable caught)
           
 void onModuleLoad()
          This is the entry point method.
 void onSuccess(ConnectionResponse response)
          Called after the client has received encryption information from the server
 void setRun(String piName, String runID, RunData runData, List<SampleInfo> samples, int[] deletedIDs, com.google.gwt.user.client.Command followUp)
          Update all the metadata for a given run, owned by a given PI
static void showAlert(String title, String message, com.google.gwt.user.client.Command followUp)
          Show a Alert with a title and message, and possible a command to execute when the alert is dismissed
 void showAnalysisResults(List<AnalysisInfo> results)
          Clear out the old analysis results and then display the new results from the server.
static void showSaveAlert(String title, String message, com.google.gwt.user.client.Command[] followUps)
          Show a Save Alert with a title, a message, and three different commands to execute depending upon how the user dismisses the alert
static void showWarning(String title, String message, String[] actionButtonTexts, com.google.gwt.user.client.Command[] actions)
          Show a Alert with a title and message, and possible a set of commands to execute when the alert is dismissed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kLogLevelLogInfo

public static final int kLogLevelLogInfo
Normal Log level

See Also:
Constant Field Values

kLogLevelDebug

public static final int kLogLevelDebug
Normal Debugging Log level

See Also:
Constant Field Values

kLogLevelLogDeepDebug

public static final int kLogLevelLogDeepDebug
Debugging Log level when want to see almost all information

See Also:
Constant Field Values

kLogLevelLogAllMessages

public static final int kLogLevelLogAllMessages
Log level for the most detailed and normally never want to see it information

See Also:
Constant Field Values

kServerWaitTime

public static final int kServerWaitTime
Amount of time, in milliseconds, to wait for the server before putting up a progress dialog

See Also:
Constant Field Values

kSaveFollowUp

public static final int kSaveFollowUp
Command to execute if caller clicks on the Save button

See Also:
Constant Field Values

kNoSaveFollowUp

public static final int kNoSaveFollowUp
Command to execute if caller clicks on the Don't Save button

See Also:
Constant Field Values

kCancelFollowUp

public static final int kCancelFollowUp
Command to execute if caller clicks on the Cancel button

See Also:
Constant Field Values

kNumFollowUps

public static final int kNumFollowUps
Number of follow up commands to pass in

See Also:
Constant Field Values
Constructor Detail

NGSPortal

public NGSPortal()
Method Detail

onModuleLoad

public void onModuleLoad()
This is the entry point method.

Specified by:
onModuleLoad in interface com.google.gwt.core.client.EntryPoint

getNgsPortalService

public NGSPortalServiceAsync getNgsPortalService()
Get the connection to the Servlet

Returns:
The NGSPortalServiceAsync object that let's us make calls to the servlet

onClick

public void onClick(com.smartgwt.client.widgets.events.ClickEvent event)
Specified by:
onClick in interface com.smartgwt.client.widgets.events.ClickHandler

onFailure

public void onFailure(Throwable caught)
Specified by:
onFailure in interface com.google.gwt.user.client.rpc.AsyncCallback<ConnectionResponse>

onSuccess

public void onSuccess(ConnectionResponse response)
Called after the client has received encryption information from the server

Specified by:
onSuccess in interface com.google.gwt.user.client.rpc.AsyncCallback<ConnectionResponse>

showWarning

public static final void showWarning(String title,
                                     String message,
                                     String[] actionButtonTexts,
                                     com.google.gwt.user.client.Command[] actions)
Show a Alert with a title and message, and possible a set of commands to execute when the alert is dismissed.

Parameters:
title - Title of the dialog.
message - Message of the dialog.
actionButtonTexts - Text to be used for action buttons.
actions - Actions that correspond to the action buttons.

showAlert

public static final void showAlert(String title,
                                   String message,
                                   com.google.gwt.user.client.Command followUp)
Show a Alert with a title and message, and possible a command to execute when the alert is dismissed

Parameters:
title - title for the Alert box
message - Message for the user
followUp - Command to execute after the user dismisses the alert, or null if no command

showSaveAlert

public static final void showSaveAlert(String title,
                                       String message,
                                       com.google.gwt.user.client.Command[] followUps)
Show a Save Alert with a title, a message, and three different commands to execute depending upon how the user dismisses the alert

Parameters:
title - title for the Alert box
message - Message for the user
followUps - Array of Commands, one of which will be executed depending on how the user dismisses the Alert

getSpacer

public static final com.google.gwt.user.client.ui.Widget getSpacer()
Return a spacer to keep things from being too close

Returns:
A widget to separate things

getBigSpacer

public static final com.google.gwt.user.client.ui.Widget getBigSpacer()
Return a big spacer to divide up sections

Returns:
A widget to separate things

LogData

public void LogData(String newText,
                    int level)
Routine to Log data, and display it for the users.

Parameters:
newText - Text to add to the Log TextField
level - Log level. The lower the level, the more likely it is to get logged.

showAnalysisResults

public void showAnalysisResults(List<AnalysisInfo> results)
Clear out the old analysis results and then display the new results from the server.

Parameters:
results - Results of the latest search

handleSampleInfoListResults

public boolean handleSampleInfoListResults(String callback,
                                           List<SampleInfo> result)
Handle the results of a call to the server that returns a list of SampleInfo

Parameters:
callback - String detailing which function was called
result - Results of the function call, a list of SampleInfo
Returns:
True if recognized callback and got valid data, else false

handleStringListResults

public boolean handleStringListResults(String callback,
                                       List<String> result)
Handle the results of a call to the server that returns a list of Strings

Parameters:
callback - String detailing which function was called
result - Results of the function call, a list of Strings
Returns:
True if recognized callback, else false

handleFileLocationListResults

public boolean handleFileLocationListResults(String callback,
                                             List<FileLocation> result)
Handle the results of a call to the server that returns a list of FileLocation

Parameters:
callback - String detailing which function was called
result - Results of the function call, a list of Strings
Returns:
True if recognized callback, else false

displayRun

public void displayRun(RunData result,
                       String piName)
Load the given run into the RunEditPanel

Parameters:
result - Run to load
piName - Name of the PI, so the Panel can load the samples for the run

getRun

public void getRun(String piName,
                   String runID)
Get a run from the server, that the user has access to, for the given PI, and populate the RunEditPanel with the information about that Run and PI

Parameters:
piName - Name of the PI of interest
runID - Name of the Run of interest

setRun

public void setRun(String piName,
                   String runID,
                   RunData runData,
                   List<SampleInfo> samples,
                   int[] deletedIDs,
                   com.google.gwt.user.client.Command followUp)
Update all the metadata for a given run, owned by a given PI

Parameters:
piName - The Last Name, First Name of the PI to look for
runID - The run ID we're interested in
runData - The updated run metadata
samples - A list of all the samples with changes, can be empty, can not be null
deletedIDs - Array of the ids of Samples that were deleted, null if none were deleted
followUp - Command to execute if the save is successful

getSamples

public void getSamples(String piName,
                       String runID,
                       String appType,
                       com.google.gwt.user.client.rpc.AsyncCallback<List<SampleInfo>> callback)
Get the samples from the server, that the user has access to, for the given run and PI

Parameters:
piName - Name of the PI of interest
runID - Name of the Run of interest
appType - If not empty or null, The type of application to return
callback - Callback to be called by the server with the result

lostConnection

public void lostConnection()
Routine that handles regaining a connection to the servlet


didLogin

public void didLogin(ConnectionResponse result)
Handle the servlet's response to a login attempt

Parameters:
result - The Connection response returned by the server, null if locin failed

isEmpty

public static final boolean isEmpty(String tested)
Utility routine for the common String test

Parameters:
tested - String to test
Returns:
True if string is null or empty

objectToString

public static final String objectToString(Object theObject)
Utility routine to turn a potentially null Object into an empty string (if null) or else into the toString of the Object

Parameters:
theObject - Object to convert to a String
Returns:
A String, possibly empty, but not null

getProjectExplorerPage

public ProjectExplorerPage getProjectExplorerPage()
Returns:
The projectExplorerPage

formfocus

public static void formfocus(String id)
Javascript to give an ID'd element in a form the focus

Parameters:
id - ID of the element

getLanID

public String getLanID()
Returns:
The userName / LanID

getUsersName

public String getUsersName()
Returns:
The firstName + ' ' + lastName