Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
InstallerEvent |
|
| 1.0;1 |
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 or later | |
5 | * as published by the Free Software Foundation. This program is distributed | |
6 | * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
7 | * the 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 | * © CrossWire Bible Society, 2005 - 2016 | |
18 | * | |
19 | */ | |
20 | package org.crosswire.jsword.book.install; | |
21 | ||
22 | import java.io.IOException; | |
23 | import java.io.ObjectInputStream; | |
24 | import java.util.EventObject; | |
25 | ||
26 | /** | |
27 | * An InstallerEvent is fired whenever an Installer is added or removed from the | |
28 | * system. | |
29 | * | |
30 | * @see gnu.lgpl.License The GNU Lesser General Public License for details. | |
31 | * @author Joe Walker | |
32 | */ | |
33 | public class InstallerEvent extends EventObject { | |
34 | /** | |
35 | * Basic constructor | |
36 | * | |
37 | * @param source the originator of the event | |
38 | * @param installer | |
39 | * The installer, or null if there is more than one change. | |
40 | * @param added | |
41 | * True if the changed installer is an addition. | |
42 | */ | |
43 | public InstallerEvent(Object source, Installer installer, boolean added) { | |
44 | 0 | super(source); |
45 | ||
46 | 0 | this.installer = installer; |
47 | 0 | this.added = added; |
48 | 0 | } |
49 | ||
50 | /** | |
51 | * Get the name of the changed Bible | |
52 | * | |
53 | * @return The Bible bmd | |
54 | */ | |
55 | public Installer getInstaller() { | |
56 | 0 | return installer; |
57 | } | |
58 | ||
59 | /** | |
60 | * Is this an addition event? | |
61 | * @return whether this is an addition event | |
62 | */ | |
63 | public boolean isAddition() { | |
64 | 0 | return added; |
65 | } | |
66 | ||
67 | /** | |
68 | * Serialization support. | |
69 | * | |
70 | * @param is | |
71 | * @throws IOException | |
72 | * @throws ClassNotFoundException | |
73 | */ | |
74 | private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { | |
75 | // Broken but we don't serialize events | |
76 | 0 | installer = null; |
77 | 0 | is.defaultReadObject(); |
78 | 0 | } |
79 | ||
80 | /** | |
81 | * Is this an addition event? | |
82 | */ | |
83 | private boolean added; | |
84 | ||
85 | /** | |
86 | * The name of the changed Bible | |
87 | */ | |
88 | private transient Installer installer; | |
89 | ||
90 | /** | |
91 | * Serialization ID | |
92 | */ | |
93 | private static final long serialVersionUID = 3257290248836102194L; | |
94 | } |