001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019:
020: package org.openharmonise.him.displaycomponents;
021:
022: import org.openharmonise.him.displaycomponents.table.*;
023: import org.openharmonise.him.dnd.*;
024: import org.openharmonise.him.swing.resourcetree.*;
025: import org.openharmonise.him.window.*;
026: import org.openharmonise.vfs.*;
027: import org.openharmonise.vfs.servers.*;
028:
029: /**
030: * Base class for components that bridge both a tree component in the outlook
031: * bar and a table component in the table area of the client's display.
032: *
033: * @author Matthew Large
034: * @version $Revision: 1.1 $
035: *
036: */
037: public abstract class AbstractTreeTableDisplayComponent extends
038: AbstractDisplayComponent implements TreeViewListener,
039: TableListener {
040:
041: /**
042: * Tree component in the outlook bar.
043: */
044: protected ResourceTree m_resourceTree = null;
045:
046: /**
047: * Table component.
048: */
049: protected TableView m_tableView = null;
050:
051: /**
052: * Constructs a new abstract tree/table display component.
053: *
054: * @param displayManager Display manager
055: */
056: public AbstractTreeTableDisplayComponent(
057: DisplayManager displayManager) {
058: super (displayManager);
059: this .setup();
060: }
061:
062: /**
063: * Constructs a new abstract tree/table display component.
064: *
065: * @param displayManager Display manager
066: * @param server Server
067: * @param sPath Full path
068: */
069: public AbstractTreeTableDisplayComponent(
070: DisplayManager displayManager, Server server, String sPath) {
071: super (displayManager);
072: this .setup();
073: this .addServerAndPath(server, sPath);
074: }
075:
076: /**
077: * Adds a server and path to a collection within that server to this
078: * component.
079: *
080: * @param server Server
081: * @param sPath Full path
082: */
083: public void addServerAndPath(Server server, String sPath) {
084: this .m_resourceTree.addCollection(server.getVFS()
085: .getVirtualFile(sPath).getResource());
086: }
087:
088: /**
089: * Configures this component.
090: *
091: */
092: private void setup() {
093: this .m_resourceTree = new ResourceTree();
094: this .m_resourceTree.setShowLeafNodes(false);
095: this .m_resourceTree.addListener(this );
096: TreeDropTarget treeTarget = new TreeDropTarget(
097: this .m_resourceTree);
098: this .m_tableView = new TableView(this );
099: }
100:
101: /**
102: * Returns the tree component.
103: *
104: * @return Tree component
105: */
106: public ResourceTree getTreeView() {
107: return this .m_resourceTree;
108: }
109:
110: /**
111: * Returns the table component.
112: *
113: * @return Table component
114: */
115: public TableView getTableView() {
116: return this .m_tableView;
117: }
118:
119: /**
120: * Opens a specified path in the tree component.
121: *
122: * @param sPath Full path
123: */
124: public void openPathInTree(String sPath) {
125: this .m_resourceTree.openPath(sPath);
126: }
127:
128: /* (non-Javadoc)
129: * @see com.simulacramedia.contentmanager.displaycomponents.tree.TreeViewListener#virtualFileSelected(com.simulacramedia.vfs.AbstractVirtualFileSystem, java.lang.String)
130: */
131: abstract public void virtualFileSelected(
132: AbstractVirtualFileSystem vfs, String sPath);
133:
134: /* (non-Javadoc)
135: * @see com.simulacramedia.contentmanager.displaycomponents.table.TableListener#fileSelection(com.simulacramedia.contentmanager.displaycomponents.table.TableEntry)
136: */
137: abstract public void fileSelection(TableEntry entry);
138:
139: /**
140: * Called when a historical virtual file is selected in the table
141: * component.
142: *
143: * @param entry Historical virtual file table entry
144: */
145: abstract public void fileSelection(VersionEntry entry);
146:
147: }
|