public class ChangePropertyCommand extends Command
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.
|
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(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
|
checkAndConfirmOutlyingOperation, getAffectedDataSet, getLayer, getOrig, getParticipatingPrimitives, invalidateAffectedLayers, invalidBecauselayerRemoved, 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(java.util.Collection<? extends OsmPrimitive> objects, java.util.Map<java.lang.String,java.lang.String> tags)
objects
- the objects to modifytags
- the tags to setpublic ChangePropertyCommand(java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String value)
objects
- the objects to modifykey
- the key of the tag to setvalue
- the value of the key to setpublic ChangePropertyCommand(OsmPrimitive object, java.lang.String key, java.lang.String value)
object
- the object to modifykey
- the key of the tag to setvalue
- the value of the key to setprivate 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
Command.invalidateAffectedLayers()
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
getDescriptionText
in class PseudoCommand
public javax.swing.Icon getDescriptionIcon()
PseudoCommand
getDescriptionIcon
in class PseudoCommand
public java.util.Collection<PseudoCommand> getChildren()
PseudoCommand
getChildren
in class PseudoCommand
public final int getObjectsNumber()
Command.getParticipatingPrimitives()
public java.util.Map<java.lang.String,java.lang.String> getTags()