home *** CD-ROM | disk | FTP | other *** search
- package hhapplet;
-
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Image;
- import java.util.Vector;
- import sitemap.SiteMapParserOutput;
- import treeview.ImageSet;
- import treeview.SiblingChildTree;
- import treeview.TreeView;
- import treeview.TreeViewNode;
-
- public class SiteMapParserToContents implements SiteMapParserOutput {
- protected TreeViewNode root_tree = new TreeViewNode();
- protected int ind = 0;
- protected int real_ind = 0;
- protected Vector parent_list = new Vector();
- protected boolean done_a_node = false;
- protected boolean in_global = true;
- protected Image[] images;
- // $FF: renamed from: a java.applet.Applet
- protected Applet field_0;
- protected TreeView m_tvTheTree = null;
- protected String default_frame_name;
- protected boolean use_folder_images = false;
- protected String name;
- protected String local;
- protected String url;
- protected String frame_name;
- protected boolean new_topic;
- private int m_nItems = 0;
- protected ImageCache m_ImageCache;
- protected String imageSource = null;
- protected String imageSourceOpen = null;
- private BsscHelpRedirector m_rd;
-
- public void end() {
- this.getTree();
- this.m_tvTheTree.setFilled(true);
- this.RemoveEmptyBooks(this.m_tvTheTree.getRoot());
- this.field_0.showStatus(ResourceLib.GetRes("CompletingContents"));
- this.m_tvTheTree.layout();
- this.m_tvTheTree.ResetCursor();
- this.field_0.showStatus(ResourceLib.GetRes("Done"));
- if (this.m_tvTheTree.isVisible()) {
- this.m_tvTheTree.requestFocus();
- this.m_tvTheTree.repaint();
- }
-
- this.m_tvTheTree.setSelectionToTop();
- this.m_tvTheTree.repaint();
- }
-
- public SiteMapParserToContents(Applet var1, Image[] var2, BsscHelpRedirector var3) {
- this.field_0 = var1;
- this.images = var2;
- this.m_ImageCache = new ImageCache(var1);
- this.parent_list.setSize(1);
- this.parent_list.setElementAt(this.root_tree, 0);
- this.m_rd = var3;
- }
-
- public void object_start() {
- this.in_global = false;
- }
-
- public void throwMessage(String var1) {
- this.field_0.showStatus(var1);
- }
-
- public void indent(int var1) {
- if (var1 == 1) {
- ++this.real_ind;
- if (this.done_a_node) {
- ++this.ind;
- }
- } else if (var1 == -1) {
- this.real_ind += -1;
- this.ind = this.real_ind;
- }
-
- this.done_a_node = false;
- }
-
- public TreeView getTree() {
- if (this.m_tvTheTree == null) {
- this.m_tvTheTree = new TreeView(new ImageSet(this.images), this.root_tree);
- }
-
- this.m_tvTheTree.setApplet(this.field_0);
- this.m_tvTheTree.setBackground(Color.white);
- return this.m_tvTheTree;
- }
-
- public void RemoveEmptyBooks(TreeViewNode var1) {
- if (var1 != null) {
- if (((SiblingChildTree)var1).getChild() != null) {
- }
-
- this.RemoveEmptyBooks((TreeViewNode)((SiblingChildTree)var1).getChild());
- if (((SiblingChildTree)var1).getSibling() != null) {
- }
-
- this.RemoveEmptyBooks((TreeViewNode)((SiblingChildTree)var1).getSibling());
- if (var1 instanceof ContentsTree && ((ContentsTree)var1).local == null && ((SiblingChildTree)var1).getChild() == null) {
- ((SiblingChildTree)var1).pruneThisSubtree();
- }
-
- }
- }
-
- public void start() {
- if (this.m_tvTheTree != null) {
- this.m_tvTheTree.setFilled(false);
- this.m_tvTheTree.requestFocus();
- }
-
- if (this.m_tvTheTree == null) {
- this.m_tvTheTree = new TreeView(new ImageSet(this.images), this.root_tree);
- }
-
- this.m_tvTheTree.SetWaitCursor();
- }
-
- public boolean matchType(String var1) {
- return var1 != null && var1.toUpperCase().endsWith(".HHC");
- }
-
- public void putImage(String var1, long var2, Object var4) {
- try {
- this.m_ImageCache.putImage(var1, var2, var4);
- } catch (Exception var6) {
- ((Throwable)var6).printStackTrace();
- }
- }
-
- public void object_end() {
- if (this.ind < 1 && this.m_tvTheTree.isVisible()) {
- this.m_tvTheTree.repaint();
- }
-
- ContentsTree var1 = new ContentsTree(this.field_0, this.images, this.name, this.local, this.url, this.frame_name == null ? this.default_frame_name : this.frame_name, this.use_folder_images, this.new_topic, this.imageSource, this.imageSourceOpen, this.m_ImageCache, this.m_rd);
- this.parent_list.setSize(this.ind + 2);
- TreeViewNode var2 = (TreeViewNode)this.parent_list.elementAt(this.ind);
- ((SiblingChildTree)var2).addChild(var1);
- this.parent_list.setElementAt(var1, this.ind + 1);
- this.done_a_node = true;
- if (this.m_nItems % 3 == 0 && this.m_nItems % 4 == 0) {
- this.field_0.showStatus(ResourceLib.GetRes("LoadingTOCItem") + " [" + this.m_nItems + "]");
- }
-
- ++this.m_nItems;
- this.name = null;
- this.local = null;
- this.frame_name = null;
- this.new_topic = false;
- this.imageSource = null;
- this.imageSourceOpen = null;
- }
-
- public void param(String var1, String var2) {
- if (this.in_global) {
- if (var1.equalsIgnoreCase("ImageType")) {
- this.use_folder_images = var2.equalsIgnoreCase("Folder");
- return;
- }
-
- if (var1.equalsIgnoreCase("FrameName")) {
- this.default_frame_name = var2;
- return;
- }
- } else {
- switch (Character.toUpperCase(var1.charAt(0))) {
- case 'F':
- if (var1.equalsIgnoreCase("FrameName")) {
- this.frame_name = var2;
- return;
- }
- break;
- case 'I':
- if (var1.equalsIgnoreCase("ImageSource")) {
- this.imageSource = var2;
- return;
- }
-
- if (var1.equalsIgnoreCase("ImageSourceOpen")) {
- this.imageSourceOpen = var2;
- return;
- }
- break;
- case 'L':
- if (var1.equalsIgnoreCase("Local")) {
- this.local = var2;
- return;
- }
- break;
- case 'N':
- if (var1.equalsIgnoreCase("Name")) {
- this.name = this.fixSpecialCharacters(var2);
- return;
- }
-
- if (var1.equalsIgnoreCase("New")) {
- this.new_topic = var2.equalsIgnoreCase("1");
- return;
- }
- break;
- case 'U':
- if (var1.equalsIgnoreCase("URL")) {
- this.url = var2;
- return;
- }
- }
- }
-
- }
-
- String fixSpecialCharacters(String var1) {
- if (var1 == null) {
- return null;
- } else {
- int var2 = var1.indexOf(38);
- if (var2 < 0) {
- return var1;
- } else {
- String var3 = "";
-
- while(var2 > -1 && var2 < var1.length() - 2) {
- var3 = var3 + var1.substring(0, var2);
- String var4 = var1.substring(var2);
- int var5 = var4.indexOf(59);
- if (var5 < 0) {
- var3 = var3 + var4;
- break;
- }
-
- if (var5 < var4.length() - 1) {
- var1 = var4.substring(var5 + 1);
- } else {
- var1 = "";
- }
-
- var4 = var4.substring(1, var5);
- switch (Character.toUpperCase(var4.charAt(0))) {
- case 'A':
- if (var4.equalsIgnoreCase("amp")) {
- var4 = "&";
- }
- break;
- case 'C':
- if (var4.equalsIgnoreCase("copy")) {
- var4 = "(c)";
- }
- break;
- case 'G':
- if (var4.equalsIgnoreCase("gt")) {
- var4 = ">";
- }
- break;
- case 'L':
- if (var4.equalsIgnoreCase("lt")) {
- var4 = "<";
- }
- break;
- case 'N':
- if (var4.equalsIgnoreCase("nbsp")) {
- var4 = " ";
- }
- break;
- case 'Q':
- if (var4.equalsIgnoreCase("quot")) {
- var4 = "\"";
- }
- break;
- case 'R':
- if (var4.equalsIgnoreCase("reg")) {
- var4 = "(R)";
- }
- }
-
- var3 = var3 + var4;
- var2 = var1.indexOf(38);
- if (var2 < 0) {
- var3 = var3 + var1;
- }
- }
-
- return var3;
- }
- }
- }
- }
-