01: /*
02: * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
03: * NETSCAPE COMMUNICATIONS CORPORATION
04: *
05: * Copyright (c) 1996 Netscape Communications Corporation.
06: * All Rights Reserved.
07: * Use of this Source Code is subject to the terms of the applicable
08: * license agreement from Netscape Communications Corporation.
09: */
10:
11: package graphical;
12:
13: import util.BTreeNode;
14:
15: import netscape.application.Target;
16: import netscape.application.View;
17:
18: /* SGP: later provide methods for graphics swapping */
19: // SGP: should TTV be public?
20: public class TreeWindow extends IconInternalWindow {
21: private TreeView treeView;
22: private Minimize minimize;
23: private String title;
24:
25: public TreeWindow(int x, int y, int width, int height,
26: TreeView treeView, String title) {
27: super (x, y, width, height, null);
28:
29: this .title = title;
30: this .treeView = treeView;
31: setResizable(true);
32: setTitle(title);
33: setMinSize(graphical.Header.IWINDMINWIDTH,
34: graphical.Header.IWINDMINHEIGHT);
35: setTreeView(treeView);
36: }
37:
38: public void setTreeView(TreeView treeView) {
39: if ((treeView == null) && (this .treeView == null)) {
40: return;
41: }
42: if (treeView == null) {
43: removeSubview(this .treeView);
44: return;
45: }
46: if (this .treeView == null) {
47: addSubview(treeView);
48: }
49: this .treeView = treeView;
50: treeView.setHorizResizeInstruction(View.WIDTH_CAN_CHANGE);
51: treeView.setVertResizeInstruction(View.HEIGHT_CAN_CHANGE);
52: treeView.scrollGroup
53: .sizeTo(treeView.scrollGroup.width()
54: - border().widthMargin(), treeView.scrollGroup
55: .height());
56: }
57:
58: public void setDragSourcePolicy(int dragSourcePolicy) {
59: if (treeView != null) {
60: treeView.setDragSourcePolicy(dragSourcePolicy);
61: }
62: }
63:
64: public void setDragDestinationPolicy(int dragDestinationPolicy) {
65: if (treeView != null) {
66: treeView.setDragDestinationPolicy(dragDestinationPolicy);
67: }
68: }
69:
70: public void setDragDestinationTarget(Target dragDestinationTarget) {
71: if (treeView != null) {
72: treeView.setDragDestinationTarget(dragDestinationTarget);
73: }
74: }
75:
76: public Minimize minimize() {
77: return minimize;
78: }
79:
80: public void didResignMain() {
81: super.didResignMain();
82: if (treeView != null) {
83: treeView.listView.selectEmpty();
84: treeView.setEditListItem();
85: }
86: }
87: }
|