Package org.openstreetmap.josm.gui
Class MapStatus
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openstreetmap.josm.gui.MapStatus
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,DataSelectionListener,DataSetListener,SystemOfMeasurement.SoMChangeListener,Helpful,NavigatableComponent.ZoomChangeListener,PreferenceChangedListener,Destroyable
public final class MapStatus
extends JPanel
implements Helpful, Destroyable, PreferenceChangedListener, SystemOfMeasurement.SoMChangeListener, DataSelectionListener, DataSetListener, NavigatableComponent.ZoomChangeListener
A component that manages some status information display about the map.
It keeps a status line below the map up to date and displays some tooltip
information if the user hold the mouse long enough at some point.
All this is done in background to not disturb other processes.
The background thread does not alter any data of the map (read only thread). Also it is rather fail safe. In case of some error in the data, it just does nothing instead of whining and complaining.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThe progress monitor that is used to display the progress if the user selects to run in backgroundprivate final classThe collector class that waits for notification and then update the display objects.(package private) static final classprivate classprivate static classEverything, the collector is interested of.(package private) static final class(package private) static final classNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested 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.FlipBufferStrategyNested classes/interfaces inherited from interface org.openstreetmap.josm.data.osm.DataSelectionListener
DataSelectionListener.AbstractSelectionEvent, DataSelectionListener.SelectionAddEvent, DataSelectionListener.SelectionChangeEvent, DataSelectionListener.SelectionRemoveEvent, DataSelectionListener.SelectionReplaceEvent, DataSelectionListener.SelectionToggleEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final ImageLabelprivate booleansee #19887: determine if thedistValuefield should be filled with length of selected objectprivate final AWTEventListenerprivate final MapStatus.Collectorprivate final DecimalFormatprivate static final AbstractProperty<Double>private final ImageLabelprivate doubleprivate final ImageLabelprivate final JosmTextFieldprivate final KeyAdapterprivate final ImageLabelprivate final ImageLabelprivate final MouseMotionListenerprivate final MapViewThe MapView this status belongs to.private final ComponentAdapterprivate final ImageLabelprivate ICoordinateFormatTheICoordinateFormatset in the previous updateprivate final JProgressBarThe progress monitor for displaying a background progressstatic final NamedColorPropertyProperty for map status background color (active state).static final NamedColorPropertyProperty for map status foreground color (active state).static final NamedColorPropertyProperty for map status background color.static final NamedColorPropertyProperty for map status foreground color.private static final AbstractProperty<Boolean>private static final List<SystemOfMeasurement>private final List<MapStatus.StatusTextHistory>private final ThreadThis is the thread that runs in the background and collects the information displayed.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_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 TypeMethodDescriptionvoidactivateAnglePanel(boolean activeFlag) Activates the angle panel.voidvoiddataChanged(DataChangedEvent event) Called after big changes in dataset.voiddestroy()Called when the object has been destroyed.Gets the panel that displays the anglestatic voidLoads all colors from preferences.private static intgetNameLabelCharacterCount(Component parent) Returns the help topic on JOSM wiki for this feature.voidnodeMoved(NodeMovedEvent event) A node's coordinates were modified.voidMinor dataset change, currently only changeset id changed is supported, but can be extended in future.voidTriggered when a preference entry value changes.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.private voidprivate voidrefreshDistText(Collection<? extends OsmPrimitive> newSelection) private voidvoidA relation's members have changed.voidresetHelpText(Object id) Removes a help text and restores the previous onevoidCalled whenever the selection is changed.voidsetAngle(double a) Sets the angle to display in the angle panel.voidsetAngleNaN(double a) Sets the angle to display in the angle panel.voidsetAngleText(String text) Sets the angle to display in the angle panelvoidsetAutoLength(boolean b) Enable or disable the automatic refresh of the length field.voidsetDist(double dist) Sets the distance text to the given valuevoidsetDist(Collection<Way> ways) Sets the distance text to the total sum of given ways lengthvoidsetHeading(double h) Sets the heading to display in the heading panelvoidsetHelpText(Object id, String text) Sets the help status text to displayvoidsetHelpText(String text) Sets the help text in the status panelvoidsystemOfMeasurementChanged(String oldSoM, String newSoM) The current SoM has changed.voidtagsChanged(TagsChangedEvent event) There was some change in the tag set of a primitive.private voidprivate voidupdateLatLonText(int x, int y) voidUpdates the system of measurement and displays a notification.voidA way's node list was changed.voidMethod called when the zoom area has changed.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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 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, 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
-
DECIMAL_FORMAT
-
DISTANCE_THRESHOLD
-
SHOW_ID
-
SORTED_SYSTEM_OF_MEASUREMENTS
-
PROP_BACKGROUND_COLOR
Property for map status background color.- Since:
- 6789
-
PROP_ACTIVE_BACKGROUND_COLOR
Property for map status background color (active state).- Since:
- 6789
-
PROP_FOREGROUND_COLOR
Property for map status foreground color.- Since:
- 6789
-
PROP_ACTIVE_FOREGROUND_COLOR
Property for map status foreground color (active state).- Since:
- 6789
-
mv
The MapView this status belongs to. -
collector
-
previousCoordinateFormat
TheICoordinateFormatset in the previous update -
latText
-
lonText
-
headingText
-
angleText
-
distText
-
nameText
-
helpText
-
progressBar
-
mvComponentAdapter
-
progressMonitor
The progress monitor for displaying a background progress -
distValue
-
angleEnabled
-
thread
This is the thread that runs in the background and collects the information displayed. It gets destroyed by destroy() when the MapFrame itself is destroyed. -
statusText
-
awtListener
-
mouseMotionListener
-
keyAdapter
-
autoLength
see #19887: determine if thedistValuefield should be filled with length of selected object
-
-
Constructor Details
-
MapStatus
Construct a new MapStatus and attach it to the map view.- Parameters:
mapFrame- The MapFrame the status line is part of.
-
-
Method Details
-
registerListeners
-
unregisterListeners
-
updateLatLonText
-
systemOfMeasurementChanged
Description copied from interface:SystemOfMeasurement.SoMChangeListenerThe current SoM has changed.- Specified by:
systemOfMeasurementChangedin interfaceSystemOfMeasurement.SoMChangeListener- Parameters:
oldSoM- The old system of measurementnewSoM- The new (current) system of measurement
-
updateSystemOfMeasurement
Updates the system of measurement and displays a notification.- Parameters:
som- The new system of measurement to set- Since:
- 6960
-
getAnglePanel
Gets the panel that displays the angle- Returns:
- The angle panel
-
helpTopic
Description copied from interface:HelpfulReturns the help topic on JOSM wiki for this feature. -
addMouseListener
- Overrides:
addMouseListenerin classComponent
-
setHelpText
Sets the help text in the status panel- Parameters:
text- The text
-
setHelpText
Sets the help status text to display- Parameters:
id- The object that caused the status update (or a id object it selects). May benulltext- The text
-
resetHelpText
Removes a help text and restores the previous one- Parameters:
id- The id passed tosetHelpText(Object, String)
-
setAngle
Sets the angle to display in the angle panel. Values less than 0 yield "--".- Parameters:
a- The angle- See Also:
-
setAngleNaN
Sets the angle to display in the angle panel. NaN yields "--".- Parameters:
a- The angle- See Also:
-
setAngleText
Sets the angle to display in the angle panel- Parameters:
text- The angle text
-
setHeading
Sets the heading to display in the heading panel- Parameters:
h- The heading
-
setDist
Sets the distance text to the given value- Parameters:
dist- The distance value to display, in meters
-
setDist
Sets the distance text to the total sum of given ways length- Parameters:
ways- The ways to consider for the total distance- Since:
- 5991
-
activateAnglePanel
Activates the angle panel.- Parameters:
activeFlag-trueto activate it,falseto deactivate it
-
refreshAnglePanel
-
destroy
Description copied from interface:DestroyableCalled when the object has been destroyed.- Specified by:
destroyin interfaceDestroyable
-
preferenceChanged
Description copied from interface:PreferenceChangedListenerTriggered when a preference entry value changes.- Specified by:
preferenceChangedin interfacePreferenceChangedListener- Parameters:
e- the preference change event
-
getColors
Loads all colors from preferences.- Since:
- 6789
-
getNameLabelCharacterCount
-
refreshDistText
-
selectionChanged
Description copied from interface:DataSelectionListenerCalled whenever the selection is changed. You get notified about the new selection, the elements that were added and removed and the layer that triggered the event.- Specified by:
selectionChangedin interfaceDataSelectionListener- Parameters:
event- The selection change event.- See Also:
-
zoomChanged
Description copied from interface:NavigatableComponent.ZoomChangeListenerMethod called when the zoom area has changed.- Specified by:
zoomChangedin interfaceNavigatableComponent.ZoomChangeListener
-
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.
-
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.
-
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
-
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
-
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.
-
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
-
setAutoLength
Enable or disable the automatic refresh of the length field.- Parameters:
b- iftruethe automatic refresh is enabled, else disabled- Since:
- 17108
-