org.apache.batik.apps.svgbrowser

Class DOMViewer

public class DOMViewer extends JFrame implements ActionMap

The components of this class are used to view a DOM tree.
Nested Class Summary
protected classDOMViewer.CapturingClickButtonAction
The action associated with the 'Capturing-click' toggle button of the viewer panel.
protected classDOMViewer.CloseButtonAction
The action associated with the 'Close' button of the viewer panel
protected static classDOMViewer.ContentNodeInfo
To store the node information for an xbl:content node's selected content.
protected classDOMViewer.DOMViewerDOMDocumentTreeController
DOMDocumentTreeController implementation.
protected classDOMViewer.DOMViewerElementOverlayController
ElementOverlayController implementation.
protected classDOMViewer.DOMViewerNodePickerController
NodePickerController implementation.
protected static classDOMViewer.NodeInfo
To store the nodes informations
protected classDOMViewer.OverlayButtonAction
The action associated with the 'overlay' toggle button of the viewer panel.
classDOMViewer.Panel
The panel that contains the viewer.
protected classDOMViewer.RedoButtonAction
The action associated with the 'Redo' dropdown button of the viewer panel
protected static classDOMViewer.ShadowNodeInfo
To store the node information for a shadow tree.
protected classDOMViewer.UndoButtonAction
The action associated with the 'Undo' dropdown button of the viewer panel
Field Summary
protected static ResourceBundlebundle
The resource bundle
protected ButtonFactorybuttonFactory
The button factory.
protected booleancanEdit
Whether the DOMViewer can be used for editing the document.
protected DOMViewerControllerdomViewerController
The DOMViewer controller.
protected ElementOverlayManagerelementOverlayManager
Manages the element selection on the canvas.
protected HistoryBrowserInterfacehistoryBrowserInterface
The history browsing manager.
protected booleanisCapturingClickEnabled
Whether "capturing click" tool is enabled.
protected booleanisElementOverlayEnabled
Whether painting the overlay on the canvas is enabled.
protected Maplisteners
The map that contains the listeners
protected JToggleButtonoverlayButton
The button for enabling and disabling the overlay.
protected DOMViewer.Panelpanel
The panel.
protected static ResourceManagerresources
The resource manager
protected static StringRESOURCE
The resource file name
protected booleanshowWhitespace
Whether to show text nodes that contain only whitespace in the tree.
Constructor Summary
DOMViewer(DOMViewerController controller)
Creates a new DOMViewer panel.
Method Summary
booleancanEdit()
Whether the document can be edited using the DOMViewer.
ActiongetAction(String key)
Returns the action associated with the given string or null on error
voidresetHistory()
Resets the history.
voidselectNode(Node node)
Selects and scrolls to the given node in the document tree.
voidsetDocument(Document doc)
Sets the document to display.
voidsetDocument(Document doc, ViewCSS view)
Sets the document to display and its ViewCSS.
voidsetEditable(boolean canEdit)
Enables / disables the DOMViewer to be used to edit the documents.
voidsetShowWhitespace(boolean state)
Sets whether to show text nodes that contain only whitespace in the tree.
protected voidtoggleOverlay()
Toggles the element highlighting overlay.

Field Detail

bundle

protected static ResourceBundle bundle
The resource bundle

buttonFactory

protected ButtonFactory buttonFactory
The button factory.

canEdit

protected boolean canEdit
Whether the DOMViewer can be used for editing the document.

domViewerController

protected DOMViewerController domViewerController
The DOMViewer controller.

elementOverlayManager

protected ElementOverlayManager elementOverlayManager
Manages the element selection on the canvas.

historyBrowserInterface

protected HistoryBrowserInterface historyBrowserInterface
The history browsing manager. Manages undo / redo.

isCapturingClickEnabled

protected boolean isCapturingClickEnabled
Whether "capturing click" tool is enabled. If enabled, the element being clicked on is found and selected in the DOMViewer's document tree

isElementOverlayEnabled

protected boolean isElementOverlayEnabled
Whether painting the overlay on the canvas is enabled.

listeners

protected Map listeners
The map that contains the listeners

overlayButton

protected JToggleButton overlayButton
The button for enabling and disabling the overlay.

panel

protected DOMViewer.Panel panel
The panel.

resources

protected static ResourceManager resources
The resource manager

RESOURCE

protected static final String RESOURCE
The resource file name

showWhitespace

protected boolean showWhitespace
Whether to show text nodes that contain only whitespace in the tree.

Constructor Detail

DOMViewer

public DOMViewer(DOMViewerController controller)
Creates a new DOMViewer panel.

Method Detail

canEdit

public boolean canEdit()
Whether the document can be edited using the DOMViewer.

Returns: True if the document can be edited throught the DOMViewer

getAction

public Action getAction(String key)
Returns the action associated with the given string or null on error

Parameters: key the key mapped with the action to get

Throws: MissingListenerException if the action is not found

resetHistory

public void resetHistory()
Resets the history.

selectNode

public void selectNode(Node node)
Selects and scrolls to the given node in the document tree.

Parameters: node The node to be selected

setDocument

public void setDocument(Document doc)
Sets the document to display.

setDocument

public void setDocument(Document doc, ViewCSS view)
Sets the document to display and its ViewCSS.

setEditable

public void setEditable(boolean canEdit)
Enables / disables the DOMViewer to be used to edit the documents.

Parameters: canEdit True - The DOMViewer can be used to edit the documents

setShowWhitespace

public void setShowWhitespace(boolean state)
Sets whether to show text nodes that contain only whitespace in the tree.

toggleOverlay

protected void toggleOverlay()
Toggles the element highlighting overlay.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.