edu.columbia.coms6901.pingtel.pingim
Class MenuSystem

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

public class MenuSystem
extends HelperClass

Contains code for different menus, including the phonebook menu, the X10 menu, the buddy list menu, and several other supporting user input screens.

Version:
1.0
Author:
Micah Sherr

Field Summary
(package private) static int CANCEL
          Cancel action
private  java.lang.String defaultBindDN
          default distinguished name (DN) for binding to LDAP
private  java.lang.String defaultBindPWD
          default password for binding to LDAP
private  int defaultLDAPPort
          default LDAP port
private  java.lang.String defaultLDAPServer
          default LDAP server
private  java.lang.String defaultRoot
          default LDAP root / search base
(package private) static int OK
          Ok
(package private) static int OPTION_ADD_BUDDY
          Returned when user chooses to add a buddy
(package private) static int OPTION_BUDDY_CALL
          Returned when user chooses to make a phone call
(package private) static int OPTION_BUDDY_LIST
          Returned when user chose to go to buddy list
(package private) static int OPTION_CONFIGURE
          Returned when user chose configuration option
(package private) static int OPTION_DELETE_BUDDY
          Returned when user chooses to delete a buddy
(package private) static int OPTION_DISABLE_IM
          Returned when user disables instant messaging
(package private) static int OPTION_EXIT
          Returned when user chooses to exit application
(package private) static int OPTION_PHONEBOOK
          Returned when user chooses to go to the phone book screen
(package private) static int OPTION_X10_LIST
          Returned when user chooses to go to the X10 screen
(package private) static int UNDEFINED
          Undefined action
 
Fields inherited from class edu.columbia.coms6901.pingtel.pingim.HelperClass
application
 
Constructor Summary
(package private) MenuSystem(PingIM app)
          Constructor.
 
Method Summary
private  void checkForBuddyAction(ActionListener listener, Buddy buddy)
          Checks for any actions concerning a buddy from the menu.
private  boolean checkForMenuAction(ActionListener listener)
          Checks for any actions coming from the menu panel.
protected  int displayIMBuddies()
          Displays IM Buddies and prompts user for action.
protected  int displayPhoneBuddies()
          Displays Phonebook and prompts user for action.
protected  int displayX10Buddies()
          Displays X10 Buddies and prompts user for action.
protected  void getLDAPServerInfo()
          Prompts the user to enter information about the LDAP server.
protected  Buddy getNewBuddyInfo()
          Prompts user for information about new buddy, such as type, name, description, etc.
protected  Buddy getNewBuddyInfo(java.lang.String sSIP)
          Prompts user for information about new buddy.
protected  int promptUserForState()
          Prompts user for current state/presence of PingIM
private  int searchMenu()
          Searches the phone book for a particular entry.
protected  void sendIM(Buddy buddy)
          Prompts user for a message to IM to another buddy
private  void setMenuButtons(com.pingtel.xpressa.awt.form.SimpleListForm form, ActionListener listener)
          Sets the menu buttons for the three display screens
 
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

UNDEFINED

static final int UNDEFINED
Undefined action

OK

static final int OK
Ok

CANCEL

static final int CANCEL
Cancel action

OPTION_CONFIGURE

static final int OPTION_CONFIGURE
Returned when user chose configuration option

OPTION_BUDDY_LIST

static final int OPTION_BUDDY_LIST
Returned when user chose to go to buddy list

OPTION_DISABLE_IM

static final int OPTION_DISABLE_IM
Returned when user disables instant messaging

OPTION_EXIT

static final int OPTION_EXIT
Returned when user chooses to exit application

OPTION_ADD_BUDDY

static final int OPTION_ADD_BUDDY
Returned when user chooses to add a buddy

OPTION_DELETE_BUDDY

static final int OPTION_DELETE_BUDDY
Returned when user chooses to delete a buddy

OPTION_BUDDY_CALL

static final int OPTION_BUDDY_CALL
Returned when user chooses to make a phone call

OPTION_PHONEBOOK

static final int OPTION_PHONEBOOK
Returned when user chooses to go to the phone book screen

OPTION_X10_LIST

static final int OPTION_X10_LIST
Returned when user chooses to go to the X10 screen

defaultLDAPServer

private java.lang.String defaultLDAPServer
default LDAP server

defaultLDAPPort

private int defaultLDAPPort
default LDAP port

defaultBindDN

private java.lang.String defaultBindDN
default distinguished name (DN) for binding to LDAP

defaultBindPWD

private java.lang.String defaultBindPWD
default password for binding to LDAP

defaultRoot

private java.lang.String defaultRoot
default LDAP root / search base
Constructor Detail

MenuSystem

MenuSystem(PingIM app)
Constructor. Initializes the menu screen.
Parameters:
app - The current PingIM application.
Method Detail

getLDAPServerInfo

protected void getLDAPServerInfo()
Prompts the user to enter information about the LDAP server. Uses several routines from GuiUtilities. Asks for host name, bind dn, password, and LDAP root. Initialized to default values for phone users who have limited keyboard input capabilities.

getNewBuddyInfo

protected Buddy getNewBuddyInfo()
Prompts user for information about new buddy, such as type, name, description, etc.
Returns:
A representation of the buddy as a @see Buddy

getNewBuddyInfo

protected Buddy getNewBuddyInfo(java.lang.String sSIP)
Prompts user for information about new buddy.
Parameters:
sSIP - Buddy's SIP address
Returns:
A representation of the buddy as a @see Buddy

promptUserForState

protected int promptUserForState()
Prompts user for current state/presence of PingIM
Returns:
The option the user chose (available, away, etc.)

sendIM

protected void sendIM(Buddy buddy)
Prompts user for a message to IM to another buddy
Parameters:
buddy - The buddy who we're sending to

displayIMBuddies

protected int displayIMBuddies()
Displays IM Buddies and prompts user for action. Options include making a call, going to another screen, etc.
Returns:
The chosen action. See finals for this class.

displayX10Buddies

protected int displayX10Buddies()
Displays X10 Buddies and prompts user for action. Options include making a call, going to another screen, etc.
Returns:
The chosen action. See finals for this class.

displayPhoneBuddies

protected int displayPhoneBuddies()
Displays Phonebook and prompts user for action. Options include making a call, going to another screen, etc.
Returns:
The chosen action. See finals for this class.

setMenuButtons

private void setMenuButtons(com.pingtel.xpressa.awt.form.SimpleListForm form,
                            ActionListener listener)
Sets the menu buttons for the three display screens
Parameters:
form - The form currently being displayed
listener - The corresponding listener for that form

checkForBuddyAction

private void checkForBuddyAction(ActionListener listener,
                                 Buddy buddy)
Checks for any actions concerning a buddy from the menu. If user selected an action, this method performs the associated task.
Parameters:
listener - The ActionListener used by the form
buddy - Buddy that was selected when action was chosen

checkForMenuAction

private boolean checkForMenuAction(ActionListener listener)
Checks for any actions coming from the menu panel. If user selected an action, performs the associated task.
Parameters:
listener - The ActionListener used by the form
Returns:
true if a valid choice was made, otherwise false

searchMenu

private int searchMenu()
Searches the phone book for a particular entry. If entry isn't fonud, prints out an error message.
Returns:
Returns the index of the entry if found. If not, returns 0.