Chapter 4: Creating a Group Chatting Application


Download CD Content

The Jabber protocol allows you to create and rename chat groups hosted on the Jabber server. End users can add user names to a particular chat group and initiate a private or group chat.

This chapter describes how to develop the Group Chatting application, which allows end users to send group messages to other end users connected to the Jabber server.

Architecture of the Group Chatting Application

The Group Chatting application uses the following files:

  • GroupLoginGUI.java: Allows end users to establish a connection with the Jabber server to communicate with other end users connected to the server. This file allows end users to log in or register automatically to the Jabber server.

  • GroupList.java: Shows the tree structure that contains the names of various chat groups and end users in each group. This file allows end users to select a group to start a chat session. End users can select any specific user within a group to start a private chat.

  • AddUser.java: Allows end users to add other end users to a particular group. This file also allows end users to create a new group.

  • ChatWindow.java: Allows end users to participate in a private chat.

  • EditGroup.java: Allows end users to rename an existing chat group.

  • GroupChat.java: Allows end users to participate in a group chat.

  • SocketConnection.java: Opens a socket to send and receive messages through the Jabber server.

  • GroupTree.java: Creates a tree structure of various groups in the Group Chatting application.

Figure 4-1 shows the architecture of the Group Chatting application:

click to expand: this figure shows the files that the group chatting application uses and the sequence in which the application uses them.
Figure 4-1: Architecture of the Group Chatting Application

The GroupLoginGUI.java file creates the Login window of the Group Chatting application that contains various labels, text boxes, and the Submit button. The GroupLoginGUI.java file allows end users to log on as an existing user or register for a new account.

When an end user enters the login information and clicks the Submit button on the Login window, the GroupLoginGUI.java file calls the GroupList.java file to create the user interface for the Group Chatting application. The GroupList.java file allows end users to create a group or add other end users to a particular group. The GroupList.java file creates the tree structure to show the list of existing chat groups.

If an end user selects File-> Add User, the GroupList.java file calls the AddUser.java file to add other end users to an end user’s personal list. The AddUser.java file also allows end users to create a chat group. The AddUser.java file provides an interface with various labels, two text boxes, and the Submit button.

If an end user selects File-> Edit Group, the GroupList.java file calls the EditGroup.java file to rename an existing group. The EditGroup.java file provides an interface with various labels, two text boxes, and the Submit button.

If an end user selects a specific end user name present in a particular group, the GroupList.java file calls the SocketConnection.java file that opens a socket to send and receive messages to the selected end user. The SocketConnection.java file calls the ChatWindow.java file, which allows an end user to start a private chat with the selected end user. The ChatWindow.java file provides an interface containing a text area to view text messages received from the Jabber server. The ChatWindow.java file also provides the Send button to send text messages to the Jabber server.

If an end user selects a chat group from the tree structure provided by the Group Chatting application, the GroupList.java file calls the SocketConnection.java file. This file opens a socket to send and receive messages to other end users present in the selected group. The SocketConnection.java file calls the GroupChat.java file to start a group chat session.




Developing Applications Using Jabber
Developing Applications Using Jabber
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 68

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net