Package org.openstreetmap.josm.actions
Class UploadSelectionAction
java.lang.Object
javax.swing.AbstractAction
org.openstreetmap.josm.actions.JosmAction
org.openstreetmap.josm.actions.AbstractUploadAction
org.openstreetmap.josm.actions.UploadSelectionAction
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action,DataSetListenerAdapter.Listener,Destroyable
public class UploadSelectionAction
extends AbstractUploadAction
implements DataSetListenerAdapter.Listener
Uploads the current selection to the server.
- Since:
- 2250
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class(package private) static classComputes the collection of primitives to upload, given a collection of candidate primitives.Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter -
Field Summary
FieldsFields inherited from class org.openstreetmap.josm.actions.JosmAction
scFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddestroy()Called when the object has been destroyed.protected Set<OsmPrimitive>protected Set<OsmPrimitive>getModifiedPrimitives(Collection<OsmPrimitive> primitives) protected booleanhasPrimitivesToDelete(Collection<OsmPrimitive> primitives) Replies true if there is at least one non-new, deleted primitive inprimitivesvoidCalled when notified about any type of dataset change event.protected voidprocessPostParentChecker(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) protected voidOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.protected voidupdateEnabledState(Collection<? extends OsmPrimitive> selection) Override in subclasses to update the enabled state of the action if the collection of selected primitives changes.voiduploadPrimitives(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) Uploads the primitives intoUploadto the server.Methods inherited from class org.openstreetmap.josm.actions.AbstractUploadAction
buildLayerChangeAdapterMethods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, checkAndConfirmOutlyingOperation, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
dataChangedAdapter
-
-
Constructor Details
-
UploadSelectionAction
public UploadSelectionAction()Constructs a newUploadSelectionAction.
-
-
Method Details
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e. when a layer is removed or added. SeeJosmAction.updateEnabledState(Collection)to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledStatein classJosmAction- See Also:
-
updateEnabledState
Description copied from class:JosmActionOverride in subclasses to update the enabled state of the action if the collection of selected primitives changes. This method is called with the new selection.- Overrides:
updateEnabledStatein classJosmAction- Parameters:
selection- the collection of selected primitives; may be empty, but not null- See Also:
-
getDeletedPrimitives
-
getModifiedPrimitives
-
actionPerformed
- Specified by:
actionPerformedin interfaceActionListener
-
hasPrimitivesToDelete
Replies true if there is at least one non-new, deleted primitive inprimitives- Parameters:
primitives- the primitives to scan- Returns:
- true if there is at least one non-new, deleted primitive in
primitives
-
uploadPrimitives
Uploads the primitives intoUploadto the server. Only uploads primitives which are either new, modified or deleted. Also checks whethertoUploadhas to be extended with deleted parents in order to avoid precondition violations on the server.- Parameters:
layer- the data layer from which we upload a subset of primitivestoUpload- the primitives to upload. If null or empty returns immediately
-
processPostParentChecker
-
destroy
Description copied from interface:DestroyableCalled when the object has been destroyed.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classJosmAction
-
processDatasetEvent
Description copied from interface:DataSetListenerAdapter.ListenerCalled when notified about any type of dataset change event.- Specified by:
processDatasetEventin interfaceDataSetListenerAdapter.Listener- Parameters:
event- dataset change event
-