KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > addressbook > gui > tree > TreeController


1 // The contents of this file are subject to the Mozilla Public License Version
2
// 1.1
3
//(the "License"); you may not use this file except in compliance with the
4
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
5
//
6
//Software distributed under the License is distributed on an "AS IS" basis,
7
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8
//for the specific language governing rights and
9
//limitations under the License.
10
//
11
//The Original Code is "The Columba Project"
12
//
13
//The Initial Developers of the Original Code are Frederik Dietz and Timo
14
// Stich.
15
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16
//
17
//All Rights Reserved.
18
package org.columba.addressbook.gui.tree;
19
20 import javax.swing.JComponent JavaDoc;
21 import javax.swing.tree.TreePath JavaDoc;
22
23 import org.columba.addressbook.folder.AbstractFolder;
24 import org.columba.addressbook.gui.focus.FocusManager;
25 import org.columba.addressbook.gui.focus.FocusOwner;
26 import org.columba.addressbook.gui.frame.AddressbookFrameController;
27
28 /**
29  *
30  *
31  * @author fdietz
32  */

33 public class TreeController implements FocusOwner {
34
35     TreeView view;
36
37     AddressbookFrameController frameController;
38
39     /**
40      *
41      */

42     public TreeController(AddressbookFrameController frameController) {
43         super();
44         this.frameController = frameController;
45
46         view = new TreeView(frameController);
47         
48 // register as focus owner
49
FocusManager.getInstance().registerComponent(this);
50     }
51
52     /**
53      * @return AddressbookTreeView
54      */

55     public TreeView getView() {
56         return view;
57     }
58
59     /**
60      * @return AddressbookFrameController
61      */

62     public AddressbookFrameController getFrameController() {
63         return frameController;
64     }
65
66     public AbstractFolder getSelectedFolder() {
67         return (AbstractFolder) getView().getLastSelectedPathComponent();
68     }
69     
70     public void setSelectedFolder(AbstractFolder folder) {
71         getView().clearSelection();
72         
73         TreePath JavaDoc path = new TreePath JavaDoc(folder.getPath());
74         
75         getView().setSelectionPath(path);
76     }
77
78     /** ************* FocusOwner Implementation ****************** */
79
80     /**
81      * @see org.columba.addressbook.gui.focus.FocusOwner#copy()
82      */

83     public void copy() {
84
85     }
86
87     /**
88      * @see org.columba.addressbook.gui.focus.FocusOwner#cut()
89      */

90     public void cut() {
91
92     }
93
94     /**
95      * @see org.columba.addressbook.gui.focus.FocusOwner#delete()
96      */

97     public void delete() {
98
99     }
100
101     /**
102      * @see org.columba.addressbook.gui.focus.FocusOwner#getComponent()
103      */

104     public JComponent JavaDoc getComponent() {
105         return getView();
106     }
107
108     /**
109      * @see org.columba.addressbook.gui.focus.FocusOwner#isCopyActionEnabled()
110      */

111     public boolean isCopyActionEnabled() {
112
113         return false;
114     }
115
116     /**
117      * @see org.columba.addressbook.gui.focus.FocusOwner#isCutActionEnabled()
118      */

119     public boolean isCutActionEnabled() {
120
121         return false;
122     }
123
124     /**
125      * @see org.columba.addressbook.gui.focus.FocusOwner#isDeleteActionEnabled()
126      */

127     public boolean isDeleteActionEnabled() {
128
129         return false;
130     }
131
132     /**
133      * @see org.columba.addressbook.gui.focus.FocusOwner#isPasteActionEnabled()
134      */

135     public boolean isPasteActionEnabled() {
136
137         return false;
138     }
139
140     /**
141      * @see org.columba.addressbook.gui.focus.FocusOwner#isRedoActionEnabled()
142      */

143     public boolean isRedoActionEnabled() {
144
145         return false;
146     }
147
148     /**
149      * @see org.columba.addressbook.gui.focus.FocusOwner#isSelectAllActionEnabled()
150      */

151     public boolean isSelectAllActionEnabled() {
152
153         return false;
154     }
155
156     /**
157      * @see org.columba.addressbook.gui.focus.FocusOwner#isUndoActionEnabled()
158      */

159     public boolean isUndoActionEnabled() {
160
161         return false;
162     }
163
164     /**
165      * @see org.columba.addressbook.gui.focus.FocusOwner#paste()
166      */

167     public void paste() {
168
169     }
170
171     /**
172      * @see org.columba.addressbook.gui.focus.FocusOwner#redo()
173      */

174     public void redo() {
175
176     }
177
178     /**
179      * @see org.columba.addressbook.gui.focus.FocusOwner#selectAll()
180      */

181     public void selectAll() {
182
183     }
184
185     /**
186      * @see org.columba.addressbook.gui.focus.FocusOwner#undo()
187      */

188     public void undo() {
189
190     }
191 }
Popular Tags