Class ImageViewerDialog
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openstreetmap.josm.gui.dialogs.ToggleDialog
org.openstreetmap.josm.gui.layer.geoimage.ImageViewerDialog
- All Implemented Interfaces:
AWTEventListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,Helpful,LayerManager.LayerChangeListener,MainLayerManager.ActiveLayerChangeListener,ShowHideButtonListener,PreferenceChangedListener,Destroyable
public final class ImageViewerDialog
extends ToggleDialog
implements LayerManager.LayerChangeListener, MainLayerManager.ActiveLayerChangeListener
Dialog to view and manipulate geo-tagged images from a
GeoImageLayer.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA tab title renderer forHideableTabbedPanethat allows us to close tabs.private classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classprivate classThis class exists to remember the last entry, and go back if clicked again when it would not otherwise be enabledprivate classprivate classprivate classprivate static classA JPanel whose entire purpose is to display an image by (a) moving the imgDisplay around and (b) setting the imgDisplay as a child for this panel.private static interfaceThis literally exists to silence sonarlint complaints.Nested classes/interfaces inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
ToggleDialog.ButtonHidingType, ToggleDialog.TitleBar, ToggleDialog.ToggleDialogActionNested 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.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate JButtonprivate booleanprivate final ImageViewerDialog.CloseOtherTabsActionprivate booleanprivate IImageEntry<? extends IImageEntry<?>>private static ImageViewerDialogprivate static final Stringprivate booleanprivate static final Stringprivate final ImageViewerDialog.ImageCenterViewActionprivate final ImageViewerDialog.ImageCollapseActionprivate final ImageViewerDialog.ImageCopyPathActionprivate final ImageViewerDialog.ImageExtendedInfoActionprivate final ImageViewerDialog.ImageFirstActionprivate final ImageViewerDialog.ImageLastActionprivate final ImageViewerDialog.ImageNextActionprivate final ImageViewerDialog.ImageOpenExternalActionprivate final ImageViewerDialog.ImagePreviousActionprivate final ImageViewerDialog.ImageRemoveActionprivate final ImageViewerDialog.ImageRemoveFromDiskActionprivate final ImageryFilterSettingsprivate final ImageViewerDialog.ImageZoomActionprivate final ImageDisplayprivate Future<?>private final HideableTabbedPaneThe layer tab (used to select images when multiple layers provide images, makes for easy switching)private JToggleButtonprivate JToggleButtonprivate final LayerVisibilityActionFields inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
button, buttonHiding, detachedDialog, dialogsPanel, isCollapsed, isDocked, isShowing, name, preferenceClass, preferencePrefix, PROP_DYNAMIC_BUTTONS, titleBar, toggleAction, windowMenuItemFields 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 TypeMethodDescriptionvoidCalled whenever the active or edit layer changed.private static voidaddButtonGroup(JPanel buttonPanel, AbstractButton... buttons) Add a button group to a panelprivate voidAdd the buttons for image layersprivate voidbuild()private voidprivate static JButtoncreateButton(AbstractAction action, Dimension buttonDim) (package private) static voidprivate static JButtoncreateNavigationButton(AbstractAction action, Dimension buttonDim) voiddestroy()Called when the object has been destroyed.private static voidDestroy the current dialogvoiddisplayImage(ImageData ignoredData, ImageEntry entry) Displays a single image for the given layer.voiddisplayImage(IImageEntry<?> entry) Displays a single image for the given layer.voiddisplayImages(List<? extends IImageEntry<?>> entries) Displays images for the given layer.protected booleanWhen an image is closed, really close it and do not pop up the side dialog.static IImageEntry<?>Returns the currently displayed image.private Stream<ImageViewerDialog.MoveImgDisplayPanel<?>>Get theImageViewerDialog.MoveImgDisplayPanelobjects inlayers.static ImageViewerDialogReplies the unique instance of this dialoggetRotation(IImageEntry<?> entry) Returns the rotation of the currently displayed image.booleanhasImage()Returns whether an image is currently displayedstatic booleanCheck if there is an instance for theImageViewerDialogstatic booleanReturns whether the center view is currently active.private static booleanisFirstImageSelected(List<? extends IImageEntry<?>> data) private static booleanisLastImageSelected(List<? extends IImageEntry<?>> data) voidNotifies this listener that a layer has been added.voidNotifies this listener that the order of layers was changed.voidNotifies this listener that a layer was just removed.voidrefresh()Reload the image.voidrefresh(boolean imageChanged) Reload the image or reload only the image info.private voidregisterOnLayer(Layer layer) private voidremoveImageTab(Layer layer) Remove a tab for a layer from thelayerstab panestatic booleansetCentreEnabled(boolean value) Enables (or disables) the "Center view" button.voidsetNextEnabled(boolean value) Enables (or disables) the "Next" button.voidsetPreviousEnabled(boolean value) Enables (or disables) the "Previous" button.private voidvoidCalled when toggle dialog is shown (after it was created or expanded).protected voidprimitive stateChangedListener for subclassesprivate voidupdateButtonsNonNullEntry(IImageEntry<?> entry, boolean imageChanged) Update the image viewer buttons for the new entryprivate voidupdateButtonsNullEntry(List<? extends IImageEntry<?>> entries) Update buttons for null entryprivate voidupdateLayers(boolean changed) Update the tabs for the different image layersprivate voidMethods inherited from class org.openstreetmap.josm.gui.dialogs.ToggleDialog
buttonHidden, buttonShown, clearButtonActions, closeDetachedDialog, collapse, createLayout, createLayout, detach, dock, eventDispatched, expand, getButton, getDefaultDetachedSize, getLastHeight, getName, getPreferencePrefix, getPreferredHeight, getToggleAction, helpTopic, hideDialog, hideNotify, isDialogInCollapsedView, isDialogInDefaultView, isDialogShowing, preferenceChanged, registerInWindowMenu, rememberHeight, setButton, setContentVisible, setDialogsPanel, setIsButtonHiding, setIsCollapsed, setIsDocked, setIsShowing, setTitle, showDialog, toggleButtonHook, toString, unfurlDialogMethods 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, 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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
GEOIMAGE_FILLER
-
DIALOG_FOLDER
- See Also:
-
imageryFilterSettings
-
imageZoomAction
-
imageCenterViewAction
-
imageExtendedInfoAction
-
imageNextAction
-
imageRemoveAction
-
imageRemoveFromDiskAction
-
imagePreviousAction
-
imageCollapseAction
-
imageFirstAction
-
imageLastAction
-
imageCopyPathAction
-
imageOpenExternalAction
-
visibilityAction
-
closeAllTabsAction
-
imgDisplay
-
imgLoadingFuture
-
centerView
-
extendedImgInfo
-
dialog
-
collapseButtonClicked
-
btnLast
-
btnNext
-
btnPrevious
-
btnFirst
-
btnCollapse
-
btnDelete
-
btnCopyPath
-
btnOpenExternal
-
btnDeleteFromDisk
-
tbCentre
-
tbImgExtInfo
-
layers
The layer tab (used to select images when multiple layers provide images, makes for easy switching) -
currentEntry
-
-
Constructor Details
-
ImageViewerDialog
private ImageViewerDialog()
-
-
Method Details
-
createInstance
-
getInstance
Replies the unique instance of this dialog- Returns:
- the unique instance
-
hasInstance
Check if there is an instance for theImageViewerDialog- Returns:
trueif there is a static singleton instance ofImageViewerDialog- Since:
- 18613
-
destroyInstance
Destroy the current dialog -
showNotify
Description copied from class:ToggleDialogCalled when toggle dialog is shown (after it was created or expanded). Descendants may overwrite this method, it's a good place to register listeners needed to keep dialog updated- Overrides:
showNotifyin classToggleDialog
-
createButton
-
build
-
addButtonGroup
Add a button group to a panel- Parameters:
buttonPanel- The panel holding the buttonsbuttons- The button group to add
-
updateLayers
Update the tabs for the different image layers- Parameters:
changed-trueif the tabs changed
-
addButtonsForImageLayers
Add the buttons for image layers -
removeImageTab
Remove a tab for a layer from thelayerstab pane- Parameters:
layer- The layer to remove
-
getImageTabs
Get theImageViewerDialog.MoveImgDisplayPanelobjects inlayers.- Returns:
- The individual panels
-
destroy
Description copied from interface:DestroyableCalled when the object has been destroyed.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classToggleDialog
-
setPreviousEnabled
Enables (or disables) the "Previous" button.- Parameters:
value-trueto enable the button,falseotherwise
-
setNextEnabled
Enables (or disables) the "Next" button.- Parameters:
value-trueto enable the button,falseotherwise
-
setCentreEnabled
Enables (or disables) the "Center view" button.- Parameters:
value-trueto enable the button,falseotherwise- Returns:
- the old enabled value. Can be used to restore the original enable state
-
displayImage
Displays a single image for the given layer.- Parameters:
ignoredData- the image dataentry- image entry- See Also:
-
displayImage
Displays a single image for the given layer.- Parameters:
entry- image entry- See Also:
-
displayImages
Displays images for the given layer.- Parameters:
entries- image entries- Since:
- 18246
-
updateButtonsNullEntry
Update buttons for null entry- Parameters:
entries-trueif multiple images are selected
-
updateButtonsNonNullEntry
Update the image viewer buttons for the new entry- Parameters:
entry- The new entryimageChanged-trueif it is not the same image as the previous image.
-
updateTitle
-
isLastImageSelected
-
isFirstImageSelected
-
dockWhenClosingDetachedDlg
When an image is closed, really close it and do not pop up the side dialog.- Overrides:
dockWhenClosingDetachedDlgin classToggleDialog
-
stateChanged
Description copied from class:ToggleDialogprimitive stateChangedListener for subclasses- Overrides:
stateChangedin classToggleDialog
-
hasImage
Returns whether an image is currently displayed- Returns:
- If image is currently displayed
-
getCurrentImage
Returns the currently displayed image.- Returns:
- Currently displayed image or
null - Since:
- 18246 (signature)
-
getRotation
Returns the rotation of the currently displayed image.- Parameters:
entry- The entry to get the rotation for. May benull.- Returns:
- the rotation of the currently displayed image, or
null - Since:
- 18263
-
isCenterView
Returns whether the center view is currently active.- Returns:
trueif the center view is active,falseotherwise- Since:
- 9416
-
layerAdded
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer has been added.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerAddedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The new added layer event
-
layerRemoving
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that a layer was just removed.Listeners are called in the EDT thread after the layer was removed. Use
LayerManager.LayerRemoveEvent.scheduleRemoval(Collection)to remove more layers. You should not do blocking or long-running tasks in this method.- Specified by:
layerRemovingin interfaceLayerManager.LayerChangeListener- Parameters:
e- The layer to be removed (as event)
-
layerOrderChanged
Description copied from interface:LayerManager.LayerChangeListenerNotifies this listener that the order of layers was changed.Listeners are called in the EDT thread. You should not do blocking or long-running tasks in this method.
- Specified by:
layerOrderChangedin interfaceLayerManager.LayerChangeListener- Parameters:
e- The order change event.
-
activeOrEditLayerChanged
Description copied from interface:MainLayerManager.ActiveLayerChangeListenerCalled whenever the active or edit layer changed.You can be sure that this layer is still contained in this set.
Listeners are called in the EDT thread and you can manipulate the layer manager in the current thread.
- Specified by:
activeOrEditLayerChangedin interfaceMainLayerManager.ActiveLayerChangeListener- Parameters:
e- The change event.
-
refresh
Reload the image. Call this if you load a low-resolution image first, and then get a high-resolution image, or if you know that the image has changed on disk.- Since:
- 18591
-
refresh
Reload the image or reload only the image info. Call this if want to update the OSD.- Parameters:
imageChanged- reload the image if true. Reload only the OSD if false.- Since:
- 19387
-
registerOnLayer
-
showLayer
-
cancelLoadingImage
-