001: /*
002: * CONFIDENTIAL AND PROPRIETARY SOURCE CODE OF
003: * NETSCAPE COMMUNICATIONS CORPORATION
004: *
005: * Copyright (c) 1996 Netscape Communications Corporation.
006: * All Rights Reserved.
007: * Use of this Source Code is subject to the terms of the applicable
008: * license agreement from Netscape Communications Corporation.
009: */
010:
011: package applications;
012:
013: import components.TaxonomyTreeView;
014: import graphical.DragListView;
015: import soif.CSID;
016: import util.ReportError;
017:
018: import netscape.application.Application;
019: import netscape.application.AWTCompatibility;
020: import netscape.application.Color;
021: import netscape.application.Size;
022: import netscape.application.Target;
023: import netscape.application.View;
024:
025: import netscape.javascript.JSException;
026: import netscape.javascript.JSObject;
027:
028: public class TaxonomyBrowse extends Application implements Target {
029: public JSObject jso;
030:
031: private TaxonomyTreeView taxonomyTreeView;
032: private boolean initialized;
033: private String testTaxonomy;
034:
035: public void init() {
036: initialized = false;
037:
038: super .init();
039:
040: Header.showVersion("TaxonomyBrowse", true, true);
041:
042: boolean valid = true;
043:
044: jso = JSObject.getWindow(AWTCompatibility.awtApplet());
045: if (jso == null) {
046: ReportError.reportError(ReportError.ADMIN,
047: "TaxonomyBrowse", "init", Messages.INVALIDJSO);
048: valid = false;
049: }
050:
051: mainRootView().setColor(graphical.Header.DESKTOPCOLOR);
052: mainRootView().draw();
053:
054: String CGILocation = Header.parameterMacro(this , "CGILocation");
055: String CGITarget = Header.parameterMacro(this , "CGITarget");
056: String BrowseCategory = Header.parameterMacro(this ,
057: "BrowseCategory");
058: // System.out.println("BrowseCategory=======\n" + BrowseCategory + "\n=======");
059:
060: CSID csid = Header.parameterCSIDMacro(this );
061:
062: if ((CGILocation == null) || (CGITarget == null)
063: || (csid.isValid() == false)) {
064: valid = false;
065: }
066:
067: testTaxonomy = parameterNamed("testTaxonomy");
068: if (testTaxonomy != null) {
069: valid = true;
070: }
071:
072: if (valid) {
073: if (testTaxonomy == null) {
074: taxonomyTreeView = new TaxonomyTreeView(CGILocation,
075: CGITarget, "", "", csid, false, false, 0, 0,
076: mainRootView().width(),
077: mainRootView().height(),
078: graphical.DragPolicy.DRAGFROMDISALLOWED,
079: graphical.DragPolicy.DRAGTODISALLOWED, false,
080: graphical.Header.spacePixels,
081: graphical.Header.folderSelPixels,
082: graphical.Header.folderPixels,
083: graphical.Header.folderSelPixels,
084: graphical.Header.folderPixels,
085: graphical.Header.branchOpenSelPixels,
086: graphical.Header.branchOpenPixels,
087: graphical.Header.branchClosedSelPixels,
088: graphical.Header.branchClosedPixels,
089: graphical.Header.imageSize,
090: graphical.Header.pixelCount);
091: } else {
092: ReportError.reportError(ReportError.WARNING,
093: ReportError.ADMIN, "TaxonomyBrowse", "init",
094: Messages.USETESTTAXONOMY);
095:
096: taxonomyTreeView = new TaxonomyTreeView(
097: // Instrument.testTaxonomy(),
098: null, false, 0, 0, mainRootView().width(),
099: mainRootView().height(),
100: graphical.DragPolicy.DRAGFROMDISALLOWED,
101: graphical.DragPolicy.DRAGTODISALLOWED, false,
102: graphical.Header.spacePixels,
103: graphical.Header.folderSelPixels,
104: graphical.Header.folderPixels,
105: graphical.Header.folderSelPixels,
106: graphical.Header.folderPixels,
107: graphical.Header.branchOpenSelPixels,
108: graphical.Header.branchOpenPixels,
109: graphical.Header.branchClosedSelPixels,
110: graphical.Header.branchClosedPixels,
111: graphical.Header.imageSize,
112: graphical.Header.pixelCount);
113: }
114:
115: taxonomyTreeView.notifyOfSelect = this ;
116:
117: mainRootView().addSubview(taxonomyTreeView);
118: }
119:
120: Header.showVersion("TaxonomyBrowse", false, true);
121:
122: initialized = true;
123: }
124:
125: public boolean isInitialized() {
126: return initialized;
127: }
128:
129: public void performCommand(String command, Object arg) {
130: if (testTaxonomy != null) {
131: return;
132: }
133:
134: if ("CLASSIFICATIONSELECT".equals(command)) {
135: jso
136: .eval("fetch(\""
137: + java.net.URLEncoder.encode((String) arg)
138: + "\");");
139: } else if ("CLASSIFICATIONTOP".equals(command)) {
140: jso.eval("gototop();");
141: }
142: }
143: }
|