01: /*
02: LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
03:
04:
05: Copyright (C) 2003 Together
06:
07: This library is free software; you can redistribute it and/or
08: modify it under the terms of the GNU Lesser General Public
09: License as published by the Free Software Foundation; either
10: version 2.1 of the License, or (at your option) any later version.
11:
12: This library is distributed in the hope that it will be useful,
13: but WITHOUT ANY WARRANTY; without even the implied warranty of
14: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: Lesser General Public License for more details.
16:
17: You should have received a copy of the GNU Lesser General Public
18: License along with this library; if not, write to the Free Software
19: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21:
22: package org.webdocwf.util.loader.wizard;
23:
24: // Java core packages
25: import java.util.*;
26: import java.net.*;
27: import java.io.*;
28:
29: // Java extension packages
30: import javax.swing.*;
31: import javax.swing.event.*;
32:
33: public class OctopusHelpPane extends JEditorPane {
34:
35: private List history = new ArrayList();
36: private int historyIndex;
37:
38: // WebBrowserPane constructor
39: public OctopusHelpPane() {
40: // disable editing to enable hyperlinks
41: setEditable(false);
42: goToURL(getClass().getResource("HelpPages/main.html"));
43:
44: }
45:
46: // display given URL and add it to history
47: public void goToURL(URL url) {
48: displayPage(url);
49:
50: history.add(url);
51: historyIndex = history.size() - 1;
52: }
53:
54: // display next history URL in editorPane
55: public URL forward() {
56: historyIndex++;
57: if (historyIndex >= history.size())
58: historyIndex = history.size() - 1;
59:
60: URL url = (URL) history.get(historyIndex);
61: displayPage(url);
62:
63: return url;
64: }
65:
66: // display previous history URL in editorPane
67: public URL back() {
68: historyIndex--;
69:
70: // do not go past beginning of history
71: if (historyIndex < 0)
72: historyIndex = 0;
73:
74: // display previous URL
75: URL url = (URL) history.get(historyIndex);
76: displayPage(url);
77:
78: return url;
79: }
80:
81: // display given URL in JEditorPane
82: private void displayPage(URL pageURL) {
83: // display URL
84: try {
85: setPage(pageURL);
86: }
87:
88: // handle exception reading from URL
89: catch (IOException ioException) {
90: ioException.printStackTrace();
91: }
92: }
93: }
|