home *** CD-ROM | disk | FTP | other *** search
- package allaire.controls;
-
- import allaire.util.netHelpers;
- import java.applet.Applet;
- import java.util.StringTokenizer;
- import netscape.application.AWTCompatibility;
- import netscape.application.Application;
- import netscape.application.Color;
- import netscape.application.ExternalWindow;
- import netscape.application.Font;
- import netscape.application.RootView;
- import netscape.application.Size;
- import netscape.application.View;
- import netscape.util.Vector;
-
- public class cftreeform extends Application {
- static final int maxlevels = 20;
- static final int NIMAGES = 8;
- private CFTree m_tree;
- private String m_separator;
- private boolean m_includeroot;
-
- public String cf_getNode() {
- return this.m_tree.currentItem();
- }
-
- public static void main(String[] var0) {
- cftreeform var1 = new cftreeform();
- ExternalWindow var2 = new ExternalWindow();
- ((Application)var1).setMainRootView(var2.rootView());
- Size var3 = var2.windowSizeForContentSize(320, 200);
- var2.sizeTo(var3.width, var3.height);
- var2.show();
- ((Application)var1).run();
- System.exit(0);
- }
-
- public String cf_getPath() {
- return this.m_includeroot ? this.m_tree.currentCompletePath(this.m_separator) : this.m_tree.currentPath(this.m_separator);
- }
-
- public void init() {
- super.init();
- RootView var1 = ((Application)this).mainRootView();
- int var2 = 0;
- Font var4 = Font.defaultFont();
- String var5 = ((Application)this).parameterNamed("treeitems");
- String var6 = ((Application)this).parameterNamed("border");
- String var7 = ((Application)this).parameterNamed("vscroll");
- String var8 = ((Application)this).parameterNamed("hscroll");
- String var9 = ((Application)this).parameterNamed("showlinks");
- String var10 = ((Application)this).parameterNamed("font");
- String var11 = ((Application)this).parameterNamed("fontsize");
- String var12 = ((Application)this).parameterNamed("fontweight");
- String var13 = ((Application)this).parameterNamed("root");
- String var14 = ((Application)this).parameterNamed("appendkey");
- Vector var15 = new Vector();
- boolean var16 = false;
- String[] var17 = new String[]{"folder", "computer", "floppy", "fixed", "remote", "cd", "document", "element"};
- this.m_separator = ((Application)this).parameterNamed("separator");
- if (this.m_separator == null) {
- this.m_separator = "\\";
- }
-
- var1.setColor(Color.white);
- if (var10 == null) {
- var10 = var4.name();
- } else {
- var16 = true;
- }
-
- int var3;
- if (var11 == null) {
- var3 = var4.size();
- } else {
- var3 = Integer.parseInt(var11);
- var16 = true;
- }
-
- if (var12 == null) {
- var2 = var4.style();
- } else {
- if (var12.indexOf("BOLD") >= 0) {
- ++var2;
- }
-
- if (var12.indexOf("ITALIC") >= 0) {
- var2 += 2;
- }
-
- var16 = true;
- }
-
- if (var13 != null && var13.compareTo("Y") == 0) {
- this.m_includeroot = true;
- }
-
- this.m_tree = new CFTree(0, 0, ((View)var1).width(), ((View)var1).height(), var1);
- if (var16) {
- this.m_tree.setFont(Font.fontNamed(var10, var2, var3));
- }
-
- if (var6 == null || var6.compareTo("no") != 0) {
- this.m_tree.setBorder(true);
- }
-
- if (var7 == null || var7.compareTo("no") != 0) {
- this.m_tree.setVScroll(true);
- }
-
- if (var9 != null && var9.compareTo("no") == 0) {
- this.m_tree.showURLs(false);
- }
-
- if (var14 != null && var14.compareTo("N") == 0) {
- this.m_tree.appendKeys(false);
- }
-
- if (var8 == null || var8.compareTo("no") != 0) {
- this.m_tree.setHScroll(true);
- }
-
- if (var5 != null) {
- var5 = netHelpers.URLDecode(var5);
- StringTokenizer var18 = new StringTokenizer(var5, "\u0002");
- String var23 = null;
- int var30 = -1;
-
- int var28;
- for(int[] var31 = new int[20]; var18.hasMoreTokens(); var30 = var28) {
- String var19 = var18.nextToken();
- StringTokenizer var34 = new StringTokenizer(var19, "\u0001");
- String var20;
- if (var34.hasMoreTokens()) {
- var20 = var34.nextToken();
- } else {
- var20 = "-1";
- }
-
- var28 = Integer.parseInt(var20);
- String var22;
- if (var34.hasMoreTokens()) {
- var22 = var34.nextToken();
- } else {
- var22 = "";
- }
-
- String var21;
- if (var34.hasMoreTokens()) {
- var21 = var34.nextToken();
- if (var21.compareTo("\u0003") == 0) {
- var21 = var22;
- }
- } else {
- var21 = var22;
- }
-
- int var29;
- boolean var32;
- if (var34.hasMoreTokens()) {
- var23 = var34.nextToken();
- var29 = 0;
- if (var23.compareTo("\u0003") == 0) {
- var32 = false;
- } else {
- var32 = true;
- if (var23.indexOf(46) == -1 && var23.indexOf(58) == -1 && var23.indexOf(92) == -1 && var23.indexOf(47) == -1) {
- int var35 = 0;
-
- do {
- if (var23.equalsIgnoreCase(var17[var35])) {
- var32 = false;
- var29 = 2 * var35;
- break;
- }
-
- ++var35;
- } while(var35 < 8);
- }
- }
- } else {
- var32 = false;
- var29 = 0;
- }
-
- String var24;
- if (var34.hasMoreTokens()) {
- var24 = var34.nextToken();
- if (var24.compareTo("\u0003") == 0) {
- var24 = null;
- }
- } else {
- var24 = null;
- }
-
- String var25;
- String var26;
- if (var34.hasMoreTokens()) {
- var25 = var34.nextToken();
- if (var34.hasMoreTokens()) {
- var26 = var34.nextToken();
- } else {
- var26 = "";
- }
-
- if (var25.compareTo("\u0003") == 0) {
- var25 = null;
- var26 = null;
- } else if (var26.compareTo("\u0003") == 0) {
- var26 = "";
- }
- } else {
- var25 = null;
- var26 = null;
- }
-
- boolean var33;
- if (var34.hasMoreTokens()) {
- String var27 = var34.nextToken();
- if (var27.compareTo("H") == 0) {
- var33 = true;
- } else {
- var33 = false;
- }
- } else {
- var33 = false;
- }
-
- if (var28 > 19) {
- var28 = 19;
- } else if (var28 > var30 + 1) {
- var28 = var30 + 1;
- }
-
- if (var28 == -1) {
- var31[0] = this.m_tree.addItem(var21, var22, var28, var29);
- if (var33) {
- var15.addElement(new Integer(var31[0]));
- }
- } else {
- var31[var28 + 1] = this.m_tree.addItem(var21, var22, var31[var28], var29);
- if (var33) {
- var15.addElement(new Integer(var31[var28 + 1]));
- }
- }
-
- if (var32) {
- this.m_tree.setItemImageURL(var31[var28 + 1], var23, var24 == null ? var23 : var24);
- }
-
- if (var25 != null) {
- this.m_tree.setItemURL(var31[var28 + 1], var25, var26, false);
- }
- }
- }
-
- if (var15.size() > 0) {
- int var39 = var15.size();
-
- for(int var40 = 0; var40 < var39; ++var40) {
- CFTreeItem var37 = this.m_tree.itemAt((Integer)var15.elementAt(var40));
- this.m_tree.hideChildren(var37);
- }
- }
-
- CFTreeFormApplet var38 = (CFTreeFormApplet)AWTCompatibility.awtApplet();
- var38.m_treeControl = this;
- ((Applet)var38).showStatus("");
- }
- }
-