Go to the documentation of this file.
20 package net.sf.gridarta.actions;
22 import java.awt.Point;
23 import java.io.IOException;
39 import org.jetbrains.annotations.NotNull;
40 import org.jetbrains.annotations.Nullable;
94 public ExitConnectorActions(@NotNull
final ExitConnectorModel exitConnectorModel, @NotNull
final ExitMatcher<G, A, R> exitMatcher, @NotNull
final ArchetypeSet<G, A, R> archetypeSet, @NotNull
final MapManager<G, A, R> mapManager, @NotNull
final FileControl<G, A, R> fileControl, @NotNull
final InsertionModeSet<G, A, R> insertionModeSet) {
113 if (mapFile ==
null) {
135 if (sourceExitLocation ==
null) {
146 if (cursorExit !=
null) {
147 targetExit = cursorExit;
156 if (targetExit ==
null) {
167 if (!
pasteExit(targetLocation, targetMapModel, targetArchetype, sourceExitLocation, targetMapFile)) {
175 pasteExit(targetExit, targetMapModel, sourceExitLocation, targetMapFile);
191 if (sourceExitLocation ==
null) {
197 if (targetMapFile ==
null) {
210 if (cursorExit !=
null) {
211 targetExit = cursorExit;
212 targetArchetype =
null;
227 }
catch (
final IOException ex) {
232 return doExitConnect(performAction, targetExit, targetArchetype, targetMapModel, targetLocation, targetMapFile, sourceMapControl.
getMapModel(), sourceExitLocation);
238 sourceMapControl.
save();
239 }
catch (
final IOException ex) {
263 private boolean doExitConnect(
final boolean performAction, @Nullable
final BaseObject<?, ?, ?, ?> targetExit, @Nullable
final BaseObject<G, A, R, ?> targetArchetype, @NotNull
final MapModel<G, A, R> targetMapModel, @NotNull
final Point targetLocation, @NotNull
final MapFile targetMapFile, @NotNull
final MapModel<G, A, R> sourceMapModel, @NotNull
final ExitLocation sourceExitLocation) {
264 final MapFile sourceMapFile = sourceMapModel.getMapFile();
265 if (sourceMapFile ==
null) {
270 final Point sourceLocation = sourceExitLocation.getMapCoordinate();
277 sourceArchetype =
null;
290 final ExitLocation targetExitLocation =
new ExitLocation(targetMapFile, targetLocation, targetMapModel.getMapArchObject().getMapName());
291 if (sourceExit ==
null) {
292 if (!
pasteExit(sourceLocation, sourceMapModel, sourceArchetype, targetExitLocation, sourceMapFile)) {
296 pasteExit(sourceExit, sourceMapModel, targetExitLocation, sourceMapFile);
299 if (targetExit ==
null) {
300 assert targetArchetype !=
null;
301 if (!
pasteExit(targetLocation, targetMapModel, targetArchetype, sourceExitLocation, targetMapFile)) {
305 pasteExit(targetExit, targetMapModel, sourceExitLocation, targetMapFile);
321 mapModel.beginTransaction(
"paste exit");
325 mapModel.endTransaction();
340 mapModel.beginTransaction(
"paste exit");
343 if (newExit ==
null) {
349 mapModel.endTransaction();
boolean doExitCopy(final boolean performAction, @NotNull final MapControl< G, A, R > mapControl, @NotNull final Point location)
R getArchetype(@NotNull String archetypeName)
InsertionMode getTopmostInsertionMode()
final ArchetypeSet< G, A, R > archetypeSet
boolean doExitConnect(final boolean performAction, @NotNull final MapControl< G, A, R > mapControl, @NotNull final Point targetLocation)
void release(@NotNull MapControl< G, A, R > mapControl)
void setExitLocation(@Nullable ExitLocation exitLocation)
boolean isPasteExitName()
final ExitMatcher< G, A, R > exitMatcher
final MapManager< G, A, R > mapManager
MapControl< G, A, R > openMapFile(@NotNull MapFile mapFile, boolean interactive)
ExitLocation getExitLocation()
void pasteExit(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final MapModel< G, A, R > mapModel, @NotNull final ExitLocation exitLocation, @Nullable final MapFile gameObjectMapFile)
ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher< G, A, R > exitMatcher, @NotNull final ArchetypeSet< G, A, R > archetypeSet, @NotNull final MapManager< G, A, R > mapManager, @NotNull final FileControl< G, A, R > fileControl, @NotNull final InsertionModeSet< G, A, R > insertionModeSet)
void reportSaveError(@NotNull MapControl< G, A, R > mapControl, @NotNull String message)
String getExitArchetypeName()
final FileControl< G, A, R > fileControl
boolean doExitConnect(final boolean performAction, @Nullable final BaseObject<?, ?, ?, ?> targetExit, @Nullable final BaseObject< G, A, R, ?> targetArchetype, @NotNull final MapModel< G, A, R > targetMapModel, @NotNull final Point targetLocation, @NotNull final MapFile targetMapFile, @NotNull final MapModel< G, A, R > sourceMapModel, @NotNull final ExitLocation sourceExitLocation)
final InsertionModeSet< G, A, R > insertionModeSet
boolean doExitPaste(final boolean performAction, @NotNull final MapControl< G, A, R > mapControl, @NotNull final Point targetLocation)
boolean isAutoCreateExit()
final ExitConnectorModel exitConnectorModel
G getExit(@NotNull final MapModel< G, A, R > mapModel, @Nullable final Point point)
MapModel< G, A, R > getMapModel()
boolean pasteExit(@NotNull final Point location, @NotNull final MapModel< G, A, R > mapModel, @NotNull final BaseObject< G, A, R, ?> archetype, @NotNull final ExitLocation exitLocation, @Nullable final MapFile mapFile)
void reportLoadError(@Nullable File file, @NotNull String message)