1   /*
2    *  Copyright (c) 2000-2001, The University of Sheffield.
3    *
4    *  This file is part of GATE (see http://gate.ac.uk/), and is free
5    *  software, licenced under the GNU Library General Public License,
6    *  Version 2, June1991.
7    *
8    *  A copy of this licence is included in the distribution in the file
9    *  licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
10   *
11   *  Valentin Tablan 09/07/2001
12   *
13   *  $Id: AnnotationVisualResource.java,v 1.5 2001/08/07 16:59:46 kalina Exp $
14   */
15  package gate.creole;
16  
17  import gate.*;
18  import gate.util.*;
19  
20  /**
21   * Visual Resources that display and/or edit annotations.
22   * This type of resources can be used to either display or edit existing
23   * annotations or to create new annotations.
24   */
25  public interface AnnotationVisualResource extends VisualResource {
26    /**
27     * Called by the GUI when this viewer/editor has to initialise itself for a
28     * specific annotation or text span.
29     * @param target the object which will always be a {@link gate.AnnotationSet}
30     */
31    public void setTarget(Object target);
32  
33  
34    /**
35     * Used when the viewer/editor has to display/edit an existing annotation
36     * @param ann the annotation to be displayed or edited
37     */
38    public void setAnnotation(Annotation ann);
39  
40    /**
41     * Used when the viewer has to create new annotations.
42     * @param startOffset the start offset of the span covered by the new
43     * annotation(s)
44     * @param endOffset the end offset of the span covered by the new
45     * annotation(s)
46     */
47    public void setSpan(Long startOffset, Long endOffset, String annotationType);
48  
49    /**
50     * Called by the GUI when the user has pressed the "OK" button. This should
51     * trigger the saving of the newly created annotation(s)
52     */
53    public void okAction() throws GateException;
54  
55    /**
56     * Called by the GUI when the user has pressed the "Cancel" button. This should
57     * trigger cleaning up action, if the editor has done any changes to the
58     * annotation sets or document or annotation
59     */
60    public void cancelAction() throws GateException;
61  
62  
63    /**
64     * Checks whether this viewer/editor can handle a specific annotation type.
65     */
66    public boolean canDisplayAnnotationType(String annotationType);
67  
68  }//public interface AnnotationVisualResource extends VisualResource