Package org.openstreetmap.josm.gui.io
Class UploadDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- org.openstreetmap.josm.gui.io.AbstractUploadDialog
-
- org.openstreetmap.josm.gui.io.UploadDialog
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,RootPaneContainer
,WindowConstants
,IUploadDialog
,PreferenceChangedListener
public class UploadDialog extends AbstractUploadDialog implements PreferenceChangedListener, PropertyChangeListener
This is a dialog for entering upload options like the parameters for the upload changeset and the strategy for opening/closing a changeset.- Since:
- 2025
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
UploadDialog.CancelAction
Action for canceling the dialog.(package private) static class
UploadDialog.CompactTabbedPane
(package private) static class
UploadDialog.UploadAction
Handles an upload.(package private) class
UploadDialog.WindowEventHandler
Listens to window closing events and processes them as cancel events.-
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description private JButton
btnUpload
the upload buttonprivate DataSet
dataSet
private UploadDialogModel
model
the model keeping the state of the changeset tagsprivate BasicUploadSettingsPanel
pnlBasicUploadSettings
the "description" tabprivate ChangesetManagementPanel
pnlChangesetManagement
the panel to select the changeset usedprivate TagEditorPanel
pnlTagEditor
the tag editor panelprivate UploadedObjectsSummaryPanel
pnlUploadedObjects
the panel with the objects to uploadprivate UploadStrategySelectionPanel
pnlUploadStrategySelectionPanel
the panel to select the upload strategyprivate JTabbedPane
tpConfigPanels
the tabbed pane used below of the list of primitivesprivate static UploadDialog
uploadDialog
the unique instance of the upload dialog-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
UploadDialog()
Constructs a newUploadDialog
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
build()
builds the guiprotected JPanel
buildActionPanel()
builds the panel with the OK and CANCEL buttonsprotected JPanel
buildContentPanel()
builds the content panel for the upload dialogvoid
clean()
Clean dialog state and release resources.Changeset
getChangeset()
Returns the changeset to use complete with tagsUploadDialogModel
getModel()
Get the upload dialog model.Map<String,String>
getTags(boolean keepEmpty)
Replies the map with the current tags in the tag editor model.String
getUploadComment()
Returns the current value for the upload commentstatic UploadDialog
getUploadDialog()
Replies the unique instance of the upload dialogString
getUploadSource()
Returns the current value for the changeset sourceUploadStrategySpecification
getUploadStrategySpecification()
Replies theUploadStrategySpecification
the user entered in the dialog.void
handleIllegalChunkSize()
Handles illegal chunk size.void
handleMissingComment()
Handles missing comment.void
handleMissingSource()
Handles missing source.void
initLifeCycle(DataSet dataSet)
Initializes this life cycle of the dialog.private void
osmServerUrlChanged(Setting<?> newValue)
void
preferenceChanged(PreferenceChangeEvent e)
Triggered when a preference entry value changes.void
propertyChange(PropertyChangeEvent evt)
void
rememberUserInput()
Remembers the user input in the preference settingsvoid
saveEdits()
Save all outstanding edits to the model.void
setFocusToUploadButton()
Sets the input focus to upload button.void
setSelectedChangesetForNextUpload(Changeset cs)
Sets the changeset to be used in the next uploadvoid
setUploadedPrimitives(APIDataSet toUpload)
Sets the collection of primitives to uploadvoid
setVisible(boolean visible)
-
Methods inherited from class org.openstreetmap.josm.gui.io.AbstractUploadDialog
isCanceled, setCanceled
-
Methods 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, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
-
Methods 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, toFront
-
Methods 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, validateTree
-
Methods 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 Detail
-
uploadDialog
private static UploadDialog uploadDialog
the unique instance of the upload dialog
-
pnlUploadedObjects
private UploadedObjectsSummaryPanel pnlUploadedObjects
the panel with the objects to upload
-
pnlBasicUploadSettings
private BasicUploadSettingsPanel pnlBasicUploadSettings
the "description" tab
-
pnlChangesetManagement
private ChangesetManagementPanel pnlChangesetManagement
the panel to select the changeset used
-
pnlUploadStrategySelectionPanel
private UploadStrategySelectionPanel pnlUploadStrategySelectionPanel
the panel to select the upload strategy
-
pnlTagEditor
private TagEditorPanel pnlTagEditor
the tag editor panel
-
tpConfigPanels
private JTabbedPane tpConfigPanels
the tabbed pane used below of the list of primitives
-
model
private final transient UploadDialogModel model
the model keeping the state of the changeset tags
-
-
Constructor Detail
-
UploadDialog
protected UploadDialog()
Constructs a newUploadDialog
.
-
-
Method Detail
-
getUploadDialog
public static UploadDialog getUploadDialog()
Replies the unique instance of the upload dialog- Returns:
- the unique instance of the upload dialog
-
buildContentPanel
protected JPanel buildContentPanel()
builds the content panel for the upload dialog- Returns:
- the content panel
-
buildActionPanel
protected JPanel buildActionPanel()
builds the panel with the OK and CANCEL buttons- Returns:
- The panel with the OK and CANCEL buttons
-
build
protected void build()
builds the gui
-
initLifeCycle
public void initLifeCycle(DataSet dataSet)
Initializes this life cycle of the dialog. Initializes the dialog each time before it is made visible. We cannot do this in the constructor because the dialog is a singleton.- Parameters:
dataSet
- The Dataset we want to upload- Since:
- 18173
-
setUploadedPrimitives
public void setUploadedPrimitives(APIDataSet toUpload)
Sets the collection of primitives to upload- Parameters:
toUpload
- the dataset with the objects to upload. If null, assumes the empty set of objects to upload
-
setFocusToUploadButton
public void setFocusToUploadButton()
Sets the input focus to upload button.- Since:
- 18173
-
rememberUserInput
public void rememberUserInput()
Description copied from interface:IUploadDialog
Remembers the user input in the preference settings- Specified by:
rememberUserInput
in interfaceIUploadDialog
- Overrides:
rememberUserInput
in classAbstractUploadDialog
-
getChangeset
public Changeset getChangeset()
Returns the changeset to use complete with tags- Returns:
- the changeset to use
-
setSelectedChangesetForNextUpload
public void setSelectedChangesetForNextUpload(Changeset cs)
Sets the changeset to be used in the next upload- Parameters:
cs
- the changeset
-
getUploadStrategySpecification
public UploadStrategySpecification getUploadStrategySpecification()
Description copied from interface:IUploadDialog
Replies theUploadStrategySpecification
the user entered in the dialog.- Specified by:
getUploadStrategySpecification
in interfaceIUploadDialog
- Returns:
- the
UploadStrategySpecification
the user entered in the dialog.
-
getModel
public UploadDialogModel getModel()
Get the upload dialog model.- Returns:
- The model.
- Since:
- 18173
-
getUploadComment
public String getUploadComment()
Description copied from interface:IUploadDialog
Returns the current value for the upload comment- Specified by:
getUploadComment
in interfaceIUploadDialog
- Returns:
- the current value for the upload comment
-
getUploadSource
public String getUploadSource()
Description copied from interface:IUploadDialog
Returns the current value for the changeset source- Specified by:
getUploadSource
in interfaceIUploadDialog
- Returns:
- the current value for the changeset source
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisible
in classDialog
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
preferenceChanged
public void preferenceChanged(PreferenceChangeEvent e)
Description copied from interface:PreferenceChangedListener
Triggered when a preference entry value changes.- Specified by:
preferenceChanged
in interfacePreferenceChangedListener
- Parameters:
e
- the preference change event
-
osmServerUrlChanged
private void osmServerUrlChanged(Setting<?> newValue)
-
getTags
public Map<String,String> getTags(boolean keepEmpty)
Description copied from interface:IUploadDialog
Replies the map with the current tags in the tag editor model.- Specified by:
getTags
in interfaceIUploadDialog
- Parameters:
keepEmpty
-true
to keep empty tags- Returns:
- the map with the current tags in the tag editor model.
-
handleMissingComment
public void handleMissingComment()
Description copied from interface:IUploadDialog
Handles missing comment.- Specified by:
handleMissingComment
in interfaceIUploadDialog
-
handleMissingSource
public void handleMissingSource()
Description copied from interface:IUploadDialog
Handles missing source.- Specified by:
handleMissingSource
in interfaceIUploadDialog
-
handleIllegalChunkSize
public void handleIllegalChunkSize()
Description copied from interface:IUploadDialog
Handles illegal chunk size.- Specified by:
handleIllegalChunkSize
in interfaceIUploadDialog
-
saveEdits
public void saveEdits()
Save all outstanding edits to the model.The combobox editors and the tag cell editor need to be manually saved because they normally save on focus loss, eg. when the "Upload" button is pressed, but there's no focus change when Ctrl+Enter is pressed.
- Since:
- 18173
-
clean
public void clean()
Clean dialog state and release resources.- Since:
- 14251
-
-