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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classHandles "DOMAttrModified" event.protected classHandles the capturing "mouseclick" event.protected classThe CharacterData panel text area.protected classHandles "DOMCharacterDataModified" event.protected classTo listen to the tree selection.protected classTo display the CSS properties of a DOM node in a table.protected classHandles "DOMNodeInserted" event.protected classHandles "DOMNodeRemoved" event.protected classTo render the tree nodes.protected classParser for the Element template.protected classHandles tree pop-up menu action for adding new node.protected classHandles tree pop-up menu action for removing nodes.protected classTree popup listener.Nested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected NodePickerPanelThe panel to show the nodes attributes.protected GridBagConstraintsThe layout for the attribute panel.protected EventListener"Attribute modified" DOM Mutation Listener.protected EventListenerCapturing "click" event type listener.static final Stringprotected DOMViewer.Panel.CharacterPanelThe CharacterData node panel.protected EventListener"Character data modified" DOM Mutation Listener.protected DocumentThe DOM document.protected JTextAreaThe documentInfo panel text area.protected JPanelThe documentInfo node panel.protected JPanelThe element panel.static final Stringstatic final Stringprotected EventListener"Node inserted" DOM Mutation Listener.protected EventListener"Node removed" DOM Mutation Listener.protected JTableThe properties table.protected GridBagConstraintsThe layout for the properties table.protected JPanelThe right panel.protected JSplitPaneThe split pane.protected DOMDocumentTreeThe tree.protected ViewCSSThe ViewCSS object associated with the document.Fields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRegisters capturing "click" listener on the document element of the given document.protected voidRegisters DOM Mutation Listener on the given document.protected JMenucreateTemplatesMenu(String name) Creates JMenu menu usingNodeTemplates.protected MutableTreeNodecreateTree(Node node, boolean showWhitespace) Creates a swing tree from a DOM document.protected DefaultMutableTreeNodeFinds and returns the node in the tree that represents the given node in the document.protected voidrefreshGUI(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 voidAdds the "DOMAttrModified" Mutation event, of the MutationEvent.ADDITION type to current history browser's interface compound commandprotected voidChecks what type of the "DOMAttrModified" mutation event occured, and invokes the appropriate method to register the change.protected voidAdds the "DOMAttrModified" Mutation event, of the MutationEvent.MODIFICATION type to current history browser's interface compound commandprotected voidAdds the "DOMAttrModified" Mutation event, of the MutationEvent.REMOVAL type to current history browser's interface compound commandprotected voidAdds the "DOMCharDataModified" Mutation event to current history browser's interface compound commandprotected voidPuts the document change in the current history browser's interface compound command if the document change occured outside of the DOMViewer.protected voidAdds the "DOMNodeInserted" Mutation event to current history browser's interface compound commandprotected voidAdds the "DOMNodeRemoved" Mutation event to current history browser's interface compound commandprotected voidRemoves previously registered capturing "click" event listener from the document element of the given document.protected voidRemoves previously registered mutation listeners from the document.voidselectNode(Node targetNode) Finds and selects 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.protected booleanChecks if the document change that occured should be registered.Methods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class 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, updateMethods inherited from class 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, validateTreeMethods inherited from class 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
-
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
-