| InstallerEvent.java |
1 /**
2 * Distribution License:
3 * JSword is free software; you can redistribute it and/or modify it under
4 * the terms of the GNU Lesser General Public License, version 2.1 as published by
5 * the Free Software Foundation. This program is distributed in the hope
6 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8 * See the GNU Lesser General Public License for more details.
9 *
10 * The License is available on the internet at:
11 * http://www.gnu.org/copyleft/lgpl.html
12 * or by writing to:
13 * Free Software Foundation, Inc.
14 * 59 Temple Place - Suite 330
15 * Boston, MA 02111-1307, USA
16 *
17 * Copyright: 2005
18 * The copyright to this program is held by it's authors.
19 *
20 * ID: $Id: InstallerEvent.java 1966 2009-10-30 01:15:14Z dmsmith $
21 */
22 package org.crosswire.jsword.book.install;
23
24 import java.io.IOException;
25 import java.io.ObjectInputStream;
26 import java.util.EventObject;
27
28 /**
29 * An InstallerEvent is fired whenever an Installer is added or removed from the
30 * system.
31 *
32 * @see gnu.lgpl.License for license details.<br>
33 * The copyright to this program is held by it's authors.
34 * @author Joe Walker [joe at eireneh dot com]
35 */
36 public class InstallerEvent extends EventObject {
37 /**
38 * Basic constructor
39 *
40 * @param installer
41 * The installer, or null if there is more than one change.
42 * @param added
43 * True if the changed installer is an addition.
44 */
45 public InstallerEvent(Object source, Installer installer, boolean added) {
46 super(source);
47
48 this.installer = installer;
49 this.added = added;
50 }
51
52 /**
53 * Get the name of the changed Bible
54 *
55 * @return The Bible bmd
56 */
57 public Installer getInstaller() {
58 return installer;
59 }
60
61 /**
62 * Is this an addition event?
63 */
64 public boolean isAddition() {
65 return added;
66 }
67
68 /**
69 * Serialization support.
70 *
71 * @param is
72 * @throws IOException
73 * @throws ClassNotFoundException
74 */
75 private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException {
76 // Broken but we don't serialize events
77 installer = null;
78 is.defaultReadObject();
79 }
80
81 /**
82 * Is this an addition event?
83 */
84 private boolean added;
85
86 /**
87 * The name of the changed Bible
88 */
89 private transient Installer installer;
90
91 /**
92 * Serialization ID
93 */
94 private static final long serialVersionUID = 3257290248836102194L;
95 }
96