public class DirectoryNavigator extends Object
Constructor and Description |
---|
DirectoryNavigator(String fileXML)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addToPath(String directory)
Function used for testing.
|
DirectoryItem |
getDirectoryItem(int position)
Searches for a node in the current directory with the given position
|
long |
getFileCode(String name)
Identifies the node with name @a name and gets its file code in case the node is a file.
|
String |
getFileName(String name) |
String |
getPath() |
ArrayList<DirectoryItem> |
goToCurrentDirectory() |
ArrayList<DirectoryItem> |
goToParentDirectory()
Travel to the parent directory.
|
ArrayList<DirectoryItem> |
goToRoot()
Go to the root directory.
|
ArrayList<DirectoryItem> |
goToSubDirectory(int directoryPosition)
Travel inside a subdirectory.
|
ArrayList<DirectoryItem> |
goToSubDirectory(String subDirectory)
Travel inside a subdirectory.
|
boolean |
isRootDirectory() |
ArrayList<DirectoryItem> |
refresh(String fileXML)
Refresh the XML file and refresh the directory data.
|
public DirectoryNavigator(String fileXML)
fileXML
- File where we obtain all the information.public ArrayList<DirectoryItem> goToSubDirectory(String subDirectory) throws es.ugr.swad.swadroid.modules.downloads.InvalidPathException
subDirectory
- The subdirectory where we will travel.es.ugr.swad.swadroid.modules.downloads.InvalidPathException
- When the directory don't exist.public ArrayList<DirectoryItem> goToCurrentDirectory()
public ArrayList<DirectoryItem> goToSubDirectory(int directoryPosition) throws es.ugr.swad.swadroid.modules.downloads.InvalidPathException
directoryPosition
- The position of the subdirectory where we will travel.es.ugr.swad.swadroid.modules.downloads.InvalidPathException
- When the directory don't exist.public ArrayList<DirectoryItem> goToParentDirectory() throws es.ugr.swad.swadroid.modules.downloads.InvalidPathException
es.ugr.swad.swadroid.modules.downloads.InvalidPathException
- When the directory does not exist.public ArrayList<DirectoryItem> refresh(String fileXML) throws es.ugr.swad.swadroid.modules.downloads.InvalidPathException
es.ugr.swad.swadroid.modules.downloads.InvalidPathException
- When the directory don't exist.public ArrayList<DirectoryItem> goToRoot() throws es.ugr.swad.swadroid.modules.downloads.InvalidPathException
es.ugr.swad.swadroid.modules.downloads.InvalidPathException
- When the directory don't exist.public String getPath()
public void addToPath(String directory)
directory
- Directory to add to the current path.public DirectoryItem getDirectoryItem(int position)
position
- position where the node is locatedpublic long getFileCode(String name)
name
- Name of the node located on the current directory.public boolean isRootDirectory()