public class UploadSelectionAction extends JosmAction
Modifier and Type | Class and Description |
---|---|
(package private) class |
UploadSelectionAction.DeletedParentsChecker |
(package private) static class |
UploadSelectionAction.UploadHullBuilder
Computes the collection of primitives to upload, given a collection of candidate
primitives.
|
sc
changeSupport, enabled
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 and Description |
---|
UploadSelectionAction() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
protected Set<OsmPrimitive> |
getDeletedPrimitives(DataSet ds) |
protected Set<OsmPrimitive> |
getModifiedPrimitives(Collection<OsmPrimitive> primitives) |
protected boolean |
hasPrimitivesToDelete(Collection<OsmPrimitive> primitives)
Replies true if there is at least one non-new, deleted primitive in
primitives |
protected void |
processPostParentChecker(OsmDataLayer layer,
Collection<OsmPrimitive> toUpload) |
protected void |
updateEnabledState()
Override 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.
|
protected void |
updateEnabledState(Collection<? extends OsmPrimitive> selection)
Override in subclasses to update the enabled state of the action if the
collection of selected primitives changes.
|
void |
uploadPrimitives(OsmDataLayer layer,
Collection<OsmPrimitive> toUpload)
Uploads the primitives in
toUpload to the server. |
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public UploadSelectionAction()
protected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
protected void updateEnabledState(Collection<? extends OsmPrimitive> selection)
JosmAction
updateEnabledState
in class JosmAction
selection
- the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
protected Set<OsmPrimitive> getDeletedPrimitives(DataSet ds)
protected Set<OsmPrimitive> getModifiedPrimitives(Collection<OsmPrimitive> primitives)
public void actionPerformed(ActionEvent e)
protected boolean hasPrimitivesToDelete(Collection<OsmPrimitive> primitives)
primitives
primitives
- the primitives to scanprimitives
public void uploadPrimitives(OsmDataLayer layer, Collection<OsmPrimitive> toUpload)
toUpload
to the server. Only
uploads primitives which are either new, modified or deleted.
Also checks whether toUpload
has to be extended with
deleted parents in order to avoid precondition violations on the server.layer
- the data layer from which we upload a subset of primitivestoUpload
- the primitives to upload. If null or empty returns immediatellyprotected void processPostParentChecker(OsmDataLayer layer, Collection<OsmPrimitive> toUpload)