~vcs-imports/xena/trunk

« back to all changes in this revision

Viewing changes to ext/src/javahelp/jhMaster/JavaHelp/src/new/javax/help/event/HelpSetEvent.java

  • Committer: matthewoliver
  • Date: 2009-12-10 03:18:07 UTC
  • Revision ID: vcs-imports@canonical.com-20091210031807-l086qguzdlljtkl9
Merged Xena Testing into Xena Stable for the Xena 5 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * @(#)HelpSetEvent.java        1.13 06/10/30
 
3
 * 
 
4
 * Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
 
5
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
6
 * 
 
7
 * This code is free software; you can redistribute it and/or modify it
 
8
 * under the terms of the GNU General Public License version 2 only, as
 
9
 * published by the Free Software Foundation.  Sun designates this
 
10
 * particular file as subject to the "Classpath" exception as provided
 
11
 * by Sun in the LICENSE file that accompanied this code.
 
12
 * 
 
13
 * This code is distributed in the hope that it will be useful, but WITHOUT
 
14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
15
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
16
 * version 2 for more details (a copy is included in the LICENSE file that
 
17
 * accompanied this code).
 
18
 * 
 
19
 * You should have received a copy of the GNU General Public License version
 
20
 * 2 along with this work; if not, write to the Free Software Foundation,
 
21
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
22
 * 
 
23
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 
24
 * CA 95054 USA or visit www.sun.com if you need additional information or
 
25
 * have any questions.
 
26
 */
 
27
 
 
28
package javax.help.event;
 
29
 
 
30
import javax.help.HelpSet;
 
31
 
 
32
/**
 
33
 * Conveys information when a HelpSet is added/removed.
 
34
 *
 
35
 * @author Eduardo Pelegri-Llopart
 
36
 * @version     1.10    03/10/99
 
37
 */
 
38
 
 
39
public class HelpSetEvent extends java.util.EventObject {
 
40
 
 
41
    /**
 
42
     * Creates a HelpSetEvent.
 
43
     *
 
44
     * @param source Source of this Event.
 
45
     * @param helpset The HelpSet being added/removed.
 
46
     * @param action HELPSET_ADDED or HELPSET_REMOVED.
 
47
     * @throws IllegalArgumentException if source is null or if action is not
 
48
     * a valid action.
 
49
     */
 
50
     public HelpSetEvent(Object source, HelpSet helpset, int action) {
 
51
         super(source);
 
52
         this.helpset = helpset;
 
53
         if (helpset == null) {
 
54
             throw new NullPointerException("helpset");
 
55
         }
 
56
         this.action = action;
 
57
         if (action < 0 || action > 1) {
 
58
             throw new IllegalArgumentException("invalid action");
 
59
         }
 
60
     }
 
61
 
 
62
    /**
 
63
     * A HelpSet was added
 
64
     */
 
65
     public static final int HELPSET_ADDED = 0;
 
66
 
 
67
    /**
 
68
     * A HelpSet was removed
 
69
     */
 
70
     public static final int HELPSET_REMOVED = 1;
 
71
 
 
72
    /**
 
73
     * @return The HelpSet.
 
74
     */
 
75
     public HelpSet getHelpSet() {
 
76
        return helpset;
 
77
     }
 
78
 
 
79
    /**
 
80
     * @return The action
 
81
     */
 
82
     public int getAction() {
 
83
        return action;
 
84
     }
 
85
 
 
86
    /**
 
87
     * Returns textual about the instance. 
 
88
     */
 
89
    public String toString() {
 
90
        if (action==HELPSET_ADDED) {
 
91
            return "HelpSetEvent("+source+", "+helpset+"; added";
 
92
        } else {
 
93
            return "HelpSetEvent("+source+", "+helpset+"; removed";
 
94
        }
 
95
    }
 
96
 
 
97
     private HelpSet helpset;
 
98
     private int action;
 
99
}