public class ChangePropertyCommand extends Command
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ChangePropertyCommand.OsmPseudoCommand |
Command.OldNodeState
Modifier and Type | Field and Description |
---|---|
private java.util.List<OsmPrimitive> |
objects
All primitives that are affected with this command.
|
private java.util.Map<java.lang.String,java.lang.String> |
tags
Key and value pairs.
|
IS_INCOMPLETE, IS_OK, IS_OUTSIDE
Constructor and Description |
---|
ChangePropertyCommand(java.util.Collection<? extends OsmPrimitive> objects,
java.util.Map<java.lang.String,java.lang.String> tags)
Creates a command to change multiple tags of multiple objects
|
ChangePropertyCommand(java.util.Collection<? extends OsmPrimitive> objects,
java.lang.String key,
java.lang.String value)
Creates a command to change one tag of multiple objects
|
ChangePropertyCommand(DataSet ds,
java.util.Collection<? extends OsmPrimitive> objects,
java.util.Map<java.lang.String,java.lang.String> tags)
Creates a command to change multiple tags of multiple objects
|
ChangePropertyCommand(OsmPrimitive object,
java.lang.String key,
java.lang.String value)
Creates a command to change one tag of one object
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
boolean |
executeCommand()
Executes the command on the dataset.
|
void |
fillModifiedData(java.util.Collection<OsmPrimitive> modified,
java.util.Collection<OsmPrimitive> deleted,
java.util.Collection<OsmPrimitive> added)
Fill in the changed data this command operates on.
|
java.util.Collection<PseudoCommand> |
getChildren()
Returns the subcommands of this command.
|
javax.swing.Icon |
getDescriptionIcon()
Provides a descriptive icon of this command.
|
java.lang.String |
getDescriptionText()
Provides a description text representing this command.
|
int |
getObjectsNumber()
Returns the number of objects that will effectively be modified, before the command is executed.
|
java.util.Map<java.lang.String,java.lang.String> |
getTags()
Returns the tags to set (key/value pairs).
|
int |
hashCode() |
private void |
init(java.util.Collection<? extends OsmPrimitive> objects)
Initialize the instance by finding what objects will be modified
|
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig, getParticipatingPrimitives, undoCommand
private final java.util.List<OsmPrimitive> objects
private final java.util.Map<java.lang.String,java.lang.String> tags
null
, delete all key references with the given
key. Otherwise, change the tags of all objects to the given value or create keys of
those objects that do not have the key yet.public ChangePropertyCommand(DataSet ds, java.util.Collection<? extends OsmPrimitive> objects, java.util.Map<java.lang.String,java.lang.String> tags)
ds
- The target data set. Must not be null
objects
- the objects to modify. Must not be emptytags
- the tags to setpublic ChangePropertyCommand(java.util.Collection<? extends OsmPrimitive> objects, java.util.Map<java.lang.String,java.lang.String> tags)
objects
- the objects to modify. Must not be empty, and objects must belong to a data settags
- the tags to setjava.lang.NullPointerException
- if objects is null or contain null itemjava.util.NoSuchElementException
- if objects is emptypublic ChangePropertyCommand(java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String value)
objects
- the objects to modify. Must not be empty, and objects must belong to a data setkey
- the key of the tag to setvalue
- the value of the key to setjava.lang.NullPointerException
- if objects is null or contain null itemjava.util.NoSuchElementException
- if objects is emptypublic ChangePropertyCommand(OsmPrimitive object, java.lang.String key, java.lang.String value)
object
- the object to modify. Must belong to a data setkey
- the key of the tag to setvalue
- the value of the key to setjava.lang.NullPointerException
- if object is nullprivate void init(java.util.Collection<? extends OsmPrimitive> objects)
objects
- the objects to (possibly) modifypublic boolean executeCommand()
Command
The layer should be invalidated after execution so that it can be re-painted.
executeCommand
in class Command
public void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
Command
fillModifiedData
in class Command
modified
- The modified primitivesdeleted
- The deleted primitivesadded
- The added primitivespublic java.lang.String getDescriptionText()
PseudoCommand
public javax.swing.Icon getDescriptionIcon()
PseudoCommand
public java.util.Collection<PseudoCommand> getChildren()
PseudoCommand
public final int getObjectsNumber()
Command.getParticipatingPrimitives()
public java.util.Map<java.lang.String,java.lang.String> getTags()