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:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.beans.PropertyChangeListener
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
,IUploadDialog
,PreferenceChangedListener
public class UploadDialog extends AbstractUploadDialog implements PreferenceChangedListener, java.beans.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
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.JButton
btnUpload
the upload buttonprivate javax.swing.event.ChangeListener
changesetTagListener
private 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 javax.swing.JTabbedPane
tpConfigPanels
the tabbed pane used below of the list of primitivesprivate static UploadDialog
uploadDialog
the unique instance of the upload dialogprivate static java.awt.Color
WARNING_BACKGROUND
A warning color to indicate something is non-default in the changeset tags-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
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 javax.swing.JPanel
buildActionPanel()
builds the panel with the OK and CANCEL buttonsprotected javax.swing.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.java.util.Map<java.lang.String,java.lang.String>
getTags(boolean keepEmpty)
Replies the map with the current tags in the tag editor model.java.lang.String
getUploadComment()
Returns the current value for the upload commentstatic UploadDialog
getUploadDialog()
Replies the unique instance of the upload dialogjava.lang.String
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(java.beans.PropertyChangeEvent evt)
void
rememberUserInput()
Remembers the user input in the preference settingsvoid
saveEdits()
Save all outstanding edits to the model.void
setChangesetTagsModifiedProgramatically()
This is called byUploadDialog.UploadAction
ifUploadHook
s change the changeset tags.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
-
WARNING_BACKGROUND
private static final java.awt.Color WARNING_BACKGROUND
A warning color to indicate something is non-default in the changeset tags
-
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 javax.swing.JTabbedPane tpConfigPanels
the tabbed pane used below of the list of primitives
-
btnUpload
private javax.swing.JButton btnUpload
the upload button
-
model
private final transient UploadDialogModel model
the model keeping the state of the changeset tags
-
changesetTagListener
private transient javax.swing.event.ChangeListener changesetTagListener
-
-
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 javax.swing.JPanel buildContentPanel()
builds the content panel for the upload dialog- Returns:
- the content panel
-
buildActionPanel
protected javax.swing.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 java.lang.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 java.lang.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 classjava.awt.Dialog
-
setChangesetTagsModifiedProgramatically
public void setChangesetTagsModifiedProgramatically()
This is called byUploadDialog.UploadAction
ifUploadHook
s change the changeset tags.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
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 java.util.Map<java.lang.String,java.lang.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
-
-