source: gli/branches/rtl-gli/src/org/greenstone/gatherer/shell/GShellEvent.java@ 18360

Last change on this file since 18360 was 6388, checked in by jmt12, 20 years ago

Completely rewrote monitors to be language independant - fixed several bugs including a decreasing progress bar and added a new reset() method to ensure that progress bars are pristine now that they can be onscreen at all times (lower detail modes)

  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * <BR><BR>
9 *
10 * Author: John Thompson, Greenstone Digital Library, University of Waikato
11 *
12 * <BR><BR>
13 *
14 * Copyright (C) 1999 New Zealand Digital Library Project
15 *
16 * <BR><BR>
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * <BR><BR>
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * <BR><BR>
31 *
32 * You should have received a copy of the GNU General Public License
33 * along with this program; if not, write to the Free Software
34 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 *########################################################################
36 */
37package org.greenstone.gatherer.shell;
38
39/** Title: The Gatherer<br>
40 * Description: The Gatherer: a tool for gathering and enriching digital collections.<br>
41 * Copyright: Copyright (c) 2001<br>
42 * Company: The University of Waikato<br>
43 * Written: / /01<br>
44 * Revised: 12/05/02 - Commented<br>
45 * 29/05/02 - Moved into correct package<br>
46 * @author John Thompson, Greenstone Digital Libraries
47 * @version 2.1 */
48import java.awt.AWTEvent;
49
50/** This class encapsulates all the information created by an event within a <strong>GShell</strong> process. */
51public class GShellEvent
52 extends AWTEvent {
53 /** Allows some part of the program to prevent this message being processed by other parts. */
54 private boolean vetoed = false;
55 /** The status of the process at the completion of event. */
56 private int status = -1;
57 /** The process type (such as COPY, BUILD or IMPORT). */
58 private int type = -1;
59 /** Any message associated with this event. */
60 private String message = null;
61
62 /* Constructor.
63 * @param source The <strong>GShell</strong> that fired this message.
64 * @param id The event identifier as an <strong>int</strong>.
65 * @param type The process type as an <strong>int</strong>.
66 * @param message A <strong>String</strong> representing any message attatched with this event.
67 * @param status The status of the process post event, as an <strong>int</strong>.
68 */
69 public GShellEvent(Object source, int id, int type, String message, int status) {
70 super(source, id);
71 this.message = message;
72 this.status = status;
73 this.type = type;
74 }
75
76 /** Gets the message associated with this event.
77 * @return The message as a <strong>String</strong> or <i>null</i>.
78 */
79 public String getMessage() {
80 return message;
81 }
82
83 /** Gets the status associated with this event. This status can then be matched back to the constants in <strong>GShell</strong>.
84 * @return An <strong>int</strong> signifying the process status.
85 */
86 public int getStatus() {
87 return status;
88 }
89
90 /** Gets the type associated with this event. This type can then be matched back to the constants in <strong>GShell</strong>.
91 * @return An <strong>int</strong> signifying the process type.
92 */
93 public int getType() {
94 return type;
95 }
96
97 /** Determine if this event has been vetoed by some other part of the GLI
98 * @return true if the event has, and thus shouldn't be further processed, false otherwise.
99 */
100 public boolean isVetoed() {
101 return vetoed;
102 }
103
104 /** Change the message to be displayed by this event - usually from something technical so something easier to understand.
105 * @param message the new message as a String
106 */
107 public void setMessage(String message) {
108 this.message = message;
109 }
110
111 public String toString() {
112 return "org.greenstone.gatherer.shell.GShellEvent[" + message + "," + status + "," + type + "]";
113 }
114
115 /** Prevent this event being processed by other parts of the GLI.
116 */
117 public void veto() {
118 vetoed = true;
119 }
120}
Note: See TracBrowser for help on using the repository browser.