Package org.openstreetmap.josm.gui
Class MapStatus.Collector
java.lang.Object
org.openstreetmap.josm.gui.MapStatus.Collector
- All Implemented Interfaces:
Runnable
- Enclosing class:
- MapStatus
The collector class that waits for notification and then update the display objects.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlockingQueue<MapStatus.MouseState>private Pointprivate Pointthe mouse position of the previous iteration.private final MapFrameprivate PopupThe popup displayed to show additional informationContains the labels that are currently shown in the information popup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate JLabelBuilds the labels with all necessary listeners for the info popup for the given OsmPrimitiveprivate PopuppopupCreatePopup(Component content, MapStatus.MouseState ms) Creates a popup for the given content next to the cursor.private voidpopupCycleSelection(Collection<OsmPrimitive> osms, int mods) Call this with a set of primitives to cycle through them.private voidTries to hide the given popupprivate voidpopupSetLabelColors(JLabel lbl, IPrimitive osm) Sets the colors for the given label depending on the selected status of the given OsmPrimitiveprivate voidpopupShowPopup(Popup newPopup, List<JLabel> lbls) Tries to show the given popup, can be hidden usingpopupHidePopup()If an old popup exists, it will be automatically hiddenprivate voidThis method should be called if the selection may have changed from outside of this class.voidrun()Execution function for the Collector.private voidCalls this to update the element that is shown in the statusbarvoidupdateMousePosition(Point mousePos, int modifiers) Called whenever the mouse position or modifiers changed.
-
Field Details
-
oldMousePos
the mouse position of the previous iteration. This is used to show the popup until the cursor is moved. -
popupLabels
Contains the labels that are currently shown in the information popup -
popup
The popup displayed to show additional information -
parent
-
incomingMouseState
-
lastMousePos
-
-
Constructor Details
-
Collector
-
-
Method Details
-
run
Execution function for the Collector. -
popupCreatePopup
Creates a popup for the given content next to the cursor. Tries to keep the popup on screen and shows a vertical scrollbar, if the screen is too small.- Parameters:
content- popup contentms- mouse state- Returns:
- popup
-
statusBarElementUpdate
Calls this to update the element that is shown in the statusbar- Parameters:
ms- mouse state
-
popupCycleSelection
Call this with a set of primitives to cycle through them. Method will automatically select the next item and update the map- Parameters:
osms- primitives to cycle throughmods- modifiers (i.e. control keys)
-
popupHidePopup
Tries to hide the given popup -
popupShowPopup
Tries to show the given popup, can be hidden usingpopupHidePopup()If an old popup exists, it will be automatically hidden- Parameters:
newPopup- popup to showlbls- labels to show (seepopupLabels)
-
popupUpdateLabels
This method should be called if the selection may have changed from outside of this class. This is the case when CTRL is pressed and the user clicks on the map instead of the popup. -
popupSetLabelColors
Sets the colors for the given label depending on the selected status of the given OsmPrimitive- Parameters:
lbl- The label to colorosm- The primitive to derive the colors from
-
popupBuildPrimitiveLabels
Builds the labels with all necessary listeners for the info popup for the given OsmPrimitive- Parameters:
osm- The primitive to create the label for- Returns:
- labels for info popup
-
updateMousePosition
Called whenever the mouse position or modifiers changed.- Parameters:
mousePos- The new mouse position.nullif it did not change.modifiers- The new modifiers.
-