|
VdexReload 1.1.3 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.reload.dweezil.util.ReloadUtils
Some useful General Utilities
Field Summary | |
static int |
MACINTOSH
Macintosh OS |
static int |
UNIX
Unix OS |
static int |
WINDOWS_2000
Windows 2000 |
static int |
WINDOWS_9x
Windows 98 |
static int |
WINDOWS_NT
Windows NT |
static int |
WINDOWS_XP
Windows XP |
Fields inherited from interface uk.ac.reload.dweezil.DweezilConstants |
CR, DEBUG |
Method Summary | |
static java.io.File |
askFileNameOpen(java.awt.Component parent,
java.lang.String title,
javax.swing.filechooser.FileFilter filter)
Ask the user for a File name to open |
static java.io.File |
askFileNameOpenUsingDirName(java.awt.Component parent,
java.lang.String title,
javax.swing.filechooser.FileFilter filter,
java.io.File currentDir)
Ask the user for a File name to open, the name of the current dir is given |
static java.io.File |
askFileNameSave(java.awt.Component parent,
java.lang.String title,
javax.swing.filechooser.FileFilter filter,
java.lang.String extension)
Ask the user for a File name to save a Document as |
static void |
centreWindow(java.awt.Window window,
int width,
int height)
Centres a window on the screen given the size of window. |
static void |
centreWindowProportional(java.awt.Window window,
double width,
double height)
Centres a window on the screen given the proportional size of window. |
static void |
copyFile(java.io.File srcFile,
java.io.File destFile)
Copy a File. |
static boolean |
copyFolder(java.io.File srcFolder,
java.io.File destFolder,
ReloadProgressMonitor progressMonitor)
Copy a Folder and all its files and sub-folder to target Folder Both Source Folder and Target Folder must exist |
static int |
countFiles(java.io.File folder)
Counts the total files & folders in a given folder |
static void |
deleteFolder(java.io.File afolder)
Delete a folder and its contents |
static java.lang.Class |
getClassFromJar(java.lang.String className,
java.io.File jarFile)
Returns a class from a jar file that exists in the given folder |
static java.lang.Object |
getClassInstanceFromJar(java.lang.String className,
java.io.File jarFile)
Returns a class New Instance from a jar file that exists in the given jar |
static java.lang.String |
getFileExtension(java.io.File file)
Get the extension portion of a filename. |
static java.lang.String |
getFileNameWithoutExtension(java.io.File file)
Get the name portion of a filename not including the extension. |
static javax.swing.JInternalFrame |
getInternalFrameAncestor(java.awt.Component c)
|
static java.lang.String |
getJavaVersion()
Get the version of Java we are on. |
static java.lang.String |
getLocalFileURL(java.io.File file)
Mac and Linux absolute file paths begin with "/" i.e /Users/fredbloggs/packages/index.htm so simply prepending "file:///" to obtain a valid URL will not work because we will end up with four forward slashes, which is an illegal URL This method examines the file reference and if it starts with a forward slash prepends "file://" instead of "file:///" and returns the String result |
static java.util.Date |
getNow()
Get the time as it is now. |
static int |
getOS()
Determine the OS we are running on. |
static java.lang.String |
getRelativePath(java.io.File rootFolder,
java.io.File file)
Get a relative path for a file given its relationship to rootFolder |
static java.net.URL |
getResourceURL(java.lang.String fileName)
Gets a local resource URL. This may be for example a help file or image that exists actually in the shipped jar. |
static int |
getScreenHeight()
Get the Screen Height |
static int |
getScreenWidth()
Get the Screen Width |
static boolean |
isComponentInInternalFrame(java.awt.Component c)
|
static boolean |
isComponentInMainFrame(java.awt.Component c)
|
static boolean |
isJava14()
Make sure we've got java version 1.4.x. |
static void |
launchFile(java.io.File file)
Launch a File in the OS |
static void |
launchFile(java.lang.String path)
Launch a File by Path in the OS |
static void |
moveFile(java.io.File srcFile,
java.io.File destFile)
Move a File |
static java.lang.String |
parseDate(java.util.Date date)
Parse a date to a short date string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MACINTOSH
public static final int WINDOWS_XP
public static final int WINDOWS_9x
public static final int WINDOWS_NT
public static final int WINDOWS_2000
public static final int UNIX
Method Detail |
public static int getOS()
public static java.lang.String getJavaVersion()
public static boolean isJava14()
public static java.lang.String parseDate(java.util.Date date)
date
- The date to parse
public static java.util.Date getNow()
public static java.lang.String getFileExtension(java.io.File file)
file
- The File in question
public static java.lang.String getFileNameWithoutExtension(java.io.File file)
file
- The File in question
public static boolean copyFolder(java.io.File srcFolder, java.io.File destFolder, ReloadProgressMonitor progressMonitor) throws java.io.IOException
java.io.IOException
public static void copyFile(java.io.File srcFile, java.io.File destFile) throws java.io.IOException
java.io.IOException
public static void moveFile(java.io.File srcFile, java.io.File destFile) throws java.io.IOException
java.io.IOException
public static void deleteFolder(java.io.File afolder) throws java.io.IOException
afolder
- - a folder
java.io.IOException
public static int countFiles(java.io.File folder)
folder
- The folder parent to count in
public static void centreWindowProportional(java.awt.Window window, double width, double height)
window
- The Window to centrewidth
- The width of the Window as a percentage of the Screen Widthheight
- The height of the Window as a percentage of the Screen Heightpublic static void centreWindow(java.awt.Window window, int width, int height)
window
- The Window to centrewidth
- The width of the Windowheight
- The height of the Windowpublic static int getScreenWidth()
public static int getScreenHeight()
public static java.net.URL getResourceURL(java.lang.String fileName)
fileName
- The filename of the Resource
public static java.lang.Class getClassFromJar(java.lang.String className, java.io.File jarFile)
className
- The name of the class requiredjarFile
- The file of the jar
public static java.lang.Object getClassInstanceFromJar(java.lang.String className, java.io.File jarFile)
className
- The name of the class requiredjarFile
- The file of the jar
public static java.lang.String getRelativePath(java.io.File rootFolder, java.io.File file)
public static javax.swing.JInternalFrame getInternalFrameAncestor(java.awt.Component c)
public static boolean isComponentInMainFrame(java.awt.Component c)
public static boolean isComponentInInternalFrame(java.awt.Component c)
public static java.lang.String getLocalFileURL(java.io.File file)
public static void launchFile(java.io.File file)
public static void launchFile(java.lang.String path)
public static java.io.File askFileNameOpen(java.awt.Component parent, java.lang.String title, javax.swing.filechooser.FileFilter filter)
public static java.io.File askFileNameOpenUsingDirName(java.awt.Component parent, java.lang.String title, javax.swing.filechooser.FileFilter filter, java.io.File currentDir)
parent
- the parent componenttitle
- the open dialog titlefilter
- the File FiltercurrentDir
- the current directory to open
public static java.io.File askFileNameSave(java.awt.Component parent, java.lang.String title, javax.swing.filechooser.FileFilter filter, java.lang.String extension)
parent
- the parent component of the dialogtitle
- the title to display on the dialogfilter
- the file filterextension
- the default extension to use in case the user doesn't provide one (no dot)
|
VdexReload 1.1.3 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |