1   /**
2    * Distribution License:
3    * BibleDesktop is free software; you can redistribute it and/or modify it under
4    * the terms of the GNU General Public License, version 2 as published by
5    * the Free Software Foundation. This program is distributed in the hope
6    * that it will be useful, but WITHOUT ANY WARRANTY; without even the
7    * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8    * See the GNU General Public License for more details.
9    *
10   * The License is available on the internet at:
11   *       http://www.gnu.org/copyleft/gpl.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   * Copyright: 2005
18   *     The copyright to this program is held by it's authors.
19   *
20   * ID: $Id: BookDataDisplay.java 1997 2010-10-23 20:53:47Z dmsmith $
21   */
22  package org.crosswire.bibledesktop.display;
23  
24  import java.awt.Component;
25  import java.beans.PropertyChangeListener;
26  
27  import org.crosswire.bibledesktop.passage.KeyChangeListener;
28  import org.crosswire.jsword.book.Book;
29  import org.crosswire.jsword.book.BookProvider;
30  import org.crosswire.jsword.passage.Key;
31  
32  /**
33   * An interface for all components that can display BookData.
34   * 
35   * @see gnu.gpl.License for license details.<br>
36   *      The copyright to this program is held by it's authors.
37   * @author Joe Walker [joe at eireneh dot com]
38   */
39  public interface BookDataDisplay extends BookProvider, PropertyChangeListener {
40      /**
41       * Used by property change listeners to listen for when books should be
42       * compared.
43       */
44      String COMPARE_BOOKS = "ComparingBooks";
45  
46      /**
47       * Clear any BookData that is displayed. This is equivalent to:
48       * <code>setBookData(null, null)</code>.
49       */
50      void clearBookData();
51  
52      /**
53       * Set the BookData to be displayed. The data to be displayed is specified
54       * as a books and key rather than the more obvious BookData (the result of
55       * reading books using a key) since some displays may wish so split up the
56       * display and only look up smaller sections at a time.
57       * 
58       * @param books
59       *            The Books to read data from
60       * @param key
61       *            The key to read from the given book
62       */
63      void setBookData(Book[] books, Key key);
64  
65      /**
66       * Establish whether books in the book array should be compared.
67       * 
68       * @param compare
69       */
70      void setCompareBooks(boolean compare);
71  
72      /**
73       * The Book Key that we are displaying, or null if we are not displaying
74       * anything
75       * 
76       * @return The current key
77       */
78      Key getKey();
79  
80      /**
81       * Cause the BookData to be re-displayed.
82       */
83      void refresh();
84  
85      /**
86       * Copy the selection to the clipboard
87       */
88      void copy();
89  
90      /**
91       * Add a listener for when the key changes.
92       * 
93       * @param listener
94       */
95      void addKeyChangeListener(KeyChangeListener listener);
96  
97      /**
98       * Remove a listener for when the key changes.
99       * 
100      * @param listener
101      */
102     void removeKeyChangeListener(KeyChangeListener listener);
103 
104     /**
105      * Add a listener for when someone clicks on a browser 'link'
106      * 
107      * @param listener
108      *            The listener to add
109      */
110     void addURIEventListener(URIEventListener listener);
111 
112     /**
113      * Remove a listener for when someone clicks on a browser 'link'
114      * 
115      * @param listener
116      *            The listener to remove
117      */
118     void removeURIEventListener(URIEventListener listener);
119 
120     /**
121      * Accessor for the Swing component
122      */
123     Component getComponent();
124 }
125