Package 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:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Enclosing class:
- DOMViewer
The panel that contains the viewer.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
Handles "DOMAttrModified" event.protected class
Handles the capturing "mouseclick" event.protected class
The CharacterData panel text area.protected class
Handles "DOMCharacterDataModified" event.protected class
To listen to the tree selection.protected class
To display the CSS properties of a DOM node in a table.protected class
Handles "DOMNodeInserted" event.protected class
Handles "DOMNodeRemoved" event.protected class
To render the tree nodes.protected class
Parser for the Element template.protected class
Handles tree pop-up menu action for adding new node.protected class
Handles tree pop-up menu action for removing nodes.protected class
Tree popup listener.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
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
FieldsModifier and TypeFieldDescriptionstatic final String
protected NodePickerPanel
The panel to show the nodes attributes.protected GridBagConstraints
The layout for the attribute panel.protected EventListener
"Attribute modified" DOM Mutation Listener.protected EventListener
Capturing "click" event type listener.static final String
protected DOMViewer.Panel.CharacterPanel
The CharacterData node panel.protected EventListener
"Character data modified" DOM Mutation Listener.protected Document
The DOM document.protected JTextArea
The documentInfo panel text area.protected JPanel
The documentInfo node panel.protected JPanel
The element panel.static final String
static final String
protected EventListener
"Node inserted" DOM Mutation Listener.protected EventListener
"Node removed" DOM Mutation Listener.protected JTable
The properties table.protected GridBagConstraints
The layout for the properties table.protected JPanel
The right panel.protected JSplitPane
The split pane.protected DOMDocumentTree
The tree.protected ViewCSS
The ViewCSS object associated with the document.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Registers capturing "click" listener on the document element of the given document.protected void
Registers DOM Mutation Listener on the given document.protected JMenu
createTemplatesMenu
(String name) Creates JMenu menu usingNodeTemplates
.protected MutableTreeNode
createTree
(Node node, boolean showWhitespace) Creates a swing tree from a DOM document.protected DefaultMutableTreeNode
Finds and returns the node in the tree that represents the given node in the document.protected void
refreshGUI
(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
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.ADDITION type to current history browser's interface compound commandprotected void
Checks what type of the "DOMAttrModified" mutation event occured, and invokes the appropriate method to register the change.protected void
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.MODIFICATION type to current history browser's interface compound commandprotected void
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.REMOVAL type to current history browser's interface compound commandprotected void
Adds the "DOMCharDataModified" Mutation event to current history browser's interface compound commandprotected void
Puts the document change in the current history browser's interface compound command if the document change occured outside of the DOMViewer.protected void
Adds the "DOMNodeInserted" Mutation event to current history browser's interface compound commandprotected void
Adds the "DOMNodeRemoved" Mutation event to current history browser's interface compound commandprotected void
Removes previously registered capturing "click" event listener from the document element of the given document.protected void
Removes previously registered mutation listeners from the document.void
selectNode
(Node targetNode) Finds and selects the given node in the document tree.void
setDocument
(Document doc) Sets the document to display.void
setDocument
(Document doc, ViewCSS view) Sets the document to display and its ViewCSS.protected boolean
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
NODE_INSERTED
- See Also:
-
NODE_REMOVED
- See Also:
-
ATTRIBUTE_MODIFIED
- See Also:
-
CHAR_DATA_MODIFIED
- See Also:
-
document
The DOM document. -
nodeInsertion
"Node inserted" DOM Mutation Listener. -
nodeRemoval
"Node removed" DOM Mutation Listener. -
attrModification
"Attribute modified" DOM Mutation Listener. -
charDataModification
"Character data modified" DOM Mutation Listener. -
capturingListener
Capturing "click" event type listener. Allows the "capturing click" option -
viewCSS
The ViewCSS object associated with the document. -
tree
The tree. -
splitPane
The split pane. -
rightPanel
The right panel. -
propertiesTable
The properties table. -
attributePanel
The panel to show the nodes attributes. -
attributePanelLayout
The layout for the attribute panel. -
propertiesTableLayout
The layout for the properties table. -
elementPanel
The element panel. -
characterDataPanel
The CharacterData node panel. -
documentInfo
The documentInfo panel text area. -
documentInfoPanel
The documentInfo node panel.
-
-
Constructor Details
-
Panel
public Panel()Creates a new Panel object.
-
-
Method Details
-
setDocument
Sets the document to display. -
setDocument
Sets the document to display and its ViewCSS. -
addDomMutationListeners
Registers DOM Mutation Listener on the given document.- Parameters:
doc
- The given document
-
removeDomMutationListeners
Removes previously registered mutation listeners from the document.- Parameters:
doc
- The document
-
addCapturingListener
Registers capturing "click" listener on the document element of the given document.- Parameters:
doc
- The given document
-
removeCapturingListener
Removes previously registered capturing "click" event listener from the document element of the given document.- Parameters:
doc
- The given document
-
refreshGUI
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
Adds the "DOMNodeInserted" Mutation event to current history browser's interface compound command- Parameters:
mevt
- The Mutation Event
-
registerNodeRemoved
Adds the "DOMNodeRemoved" Mutation event to current history browser's interface compound command- Parameters:
mevt
- The Mutation Event
-
registerAttributeAdded
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.ADDITION type to current history browser's interface compound command- Parameters:
mevt
- The Mutation Event
-
registerAttributeRemoved
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.REMOVAL type to current history browser's interface compound command- Parameters:
mevt
- The Mutation Event
-
registerAttributeModified
Adds the "DOMAttrModified" Mutation event, of the MutationEvent.MODIFICATION type to current history browser's interface compound command- Parameters:
mevt
- The Mutation Event
-
registerAttributeChanged
Checks what type of the "DOMAttrModified" mutation event occured, and invokes the appropriate method to register the change.- Parameters:
mevt
- The Mutation Event
-
registerCharDataModified
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
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
Creates a swing tree from a DOM document. -
findNode
Finds and returns the node in the tree that represents the given node in the document.- Parameters:
theTree
- The given JTreenode
- The given org.w3c.dom.Node- Returns:
- Node or null if not found
-
selectNode
Finds and selects the given node in the document tree.- Parameters:
targetNode
- The node to be selected
-
createTemplatesMenu
Creates JMenu menu usingNodeTemplates
.- Parameters:
name
- The name of the submenu- Returns:
- The JMenu submenu
-