1. Application Documentation
1.1. Part 1 - The original concept
The idea is originally to create an expressive, multi-media display that can serve several purposes including acting as an interactive bulletin board. To showcase our application we will use a monitor situated in the hallway of Park Science Building that is currently displaying a powerpoint presentation of images. In this setting the application will be used to promote the Computer Science department, notify students of events and allow remote access for faculty and students to interact and add data. This software is intended to perform a variety of task including, but not limited to displaying: text messages on a scrolling text ticker, images or fliers in a slide show format, time, weather, images captured by various web cameras and wave images created by sound.
1.2. Part 2 - Where the program is at right now
Functions
Currently we have a software application which displays images in a slide show format and a ticker tape spanning the entire screen. It also displays the date and time. One mouse click on the ticker tape will exit the program. The application reads in images for the slide show from a folder called Images and reads in text for the scrolling text from a file text.txt, both stored in the same directory. Images can be added to the applet by anybody who has access to the server by copying the image into the Images file directly. Alternatively anybody can go to http://bluepig.brynmawr.edu and can add an image stored on their computer. Similarly, to add text to the ticker tape one can either directly open text.txt and add the text on a new line, or, one can go to the site mentioned above and enter the text through a form. The images are updated each time the application gets to the end of the cycle (ie the last picture) and then starts again at the beginning. Similarly the text for the ticker tape updates itself when the last message has been read.
The webpages that are used by the program for interaction purposes are accessed from http://bluepig.brynmawr.edu. The first page that users are directed to initially (index.php) asks the user to input his or her bryn mawr email addresss. Currently anything can be submitted and will be accepted however refer to improvements to see why this page was implemented. This page links directly to a page which allows the user to add text, an image or view an applet.
The applet is a direct mirror of the application. It appears on the webpage http://bluepig.brynmawr.edu/add.php so that anyone can view what is currently being shown on the monitor in the hallway of Park.
The function 'make' can be used to compile the necessary portions of and run the application by using makefile
Structure/Architecture
The application, applet and web interaction files include the following: program.java, program.class, ImageCanvas.class, TickerCanvas.class, Images folder, images.txt, text.txt, makefile, appletprogram.java, appletprogram.class, TicketCanvas2.class, ImageCanvas2.class, index.php, add.php, post.php, log.txt
The following diagrams show the flow of information and the dependency described more specifically below:
Program
The code for the application is stored in program.java. When compiled it creates the files program.class, ImageCanvas.class and TickerCanvas.class. When executed, the application reads in image files from the Images folder, and reads in text from the text.txt file. It then updates this data on a regular basis.
Make
The function 'make' uses the file makefile which declares file dependency ie the file heirarchy stated in the previous section.
Web Interaction
The first page that is displayed is index.php. When data has been submitted through a form the user is taken to add.php. This page directly uses appletprogram.class and the output is either text to text.txt and appends the information to log.txt or if an image is submitted a link to post.php. Post.php outputs to log.txt, images.txt, and the Images folder. Post.php also contains a link to go back to add.php.
Applet
The code for the applet is stored in appletprogram.java. When compiled it creates the files appletprogram.class, ImageCanvas2.class and TickerCanvas2.class. When viewed through the website, the applet reads in image names from images.txt which contains the names of all the images stored in the Images folder. The applet then reads in the images from the Images folder and text from the text.txt file. It also updates this data on a regular basis.
How the software works
Program
The program consists of three classes; program, TickerCanvas and Image Canvas. Program creates the window to fill the screen, creates both the TickerCanvas and ImageCanvas and then starts each of their strings. It also uses a MouseListener to the TickerCanvas so that the user can exit the program by clicking on the ticker tape.
The ImageCanvas sets it's position and size using the screen dimensions. The OpenDirectory method opens the Images directory and collects the names of every image and stores them in an array. LoadPictures then cycles through the array and gets each image, storing it in an Image array. It then prepares each image for display. ImageCanvas uses doublebuffering to reduce the flickering between each paint. An image is created to store the double buffer (ii) and the graphics of this image are retrieved (goff). Then before painting to the screen, the current image is drawn into the double buffer image. Also the time is found using the GregorianCalendar. This too is written onto the double buffer image. Then the buffer image is drawn onto the screen in the ImageCanvas. To rotate between pictures and recalculate the time, a thread is used to repaint every 4000 counts (ie 4 seconds), each time incrementing a counter pointing to a specific position in the image array. If the counter was pointing at the last image, it is reset to zero and the Image directory is reread and the images are reloaded so that any pictures added are encorporated.
The TickerCanvas sets its position and size similarly to the ImageCanvas. The OpenFile method uses a BufferedReader to read in text from text.txt a line at a time (ie message by message), adding each line into an array. While it does this it also changes each message to upper case which has a much more appealing effect in the ticker tape. The ticker tape also uses double buffering to create the illusion of the text scrolling smoothly across the bottom of the screen. The basic concept of the ticker tape is that a continuously changing string is constantly being drawn in the same space. To do this a thread is used which repaints a string every 1 count. Similarly to the ImageCanvas, when the last message has been displayed the text.txt file is reread to encorporate any new messages. In paint a double buffer image is created, the graphics are retrieved and the string of messages (data) is draw to the buffer image at coordinates that are decremented at each repaint to cause the scrolling effect. When the end of the string has reached the leftmost point of the window the process is restarted with the coordinates of the beginning of the string reset to the rightmost point of the window. The double buffer image is then painted to the canvas.
Applet
The applet is essentially the same as the application with a few minor changes:
-
appletprogram extends Applet and the main method was changed to init
-
The need for a frame and window was depleted since this is built into applets.
-
The size was no longer dependent on the screensize, it was fixed to the size specified in the relevent html code.
Applets are designed specifically to not be able to read or write to any file for security purposes. As a result, to get the text from text.txt and to retrieve the images from the Images directory the follow changes were necessary:
-
To retrieve the text for the ticker tape, a BufferedReader was created using an InputStream which used a URL corresponding to the text.txt file.
-
To retrieve the names of each image, a BufferedReader was created using an InputStream which used a URL corresponding to the images.txt file.
-
A URL was used to access each image, then the same URL was used by ImageIO to read each image.
Web
If the user submits text, add.php (written in PHP for ability to easily output to files) opens text.txt and then appends the string to the next line of the file. Otherwise, if the path for an image is submitted, then the data is posted to post.php. In post.php the image is copied to the Images folder stored in the html directory. In both cases, the IP is retrieved and along with the date and submittion, is appended to the log file. The html for each website is encorporated into the different php files.
1.3. Part 4 - Enhancements that could be made
Program
-
the speed of the ticker could be increased
-
a weather display which reads the current temperature and conditions
-
a camera which displays either the hallway or various pictures from around campus. These could be added the cycles of pictures that currently exists.
-
a microphone that takes the sounds from the hallway and turns the sound into a corresponding image which again is added to the cycle of images
-
speakers to play various message or sound clips to create a more interactive display
-
having specific modes happen at specific times (ie if during school hours, cycle through messages and images and during the evening have the ability to play sound clips
-
A more interesting transition between images could be implemented
Web Interaction
-
The opening web page has the ability to be adapted to allow Bryn Mawr e-mail addresses access to the rest of the website. This would improve security by allowing the administrator to see who added specific items to the program.
-
The second page after the security check could be altered by having one submit button for both the images and text.
-
All of the webpages involved could be made more graphical and user friendly
-
Post.php's resulting text could be incorporated on to add.php to eliminate the need for post.php so that add.php takes care of all the submissions
Applet
-
Currently the applet cannot be displayed on machines running Windows or Mac OSs. This is problematic since the majority of computers on campus do not run Linux. This maybe due to adding an applet to php code since adding a link to the applet works correctly.
-
The images displayed on the applet need to be scaled.
-
Part of the ticker is shown at the very top of the applet and could be adjusted
