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 classUploadDialog.CancelActionAction for canceling the dialog.(package private) static classUploadDialog.CompactTabbedPane(package private) static classUploadDialog.UploadActionHandles an upload.(package private) classUploadDialog.WindowEventHandlerListens 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.JButtonbtnUploadthe upload buttonprivate javax.swing.event.ChangeListenerchangesetTagListenerprivate DataSetdataSetprivate UploadDialogModelmodelthe model keeping the state of the changeset tagsprivate BasicUploadSettingsPanelpnlBasicUploadSettingsthe "description" tabprivate ChangesetManagementPanelpnlChangesetManagementthe panel to select the changeset usedprivate TagEditorPanelpnlTagEditorthe tag editor panelprivate UploadedObjectsSummaryPanelpnlUploadedObjectsthe panel with the objects to uploadprivate UploadStrategySelectionPanelpnlUploadStrategySelectionPanelthe panel to select the upload strategyprivate javax.swing.JTabbedPanetpConfigPanelsthe tabbed pane used below of the list of primitivesprivate static UploadDialoguploadDialogthe unique instance of the upload dialogprivate static java.awt.ColorWARNING_BACKGROUNDA 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 protectedUploadDialog()Constructs a newUploadDialog.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbuild()builds the guiprotected javax.swing.JPanelbuildActionPanel()builds the panel with the OK and CANCEL buttonsprotected javax.swing.JPanelbuildContentPanel()builds the content panel for the upload dialogvoidclean()Clean dialog state and release resources.ChangesetgetChangeset()Returns the changeset to use complete with tagsUploadDialogModelgetModel()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.StringgetUploadComment()Returns the current value for the upload commentstatic UploadDialoggetUploadDialog()Replies the unique instance of the upload dialogjava.lang.StringgetUploadSource()Returns the current value for the changeset sourceUploadStrategySpecificationgetUploadStrategySpecification()Replies theUploadStrategySpecificationthe user entered in the dialog.voidhandleIllegalChunkSize()Handles illegal chunk size.voidhandleMissingComment()Handles missing comment.voidhandleMissingSource()Handles missing source.voidinitLifeCycle(DataSet dataSet)Initializes this life cycle of the dialog.private voidosmServerUrlChanged(Setting<?> newValue)voidpreferenceChanged(PreferenceChangeEvent e)Triggered when a preference entry value changes.voidpropertyChange(java.beans.PropertyChangeEvent evt)voidrememberUserInput()Remembers the user input in the preference settingsvoidsaveEdits()Save all outstanding edits to the model.voidsetChangesetTagsModifiedProgramatically()This is called byUploadDialog.UploadActionifUploadHooks change the changeset tags.voidsetFocusToUploadButton()Sets the input focus to upload button.voidsetSelectedChangesetForNextUpload(Changeset cs)Sets the changeset to be used in the next uploadvoidsetUploadedPrimitives(APIDataSet toUpload)Sets the collection of primitives to uploadvoidsetVisible(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:IUploadDialogRemembers the user input in the preference settings- Specified by:
rememberUserInputin interfaceIUploadDialog- Overrides:
rememberUserInputin 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:IUploadDialogReplies theUploadStrategySpecificationthe user entered in the dialog.- Specified by:
getUploadStrategySpecificationin interfaceIUploadDialog- Returns:
- the
UploadStrategySpecificationthe 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:IUploadDialogReturns the current value for the upload comment- Specified by:
getUploadCommentin interfaceIUploadDialog- Returns:
- the current value for the upload comment
-
getUploadSource
public java.lang.String getUploadSource()
Description copied from interface:IUploadDialogReturns the current value for the changeset source- Specified by:
getUploadSourcein interfaceIUploadDialog- Returns:
- the current value for the changeset source
-
setVisible
public void setVisible(boolean visible)
- Overrides:
setVisiblein classjava.awt.Dialog
-
setChangesetTagsModifiedProgramatically
public void setChangesetTagsModifiedProgramatically()
This is called byUploadDialog.UploadActionifUploadHooks change the changeset tags.
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
preferenceChanged
public void preferenceChanged(PreferenceChangeEvent e)
Description copied from interface:PreferenceChangedListenerTriggered when a preference entry value changes.- Specified by:
preferenceChangedin 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:IUploadDialogReplies the map with the current tags in the tag editor model.- Specified by:
getTagsin interfaceIUploadDialog- Parameters:
keepEmpty-trueto keep empty tags- Returns:
- the map with the current tags in the tag editor model.
-
handleMissingComment
public void handleMissingComment()
Description copied from interface:IUploadDialogHandles missing comment.- Specified by:
handleMissingCommentin interfaceIUploadDialog
-
handleMissingSource
public void handleMissingSource()
Description copied from interface:IUploadDialogHandles missing source.- Specified by:
handleMissingSourcein interfaceIUploadDialog
-
handleIllegalChunkSize
public void handleIllegalChunkSize()
Description copied from interface:IUploadDialogHandles illegal chunk size.- Specified by:
handleIllegalChunkSizein 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
-
-