|
What this is
Other links
The source code/* * HelpTOCPanel.java - Help table of contents * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * * Copyright (C) 1999, 2004 Slava Pestov * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.gjt.sp.jedit.help; //{{{ Imports import com.microstar.xml.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.tree.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import org.gjt.sp.jedit.browser.FileCellRenderer; // for icons import org.gjt.sp.jedit.io.VFSManager; import org.gjt.sp.jedit.*; import org.gjt.sp.util.Log; //}}} class HelpTOCPanel extends JPanel { //{{{ HelpTOCPanel constructor HelpTOCPanel(HelpViewer helpViewer) { super(new BorderLayout()); this.helpViewer = helpViewer; nodes = new Hashtable(); toc = new TOCTree(); // looks bad with the OS X L&F, apparently... if(!OperatingSystem.isMacOSLF()) toc.putClientProperty("JTree.lineStyle", "Angled"); toc.setCellRenderer(new TOCCellRenderer()); toc.setEditable(false); toc.setShowsRootHandles(true); add(BorderLayout.CENTER,new JScrollPane(toc)); load(); } //}}} //{{{ selectNode() method void selectNode(String shortURL) { if(tocModel == null) return; DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.get(shortURL); if(node == null) return; TreePath path = new TreePath(tocModel.getPathToRoot(node)); toc.expandPath(path); toc.setSelectionPath(path); toc.scrollPathToVisible(path); } //}}} //{{{ load() method void load() { DefaultTreeModel empty = new DefaultTreeModel( new DefaultMutableTreeNode( jEdit.getProperty("helpviewer.toc.loading"))); toc.setModel(empty); toc.setRootVisible(true); VFSManager.runInWorkThread(new Runnable() { public void run() { createTOC(); tocModel.reload(tocRoot); toc.setModel(tocModel); toc.setRootVisible(false); for(int i = 0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.