edu.columbia.coms6901.pingtel.pingim
Class GuiUtilities

java.lang.Object
  |
  +--edu.columbia.coms6901.pingtel.pingim.HelperClass
        |
        +--edu.columbia.coms6901.pingtel.pingim.GuiUtilities

public class GuiUtilities
extends HelperClass

Set of utilities for easy human IO interfacing, including popup menus, logging, etc.

Version:
1.0
Author:
Micah Sherr

Field Summary
private static java.io.PrintStream out
          output stream, defaulted to STDOUT
 
Fields inherited from class edu.columbia.coms6901.pingtel.pingim.HelperClass
application
 
Constructor Summary
GuiUtilities()
           
 
Method Summary
static void consoleLog(java.lang.String message)
          Logs message to console with date stamp.
static java.io.PrintStream getPrintStream()
          Retrieves the output stream.
static void popup(com.pingtel.xpressa.Application app, java.lang.String text)
          Displays a pop-up box
static void popup(com.pingtel.xpressa.Application app, java.lang.String text, java.lang.String title)
          Displays a pop-up box with a title
static boolean printChoice(com.pingtel.xpressa.Application app, java.lang.String title, java.lang.String text, java.lang.String option1, java.lang.String option2)
          Presents the user with a choice of two options.
static boolean printConfirmation(com.pingtel.xpressa.Application app, java.lang.String title, java.lang.String text)
          Prints confirmation dialogue to user
static void printError(com.pingtel.xpressa.Application app, java.lang.Exception e)
          Prints an error message on the GUI
static void printError(com.pingtel.xpressa.Application app, java.lang.String sText)
          Prints an error message on the GUI
static void printError(com.pingtel.xpressa.Application app, java.lang.String text, java.lang.Exception e)
          Prints an error message on the GUI.
static java.lang.String readLine(com.pingtel.xpressa.Application app, java.lang.String title, java.lang.String instructions, int mode)
          Reads line of text from user
static java.lang.String readLine(com.pingtel.xpressa.Application app, java.lang.String title, java.lang.String instructions, int mode, java.lang.String defaultValue)
          Reads line of text from user
static java.lang.String readLineReq(com.pingtel.xpressa.Application app, java.lang.String title, java.lang.String instructions, int mode, java.lang.String defaultValue)
          Reads line of text from user, requiring the user to enter some text
 
Methods inherited from class edu.columbia.coms6901.pingtel.pingim.HelperClass
setApplication
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

out

private static java.io.PrintStream out
output stream, defaulted to STDOUT
Constructor Detail

GuiUtilities

public GuiUtilities()
Method Detail

popup

public static void popup(com.pingtel.xpressa.Application app,
                         java.lang.String text)
Displays a pop-up box
Parameters:
app - Refers to this PingTel Expression
text - Text to display in popup box

popup

public static void popup(com.pingtel.xpressa.Application app,
                         java.lang.String text,
                         java.lang.String title)
Displays a pop-up box with a title
Parameters:
app - Refers to this PingTel Expression
text - Text to display in popup box
title - Title of popup box

readLine

public static java.lang.String readLine(com.pingtel.xpressa.Application app,
                                        java.lang.String title,
                                        java.lang.String instructions,
                                        int mode,
                                        java.lang.String defaultValue)
Reads line of text from user
Parameters:
app - PingTel Expression
title - Window title
instructions - Instructions for user
mode - E.g., ALPHANUMERIC, NUMERIC, etc.
defaultValue - Default value
Returns:
the string provided by the user

readLineReq

public static java.lang.String readLineReq(com.pingtel.xpressa.Application app,
                                           java.lang.String title,
                                           java.lang.String instructions,
                                           int mode,
                                           java.lang.String defaultValue)
Reads line of text from user, requiring the user to enter some text
Parameters:
app - PingTel Expression
title - Window title
instructions - Instructions for user
mode - E.g., ALPHANUMERIC, NUMERIC, etc.
defaultValue - Default value
Returns:
the String provided by the end user

readLine

public static java.lang.String readLine(com.pingtel.xpressa.Application app,
                                        java.lang.String title,
                                        java.lang.String instructions,
                                        int mode)
Reads line of text from user
Parameters:
app - PingTel Expression
title - Window title
instructions - Instructions for user
mode - E.g., ALPHANUMERIC, NUMERIC, etc.
Returns:
The input from the end user

consoleLog

public static void consoleLog(java.lang.String message)
Logs message to console with date stamp.
Parameters:
message - message to log

getPrintStream

public static java.io.PrintStream getPrintStream()
Retrieves the output stream.
Returns:
the current output stream

printError

public static void printError(com.pingtel.xpressa.Application app,
                              java.lang.String text,
                              java.lang.Exception e)
Prints an error message on the GUI.
Parameters:
app - Pointer to this instance of PingIM
text - Error message
e - An exception, if one occurred, or null

printError

public static void printError(com.pingtel.xpressa.Application app,
                              java.lang.Exception e)
Prints an error message on the GUI
Parameters:
app - Pointer to this instance of PingIM
e - An exception

printError

public static void printError(com.pingtel.xpressa.Application app,
                              java.lang.String sText)
Prints an error message on the GUI
Parameters:
app - Pointer to this instance of PingIM
sText - Text of the error message

printConfirmation

public static boolean printConfirmation(com.pingtel.xpressa.Application app,
                                        java.lang.String title,
                                        java.lang.String text)
Prints confirmation dialogue to user
Parameters:
app - PingTel Expression
title - Window title
text - Instructions for user
Returns:
true if user accepted, false if user canceled

printChoice

public static boolean printChoice(com.pingtel.xpressa.Application app,
                                  java.lang.String title,
                                  java.lang.String text,
                                  java.lang.String option1,
                                  java.lang.String option2)
Presents the user with a choice of two options.
Parameters:
app - PingTel Expression
title - Window title
text - Instructions for user
option1 - Description of the first option
option2 - Description of the second option
Returns:
true if the user chose option one, otherwise false