Preface Introduction Description of client program References

Client (Desktop) Application

Preface

The idea behind this white paper is to give a general view of the project TV-Guide for

Palm™ Pilot. The information in this white paper is subject to change without prior

notice. As part of the Gnu Public License (GPL) no warranties are made about the

functionality of the programs. The programs may be used or copied only in accordance

with the terms and conditions of the license agreement.

Introduction

The project is the result of an assignment from the course 2D1954

Programutvecklingsprojekt (Swedish for program development project), spring term 2000,

together with Appeal Software Solutions AB (Appeal). Appeal came with the idea of

developing an application for the Palm™ Pilot in which the user could choose TV

programmes of his/her interests and eventually put them in the Palm™ Pilots’ calendar.

The system is divided in three different parts; a desktop application developed in Java, a

program for the Palm™ Pilot developed in C and a conduit to link the first two

applications, developed in Visual C++.

The software package

The software package can be downloaded from the web and contains the desktop, the

conduit and the Palm™ Pilot applications. Having these, the user is able to run the

installation script.

General description

The user runs the desktop application, which gets information about TV programmes from

the web. The software sorts the information and puts relevant data in a data file which

later will be transferred to the Palm™ Pilot via the conduit. The user can not only choose

the channels he or she wants to have information about, but also have a profile with

his/her favourite programmes. If the user chooses to get only the favourite programs only

these will be sent to the Palm™ Pilot.

The conduit application is run when the user ”hot-syncs” the data file with the Palm™

Pilot application. After that the Palm™ Pilot will be loaded with the TV programs and the

user can at any time take a look at the programs and if desired put these in the Palm™

Pilots’ calendar which will alert the user when the TV programme is about to start.

For a schematic view of the system, see figure I.

Description of client program

Overview

Figure I shows an overview of the different classes that make up the client program. The

main class here is FrameMain (instantiated from TVMain) which holds the main window and

instantiates, upon request, the following dialogues:

  1. Exit (exitDialogue)
  2. Help (Help)
  3. Error message (ErrorFrame)
  4. About (About)
  5. New Channel/Edit Channel (newChannel/propChannel)
  6. Edit Favourites (Favourites)
  7. Presentation of read and filtered data (presenFile)

The classes newChannel and propChannel both use the abstract class newAndPropCh.

FrameMain has two vectors that contain the channels and favourites: channelVec and

favVec. All available channels and favourites are read at start-up by the method

readFiles() and written on exit if the ”Save settings” check box is checked by writeFiles().

All channel settings are stored in the Channels.tvg file in the User directory. All favourites

with settings are stored in the same directory in the file Fav.tvg. FrameMain also contains

a Jlist that holds the channel names. In order for the channels to be presented in the Jlist

the class FrameMain uses the vector listVec that is passed to the Jlist. The whole package

mainly uses the Swing tools and components (classes javax.swing.*).

A channel (Channel class) has the following properties:

· The name of the Channel

· The URL where the programmes can be found

· A filter that is used to filter the data read from the URL

Currently (11/5/00) there is only one specific filter, but we hope that there will be a

general filter with a ”training mode” some time in the future.

A favourite (Favourite class) has the following properties:

The drop-down menus in FrameMain are File, Favourites and Help and are all JLists. In

the file menu there are two items: Users and Exit. The Users item is used to tell the

program in which directory/folder the file prToPalm.tvg will be stored. This is the file that

(during Hot-syncing) will be sent to the Palm™ Pilot. The personal settings are favourites

and user name for the conduit program.

The Favourites menu has an option ”Edit favourites” whose listener instantiates the

Favourites class when it is selected. Favourites are listed in the Favourites menu and each

favourite has a check box to indicate if the program should search the downloaded

channel lists for it. If the favourite is an ”un-favourite” it is marked with a red box (class

ColoredSquare).

Transferring channels

The workings of the current (and only) filter:

When parsing the read data each recognised programme is instantiated as a program and put

in a vector in the filter class (programVec). When all programmes are read, the endtime

of all but one programme (the last one in programVec) are set to the start-time of the next

programme in the vector. (This is, of course, caused by the fact that the URL does not

provide any information about end times.)

Before the filter can access the channels an instance of the netreader class is used to read

the data from a URL specified for each channel. The read channels are then written to

disk. The files have the same name as in the channel descriptions but with the space

character replaced by underscore (_). When all files are written they are taken as input to

the filter as shown in figure 1.

 

Figure 1 (click here to enlarge)

 

The class Favourites is used from FrameMain to set the favourite’s searchable state and

to add the ”important” listener to the favourite in the favourite menu (a Jmenu in

FrameMain). The structure and dependencies are illustrated in figure I.

Figure 2 shows an activity diagram for the transferring sequence.

Figure 2(click here to enlarge)

Transferring favourites

The transferring sequence for favourites is similar to transferring channels: netreader

reads the channels in all favourites that are marked as “searchable” and writes the read

channels to disk. The filter creates a new, filtered file. In the next step it looks for

favourites in this file and writes them to the prToPalm.tvg file.

The most important classes of the desktop application

FrameMain.java

This is the main frame of the TV-Guide. It instantiates all the buttons, icons, etc. and reads

the files Fav.tvg and Channel.tvg. The file Fav.tvg contains the user's last saved favourite

programs with their search properties (i.e. is it a program to be search or is it a program

the user absolutely doesn't want to see?). The file Channel.tvg contains the channels name

and their respective url addresses. The class FrameMain also reads User.tvg to set the path

where the user wants to create the file prToPalm.tvg.

netreader.java

This class uses a vector with the url addresses to get information from the web. It creates

as many text files as the number of channels to be search (each channel gets its own text

file) The files has the same content as the html page from the web, but without the html

tags.

filter.java

This class reads the text files created by netreader.java, selects the different fields about each

program in that channel and instantiates new program(s).java

presentFile.java

presentFile.java reads prToPalm.tvg and shows all the programs in a JList. Even used to

create new favourites when the user presses the button "Add". Other features in this class

offer the possibility to jump between the programs selected as favourite when the user

press the button "Next fav" or between the channels when the user presses the button

"Next ch" (if the user chooses to get more than only one channel).

Channel.java

This class contains a string for the channel name, the url location for the channel and

which filter is going to be used. At the time of the writing of this paper only one filter is

implemented.

Favourite.java

This class has the properties of the programs, like name, search properties and which

channels we have to look at in order to find the favourite program.

Favourites.java

This class instantiates the frame that shows the user's favourite programs and enables the

user to edit existent favourites, create new favourites and/or delete favourites.

program.java

This is the instance of every programme. The following tags are used to identify the

different fields. Here we show the start and end tag for each field.

<Ch> </Ch> channel name
<Prg> </Prg> programme name
<Date> </Date> date
<STime> </Stime> start time
<ETime> </Etime> end time
<Desc> </Desc> description
<ShowView> </ShowView> show view number
<Favo> </Favo> is it a favourite?
<Sel> </Sel> field necessary in the Palm app
<AlmOn> </AlmOn> field necessary in the Palm app
<AlmMin> </AlmMin> field necessary in the Palm app

Figure I(click here to enlarge)

Figure II(click here to enlarge)

References

Sun java Web Pages, Internet URL: http://java.sun.com, checked 00-05-05

Java Programming Resources, http://www.apl.jhu.edu/~hall/java, checked 00-05-05

Walrath, Kathy. The JFC Swing tutorial : a guide to constructing GUIs, SUN

Microsystems, 1999