Package org.openstreetmap.josm.command
Class ChangePropertyKeyCommand
- java.lang.Object
-
- org.openstreetmap.josm.command.Command
-
- org.openstreetmap.josm.command.ChangePropertyKeyCommand
-
- All Implemented Interfaces:
PseudoCommand
public class ChangePropertyKeyCommand extends Command
Command that replaces the key of one or several objects- Since:
- 3669
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classChangePropertyKeyCommand.SinglePrimitivePseudoCommand-
Nested classes/interfaces inherited from class org.openstreetmap.josm.command.Command
Command.OldNodeState
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringkeyThe key that is subject to change.private java.lang.StringnewKeyThe mew key.private java.util.List<? extends OsmPrimitive>objectsAll primitives, that are affected with this command.-
Fields inherited from class org.openstreetmap.josm.command.Command
IS_INCOMPLETE, IS_OK, IS_OUTSIDE
-
-
Constructor Summary
Constructors Constructor Description ChangePropertyKeyCommand(java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String newKey)Constructs a newChangePropertyKeyCommand.ChangePropertyKeyCommand(DataSet ds, java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String newKey)Constructs a newChangePropertyKeyCommand.ChangePropertyKeyCommand(OsmPrimitive object, java.lang.String key, java.lang.String newKey)Constructs a newChangePropertyKeyCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)booleanexecuteCommand()Executes the command on the dataset.voidfillModifiedData(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.IcongetDescriptionIcon()Provides a descriptive icon of this command.java.lang.StringgetDescriptionText()Provides a description text representing this command.inthashCode()-
Methods inherited from class org.openstreetmap.josm.command.Command
checkOutlyingOrIncompleteOperation, ensurePrimitivesAreInDataset, getAffectedDataSet, getOrig, getParticipatingPrimitives, undoCommand
-
-
-
-
Field Detail
-
objects
private final java.util.List<? extends OsmPrimitive> objects
All primitives, that are affected with this command.
-
key
private final java.lang.String key
The key that is subject to change.
-
newKey
private final java.lang.String newKey
The mew key.
-
-
Constructor Detail
-
ChangePropertyKeyCommand
public ChangePropertyKeyCommand(OsmPrimitive object, java.lang.String key, java.lang.String newKey)
Constructs a newChangePropertyKeyCommand.- Parameters:
object- the object subject to change replacement. Must not be null, and belong to a data setkey- The key to replacenewKey- the new value of the key- Since:
- 6329
-
ChangePropertyKeyCommand
public ChangePropertyKeyCommand(java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String newKey)
Constructs a newChangePropertyKeyCommand.- Parameters:
objects- all objects subject to change replacement. Must not be null or empty, and objects must belong to a data setkey- The key to replacenewKey- the new value of the key- Throws:
java.lang.NullPointerException- if objects is null or contain null itemjava.util.NoSuchElementException- if objects is empty
-
ChangePropertyKeyCommand
public ChangePropertyKeyCommand(DataSet ds, java.util.Collection<? extends OsmPrimitive> objects, java.lang.String key, java.lang.String newKey)
Constructs a newChangePropertyKeyCommand.- Parameters:
ds- The target data set. Must not benullobjects- all objects subject to change replacement.key- The key to replacenewKey- the new value of the key- Since:
- 12726
-
-
Method Detail
-
executeCommand
public boolean executeCommand()
Description copied from class:CommandExecutes the command on the dataset. This implementation will remember all primitives returned by fillModifiedData for restoring them on undo.The layer should be invalidated after execution so that it can be re-painted.
- Overrides:
executeCommandin classCommand- Returns:
- true
-
fillModifiedData
public void fillModifiedData(java.util.Collection<OsmPrimitive> modified, java.util.Collection<OsmPrimitive> deleted, java.util.Collection<OsmPrimitive> added)
Description copied from class:CommandFill in the changed data this command operates on. Add to the lists, don't clear them.- Specified by:
fillModifiedDatain classCommand- Parameters:
modified- The modified primitivesdeleted- The deleted primitivesadded- The added primitives
-
getDescriptionText
public java.lang.String getDescriptionText()
Description copied from interface:PseudoCommandProvides a description text representing this command.- Returns:
- description text representing this command
-
getDescriptionIcon
public javax.swing.Icon getDescriptionIcon()
Description copied from interface:PseudoCommandProvides a descriptive icon of this command.- Returns:
- descriptive icon of this command
-
getChildren
public java.util.Collection<PseudoCommand> getChildren()
Description copied from interface:PseudoCommandReturns the subcommands of this command. Override for subclasses that have child commands.- Returns:
- the subcommands, null if there are no child commands
-
-