Chapter 7: Creating a Contact List Application


Download CD Content

The Jabber protocol allows you to develop an application for creating and managing contact information by using the Jabber server. This chapter describes how to develop the Contact List application, which allows end users to manage contact information. By using the Contact List application, end users can add information to the contact list and check whether or not other end users are online. An end user can send messages to other end users added to the contact list.

Architecture of the Contact List Application

The Contact List application uses the following files:

  • UserLogin.java: Creates the Login window for the Contact List application that allows end users to establish a connection with the Jabber server to communicate with other end users. This file allows end users to login as existing end users or register for a new account.

  • ContactList.java: Shows a tree structure of the contact list created by end users. This file also allows end users to manage their contact list by adding, editing, or deleting contact information.

  • UserInfo.java: Allows end users to view the information about other end users in the contact list.

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

  • EditDelete.java: Allows end users to edit or delete contact information from the contact list.

  • DynamicTree.java: Creates and maintains a tree structure of the contact list. The tree structure is visible in the user interface of the Contact List application.

  • ChatWindow.java: Creates a Chat window that allows end users to send messages to other end users present in the contact list.

  • AddUser.java: Creates a user interface that allows end users to add other end users to the contact list.

Figure 7-1 shows the architecture of the Contact List application:

click to expand: this figure shows the files that the contact list application uses and the sequence in which the application uses them.
Figure 7-1: Architecture of the Contact List Application

The UserLogin.java file creates the Login window of the Contact List application that contains various labels, text boxes, and the Submit button. The UserLogin.java file allows end users to login as existing users or register for a new account.

When an end user enters the login information and clicks the Submit button on the Login window, the UserLogin.java file calls the ContactList.java file to create the user interface for the Contact List application. The ContactList.java file allows end users to add other end users and edit or delete the existing end users from the contact list. The ContactList.java file shows a tree structure of the contact list.

If an end user selects File-> Add User, the ContactList.java file calls the AddUser.java file to add other end users to the contact list. The AddUser.java file provides an interface with various labels, three text boxes, and two buttons, Add and Cancel.

If an end user selects File-> Manage User, the ContactList.java file calls the EditDelete.java file to edit or delete the existing end users from the contact list. The EditDelete.java file provides an interface containing two panes. The left pane shows a tree structure of the contact list and the right pane contains various labels, two text boxes, and three buttons: Up, Delete, and Cancel.

If an end user selects a specific end user name from the tree structure of the contact list, the ContactList.java file calls the ChatWindow.java file that allows end users to send messages to the selected end users. The ChatWindow.java file provides an interface with text area to view the text messages and the Send button to send the text messages.

The ChatWindow.java file calls the SocketClass.java file that opens a socket to send and receive messages with the help of the Jabber server.

When an end user right-clicks any user name in the contact list, the pop-up option, View Contact appears. If the end user selects the View Contact option, the ContactList.java file calls the UserInfo.java file to display the contact information of the selected end user.




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