Class DownloadDialog
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.openstreetmap.josm.gui.download.DownloadDialog
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants
Dialog displayed to the user to download mapping data.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classAction that is executed when the cancel button is pressed.(package private) classAction that is executed when the download button is pressed.private static classA special split pane that acts according to aDownloadSourceSizingPolicyIt attempts to size the top tab content correctly.private classA special tabbed pane forAbstractDownloadSourcePanels(package private) classNested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested 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 final ImageLabelprotected JButtonprotected JButtonprotected JButtonprotected JButtonprotected booleanprotected JCheckBoxprotected JCheckBoxprotected Boundsprotected DownloadDialog.DownloadDialogSplitPaneprivate static final BooleanPropertyprivate static final StringPropertyprivate static final IntegerPropertyprivate static final BooleanPropertyprotected final List<DownloadSelection>private static final List<DownloadSource<?>>private static final ListenerList<DownloadSourceListener>protected final DownloadDialog.DownloadSourceTabsprotected final ExpertToggleAction.ExpertModeChangeListenerprivate static DownloadDialogthe unique instance of the download dialogprivate final ImageLabelprivate final ImageLabelprotected JPanelprotected SlippyMapChooserprotected final JTabbedPaneFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionDownloadDialog(Component parent) Constructs a newDownloadDialog.DownloadDialog(Component parent, String helpTopic) Constructs a newDownloadDialog. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddDownloadAreaListener(DownloadSelection selection) Add a listener to get events from the DownloadSelection windowvoidaddDownloadAreaSelector(JPanel selector, String displayName) Adds a new download area selector to the download dialog.static <T> voidaddDownloadSource(DownloadSource<T> downloadSource) Adds a new download source to the download dialog if it is not added.protected <T> voidaddNewDownloadSourceTab(DownloadSource<T> downloadSource) Adds the download source to the download sources tab.static voidAutomatically opens the download dialog, if autorun is enabled.voidboundingBoxChanged(Bounds b, DownloadSelection eventSource) Distributes a "bounding box changed" from one DownloadSelection object to the others, so they may update or clear their input fields.protected final JPanelBuilds the button pane of the dialog.protected final JPanelBuilds the main panel of the dialog.getDownloadSettings(boolean newLayer) Gets the global settings of the download dialog.private ChangeListenerCreates a listener that reacts on tab switches fordownloadSourcesTabin order to adjust proper division of the dialog according to user saved preferences or minimal size of the panel.Creates listener that removes/adds download sources from/todownloadSourcesTabdepending on the current mode.static DownloadDialogReplies the unique instance of the download dialogstatic BoundsReturns the previously saved bounding box from preferences.Returns anOptionalof the currently selected download area.static booleanDetermines if the dialog autorun is enabled in preferences.booleanReplies true if the dialog was canceledbooleanReplies true if the user requires to zoom to new downloaded datavoidmapCursorChanged(ILatLon latLon) Updates the coordinates after moving the mouse cursorfinal voidRefreshes the tile sources.voidRemembers the current settings in the download dialog.booleanremoveDownloadAreaListener(DownloadSelection selection) Remove a listener that was getting events from the DownloadSelection windowstatic booleanremoveDownloadSource(DownloadSource<?> downloadSource) Remove a download source from the download dialogvoidRestores the previous settings in the download dialog.protected voidsetCanceled(boolean canceled) voidsetVisible(boolean visible) voidStarts download.voidStarts download for the given bounding boxMethods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
DOWNLOAD_TAB
-
DOWNLOAD_SOURCE_TAB
-
DOWNLOAD_AUTORUN
-
DOWNLOAD_ZOOMTODATA
-
instance
the unique instance of the download dialog -
downloadSourcesListeners
-
downloadSources
-
downloadSelections
-
tpDownloadAreaSelectors
-
downloadSourcesTab
-
latText
-
lonText
-
bboxText
-
cbStartup
-
cbZoomToDownloadedData
-
slippyMapChooser
-
mainPanel
-
dialogSplit
-
expertListener
-
currentBounds
-
canceled
-
btnDownload
-
btnDownloadNewLayer
-
btnCancel
-
btnHelp
-
-
Constructor Details
-
DownloadDialog
Constructs a newDownloadDialog.- Parameters:
parent- the parent component
-
DownloadDialog
Constructs a newDownloadDialog.- Parameters:
parent- the parent componenthelpTopic- the help topic to assign
-
-
Method Details
-
getInstance
Replies the unique instance of the download dialog- Returns:
- the unique instance of the download dialog
-
buildMainPanel
Builds the main panel of the dialog.- Returns:
- The panel of the dialog.
-
buildButtonPanel
Builds the button pane of the dialog.- Returns:
- The button panel of the dialog.
-
boundingBoxChanged
Distributes a "bounding box changed" from one DownloadSelection object to the others, so they may update or clear their input fields. Also informs download sources about the change, so they can react on it.- Parameters:
b- new current boundseventSource- - the DownloadSelection object that fired this notification.
-
mapCursorChanged
Updates the coordinates after moving the mouse cursor- Parameters:
latLon- the coordinates under the mouse cursor
-
startDownload
Starts download for the given bounding box- Parameters:
b- bounding box to download
-
startDownload
Starts download. -
isZoomToDownloadedDataRequired
Replies true if the user requires to zoom to new downloaded data- Returns:
- true if the user requires to zoom to new downloaded data
- Since:
- 11658
-
isAutorunEnabled
Determines if the dialog autorun is enabled in preferences.- Returns:
trueif the download dialog must be open at startup,falseotherwise.
-
addDownloadAreaSelector
Adds a new download area selector to the download dialog.- Parameters:
selector- the download are selector.displayName- the display name of the selector.
-
addDownloadAreaListener
Add a listener to get events from the DownloadSelection window- Parameters:
selection- The DownloadSelection object to send the Bounds to- Returns:
- See
List.add(E) - Since:
- 16684
-
removeDownloadAreaListener
Remove a listener that was getting events from the DownloadSelection window- Parameters:
selection- The DownloadSelection object to not send the Bounds to- Returns:
- See
List.remove(java.lang.Object) - Since:
- 16684
-
addDownloadSource
Adds a new download source to the download dialog if it is not added.- Type Parameters:
T- The type of the download data.- Parameters:
downloadSource- The download source to be added.- Throws:
JosmRuntimeException- If the download source is already added. Note, download sources are compared by their reference.- Since:
- 12878
-
removeDownloadSource
Remove a download source from the download dialog- Parameters:
downloadSource- The download source to be removed.- Returns:
- see
List.remove(java.lang.Object) - Since:
- 15542
-
refreshTileSources
Refreshes the tile sources.- Since:
- 6364
-
rememberSettings
Remembers the current settings in the download dialog. -
restoreSettings
Restores the previous settings in the download dialog. -
getSavedDownloadBounds
Returns the previously saved bounding box from preferences.- Returns:
- The bounding box saved in preferences if any,
nullotherwise. - Since:
- 6509
-
autostartIfNeeded
Automatically opens the download dialog, if autorun is enabled.- See Also:
-
getSelectedDownloadArea
Returns anOptionalof the currently selected download area.- Returns:
- An
Optionalof the currently selected download area. - Since:
- 12574 Return type changed to optional
-
setVisible
- Overrides:
setVisiblein classDialog
-
isCanceled
Replies true if the dialog was canceled- Returns:
- true if the dialog was canceled
-
getDownloadSettings
Gets the global settings of the download dialog.- Parameters:
newLayer- The flag defining if a new layer must be created for the downloaded data.- Returns:
- The
DownloadSettingsobject that describes the current state of the download dialog.
-
setCanceled
-
addNewDownloadSourceTab
Adds the download source to the download sources tab.- Type Parameters:
T- The type of the download data.- Parameters:
downloadSource- The download source to be added.
-
getExpertModeListenerForDownloadSources
Creates listener that removes/adds download sources from/todownloadSourcesTabdepending on the current mode.- Returns:
- The expert mode listener.
-
getDownloadSourceTabChangeListener
Creates a listener that reacts on tab switches fordownloadSourcesTabin order to adjust proper division of the dialog according to user saved preferences or minimal size of the panel.- Returns:
- A listener to adjust dialog division.
-