Gridarta Editor
net.sf.gridarta.model.io.PathManager Class Reference

This class contains methods for converting relative map paths to absolute map paths and vice versa. More...

+ Collaboration diagram for net.sf.gridarta.model.io.PathManager:

Public Member Functions

MapFile getMapFile (@NotNull final AbsoluteMapPath mapPath)
 Returns a MapFile instance from an AbsoluteMapPath. More...
 
MapFile getMapFile (@NotNull final File file)
 Returns a MapFile instance for a File. More...
 
String getMapPath (@NotNull final File file)
 Returns a map path for a File. More...
 
 PathManager (@NotNull final ProjectSettings projectSettings)
 Creates a new instance. More...
 

Private Attributes

final ProjectSettings projectSettings
 The ProjectSettings instance for obtaining folder information. More...
 

Detailed Description

This class contains methods for converting relative map paths to absolute map paths and vice versa.

Server-side, paths to maps always are URIs with the maps directory being the root directory for the maps. Therefore it makes sense to treat them as URIs in the editor as well.

Author
Christian Hujer
Todo:
make more use of URI

Definition at line 38 of file PathManager.java.

Constructor & Destructor Documentation

◆ PathManager()

net.sf.gridarta.model.io.PathManager.PathManager ( @NotNull final ProjectSettings  projectSettings)

Creates a new instance.

Parameters
projectSettingsthe project settings instance for obtaining folder information

Definition at line 51 of file PathManager.java.

References net.sf.gridarta.model.io.PathManager.projectSettings.

Member Function Documentation

◆ getMapFile() [1/2]

MapFile net.sf.gridarta.model.io.PathManager.getMapFile ( @NotNull final AbsoluteMapPath  mapPath)

Returns a MapFile instance from an AbsoluteMapPath.

Parameters
mapPaththe map path
Returns
the map file instance

Definition at line 71 of file PathManager.java.

References net.sf.gridarta.model.settings.ProjectSettings.getMapsDirectory().

Referenced by net.sf.gridarta.model.mapcontrol.TestMapControlCreator.createMaps(), net.sf.gridarta.plugin.parameter.MapParameter< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getValue(), net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadEntry(), net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.openMapFile(), net.sf.gridarta.gui.map.mapview.MapViewsManager<?, ?, ?>.openMapFileWithView(), net.sf.gridarta.gui.misc.DefaultFileControl< G, A, R >.saveAs(), net.sf.gridarta.plugin.parameter.MapPathParameter< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setFile(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1(), net.sf.gridarta.model.index.MapsIndexerTest.test2(), net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test3(), net.sf.gridarta.plugin.parameter.PluginParameterCodecTest.testMapFromXml3(), net.sf.gridarta.plugin.parameter.PluginParameterCodecTest.testMapToXml3(), net.sf.gridarta.model.io.DefaultMapReaderTest.testReorderMultiSquares(), net.sf.gridarta.model.mapmanager.DefaultMapManagerTest.testRevertResizedMap(), net.sf.gridarta.model.mapcontrol.DefaultMapControlTest.testSave1(), net.sf.gridarta.model.mapcontrol.DefaultMapControlTest.testSaveAs1(), and net.sf.gridarta.gui.mapmenu.MapMenuManagerTest.testSaveBookmarks().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMapFile() [2/2]

MapFile net.sf.gridarta.model.io.PathManager.getMapFile ( @NotNull final File  file)

Returns a MapFile instance for a File.

If the file points into the maps directory, a properly based map file is returned. Otherwise a map file based on the root directory is returned.

Parameters
filethe file
Returns
the map file instance

Definition at line 83 of file PathManager.java.

References net.sf.gridarta.utils.IOUtils.getCanonicalPath(), net.sf.gridarta.model.settings.ProjectSettings.getMapsDirectory(), and net.sf.gridarta.model.mapmodel.MapPathUtils.newMapPath().

+ Here is the call graph for this function:

◆ getMapPath()

String net.sf.gridarta.model.io.PathManager.getMapPath ( @NotNull final File  file)

Returns a map path for a File.

Parameters
filethe file
Returns
the map path

Definition at line 61 of file PathManager.java.

References net.sf.gridarta.model.io.PathManagerUtils.getMapPath(), and net.sf.gridarta.model.settings.ProjectSettings.getMapsDirectory().

+ Here is the call graph for this function:

Member Data Documentation

◆ projectSettings

final ProjectSettings net.sf.gridarta.model.io.PathManager.projectSettings
private

The ProjectSettings instance for obtaining folder information.

Definition at line 44 of file PathManager.java.

Referenced by net.sf.gridarta.model.io.PathManager.PathManager().


The documentation for this class was generated from the following file: