KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > displaycomponents > AbstractTreeTableDisplayComponent


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19
20 package org.openharmonise.him.displaycomponents;
21
22 import org.openharmonise.him.displaycomponents.table.*;
23 import org.openharmonise.him.dnd.*;
24 import org.openharmonise.him.swing.resourcetree.*;
25 import org.openharmonise.him.window.*;
26 import org.openharmonise.vfs.*;
27 import org.openharmonise.vfs.servers.*;
28
29 /**
30  * Base class for components that bridge both a tree component in the outlook
31  * bar and a table component in the table area of the client's display.
32  *
33  * @author Matthew Large
34  * @version $Revision: 1.1 $
35  *
36  */

37 public abstract class AbstractTreeTableDisplayComponent
38     extends AbstractDisplayComponent implements TreeViewListener, TableListener {
39
40     /**
41      * Tree component in the outlook bar.
42      */

43     protected ResourceTree m_resourceTree = null;
44     
45     /**
46      * Table component.
47      */

48     protected TableView m_tableView = null;
49
50     /**
51      * Constructs a new abstract tree/table display component.
52      *
53      * @param displayManager Display manager
54      */

55     public AbstractTreeTableDisplayComponent(DisplayManager displayManager) {
56         super(displayManager);
57         this.setup();
58     }
59     
60     /**
61      * Constructs a new abstract tree/table display component.
62      *
63      * @param displayManager Display manager
64      * @param server Server
65      * @param sPath Full path
66      */

67     public AbstractTreeTableDisplayComponent(DisplayManager displayManager, Server server, String JavaDoc sPath) {
68         super(displayManager);
69         this.setup();
70         this.addServerAndPath(server, sPath);
71     }
72     
73     /**
74      * Adds a server and path to a collection within that server to this
75      * component.
76      *
77      * @param server Server
78      * @param sPath Full path
79      */

80     public void addServerAndPath(Server server, String JavaDoc sPath) {
81         this.m_resourceTree.addCollection(server.getVFS().getVirtualFile(sPath).getResource());
82     }
83     
84     /**
85      * Configures this component.
86      *
87      */

88     private void setup() {
89         this.m_resourceTree = new ResourceTree();
90         this.m_resourceTree.setShowLeafNodes(false);
91         this.m_resourceTree.addListener(this);
92         TreeDropTarget treeTarget = new TreeDropTarget(this.m_resourceTree);
93         this.m_tableView = new TableView(this);
94     }
95     
96     /**
97      * Returns the tree component.
98      *
99      * @return Tree component
100      */

101     public ResourceTree getTreeView() {
102         return this.m_resourceTree;
103     }
104     
105     /**
106      * Returns the table component.
107      *
108      * @return Table component
109      */

110     public TableView getTableView() {
111         return this.m_tableView;
112     }
113     
114     /**
115      * Opens a specified path in the tree component.
116      *
117      * @param sPath Full path
118      */

119     public void openPathInTree(String JavaDoc sPath) {
120         this.m_resourceTree.openPath(sPath);
121     }
122     
123     /* (non-Javadoc)
124      * @see com.simulacramedia.contentmanager.displaycomponents.tree.TreeViewListener#virtualFileSelected(com.simulacramedia.vfs.AbstractVirtualFileSystem, java.lang.String)
125      */

126     abstract public void virtualFileSelected(AbstractVirtualFileSystem vfs, String JavaDoc sPath);
127
128     /* (non-Javadoc)
129      * @see com.simulacramedia.contentmanager.displaycomponents.table.TableListener#fileSelection(com.simulacramedia.contentmanager.displaycomponents.table.TableEntry)
130      */

131     abstract public void fileSelection(TableEntry entry);
132     
133     /**
134      * Called when a historical virtual file is selected in the table
135      * component.
136      *
137      * @param entry Historical virtual file table entry
138      */

139     abstract public void fileSelection(VersionEntry entry);
140
141 }
142
Popular Tags