- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,TocTree
,UrlTocTree
A DOCTYPE directive is not necessary - the DTD above will be assumed. If a DOCTYPE directive is desired (e.g, for documentation reasons), one should use "sreource:/org/bzdev/swing/toc.dtd". For each<!ELEMENT toc (node) > <!ELEMENT node (node)*> <!ATTLIST node title CDATA #IMPLIED uri CDATA #IMPLIED href CDATA #IMPLIED >
node
element, the title
attribute
will be the title that appears in a table-of-contents panel and
the uri
attribute provides the URI for the contents
for that title. The contents should be an HTML document using HTML 3.2
the HTML version that Java supports (Java is slowly migrating to full
HTML 4.0 support but this class uses whatever the standard Java runtime
environment supports). The href
attribute is ignored by
HtmlWithTocPane and is provided in case the XML file is also used by
a web server, in which case the URL it needs to use may be
different than the one provided by the uri
attribute.
After the document is loaded (e.g., by using one of the
constructors for this class), one should call
setSelectionWithAction(row)
to select the initial row
and the corresponding URL. This will almost always be row 0. If
setSelectionWithAction
is not called, no initial
contents will appear in the HTML portion of the pane.
To initialize the class manually, use the same procedure as for
an instance of the class UrlTocPane
.
A number of method signatures are borrowed from the JSplitPane class
(with some of the Javadoc comments) and simply call the
corresponding JSplitPane methods (but with 'left' and 'right' replaced by
the edges closest to the TOC pane and HTML pane respectively.
When an instance of this class is no longer needed, one should call
clearToc()
to release some resources.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsConstructorDescriptionClass Constructor.Class Constructor specifying an input stream for initialization.HtmlWithTocPane
(InputStream is, boolean expand) Class Constructor specifying an input stream for initialization and a flag indicating if the nodes should be expanded or not.HtmlWithTocPane
(InputStream is, boolean expand, boolean validating) Class constructor specifying and input stream for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used.HtmlWithTocPane
(String url) Class constructor specifying an URL represented as a String for initialization.HtmlWithTocPane
(String url, boolean expand) Class constructor specifying an URL represented as a String for initialization and a flag indicating if the nodes should be expanded or not.HtmlWithTocPane
(String url, boolean expand, boolean validating) Class Constructor specifying and URL represented as a String for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used.HtmlWithTocPane
(URL url) Class constructor specifying an URL for initialization.HtmlWithTocPane
(URL url, boolean expand) Class Constructor specifying an URL for initialization and a flag indicating if the nodes should be expanded or not.HtmlWithTocPane
(URL url, boolean expand, boolean validating) Class Constructor specifying and URL for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an action listener.void
Add a new node to the tree, giving it a name.void
Add an entry.void
Add an entry.void
Clear the selection.void
clearToc()
Clear the table of contents and puts it in a state where entries can be added.void
collapseRow
(int row) Ensures that the node in the specified row is collapsed.void
Assert that no more entries will be added.void
entriesCompleted
(boolean expand) Assert that no more entries will be added.void
expandRow
(int row) Ensures that the node in the specified row is expanded and viewable.Get the border for this component's contents.int
Returns the last value passed to setDividerLocation.final String
Get the title used in error message dialog boxes associated with the HTML pane.Get the border for this component's HTML pane.Get the preferred size for the HTML pane.double
Returns the number that determines how extra space is distributed.Get the border for this component's split pane.final Color
Get the background color for the table of contents.Get the tre cell renderer for the table of contents.final Color
Get the foreground color for the table of contents.Get the border for this component's table of contents.Get the preferred size for the TOC pane.boolean
isCollapsed
(int row) Returns true if the node at the specified display row is collapsed.boolean
isExpanded
(int row) Returns true if the node at the specified display row is currently expanded.void
Add a new level to the tree rooted at the last node entered.void
Return to the previous level in the tree.void
Remove an action listener.void
Reset the split pane to the preferred sizes.void
setBackground
(Color color) Set the background color.void
void
setContentLocale
(Locale locale) Set the local of the content pane.void
setContentPaneBorder
(Border border) Set the border for this component's contents.void
setDividerLocation
(double proportionalLocation) Sets the divider location as a percentage of the HtmlWithTocPane's size.void
setDividerLocation
(int location) Sets the location of the divider.void
setHtmlButtonBackground
(Color color, boolean rvmode) Set the background color for the 'start', 'back', 'reload', 'forward', and 'end' controls.void
setHtmlPaneBackground
(Color color) Set the background color for the HTML pane.void
setHtmlPaneBorder
(Border border) Set the border for this component's HTML pane.void
setHtmlPanePreferredSize
(Dimension preferredSize) Set the preferred size for the HTML pane.void
Set the background color for the HTML pane scroll bars.void
void
setResizeWeight
(double weight) Specifies how to distribute extra space when the size of the split pane changes.void
setSelectionWithAction
(int row) Set the selection and perform an action.void
setSplitPaneBorder
(Border border) Set the border for this component's split pane.void
setSplitterBackground
(Color color) Set the background color of the splitter (or divider).void
setToc
(InputStream is, boolean expand, boolean validating) Set the table of contents from a URL represented as a String.void
Set the table of contents from a URL represented as a String.void
Set the table of contents from a URL.final void
Set the background color for the table of contents.void
Set the background color for items that are not selected in the table of contents.void
Set the background color for items that are selected in the table of contents.final void
Set the foreground color for the table of contents.void
setTocPaneBorder
(Border border) Set the border for this component's table of contents.void
setTocPreferredSize
(Dimension preferredSize) Set the preferred size for the Table of Contents pane.void
setTocScrollbarBackground
(Color color) Set the background color for the table of contents scroll bars.final void
setTocTCRFont
(Font font) Set the font for the entries in table of contents.void
Set the color of text describing items that are not selected in the table of contents.void
Set the color of text describing items that are selected in the table of contents.Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
HtmlWithTocPane
public HtmlWithTocPane()Class Constructor. -
HtmlWithTocPane
public HtmlWithTocPane(InputStream is) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class Constructor specifying an input stream for initialization. The input stream contains an XML document.- Parameters:
is
- The input stream- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(InputStream is, boolean expand) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class Constructor specifying an input stream for initialization and a flag indicating if the nodes should be expanded or not. The input stream contains an XML document.- Parameters:
is
- The input streamexpand
- True if the nodes should be expanded; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(InputStream is, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class constructor specifying and input stream for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used. The input stream contains an XML document.- Parameters:
is
- The input streamexpand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(URL url) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class constructor specifying an URL for initialization. The URL contains an XML document.- Parameters:
url
- The URL- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(URL url, boolean expand) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class Constructor specifying an URL for initialization and a flag indicating if the nodes should be expanded or not. The URL contains an XML document.- Parameters:
url
- The URLexpand
- True if the nodes should be expanded; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(URL url, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Class Constructor specifying and URL for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used. The URL contains an XML document.- Parameters:
url
- The URLexpand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configured
-
HtmlWithTocPane
public HtmlWithTocPane(String url) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException, MalformedURLException Class constructor specifying an URL represented as a String for initialization. The URL contains an XML document.- Parameters:
url
- The URL- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configuredMalformedURLException
- if the url is malformed
-
HtmlWithTocPane
public HtmlWithTocPane(String url, boolean expand) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException, MalformedURLException Class constructor specifying an URL represented as a String for initialization and a flag indicating if the nodes should be expanded or not. The URL contains an XML document.- Parameters:
url
- The URLexpand
- True if the nodes should be expanded; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configuredMalformedURLException
- if the url is malformed
-
HtmlWithTocPane
public HtmlWithTocPane(String url, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException, MalformedURLException Class Constructor specifying and URL represented as a String for initialization, a flag indicating if the nodes should be expanded or not, and a flag indicating if a validating parser should be used. The URL contains an XML document.- Parameters:
url
- The URLexpand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the URL in not well formed or is not valid.IOException
- an IO error was seenParserConfigurationException
- the XML parser cannot be configuredMalformedURLException
- if the url is malformed
-
-
Method Details
-
setComponentOrientation
- Overrides:
setComponentOrientation
in classComponent
-
setLocale
-
setContentLocale
Set the local of the content pane. This method allows the locale of the content panes (the table of contents and its corresponding HTML pane) to be set without changing the layout of navigation controls.- Parameters:
locale
- the locale.
-
getSplitPaneBorder
Get the border for this component's split pane.- Returns:
- the border
-
setSplitPaneBorder
Set the border for this component's split pane.- Parameters:
border
- the border
-
getTocPaneBorder
Get the border for this component's table of contents.- Returns:
- the border
-
setTocPaneBorder
Set the border for this component's table of contents.- Parameters:
border
- the border
-
getHtmlPaneBorder
Get the border for this component's HTML pane.- Returns:
- the border
-
setHtmlPaneBorder
Set the border for this component's HTML pane.- Parameters:
border
- the border
-
getContentPaneBorder
Get the border for this component's contents.- Returns:
- the border
-
setContentPaneBorder
Set the border for this component's contents.- Parameters:
border
- the border
-
getTocPreferredSize
Get the preferred size for the TOC pane.- Returns:
- the preferred size
-
getHtmlPanePreferredSize
Get the preferred size for the HTML pane.- Returns:
- the preferred size
-
setTocPreferredSize
Set the preferred size for the Table of Contents pane.- Parameters:
preferredSize
- the preferred size
-
setHtmlPanePreferredSize
Set the preferred size for the HTML pane.- Parameters:
preferredSize
- the preferred size
-
setBackground
Set the background color. This method will also set the background color of scroll bars unless the last call tosetTocScrollbarBackground(Color)
orsetHtmlPaneScrollbarBackground(Color)
if any were made, had a non-null argument, which explicitly sets the background color for the corresponding scrollbars.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Overrides:
setBackground
in classJComponent
- Parameters:
color
- the color
-
setTocScrollbarBackground
Set the background color for the table of contents scroll bars. If color is null and the last call tosetBackground(Color)
, if one was made, had a non-null argument, that background color will be used. If the last call tosetBackground(Color)
had a null argument, the color passed as an argument will be used.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
color
- the color; null for the default color
-
setHtmlPaneScrollbarBackground
Set the background color for the HTML pane scroll bars. If color is null and the last call tosetBackground(Color)
, if one was made, had a non-null argument, that background color will be used. If the last call tosetBackground(Color)
had a null argument, the color passed as an argument will be used.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
color
- the color; null for the default color as modified by the last call (if any) tosetBackground(Color)
-
setHtmlButtonBackground
Set the background color for the 'start', 'back', 'reload', 'forward', and 'end' controls. When rvmode is true, the icons will be white when enabled and grey when disabled, the reverse from the normal behavior.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
color
- the colorrvmode
- true for reverse video; false otherwise
-
setSplitterBackground
Set the background color of the splitter (or divider).Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
color
- the color
-
setHtmlPaneBackground
Set the background color for the HTML pane.Note: sometimes the background color for the HTML pane will be visible such as when the HTML code is being loaded and this method can produce a suitable color for this case.
Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
color
- the color
-
resetToPreferredSizes
public void resetToPreferredSizes()Reset the split pane to the preferred sizes. This must be called after individual preferred sizes are set for those to have any effect. The divider may move as a result of using this method. -
setDividerLocation
public void setDividerLocation(double proportionalLocation) Sets the divider location as a percentage of the HtmlWithTocPane's size.This method is implemented in terms of
setDividerLocation(int)
. This method immediately changes the size of the split pane based on its current size. If the split pane is not correctly realized and on screen, this method will have no effect (new divider location will become (current size * proportionalLocation) which is 0).- Parameters:
proportionalLocation
- a double-precision floating point value that specifies a percentage, from zero (The TOC side of the component) to 1.0 (the HTML Pane side of the component)
-
getDividerLocation
public int getDividerLocation()Returns the last value passed to setDividerLocation. The value returned from this method may differ from the actual divider location (if setDividerLocation was passed a value bigger than the current size).- Returns:
- an integer specifying the location of the divider
-
setDividerLocation
public void setDividerLocation(int location) Sets the location of the divider. This is passed off to the look and feel implementation, and then listeners are notified. A value less than 0 implies the divider should be reset to a value that attempts to honor the preferred size of the TOC component.- Parameters:
location
- an integer specifying the location of the divider measured from the right or left hand edge adjacent to the TOC pane.
-
setResizeWeight
public void setResizeWeight(double weight) Specifies how to distribute extra space when the size of the split pane changes. A value of 0, the default, indicates the right/bottom component gets all the extra space (the left/top component acts fixed), where as a value of 1 specifies the left/top component gets all the extra space (the right/bottom component acts fixed). Specifically, the left/top component gets (weight * diff) extra space and the right/bottom component gets (1 - weight) * diff extra space.- Parameters:
weight
- as described above
-
getResizeWeight
public double getResizeWeight()Returns the number that determines how extra space is distributed.- Returns:
- how extra space is to be distributed on a resize of the split pane contained in this component.
-
addEntry
Description copied from interface:TocTree
Add a new node to the tree, giving it a name. -
addEntry
Description copied from interface:UrlTocTree
Add an entry. This will define a new TOC entry.- Specified by:
addEntry
in interfaceUrlTocTree
- Parameters:
title
- A string naming the entry.url
- The URL to associate with the entry;- Throws:
MalformedURLException
- if the url is malformed- See Also:
-
addEntry
Description copied from interface:UrlTocTree
Add an entry. This will define a new TOC entry.- Specified by:
addEntry
in interfaceUrlTocTree
- Parameters:
title
- A string naming the entry.url
- The URL to associate with the entry;- Throws:
MalformedURLException
- if the url is malformed- See Also:
-
nextLevel
public void nextLevel()Description copied from interface:TocTree
Add a new level to the tree rooted at the last node entered. -
prevLevel
public void prevLevel()Description copied from interface:TocTree
Return to the previous level in the tree. -
entriesCompleted
public void entriesCompleted()Description copied from interface:TocTree
Assert that no more entries will be added. A call to this method will complete construction of the tree. It is equivalent to callingentriesCompleted(false)
.- Specified by:
entriesCompleted
in interfaceTocTree
- See Also:
-
entriesCompleted
public void entriesCompleted(boolean expand) Description copied from interface:TocTree
Assert that no more entries will be added. A call to this method will complete construction of the tree.- Specified by:
entriesCompleted
in interfaceTocTree
- Parameters:
expand
-true
if all nodes should be expanded before the tree is displayed; false if no nodes should be expanded- See Also:
-
setSelectionWithAction
public void setSelectionWithAction(int row) Description copied from interface:TocTree
Set the selection and perform an action. This method should be called after the call toentriesCompleted
. It sets the selected object and callsfireActionPerformed()
. Rows are indexed with 0 indicating the first visible node and with only visible nodes counted, regardless of whether these nodes are displayable. Expanding or collapsing nodes changes the indexing. Changing the portion of the pane that is shown in the display does not change the indexing. At the time this description was written, the JTree documentation was somewhat obscure regarding how this indexing works.- Specified by:
setSelectionWithAction
in interfaceTocTree
- Parameters:
row
- the row to select.
-
clearSelection
public void clearSelection()Description copied from interface:TocTree
Clear the selection. This method also generates action events with the source set to an entry with a null title and a null object.- Specified by:
clearSelection
in interfaceTocTree
-
addActionListener
Description copied from interface:TocTree
Add an action listener.- Specified by:
addActionListener
in interfaceTocTree
- Parameters:
l
- the action listener to add.
-
removeActionListener
Description copied from interface:TocTree
Remove an action listener.- Specified by:
removeActionListener
in interfaceTocTree
- Parameters:
l
- the action listener to remove.
-
collapseRow
public void collapseRow(int row) Description copied from interface:TocTree
Ensures that the node in the specified row is collapsed. If row is < 0 or ≥ getRowCount this will have no effect.- Specified by:
collapseRow
in interfaceTocTree
- Parameters:
row
- an integer specifying a row, where 0 is the first viewable row.
-
expandRow
public void expandRow(int row) Description copied from interface:TocTree
Ensures that the node in the specified row is expanded and viewable. If row is < 0 or ≥ getRowCount this will have no effect. -
isCollapsed
public boolean isCollapsed(int row) Description copied from interface:TocTree
Returns true if the node at the specified display row is collapsed.- Specified by:
isCollapsed
in interfaceTocTree
- Parameters:
row
- the row to check, where 0 is the first viewable row.- Returns:
- true if the node is currently collapsed, otherwise false
-
isExpanded
public boolean isExpanded(int row) Description copied from interface:TocTree
Returns true if the node at the specified display row is currently expanded.- Specified by:
isExpanded
in interfaceTocTree
- Parameters:
row
- he row to check, where 0 is the first viewable row.- Returns:
- true if the node is currently expanded, otherwise false
-
clearToc
public void clearToc()Description copied from interface:TocTree
Clear the table of contents and puts it in a state where entries can be added. -
setToc
public void setToc(URL url, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException, MalformedURLException Description copied from interface:UrlTocTree
Set the table of contents from a URL. This method should be used as as an alternative toaddEntry
,nextLevel
,prevLevel
andentriesCompleted
- Specified by:
setToc
in interfaceUrlTocTree
- Parameters:
url
- the URL containing the table of contents.expand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenMalformedURLException
- if the url is malformedParserConfigurationException
- the XML parser cannot be configured
-
setToc
public void setToc(String url, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Description copied from interface:UrlTocTree
Set the table of contents from a URL represented as a String. This method should be used as as an alternative toaddEntry
,nextLevel
,prevLevel
andentriesCompleted
- Specified by:
setToc
in interfaceUrlTocTree
- Parameters:
url
- the URL containing the table of contents.expand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenMalformedURLException
- the string representing the URL was illformed.ParserConfigurationException
- the XML parser cannot be configured
-
setToc
public void setToc(InputStream is, boolean expand, boolean validating) throws FactoryConfigurationError, SAXException, IOException, ParserConfigurationException Description copied from interface:UrlTocTree
Set the table of contents from a URL represented as a String. This method should be used as as an alternative toaddEntry
,nextLevel
,prevLevel
andentriesCompleted
- Specified by:
setToc
in interfaceUrlTocTree
- Parameters:
is
- the Inputstream containing the table of contents.expand
- True if the nodes should be expanded; false otherwisevalidating
- True if the parser is validating; false otherwise- Throws:
FactoryConfigurationError
- the XML parser cannot be configuredSAXException
- the XML data in the input stream in not well formed or is not valid.IOException
- an IO error was seenMalformedURLException
- the string representing the URL was illformed.ParserConfigurationException
- the XML parser cannot be configured
-
getHtmlErrorTitle
Get the title used in error message dialog boxes associated with the HTML pane.- Returns:
- the current title.
-
getTocCellRenderer
Get the tre cell renderer for the table of contents.- Returns:
- the cell renderer
-
getTocBackgound
Get the background color for the table of contents.- Returns:
- the background color for the table of contents (if none has been explicitly set, the background color of the TOC component's parent is returned)
-
setTocBackground
Set the background color for the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the background color; null if the parent component's color should be used.
-
getTocForeground
Get the foreground color for the table of contents.- Returns:
- the foreground color for the table of contents (if none has been explicitly set, the foreground color of the TOC component's parent is returned)
-
setTocForeground
Set the foreground color for the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the foreground color; null if the parent component's color should be used.
-
setTocBackgroundSelectionColor
Set the background color for items that are selected in the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the color
-
setTocBackgroundNonSelectionColor
Set the background color for items that are not selected in the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the color
-
setTocTextSelectionColor
Set the color of text describing items that are selected in the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the color
-
setTocTextNonSelectionColor
Set the color of text describing items that are not selected in the table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
c
- the color
-
setTocTCRFont
Set the font for the entries in table of contents.Note: with some pluggable look and feels, this method may be fully or partially ignored. It works as expected with the default look and feel.
- Parameters:
font
- the font
-