public class XMLTree
extends javax.swing.JTree
Modifier and Type | Class and Description |
---|---|
class |
XMLTree.XmlNodeList
Class XmlNodeList
|
class |
XMLTree.XmlTreeNode
Class XmlTreeNode
|
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DropLocation, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTR_LABEL
xml attribute
|
static java.lang.String |
ATTR_NAME
xml attribute
|
static java.lang.String |
NULL_STRING
the null string
|
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
XMLTree(org.w3c.dom.Element xmlRoot,
java.lang.String basePath)
ctor
|
Modifier and Type | Method and Description |
---|---|
void |
addTagsToProcess(java.util.List tags)
Define the set of tags who we should process
|
boolean |
equals(java.lang.Object o1,
java.lang.Object o2) |
java.lang.String |
getAttribute(org.w3c.dom.NamedNodeMap attrs,
java.lang.String name,
java.lang.String dflt)
Get the given name-d attribute from the given attrs map.
|
java.lang.String |
getAttribute(org.w3c.dom.Node element,
java.lang.String name,
java.lang.String dflt)
Get the given name-d attribute from the given element.
|
java.lang.String |
getChildText(org.w3c.dom.Node parent)
Concatenates the node values (grom getNodeValue) of the children of the given parent Node.
|
org.w3c.dom.Element |
getElement(org.w3c.dom.Element parent,
java.lang.String tagName)
Get the first Element children of the given parent Element with the given tagName.
|
org.w3c.dom.NodeList |
getElements(org.w3c.dom.Element parent)
Get all children of the given parent Element who are instances of
the Element class.
|
XMLTree.XmlNodeList |
getElements(org.w3c.dom.Element parent,
java.lang.String tagName)
Get all Element children of the given parent Element with the
given tagName.
|
static org.w3c.dom.NodeList |
getElements(org.w3c.dom.Element parent,
XMLTree.XmlNodeList nodeList)
Get all children of the given parent Element who are instances of
the Element class.
|
java.lang.String |
getLabel(org.w3c.dom.Element n)
Return the String used for the JTree node.
|
java.lang.String |
getLocalName(org.w3c.dom.Node element)
Get the non qualified tag name
|
XMLTree.XmlTreeNode |
getXmlTreeNodeAt(int x,
int y)
Return the xml tree node located at the given position
|
protected XMLTree.XmlTreeNode |
getXmlTreeNodeAtPath(javax.swing.tree.TreePath path)
Return the xml tree node located at the given position
|
boolean |
isTag(org.w3c.dom.Node node,
java.lang.String name)
Checks if the tag name of the given node matches the given name.
|
void |
loadDocument(org.w3c.dom.Element xmlRoot,
java.lang.String basePath)
loadDocument
|
protected void |
process(XMLTree.XmlTreeNode parentTreeNode,
org.w3c.dom.Element xmlNode)
Walk the xml tree at the given xmlNode and create the JTree
|
void |
setMultipleSelect(boolean v)
Set tree select mode
|
protected boolean |
shouldProcess(org.w3c.dom.Element xmlNode)
Should we show the given xml Element
|
protected boolean |
shouldRecurse(org.w3c.dom.Element xmlNode)
Should we recursiely descend the children of the given xml Element
|
protected void |
treeClick(java.awt.event.MouseEvent event)
Gets called when the tree is clicked.
|
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getDropLocation, getDropMode, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setDropMode, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI
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, 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
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
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, 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, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String ATTR_NAME
public static final java.lang.String ATTR_LABEL
public static final java.lang.String NULL_STRING
public XMLTree(org.w3c.dom.Element xmlRoot, java.lang.String basePath)
xmlRoot
- The root of the xml dom treebasePath
- Where the xml came frompublic void loadDocument(org.w3c.dom.Element xmlRoot, java.lang.String basePath)
xmlRoot
- The root of the xml dom treebasePath
- Where the xml came fromprotected void treeClick(java.awt.event.MouseEvent event)
event
- Mouse eventpublic void addTagsToProcess(java.util.List tags)
tags
- List of tag namesprotected boolean shouldProcess(org.w3c.dom.Element xmlNode)
xmlNode
- protected void process(XMLTree.XmlTreeNode parentTreeNode, org.w3c.dom.Element xmlNode)
parentTreeNode
- The parent jtree nodexmlNode
- The xml node to processprotected boolean shouldRecurse(org.w3c.dom.Element xmlNode)
xmlNode
- The xml nodepublic java.lang.String getLabel(org.w3c.dom.Element n)
n
- The nodepublic XMLTree.XmlTreeNode getXmlTreeNodeAt(int x, int y)
x
- xy
- yprotected XMLTree.XmlTreeNode getXmlTreeNodeAtPath(javax.swing.tree.TreePath path)
path
- The tree pathpublic void setMultipleSelect(boolean v)
v
- Do multiples?public java.lang.String getLocalName(org.w3c.dom.Node element)
element
- elementpublic java.lang.String getAttribute(org.w3c.dom.Node element, java.lang.String name, java.lang.String dflt)
element
- The xml element to look within.name
- The attribute name.dflt
- The default value.public java.lang.String getAttribute(org.w3c.dom.NamedNodeMap attrs, java.lang.String name, java.lang.String dflt)
attrs
- The xml attribute map.name
- The name of the attribute.dflt
- The default valuepublic java.lang.String getChildText(org.w3c.dom.Node parent)
parent
- The xml node to search its chidlren.public org.w3c.dom.Element getElement(org.w3c.dom.Element parent, java.lang.String tagName)
parent
- The xml node to search its children.tagName
- The tag to match.public org.w3c.dom.NodeList getElements(org.w3c.dom.Element parent)
parent
- The xml node to search its chidlren.public XMLTree.XmlNodeList getElements(org.w3c.dom.Element parent, java.lang.String tagName)
parent
- The xml node to search its children.tagName
- The tag to match.public static org.w3c.dom.NodeList getElements(org.w3c.dom.Element parent, XMLTree.XmlNodeList nodeList)
parent
- The xml node to search its chidlren.nodeList
- list to add topublic boolean isTag(org.w3c.dom.Node node, java.lang.String name)
node
- the xml nodename
- namepublic boolean equals(java.lang.Object o1, java.lang.Object o2)