~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/jsword/org/crosswire/jsword/view/swing/passage/PassageTreeNode.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
import org.crosswire.common.util.IteratorEnumeration;
15
15
 
16
16
/**
17
 
* A PassageTreeNode extends TreeNode to Model a Passage.
18
 
*
19
 
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
20
 
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
21
 
* Distribution Licence:<br />
22
 
* Project B is free software; you can redistribute it
23
 
* and/or modify it under the terms of the GNU General Public License,
24
 
* version 2 as published by the Free Software Foundation.<br />
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 GNU
28
 
* General Public License for more details.<br />
29
 
* The License is available on the internet
30
 
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
31
 
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
32
 
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
33
 
* The copyright to this program is held by it's authors.
34
 
* </font></td></tr></table>
35
 
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
36
 
* @see <{docs.Licence}>
37
 
* @author Joe Walker
38
 
* @version D5.I0.T0
39
 
*/
 
17
 * A PassageTreeNode extends TreeNode to Model a Passage.
 
18
 * 
 
19
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
20
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
21
 *
 
22
 * Distribution Licence:<br />
 
23
 * JSword is free software; you can redistribute it
 
24
 * and/or modify it under the terms of the GNU General Public License,
 
25
 * version 2 as published by the Free Software Foundation.<br />
 
26
 * This program is distributed in the hope that it will be useful,
 
27
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
28
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
29
 * General Public License for more details.<br />
 
30
 * The License is available on the internet
 
31
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 
32
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
33
 * MA 02111-1307, USA<br />
 
34
 * The copyright to this program is held by it's authors.
 
35
 * </font></td></tr></table>
 
36
 * @see docs.Licence
 
37
 * @author Joe Walker [joe at eireneh dot com]
 
38
 * @version $Id$
 
39
 */
40
40
public class PassageTreeNode implements TreeNode, PassageListener
41
41
{
42
42
    /**
43
 
    *
44
 
    */
 
43
     *
 
44
     */
45
45
    public PassageTreeNode(Passage ref, JTree tree)
46
46
    {
47
47
        this.ref = ref;
50
50
    }
51
51
 
52
52
    /**
53
 
    * Returns the child <code>TreeNode</code> at index i
54
 
    */
 
53
     * Returns the child <code>TreeNode</code> at index i
 
54
     */
55
55
    public TreeNode getChildAt(int index)
56
56
    {
57
57
        return new VerseRangeTreeNode(ref.getVerseRangeAt(index));
58
58
    }
59
59
 
60
60
    /**
61
 
    * Returns the number of children <code>TreeNode</code>s the receiver
62
 
    * contains.
63
 
    */
 
61
     * Returns the number of children <code>TreeNode</code>s the receiver
 
62
     * contains.
 
63
     */
64
64
    public int getChildCount()
65
65
    {
66
66
        return ref.countRanges();
67
67
    }
68
68
 
69
69
    /**
70
 
    * Returns the parent <code>TreeNode</code> of the receiver.
71
 
    */
 
70
     * Returns the parent <code>TreeNode</code> of the receiver.
 
71
     */
72
72
    public TreeNode getParent()
73
73
    {
74
74
        return this;
75
75
    }
76
76
 
77
77
    /**
78
 
    * Returns the index of <code>node</code> in the receivers children.
79
 
    * If the receiver does not contain <code>node</code>, -1 will be
80
 
    * returned.
81
 
    */
 
78
     * Returns the index of <code>node</code> in the receivers children.
 
79
     * If the receiver does not contain <code>node</code>, -1 will be
 
80
     * returned.
 
81
     */
82
82
    public int getIndex(TreeNode node)
83
83
    {
84
84
        int count = 0;
96
96
    }
97
97
 
98
98
    /**
99
 
    * Returns true if the receiver allows children.
100
 
    */
 
99
     * Returns true if the receiver allows children.
 
100
     */
101
101
    public boolean getAllowsChildren()
102
102
    {
103
103
        return true;
104
104
    }
105
105
 
106
106
    /**
107
 
    * Returns true if the receiver is a leaf.
108
 
    */
 
107
     * Returns true if the receiver is a leaf.
 
108
     */
109
109
    public boolean isLeaf()
110
110
    {
111
111
        return false;
112
112
    }
113
113
 
114
114
    /**
115
 
    * Sent after stuff has been added to the Passage.
116
 
    * More info about what and where can be had from the Event
117
 
    * @param ev a PassageEvent encapuslating the event information
118
 
    */
 
115
     * Sent after stuff has been added to the Passage.
 
116
     * More info about what and where can be had from the Event
 
117
     * @param ev a PassageEvent encapuslating the event information
 
118
     */
119
119
    public void versesAdded(PassageEvent ev)
120
120
    {
121
121
    }
122
122
 
123
123
    /**
124
 
    * Sent after stuff has been removed from the Passage.
125
 
    * More info about what and where can be had from the Event
126
 
    * @param ev a PassageEvent encapuslating the event information
127
 
    */
 
124
     * Sent after stuff has been removed from the Passage.
 
125
     * More info about what and where can be had from the Event
 
126
     * @param ev a PassageEvent encapuslating the event information
 
127
     */
128
128
    public void versesRemoved(PassageEvent ev)
129
129
    {
130
130
    }
131
131
 
132
132
    /**
133
 
    * Sent after verses have been symultaneously added and removed from the Passage.
134
 
    * More info about what and where can be had from the Event
135
 
    * @param ev a PassageEvent encapuslating the event information
136
 
    */
 
133
     * Sent after verses have been symultaneously added and removed from the Passage.
 
134
     * More info about what and where can be had from the Event
 
135
     * @param ev a PassageEvent encapuslating the event information
 
136
     */
137
137
    public void versesChanged(PassageEvent ev)
138
138
    {
139
139
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
141
141
    }
142
142
 
143
143
    /**
144
 
    * Returns the children of the reciever as an Enumeration.
145
 
    */
 
144
     * Returns the children of the reciever as an Enumeration.
 
145
     */
146
146
    public Enumeration children()
147
147
    {
148
148
        return new IteratorEnumeration(ref.rangeIterator());
149
149
    }
150
150
 
151
151
    /**
152
 
    * Returns the children of the reciever as an Enumeration.
153
 
    */
 
152
     * Returns the children of the reciever as an Enumeration.
 
153
     */
154
154
    public String toString()
155
155
    {
156
156
        return ref.getOverview();