Class JaxoIO
java.lang.Object
net.sf.jaxodraw.io.JaxoIO
The class responsible for opening/saving JaxoGraphs.
Also contains utility methods for file name management etc.
- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringabsoluteName(String fileName) Returns the absolute path of the given file name.static StringBasename: part before the last '.' that does not occur at the beginning, or the fileName itself if there is none.static StringReturns the current directory as a string.static StringdirectoryString(String fileName) Returns the absolute path of he directory that contains the fgiven file.static StringExtension: part after the last '.' that does not occur at the beginning, or "" if there is none.open()Opens a new JaxoGraph: asks for an open file.Opens a new JaxoGraph from the specified file.Opens a new JaxoGraph from the specified file.Opens a new JaxoGraph from the specified file fileName.voidSaves the specified JaxoGraph: if the current JaxoGraph has no save file associated with it, asks for a save file name.voidSaves the specified JaxoGraph: asks for a save file.static StringReturns the short name if the given file.static booleanshouldOverwrite(Component parent, File f) Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten and return the result.static booleanshouldOverwrite(Component parent, File f, String dTitle) Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten and return the result.static URLConvert 'f' to URL, and MalformedURLExceptions to IOExceptions.static StringwithExtension(String name, String extension) fileName with "." + extension added unless it is already at the end or the fileName is empty.
-
Constructor Details
-
JaxoIO
-
-
Method Details
-
toURL
Convert 'f' to URL, and MalformedURLExceptions to IOExceptions.- Parameters:
f- The file to convert.- Returns:
- The URL of the file.
- Throws:
IOException- If the file cannot be converted.
-
absoluteName
-
currentDirectoryString
Returns the current directory as a string.- Returns:
- The current directory.
-
directoryString
-
shortName
-
extension
-
baseName
-
withExtension
-
save
Saves the specified JaxoGraph: if the current JaxoGraph has no save file associated with it, asks for a save file name. Othrewise saves the graph to the default file.- Parameters:
graph- The graph to be saved.title- title of graph (e.g. in tab)fileName- suggested file name (if the graph does not have one)
-
saveAs
-
shouldOverwrite
Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten and return the result. Otherwise, return true.- Parameters:
parent- parent component for the dialog.f- The file to test.- Returns:
- True if the file should be overwritten.
-
shouldOverwrite
Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten and return the result. Otherwise, return true.- Parameters:
parent- parent component for the dialog.f- The file to test.dTitle- of the question dialog, may be 'null', then a default title will be used.- Returns:
- True if the file should be overwritten.
-
open
Opens a new JaxoGraph: asks for an open file.- Returns:
- The new JaxoGraph or null if the file could not be opened.
-
open
-
open
-
open
-