net.sf.gridarta.model.mapmanager
public class TestFileControl extends Object implements FileControl<TestGameObject,TestMapArchObject,TestArchetype>
FileControl
implementation for testing purposes.Modifier and Type | Field and Description |
---|---|
private StringBuilder |
sb
Collects the performed actions.
|
Constructor and Description |
---|
TestFileControl() |
Modifier and Type | Method and Description |
---|---|
boolean |
closeAllMaps()
Invoked when the user wants to close all maps.
|
boolean |
confirmSaveChanges(MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
Asks the user whether to save changes of a map.
|
void |
openFile(boolean mapFile)
The user wants to edit a file.
|
void |
reportLoadError(File file,
String message) |
void |
reportOutOfMapBoundsDeleted(File file,
int outOfMapBoundsDeleted,
StringBuilder outOfMapBoundsObjects) |
void |
reportOutOfMemory(File file) |
void |
reportSaveError(File mapFile,
String message)
Reports an error while saving a map file to the user.
|
void |
reportSaveError(MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl,
String message)
Reports an error while saving a map file to the user.
|
void |
reportTeleportCharacterError(String mapPath,
String message)
Reports an error while teleporting a character to the current map.
|
boolean |
save(MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
Save one map.
|
void |
saveAllMaps()
Saves all maps.
|
boolean |
saveAs(MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
Asks the user for a filename, then saves the map.
|
String |
toString() |
@NotNull private final StringBuilder sb
public TestFileControl()
public void openFile(boolean mapFile)
openFile
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapFile
- true
for map files, false
for script
filespublic boolean save(@NotNull MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
save
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapControl
- the mapfalse
if saving failed, true
otherwisepublic void saveAllMaps()
saveAllMaps
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
public boolean closeAllMaps()
closeAllMaps
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
true
if all maps closed, false
if user
cancelled.public boolean saveAs(@NotNull MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
saveAs
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapControl
- the mapfalse
if the user cancelled the save or if saving
failed, true
otherwisepublic boolean confirmSaveChanges(@NotNull MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl)
true
(and does not ask the user) if the map is unmodified.confirmSaveChanges
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapControl
- the mappublic void reportSaveError(@NotNull MapControl<TestGameObject,TestMapArchObject,TestArchetype> mapControl, @NotNull String message)
reportSaveError
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapControl
- the map control that failed savingmessage
- the error messagepublic void reportSaveError(@NotNull File mapFile, @NotNull String message)
reportSaveError
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapFile
- the map file that failed savingmessage
- the error messagepublic void reportLoadError(@Nullable File file, @NotNull String message)
reportLoadError
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
public void reportOutOfMapBoundsDeleted(@NotNull File file, int outOfMapBoundsDeleted, @NotNull StringBuilder outOfMapBoundsObjects)
reportOutOfMapBoundsDeleted
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
public void reportOutOfMemory(@NotNull File file)
reportOutOfMemory
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
public void reportTeleportCharacterError(@NotNull String mapPath, @NotNull String message)
reportTeleportCharacterError
in interface FileControl<TestGameObject,TestMapArchObject,TestArchetype>
mapPath
- the map path to teleport tomessage
- the error messageFeedback: webmaster
© 2003-2010 The Gridarta Developers. All rights reserved.