Client
Class MainPane

java.lang.Object
  extended by Client.MainPane

public class MainPane
extends java.lang.Object

Manages a JPanel representing the main "homepage" tab of the chat client. Can switch from the "username-asking" view to the "who is online" view, after an acceptable username is typed in.


Constructor Summary
MainPane(ClientView vi)
          Construct a new MainPane, as the initial "username-asking" version.
 
Method Summary
 javax.swing.JPanel getPanel()
           
 void setMessage(java.lang.String errorMessage)
          Sets a label in the username-asking view, so that if the username was rejected, the user can read why.
 void setUsername(java.lang.String name)
          Swaps out the GUI from a "Type your username here" panel to a "Here is who is online" panel.
 void updateUsers(java.util.List<java.lang.String> users)
          Updates the list of users here.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainPane

public MainPane(ClientView vi)
Construct a new MainPane, as the initial "username-asking" version.

Parameters:
vi - The ClientView that is the "parent" of this main pane
Method Detail

getPanel

public javax.swing.JPanel getPanel()
Returns:
the panel this MainPane manages

setUsername

public void setUsername(java.lang.String name)
Swaps out the GUI from a "Type your username here" panel to a "Here is who is online" panel. Triggered upon receiving an accept_uname message from the server.

Parameters:
name - the username that was accepted

updateUsers

public void updateUsers(java.util.List<java.lang.String> users)
Updates the list of users here.

Parameters:
users - the list of users here, as sent by the server

setMessage

public void setMessage(java.lang.String errorMessage)
Sets a label in the username-asking view, so that if the username was rejected, the user can read why.

Parameters:
errorMessage - the error to say