Class ValidatorTreePanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
org.openstreetmap.josm.gui.dialogs.validator.ValidatorTreePanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,Scrollable,DataSetListener,Destroyable
A panel that displays the error tree. The selection manager
respects clicks into the selection list. Ctrl-click will remove entries from
the list while single click will make the clicked entry the only selection.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JTree
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirectorNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionThe list of errors shown in the tree, normally identical to field validationErrors in current edit layerprivate Set<? extends OsmPrimitive>Iffilteris notnullonly errors are displayed that refer to one of the primitives in the filter.private final ListenerList<Runnable>private booleanif true, buildTree() does nothingprotected DefaultTreeModelThe validation data.Fields inherited from class javax.swing.JTree
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, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCountFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInvalidationListener(Runnable listener) Add a new invalidation listenerprivate static StringaddSize(String msg, Collection<?> coll) voidBuilds the errors treevoidbuildTree(boolean expandAgain) Builds the errors treeprivate voidbuildTreeInternal(boolean expandAgain) voiddataChanged(DataChangedEvent event) Called after big changes in dataset.voiddestroy()Called when the object has been destroyed.voidExpands complete treeprivate booleanRemove errors which refer to removed or purged primitives.Returns the errors of the treeSet<? extends OsmPrimitive>Returns the filter listgetRoot()Returns the root node model.private static StringvoidnodeMoved(NodeMovedEvent event) A node's coordinates were modified.voidMinor dataset change, currently only changeset id changed is supported, but can be extended in future.voidA bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.voidA bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.voidA relation's members have changed.voidremoveInvalidationListener(Runnable listener) Remove an invalidation listenerprivate static StringremoveSize(String msg) voidUpdates the current errors listvoidselectRelatedErrors(Collection<OsmPrimitive> primitives) Selects all errors related to the specifiedprimitives, i.e.final voidsetErrorList(List<TestError> errors) Sets the errors list used by a data layervoidClears the current error list and adds these errors to itvoidsetFilter(Set<? extends OsmPrimitive> filter) Set the filter list to a set of primitivesvoidCan be called to suppress execution of buildTree() while doing multiple updates.voidsetVisible(boolean v) voidtagsChanged(TagsChangedEvent event) There was some change in the tag set of a primitive.static voidvisitTestErrors(DefaultMutableTreeNode root, Consumer<TestError> visitor) Visitor call for allTestErrornodes children of root, in breadth-first order.static voidvisitTestErrors(DefaultMutableTreeNode root, Consumer<TestError> visitor, Set<DefaultMutableTreeNode> processedNodes) Visitor call for allTestErrornodes children of root, in breadth-first order.static voidvisitTreeNodes(DefaultMutableTreeNode root, Consumer<DefaultMutableTreeNode> visitor) Visitor call for all tree nodes children of root, in breadth-first order.private voidwalkAndSelectRelatedErrors(TreePath p, Predicate<OsmPrimitive> isRelevant, Collection<TreePath> paths) voidA way's node list was changed.Methods inherited from class javax.swing.JTree
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, 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, updateUIMethods 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, 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, unregisterKeyboardAction, updateMethods 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, validateTreeMethods 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, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.osm.event.DataSetListener
dataChangedIndividualEvents
-
Field Details
-
valTreeModel
The validation data. -
errors
The list of errors shown in the tree, normally identical to field validationErrors in current edit layer -
filter
Iffilteris notnullonly errors are displayed that refer to one of the primitives in the filter. -
invalidationListeners
-
resetScheduled
if true, buildTree() does nothing
-
-
Constructor Details
-
ValidatorTreePanel
Constructor- Parameters:
errors- The list of errors
-
ValidatorTreePanel
public ValidatorTreePanel()Constructor
-
-
Method Details
-
getToolTipText
- Overrides:
getToolTipTextin classJTree
-
getTesterDetails
-
setVisible
- Overrides:
setVisiblein classJComponent
-
buildTree
Builds the errors tree -
buildTree
Builds the errors tree- Parameters:
expandAgain- if true, try to expand the same rows as before
-
buildTreeInternal
-
addSize
-
removeSize
-
addInvalidationListener
Add a new invalidation listener- Parameters:
listener- The listener
-
removeInvalidationListener
Remove an invalidation listener- Parameters:
listener- The listener- Since:
- 10880
-
setErrorList
Sets the errors list used by a data layer- Parameters:
errors- The error list that is used by a data layer
-
setErrors
Clears the current error list and adds these errors to it- Parameters:
newerrors- The validation errors
-
getErrors
Returns the errors of the tree- Returns:
- the errors of the tree
-
selectRelatedErrors
Selects all errors related to the specifiedprimitives, i.e. whereTestError.getPrimitives()returns a primitive present inprimitives.- Parameters:
primitives- collection of primitives
-
walkAndSelectRelatedErrors
private void walkAndSelectRelatedErrors(TreePath p, Predicate<OsmPrimitive> isRelevant, Collection<TreePath> paths) -
getFilter
Returns the filter list- Returns:
- the set of primitives used for filtering
-
setFilter
Set the filter list to a set of primitives- Parameters:
filter- the list of primitives used for filtering
-
resetErrors
Updates the current errors list -
expandAll
Expands complete tree -
getRoot
Returns the root node model.- Returns:
- The root node model
-
destroy
Description copied from interface:DestroyableCalled when the object has been destroyed.- Specified by:
destroyin interfaceDestroyable
-
visitTreeNodes
public static void visitTreeNodes(DefaultMutableTreeNode root, Consumer<DefaultMutableTreeNode> visitor) Visitor call for all tree nodes children of root, in breadth-first order.- Parameters:
root- Root nodevisitor- Visitor- Since:
- 13940
-
visitTestErrors
Visitor call for allTestErrornodes children of root, in breadth-first order.- Parameters:
root- Root nodevisitor- Visitor- Since:
- 13940
-
visitTestErrors
public static void visitTestErrors(DefaultMutableTreeNode root, Consumer<TestError> visitor, Set<DefaultMutableTreeNode> processedNodes) Visitor call for allTestErrornodes children of root, in breadth-first order.- Parameters:
root- Root nodevisitor- VisitorprocessedNodes- Set of already visited nodes (optional)- Since:
- 13940
-
primitivesRemoved
Description copied from interface:DataSetListenerA bunch of primitives were removed from the DataSet, or preexisting primitives were marked as deleted.- Specified by:
primitivesRemovedin interfaceDataSetListener- Parameters:
event- An event for an collection of newly-invisible primitives
-
primitivesAdded
Description copied from interface:DataSetListenerA bunch of primitives were added into the DataSet, or existing deleted/invisible primitives were resurrected.- Specified by:
primitivesAddedin interfaceDataSetListener- Parameters:
event- An event for an collection of newly-visible primitives
-
tagsChanged
Description copied from interface:DataSetListenerThere was some change in the tag set of a primitive. It can have been a tag addition, tag removal or change in tag value.- Specified by:
tagsChangedin interfaceDataSetListener- Parameters:
event- the event for the primitive, whose tags were affected.
-
nodeMoved
Description copied from interface:DataSetListenerA node's coordinates were modified.- Specified by:
nodeMovedin interfaceDataSetListener- Parameters:
event- The event for the node that was moved.
-
wayNodesChanged
Description copied from interface:DataSetListenerA way's node list was changed.- Specified by:
wayNodesChangedin interfaceDataSetListener- Parameters:
event- The event for the way that was modified.
-
relationMembersChanged
Description copied from interface:DataSetListenerA relation's members have changed.- Specified by:
relationMembersChangedin interfaceDataSetListener- Parameters:
event- The event for the relation that was modified.
-
otherDatasetChange
Description copied from interface:DataSetListenerMinor dataset change, currently only changeset id changed is supported, but can be extended in future.- Specified by:
otherDatasetChangein interfaceDataSetListener- Parameters:
event- the event for data modification
-
dataChanged
Description copied from interface:DataSetListenerCalled after big changes in dataset. Usually other events are stopped using Dataset.beginUpdate() and after operation is completed (Dataset.endUpdate()),DataSetListener.dataChanged(DataChangedEvent event)is called.- Specified by:
dataChangedin interfaceDataSetListener- Parameters:
event- data change event
-
setResetScheduled
Can be called to suppress execution of buildTree() while doing multiple updates. Caller must call resetErrors() to end this state.- Since:
- 14849
-
filterRemovedPrimitives
Remove errors which refer to removed or purged primitives.- Returns:
- true if error list was changed
-