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 components;
12:
13: import netscape.application.DragDestination;
14: import netscape.application.DragSession;
15: import netscape.application.ListItem;
16: import netscape.application.TextField;
17:
18: import util.BTreeNode;
19:
20: import soif.TaxonomyNode;
21:
22: /**
23: * A TextField that will accept a category drop.
24: */
25: public class SearchTextField extends TextField implements
26: DragDestination {
27: public SearchTextField(int x, int y, int w, int h) {
28: super (x, y, w, h);
29: }
30:
31: /*******************/
32: /* DragDestination */
33: /*******************/
34:
35: public boolean dragEntered(DragSession ds) {
36: return true;
37: }
38:
39: public boolean dragMoved(DragSession ds) {
40: return true;
41: }
42:
43: public void dragExited(DragSession ds) {
44: return;
45: }
46:
47: public boolean dragDropped(DragSession ds) {
48: ListItem li = (ListItem) ds.data();
49: BTreeNode btn = (BTreeNode) li.data();
50: Object o = btn.getValue();
51:
52: if (o instanceof TaxonomyNode) {
53: setStringValue(((TaxonomyNode) o).getId());
54: }
55:
56: return true;
57: }
58:
59: public DragDestination acceptsDrag(DragSession ds, int x, int y) {
60: return this;
61: }
62: }
|