## org.apache.batik.apps.svgbrowser
Class DOMViewer.Panel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      org.apache.batik.apps.svgbrowser.DOMViewer.Panel

All Implemented Interfaces:
  java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

Enclosing class:
  DOMViewer

    public class DOMViewer.Panel

extends javax.swing.JPanel

The panel that contains the viewer.

See Also:
  Serialized Form

Nested Class Summary
`protected class` `DOMViewer.Panel.AttributeModificationHandler` Handles "DOMAttrModified" event.
`protected class` `DOMViewer.Panel.CapturingClickHandler` Handles the capturing "mouseclick" event.
`protected class` `DOMViewer.Panel.CharacterPanel` The CharacterData panel text area.
`protected class` `DOMViewer.Panel.CharDataModificationHandler` Handles "DOMCharacterDataModified" event.
`protected class` `DOMViewer.Panel.DOMTreeSelectionListener` To listen to the tree selection.
`protected class` `DOMViewer.Panel.NodeCSSValuesModel` To display the CSS properties of a DOM node in a table.
`protected class` `DOMViewer.Panel.NodeInsertionHandler` Handles "DOMNodeInserted" event.
`protected class` `DOMViewer.Panel.NodeRemovalHandler` Handles "DOMNodeRemoved" event.
`protected class` `DOMViewer.Panel.NodeRenderer` To render the tree nodes.
`protected class` `DOMViewer.Panel.NodeTemplateParser` Parser for the Element template.
`protected class` `DOMViewer.Panel.TreeNodeAdder` Handles tree pop-up menu action for adding new node.
`protected class` `DOMViewer.Panel.TreeNodeRemover` Handles tree pop-up menu action for removing nodes.
`protected class` `DOMViewer.Panel.TreePopUpListener` Tree popup listener.

Nested classes/interfaces inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes/interfaces inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes/interfaces inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes/interfaces inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static java.lang.String` `ATTRIBUTE_MODIFIED`
`protected NodePickerPanel` `attributePanel` The panel to show the nodes attributes.
`protected java.awt.GridBagConstraints` `attributePanelLayout` The layout for the attribute panel.
`protected EventListener` `attrModification` "Attribute modified" DOM Mutation Listener.
`protected EventListener` `capturingListener` Capturing "click" event type listener.
`static java.lang.String` `CHAR_DATA_MODIFIED`
`protected DOMViewer.Panel.CharacterPanel` `characterDataPanel` The CharacterData node panel.
`protected EventListener` `charDataModification` "Character data modified" DOM Mutation Listener.
`protected org.w3c.dom.Document` `document` The DOM document.
`protected javax.swing.JTextArea` `documentInfo` The documentInfo panel text area.
`protected javax.swing.JPanel` `documentInfoPanel` The documentInfo node panel.
`protected javax.swing.JPanel` `elementPanel` The element panel.
`static java.lang.String` `NODE_INSERTED`
`static java.lang.String` `NODE_REMOVED`
`protected EventListener` `nodeInsertion` "Node inserted" DOM Mutation Listener.
`protected EventListener` `nodeRemoval` "Node removed" DOM Mutation Listener.
`protected javax.swing.JTable` `propertiesTable` The properties table.
`protected java.awt.GridBagConstraints` `propertiesTableLayout` The layout for the properties table.
`protected javax.swing.JPanel` `rightPanel` The right panel.
`protected javax.swing.JSplitPane` `splitPane` The split pane.
`protected DOMDocumentTree` `tree` The tree.
`protected org.w3c.dom.css.ViewCSS` `viewCSS` The ViewCSS object associated with the document.

Fields inherited from class javax.swing.JComponent
`accessibleContext, 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
`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
`DOMViewer.Panel()` Creates a new Panel object.

Method Summary
`protected void` `addCapturingListener(org.w3c.dom.Document doc)` Registers capturing "click" listener on the document element of the given document.
`protected void` `addDomMutationListeners(org.w3c.dom.Document doc)` Registers DOM Mutation Listener on the given document.
`protected javax.swing.JMenu` `createTemplatesMenu(java.lang.String name)` Creates JMenu menu using `NodeTemplates`.
`protected javax.swing.tree.MutableTreeNode` `createTree(org.w3c.dom.Node node, boolean showWhitespace)` Creates a swing tree from a DOM document.
`protected javax.swing.tree.DefaultMutableTreeNode` `findNode(javax.swing.JTree theTree, org.w3c.dom.Node node)` Finds and returns the node in the tree that represents the given node in the document.
`protected void` `refreshGUI(java.lang.Runnable runnable)` Checks whether the DOMViewer can be used to edit the document and if true refreshes the DOMViewer after the DOM Mutation event occured.
`protected void` `registerAttributeAdded(MutationEvent mevt)` Adds the "DOMAttrModified" Mutation event, of the MutationEvent.ADDITION type to current history browser's interface compound command
`protected void` `registerAttributeChanged(MutationEvent mevt)` Checks what type of the "DOMAttrModified" mutation event occured, and invokes the appropriate method to register the change.
`protected void` `registerAttributeModified(MutationEvent mevt)` Adds the "DOMAttrModified" Mutation event, of the MutationEvent.MODIFICATION type to current history browser's interface compound command
`protected void` `registerAttributeRemoved(MutationEvent mevt)` Adds the "DOMAttrModified" Mutation event, of the MutationEvent.REMOVAL type to current history browser's interface compound command
`protected void` `registerCharDataModified(MutationEvent mevt)` Adds the "DOMCharDataModified" Mutation event to current history browser's interface compound command
`protected void` `registerDocumentChange(MutationEvent mevt)` Puts the document change in the current history browser's interface compound command if the document change occured outside of the DOMViewer.
`protected void` `registerNodeInserted(MutationEvent mevt)` Adds the "DOMNodeInserted" Mutation event to current history browser's interface compound command
`protected void` `registerNodeRemoved(MutationEvent mevt)` Adds the "DOMNodeRemoved" Mutation event to current history browser's interface compound command
`protected void` `removeCapturingListener(org.w3c.dom.Document doc)` Removes previously registered capturing "click" event listener from the document element of the given document.
`protected void` `removeDomMutationListeners(org.w3c.dom.Document doc)` Removes previously registered mutation listeners from the document.
`void` `selectNode(org.w3c.dom.Node targetNode)` Finds and selects the given node in the document tree.
`void` `setDocument(org.w3c.dom.Document doc)` Sets the document to display.
`void` `setDocument(org.w3c.dom.Document doc, org.w3c.dom.css.ViewCSS view)` Sets the document to display and its ViewCSS.
`protected boolean` `shouldRegisterDocumentChange()` Checks if the document change that occured should be registered.

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setBackground, 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`

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, transferFocusBackward, 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, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### NODE_INSERTED

    public static final java.lang.String NODE_INSERTED

See Also:
  Constant Field Values

### NODE_REMOVED

    public static final java.lang.String NODE_REMOVED

See Also:
  Constant Field Values

### ATTRIBUTE_MODIFIED

    public static final java.lang.String ATTRIBUTE_MODIFIED

See Also:
  Constant Field Values

### CHAR_DATA_MODIFIED

    public static final java.lang.String CHAR_DATA_MODIFIED

See Also:
  Constant Field Values

### document

    protected org.w3c.dom.Document document

  The DOM document.

### nodeInsertion

    protected EventListener nodeInsertion

  "Node inserted" DOM Mutation Listener.

### nodeRemoval

    protected EventListener nodeRemoval

  "Node removed" DOM Mutation Listener.

### attrModification

    protected EventListener attrModification

  "Attribute modified" DOM Mutation Listener.

### charDataModification

    protected EventListener charDataModification

  "Character data modified" DOM Mutation Listener.

### capturingListener

    protected EventListener capturingListener

  Capturing "click" event type listener. Allows the "capturing click" option

### viewCSS

    protected org.w3c.dom.css.ViewCSS viewCSS

  The ViewCSS object associated with the document.

### tree

    protected DOMDocumentTree tree

  The tree.

### splitPane

    protected javax.swing.JSplitPane splitPane

  The split pane.

### rightPanel

    protected javax.swing.JPanel rightPanel

  The right panel.

### propertiesTable

    protected javax.swing.JTable propertiesTable

  The properties table.

### attributePanel

    protected NodePickerPanel attributePanel

  The panel to show the nodes attributes.

### attributePanelLayout

    protected java.awt.GridBagConstraints attributePanelLayout

  The layout for the attribute panel.

### propertiesTableLayout

    protected java.awt.GridBagConstraints propertiesTableLayout

  The layout for the properties table.

### elementPanel

    protected javax.swing.JPanel elementPanel

  The element panel.

### characterDataPanel

    protected DOMViewer.Panel.CharacterPanel characterDataPanel

  The CharacterData node panel.

### documentInfo

    protected javax.swing.JTextArea documentInfo

  The documentInfo panel text area.

### documentInfoPanel

    protected javax.swing.JPanel documentInfoPanel

  The documentInfo node panel.

Constructor Detail

### DOMViewer.Panel

    public DOMViewer.Panel()

  Creates a new Panel object.

Method Detail

### setDocument

    public void setDocument(org.w3c.dom.Document doc)

  Sets the document to display.

### setDocument

    public void setDocument(org.w3c.dom.Document doc,
                            org.w3c.dom.css.ViewCSS view)

  Sets the document to display and its ViewCSS.

### addDomMutationListeners

    protected void addDomMutationListeners(org.w3c.dom.Document doc)

  Registers DOM Mutation Listener on the given document.

  Parameters:
    `doc` - The given document

### removeDomMutationListeners

    protected void removeDomMutationListeners(org.w3c.dom.Document doc)

  Removes previously registered mutation listeners from the document.

  Parameters:
    `doc` - The document

### addCapturingListener

    protected void addCapturingListener(org.w3c.dom.Document doc)

  Registers capturing "click" listener on the document element of the given document.

  Parameters:
    `doc` - The given document

### removeCapturingListener

    protected void removeCapturingListener(org.w3c.dom.Document doc)

  Removes previously registered capturing "click" event listener from the document element of the given document.

  Parameters:
    `doc` - The given document

### refreshGUI

    protected void refreshGUI(java.lang.Runnable runnable)

  Checks whether the DOMViewer can be used to edit the document and if true refreshes the DOMViewer after the DOM Mutation event occured.

  Parameters:
    `runnable` - The runnable to invoke for refresh

### registerNodeInserted

    protected void registerNodeInserted(MutationEvent mevt)

  Adds the "DOMNodeInserted" Mutation event to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### registerNodeRemoved

    protected void registerNodeRemoved(MutationEvent mevt)

  Adds the "DOMNodeRemoved" Mutation event to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### registerAttributeAdded

    protected void registerAttributeAdded(MutationEvent mevt)

  Adds the "DOMAttrModified" Mutation event, of the MutationEvent.ADDITION type to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### registerAttributeRemoved

    protected void registerAttributeRemoved(MutationEvent mevt)

  Adds the "DOMAttrModified" Mutation event, of the MutationEvent.REMOVAL type to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### registerAttributeModified

    protected void registerAttributeModified(MutationEvent mevt)

  Adds the "DOMAttrModified" Mutation event, of the MutationEvent.MODIFICATION type to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### registerAttributeChanged

    protected void registerAttributeChanged(MutationEvent mevt)

  Checks what type of the "DOMAttrModified" mutation event occured, and invokes the appropriate method to register the change.

  Parameters:
    `mevt` - The Mutation Event

### registerCharDataModified

    protected void registerCharDataModified(MutationEvent mevt)

  Adds the "DOMCharDataModified" Mutation event to current history browser's interface compound command

  Parameters:
    `mevt` - The Mutation Event

### shouldRegisterDocumentChange

    protected boolean shouldRegisterDocumentChange()

  Checks if the document change that occured should be registered. If the document change has occured out of the DOMViewer, the state of the history browser should be HistoryBrowserState.IDLE. Otherwise, if the DOMViewer caused the change, one of the following states is active: HistoryBrowserState.EXECUTING, HistoryBrowserState.UNDOING, HistoryBrowserState.REDOING. This method should be invoked while the document change is occuring (in mutation event handlers), otherwise, if put in another thread, the state flag becomes invalid. Also checks if the DOMViewer can be used to edit the document. If not, then the change shouldn't be registered by the HistoryBrowser

  Returns:
    True if the DOMViewer can edit the document and the history browser state is IDLE at the moment

### registerDocumentChange

    protected void registerDocumentChange(MutationEvent mevt)

  Puts the document change in the current history browser's interface compound command if the document change occured outside of the DOMViewer.

  Parameters:
    `mevt` - The info on the event. Use to describe the document change to the history browser

### createTree

    protected javax.swing.tree.MutableTreeNode createTree(org.w3c.dom.Node node,
                                                          boolean showWhitespace)

  Creates a swing tree from a DOM document.

### findNode

    protected javax.swing.tree.DefaultMutableTreeNode findNode(javax.swing.JTree theTree,
                                                               org.w3c.dom.Node node)

  Finds and returns the node in the tree that represents the given node in the document.

  Parameters:
    `theTree` - The given JTree
    `node` - The given org.w3c.dom.Node
  Returns:
    Node or null if not found

### selectNode

    public void selectNode(org.w3c.dom.Node targetNode)

  Finds and selects the given node in the document tree.

  Parameters:
    `targetNode` - The node to be selected

### createTemplatesMenu

    protected javax.swing.JMenu createTemplatesMenu(java.lang.String name)

  Creates JMenu menu using `NodeTemplates`.

  Parameters:
    `name` - The name of the submenu
  Returns:
    The JMenu submenu

Copyright © 2008 Apache Software Foundation. All Rights Reserved.