1 //
2 // Neuros Database Manipulator
3 // Copyright (C) 2003 Neuros Database Manipulator
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //
19 // For information about Neuros Database Manipulator and its authors,
20 // please contact the Neuros Database Manipulator Web Site at
21 // http://neurosdbm.sourceforge.net
22 //
23 //
24
25 package net.sourceforge.neurosdbm;
26
27
28 import java.io.File;
29 import java.io.FileReader;
30 import java.io.BufferedReader;
31 import java.io.IOException;
32 import javax.swing.JLabel;
33 import net.sourceforge.neurosdbm.db.Database;
34
35 public class StatusLine extends JLabel {
36
37 private Database database;
38 public StatusLine(Database database) {
39 this.database = database;
40 update();
41 }
42
43
44 public void update() {
45 String statusLineString = new String();
46
47 statusLineString += "Queued Tracks: " + database.getNumberQueued();
48 statusLineString += " ";
49
50 statusLineString += "Deleted Tracks: " + database.getNumberDeleted();
51 statusLineString += " ";
52
53 statusLineString += "NDBM: " + Version.getVersionString();
54 statusLineString += " ";
55
56 String firmwareVersion = new String("?");
57 File firmwareVersionFile = new File(database.getPath() + "/version.txt");
58 if (firmwareVersionFile.exists()) {
59 try {
60 FileReader fr = new FileReader(firmwareVersionFile);
61 BufferedReader br = new BufferedReader(fr);
62 firmwareVersion = br.readLine();
63 firmwareVersion = firmwareVersion.trim();
64 } catch (Exception exp) {
65 firmwareVersion = "?";
66 }
67 }
68 statusLineString += "Firmware: " + firmwareVersion;
69 statusLineString += " ";
70
71 statusLineString += database.getDevice().getDescription();
72 statusLineString += " ";
73
74
75 setText(statusLineString);
76 }
77 }
78