![]() |
Gridarta Editor
|
Common base implementation of CopyBuffer. More...
Public Member Functions | |
void | addMapModelListener (@NotNull final MapModelListener< G, A, R > listener) |
Adds a MapModelListener to be notified about changes of the cut/copied game objects. More... | |
void | clear (@NotNull final MapView< G, A, R > mapView, @NotNull final Rectangle selectedRec) |
Executes the Clear command. More... | |
void | copy (@NotNull final MapView< G, A, R > mapView, @NotNull final Rectangle selectedRec) |
Executes the Copy command. More... | |
CopyBuffer (@NotNull final MapViewSettings mapViewSettings, @NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final MapArchObjectFactory< A > mapArchObjectFactory, @NotNull final MapModelFactory< G, A, R > mapModelFactory, @NotNull final InsertionModeSet< G, A, R > insertionModeSet) | |
Creates a new instance. More... | |
void | cut (@NotNull final MapView< G, A, R > mapView, @NotNull final Rectangle selectedRec) |
Executes the Cut command. More... | |
List< G > | getAllGameObjects () |
Returns all game objects. More... | |
boolean | isEmpty () |
Returns whether this copy buffer contains any game objects. More... | |
void | paste (@NotNull final MapView< G, A, R > mapView, @NotNull final Point startLocation) |
Executes the Paste command. More... | |
void | pasteTiled (@NotNull final MapView< G, A, R > mapView, @NotNull final Iterable< MapSquare< G, A, R >> selectedSquares, @NotNull final Point origin) |
Executes the Paste Tiled command. More... | |
void | removeMapModelListener (@NotNull final MapModelListener< G, A, R > listener) |
Removes a MapModelListener to be notified about changes of the cut/copied game objects. More... | |
Private Member Functions | |
void | copyNCut (@NotNull final MapView< G, A, R > mapView, @NotNull final Rectangle selectedRec, @NotNull final CopyMode copyMode) |
Implements clear, cut and copy in one function (since they are so similar). More... | |
Private Attributes | |
final GameObjectFactory< G, A, R > | gameObjectFactory |
The GameObjectFactory to use. More... | |
final InsertionModeSet< G, A, R > | insertionModeSet |
The InsertionModeSet to use. More... | |
final MapModel< G, A, R > | mapModel |
Internal map model to store the cut / copied game objects. More... | |
final MapViewSettings | mapViewSettings |
The map view settings instance. More... | |
Common base implementation of CopyBuffer.
The CopyBuffer is responsible for cut, copy, paste and related operations like filling. It is backed by an invisible MapModel.
Definition at line 52 of file CopyBuffer.java.
net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.CopyBuffer | ( | @NotNull final MapViewSettings | mapViewSettings, |
@NotNull final GameObjectFactory< G, A, R > | gameObjectFactory, | ||
@NotNull final MapArchObjectFactory< A > | mapArchObjectFactory, | ||
@NotNull final MapModelFactory< G, A, R > | mapModelFactory, | ||
@NotNull final InsertionModeSet< G, A, R > | insertionModeSet | ||
) |
Creates a new instance.
mapViewSettings | the map view settings instance |
gameObjectFactory | the game object factory to use |
mapArchObjectFactory | the map arch object factory to use |
mapModelFactory | the map model factory to use |
insertionModeSet | the insertion mode set to use |
Definition at line 86 of file CopyBuffer.java.
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addMapModelListener | ( | @NotNull final MapModelListener< G, A, R > | listener | ) |
Adds a MapModelListener to be notified about changes of the cut/copied game objects.
listener | the listener |
Definition at line 100 of file CopyBuffer.java.
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.clear | ( | @NotNull final MapView< G, A, R > | mapView, |
@NotNull final Rectangle | selectedRec | ||
) |
Executes the Clear command.
mapView | the map view to clear |
selectedRec | the rectangle to operate on |
Definition at line 118 of file CopyBuffer.java.
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.copy | ( | @NotNull final MapView< G, A, R > | mapView, |
@NotNull final Rectangle | selectedRec | ||
) |
Executes the Copy command.
mapView | the map view to copy from |
selectedRec | the rectangle to operate on |
Definition at line 136 of file CopyBuffer.java.
|
private |
Implements clear, cut and copy in one function (since they are so similar).
mapView | the map view to operate on |
selectedRec | the rectangle to operate on |
copyMode | defines if we have a cut, copy or paste action |
Definition at line 147 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.clear(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.copy(), and net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.cut().
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.cut | ( | @NotNull final MapView< G, A, R > | mapView, |
@NotNull final Rectangle | selectedRec | ||
) |
Executes the Cut command.
mapView | the map view to cut from |
selectedRec | the rectangle to operate on |
Definition at line 127 of file CopyBuffer.java.
Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doCut(), and net.sf.gridarta.gui.copybuffer.CopyBufferTest.testCutPaste1().
List<G> net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getAllGameObjects | ( | ) |
Returns all game objects.
Only top-level head parts are returned; tail parts are ignored as are objects in inventories.
Definition at line 263 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.dialog.replace.ReplaceDialog< G, A, R >.display(), and net.sf.gridarta.gui.dialog.replace.ReplaceDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.ReplaceWithBoxItemListener.itemStateChanged().
boolean net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isEmpty | ( | ) |
Returns whether this copy buffer contains any game objects.
Definition at line 271 of file CopyBuffer.java.
Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doPaste(), and net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doPasteTiled().
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.paste | ( | @NotNull final MapView< G, A, R > | mapView, |
@NotNull final Point | startLocation | ||
) |
Executes the Paste command.
mapView | the map view to paste on |
startLocation | the location to paste into |
Definition at line 180 of file CopyBuffer.java.
Referenced by net.sf.gridarta.mainactions.MainActions< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doPaste(), and net.sf.gridarta.gui.copybuffer.CopyBufferTest.testCutPaste1().
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pasteTiled | ( | @NotNull final MapView< G, A, R > | mapView, |
@NotNull final Iterable< MapSquare< G, A, R >> | selectedSquares, | ||
@NotNull final Point | origin | ||
) |
Executes the Paste Tiled command.
mapView | the map view to paste on |
selectedSquares | the square to paste into |
origin | the origin where to start pasting |
Definition at line 220 of file CopyBuffer.java.
void net.sf.gridarta.gui.copybuffer.CopyBuffer< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeMapModelListener | ( | @NotNull final MapModelListener< G, A, R > | listener | ) |
Removes a MapModelListener to be notified about changes of the cut/copied game objects.
listener | the listener |
Definition at line 109 of file CopyBuffer.java.
|
private |
The GameObjectFactory to use.
Definition at line 70 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.CopyBuffer(), and net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.copyNCut().
|
private |
The InsertionModeSet to use.
Definition at line 76 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.CopyBuffer(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.copyNCut(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.paste(), and net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.pasteTiled().
|
private |
Internal map model to store the cut / copied game objects.
Definition at line 64 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.addMapModelListener(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.CopyBuffer(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.copyNCut(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.getAllGameObjects(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.isEmpty(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.paste(), net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.pasteTiled(), and net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.removeMapModelListener().
|
private |
The map view settings instance.
Definition at line 58 of file CopyBuffer.java.
Referenced by net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.CopyBuffer(), and net.sf.gridarta.gui.copybuffer.CopyBuffer< G, A, R >.copyNCut().