1 /*
2 * Copyright (C) 2000 Bill Bereza
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Bill Bereza
19 * email : bereza@pobox.com
20 * url : http://www.pobox.com/~bereza/
21 */
22 package net.bereza.gui;
23
24 import net.bereza.io.SortableFile;
25 import net.bereza.util.SortedVector;
26
27 import java.io;
28 import java.util;
29
30 import java.awt;
31 import java.awt.event;
32 import javax.swing;
33 import javax.swing.event;
34 import javax.swing.text;
35 import javax.swing.border;
36
37 /**
38 * SpoolViewer is a dialog for displaying a SortedVector
39 * of files, using a specified command.
40 *
41 * @author $Author: bereza $
42 * @version $Revision: 1.1 $
43 * <p>
44 * $Log: SpoolViewer.java,v $
45 * Revision 1.1 2000/07/06 01:46:39 bereza
46 * Initial revision
47 *
48 * <p>
49 * $Id: SpoolViewer.java,v 1.1 2000/07/06 01:46:39 bereza Exp $
50 */
51 public class SpoolViewer extends JDialog
52 {
53 /** SpoolViewerPanel we contain. */
54 protected SpoolViewerPanel viewer;
55
56 /**
57 * Construct a SpoolViewer with the given parent frame,
58 * title, vector of files, and command format string.
59 *
60 * @param parent owner frame
61 * @param title title of dialog window
62 * @param files Vector of files to view
63 * @param command MessageFormat command string
64 * @param bitsPerSample number of bits in each unit of data in the file
65 * @param samplesPerSecond number of units of data in each second
66 * of transmission of this file format
67 */
68 public SpoolViewer(Frame parent,
69 String title,
70 Vector files,
71 String command,
72 double bitsPerSample,
73 double samplesPerSecond)
74 {
75 super(parent, title, true);
76 viewer=new SpoolViewerPanel(parent,
77 files,
78 command,
79 bitsPerSample,
80 samplesPerSecond);
81 getContentPane().add(viewer);
82
83 addWindowListener(new WindowAdapter()
84 {
85 public void windowClosing(WindowEvent e)
86 {
87 viewer.doPlay(false);
88 }
89 });
90
91 pack();
92 }
93
94 /**
95 * Show the dialog. Start the spool viewer panel playing.
96 */
97 public void setVisible(boolean to)
98 {
99 if(to)
100 {
101 viewer.start();
102 }
103 else
104 {
105 viewer.doPlay(false);
106 }
107 super.setVisible(to);
108 }
109
110 /**
111 * Get the last (in terms of date) fully viewed file.
112 */
113 public File getLastViewedFile()
114 {
115 return viewer.getLastViewedFile();
116 }
117 }
118
119