01 /*
02 * Copyright (c) 1995-2010, The University of Sheffield. See the file
03 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
04 *
05 * This file is part of GATE (see http://gate.ac.uk/), and is free
06 * software, licenced under the GNU Library General Public License,
07 * Version 2, June 1991 (in the distribution as file licence.html,
08 * and also available at http://gate.ac.uk/gate/licence.html).
09 *
10 * Valentin Tablan 12/12/2000
11 *
12 * $Id: DocumentEvent.java 12006 2009-12-01 17:24:28Z thomas_heitz $
13 */
14 package gate.event;
15
16 import gate.Document;
17
18 /**
19 * This class models events fired by an {@link gate.Document}.
20 */
21 public class DocumentEvent extends GateEvent {
22
23 /**Event type used to mark the addition of an {@link gate.AnnotationSet}*/
24 public static final int ANNOTATION_SET_ADDED = 101;
25
26 /**Event type used to mark the removal of an {@link gate.AnnotationSet}*/
27 public static final int ANNOTATION_SET_REMOVED = 102;
28
29 /**Event type used to mark the editing of the document content
30 */
31 public static final int CONTENT_EDITED = 103;
32
33 /**
34 * Constructor.
35 * @param source the document that has been changed
36 * @param type the type of the event
37 * @param setName the name of the {@link gate.AnnotationSet} that has been
38 * added or removed.
39 */
40 public DocumentEvent(Document source, int type, String setName) {
41 super(source, type);
42 this.annotationSetName = setName;
43 }
44
45 /**
46 * Constructor.
47 * @param source the document that has been changed
48 * @param type the type of the event
49 * @param editStart the offset where the edit operation started
50 * @param editEnd the offset where the edit operation ended
51 */
52 public DocumentEvent(Document source, int type, Long editStart, Long editEnd) {
53 super(source, type);
54 this.editStart = editStart;
55 this.editEnd = editEnd;
56 }
57
58 /**
59 * Gets the name of the {@link gate.AnnotationSet} that has been added or
60 * removed.
61 */
62 public String getAnnotationSetName() {
63 return annotationSetName;
64 }
65
66 /**
67 * @return Returns the editEnd.
68 */
69 public Long getEditEnd(){
70 return editEnd;
71 }
72
73 /**
74 * @return Returns the editStart.
75 */
76 public Long getEditStart(){
77 return editStart;
78 }
79 private String annotationSetName;
80 private Long editStart;
81 private Long editEnd;
82 }
|