public final class JaxoIO
extends java.lang.Object
Constructor and Description |
---|
JaxoIO(java.awt.Component parentc)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
absoluteName(java.lang.String fileName)
Returns the absolute path of the given file name.
|
static java.lang.String |
baseName(java.lang.String fileName)
Basename: part before the last '.' that does not
occur at the beginning, or the fileName itself if
there is none.
|
static java.lang.String |
currentDirectoryString()
Returns the current directory as a string.
|
static java.lang.String |
directoryString(java.lang.String fileName)
Returns the absolute path of he directory that contains the fgiven file.
|
static java.lang.String |
extension(java.lang.String fileName)
Extension: part after the last '.' that does not
occur at the beginning, or "" if there is none.
|
JaxoGraph |
open()
Opens a new JaxoGraph: asks for an open file.
|
JaxoGraph |
open(java.io.File f)
Opens a new JaxoGraph from the specified file.
|
JaxoGraph |
open(java.io.File f,
boolean guiWarnings)
Opens a new JaxoGraph from the specified file.
|
JaxoGraph |
open(java.lang.String name)
Opens a new JaxoGraph from the specified file fileName.
|
void |
save(JaxoGraph graph,
java.lang.String title,
java.lang.String fileName)
Saves the specified JaxoGraph: if the current JaxoGraph has no
save file associated with it, asks for a save file name.
|
void |
saveAs(JaxoGraph graph,
java.lang.String title,
java.lang.String fileName)
Saves the specified JaxoGraph: asks for a save file.
|
static java.lang.String |
shortName(java.lang.String fileName)
Returns the short name if the given file.
|
static boolean |
shouldOverwrite(java.awt.Component parent,
java.io.File f)
Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten
and return the result.
|
static boolean |
shouldOverwrite(java.awt.Component parent,
java.io.File f,
java.lang.String dTitle)
Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten
and return the result.
|
static java.net.URL |
toURL(java.io.File f)
Convert 'f' to URL, and MalformedURLExceptions to IOExceptions.
|
static java.lang.String |
withExtension(java.lang.String name,
java.lang.String extension)
fileName with "." + extension added unless it is already at the end
or the fileName is empty.
|
public JaxoIO(java.awt.Component parentc)
parentc
- The parent component.public static java.net.URL toURL(java.io.File f) throws java.io.IOException
f
- The file to convert.java.io.IOException
- If the file cannot be converted.public static java.lang.String absoluteName(java.lang.String fileName)
fileName
- The file name.public static java.lang.String currentDirectoryString()
public static java.lang.String directoryString(java.lang.String fileName)
fileName
- The file name.public static java.lang.String shortName(java.lang.String fileName)
fileName
- The file name.public static java.lang.String extension(java.lang.String fileName)
f.equals(baseName(f) + "." + extension(f))
fileName
- The file name.public static java.lang.String baseName(java.lang.String fileName)
fileName
- The file name.public static java.lang.String withExtension(java.lang.String name, java.lang.String extension)
name
- The file name.extension
- The extension to add.public void save(JaxoGraph graph, java.lang.String title, java.lang.String fileName)
title
- title of graph (e.g. in tab)fileName
- suggested file name (if the graph does not have one)graph
- The graph to be saved.public void saveAs(JaxoGraph graph, java.lang.String title, java.lang.String fileName)
title
- title of graph (e.g. in tab)fileName
- suggested file name (if the graph does not have one)graph
- The graph to be saved.public static boolean shouldOverwrite(java.awt.Component parent, java.io.File f)
parent
- parent component for the dialog.f
- The file to test.public static boolean shouldOverwrite(java.awt.Component parent, java.io.File f, java.lang.String dTitle)
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.public JaxoGraph open()
public JaxoGraph open(java.lang.String name)
name
- An absolute path to the file to be opened.public JaxoGraph open(java.io.File f)
f
- A file to be opened.public JaxoGraph open(java.io.File f, boolean guiWarnings)
f
- A file to be opened.guiWarnings
- set to false to suppress any graphical warning dialogs.Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.