|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jaxodraw.io.JaxoIO
public final class JaxoIO
The class responsible for opening/saving JaxoGraphs. Also contains utility methods for file name management etc.
Constructor Summary | |
---|---|
JaxoIO(Component parentc)
Constructor. |
Method Summary | |
---|---|
static String |
absoluteName(String fileName)
Returns the absolute path of the given file name. |
static String |
baseName(String fileName)
Basename: part before the last '.' that does not occur at the beginning, or the fileName itself if there is none. |
static String |
currentDirectoryString()
Returns the current directory as a string. |
static String |
directoryString(String fileName)
Returns the absolute path of he directory that contains the fgiven file. |
static String |
extension(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(File f)
Opens a new JaxoGraph from the specified file. |
JaxoGraph |
open(File f,
boolean guiWarnings)
Opens a new JaxoGraph from the specified file. |
JaxoGraph |
open(String name)
Opens a new JaxoGraph from the specified file fileName. |
void |
save(JaxoGraph graph,
String title,
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,
String title,
String fileName)
Saves the specified JaxoGraph: asks for a save file. |
static String |
shortName(String fileName)
Returns the short name if the given file. |
static boolean |
shouldOverwrite(Component parent,
File f)
Show a dialog if 'f' exists, asking the user whether 'f' should be overwritten and return the result. |
static boolean |
shouldOverwrite(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 URL |
toURL(File f)
Convert 'f' to URL, and MalformedURLExceptions to IOExceptions. |
static String |
withExtension(String name,
String extension)
fileName with "." + extension added unless it is already at the end or the fileName is empty. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JaxoIO(Component parentc)
parentc
- The parent component.Method Detail |
---|
public static URL toURL(File f) throws IOException
f
- The file to convert.
IOException
- If the file cannot be converted.public static String absoluteName(String fileName)
fileName
- The file name.
public static String currentDirectoryString()
public static String directoryString(String fileName)
fileName
- The file name.
public static String shortName(String fileName)
fileName
- The file name.
public static String extension(String fileName)
f.equals(baseName(f) + "." + extension(f))
fileName
- The file name.
public static String baseName(String fileName)
fileName
- The file name.
public static String withExtension(String name, String extension)
name
- The file name.extension
- The extension to add.
public void save(JaxoGraph graph, String title, 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, String title, 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(Component parent, File f)
parent
- parent component for the dialog.f
- The file to test.
public static boolean shouldOverwrite(Component parent, File f, 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(String name)
name
- An absolute path to the file to be opened.
public JaxoGraph open(File f)
f
- A file to be opened.
public JaxoGraph open(File f, boolean guiWarnings)
f
- A file to be opened.guiWarnings
- set to false to suppress any graphical warning dialogs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |