001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.addressbook.gui.tree;
019:
020: import javax.swing.JComponent;
021: import javax.swing.tree.TreePath;
022:
023: import org.columba.addressbook.folder.AbstractFolder;
024: import org.columba.addressbook.gui.focus.FocusManager;
025: import org.columba.addressbook.gui.focus.FocusOwner;
026: import org.columba.addressbook.gui.frame.AddressbookFrameController;
027:
028: /**
029: *
030: *
031: * @author fdietz
032: */
033: public class TreeController implements FocusOwner {
034:
035: TreeView view;
036:
037: AddressbookFrameController frameController;
038:
039: /**
040: *
041: */
042: public TreeController(AddressbookFrameController frameController) {
043: super ();
044: this .frameController = frameController;
045:
046: view = new TreeView(frameController);
047:
048: // register as focus owner
049: FocusManager.getInstance().registerComponent(this );
050: }
051:
052: /**
053: * @return AddressbookTreeView
054: */
055: public TreeView getView() {
056: return view;
057: }
058:
059: /**
060: * @return AddressbookFrameController
061: */
062: public AddressbookFrameController getFrameController() {
063: return frameController;
064: }
065:
066: public AbstractFolder getSelectedFolder() {
067: return (AbstractFolder) getView()
068: .getLastSelectedPathComponent();
069: }
070:
071: public void setSelectedFolder(AbstractFolder folder) {
072: getView().clearSelection();
073:
074: TreePath path = new TreePath(folder.getPath());
075:
076: getView().setSelectionPath(path);
077: }
078:
079: /** ************* FocusOwner Implementation ****************** */
080:
081: /**
082: * @see org.columba.addressbook.gui.focus.FocusOwner#copy()
083: */
084: public void copy() {
085:
086: }
087:
088: /**
089: * @see org.columba.addressbook.gui.focus.FocusOwner#cut()
090: */
091: public void cut() {
092:
093: }
094:
095: /**
096: * @see org.columba.addressbook.gui.focus.FocusOwner#delete()
097: */
098: public void delete() {
099:
100: }
101:
102: /**
103: * @see org.columba.addressbook.gui.focus.FocusOwner#getComponent()
104: */
105: public JComponent getComponent() {
106: return getView();
107: }
108:
109: /**
110: * @see org.columba.addressbook.gui.focus.FocusOwner#isCopyActionEnabled()
111: */
112: public boolean isCopyActionEnabled() {
113:
114: return false;
115: }
116:
117: /**
118: * @see org.columba.addressbook.gui.focus.FocusOwner#isCutActionEnabled()
119: */
120: public boolean isCutActionEnabled() {
121:
122: return false;
123: }
124:
125: /**
126: * @see org.columba.addressbook.gui.focus.FocusOwner#isDeleteActionEnabled()
127: */
128: public boolean isDeleteActionEnabled() {
129:
130: return false;
131: }
132:
133: /**
134: * @see org.columba.addressbook.gui.focus.FocusOwner#isPasteActionEnabled()
135: */
136: public boolean isPasteActionEnabled() {
137:
138: return false;
139: }
140:
141: /**
142: * @see org.columba.addressbook.gui.focus.FocusOwner#isRedoActionEnabled()
143: */
144: public boolean isRedoActionEnabled() {
145:
146: return false;
147: }
148:
149: /**
150: * @see org.columba.addressbook.gui.focus.FocusOwner#isSelectAllActionEnabled()
151: */
152: public boolean isSelectAllActionEnabled() {
153:
154: return false;
155: }
156:
157: /**
158: * @see org.columba.addressbook.gui.focus.FocusOwner#isUndoActionEnabled()
159: */
160: public boolean isUndoActionEnabled() {
161:
162: return false;
163: }
164:
165: /**
166: * @see org.columba.addressbook.gui.focus.FocusOwner#paste()
167: */
168: public void paste() {
169:
170: }
171:
172: /**
173: * @see org.columba.addressbook.gui.focus.FocusOwner#redo()
174: */
175: public void redo() {
176:
177: }
178:
179: /**
180: * @see org.columba.addressbook.gui.focus.FocusOwner#selectAll()
181: */
182: public void selectAll() {
183:
184: }
185:
186: /**
187: * @see org.columba.addressbook.gui.focus.FocusOwner#undo()
188: */
189: public void undo() {
190:
191: }
192: }
|