|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object processing.app.Base
public class Base
The base class for the main processing application. Primary role of this class is for platform identification and general interaction with the system (launching URLs, loading files and images, etc) that comes from that.
Field Summary | |
---|---|
static java.lang.String |
librariesClassPath
|
Constructor Summary | |
---|---|
Base(java.lang.String[] args)
|
Method Summary | |
---|---|
static int |
calcFolderSize(java.io.File folder)
Calculate the size of the contents of a folder. |
static void |
copyDir(java.io.File sourceDir,
java.io.File targetDir)
Copy a folder from one place to another. |
static void |
copyFile(java.io.File sourceFile,
java.io.File targetFile)
|
static int |
countLines(java.lang.String what)
Get the number of lines in a file by counting the number of newline characters inside a String (and adding 1). |
static java.io.File |
createTempFolder(java.lang.String name)
Get the path to the platform's temporary folder, by creating a temporary temporary file and getting its parent folder. |
static java.io.File |
getBuildFolder()
|
static java.io.File |
getContentFile(java.lang.String name)
Get a path for something in the Processing lib folder. |
static java.lang.String |
getExamplesPath()
|
static java.awt.Image |
getLibImage(java.lang.String name,
java.awt.Component who)
Return an Image object from inside the Processing lib folder. |
static java.lang.String |
getLibrariesPath()
|
static java.io.InputStream |
getLibStream(java.lang.String filename)
Return an InputStream for a file inside the Processing lib folder. |
static int |
getPlatformIndex(java.lang.String what)
|
static java.lang.String |
getPlatformName()
Get list of platform constants. |
static java.lang.String |
getPlatformName(int which)
Map a platform constant to its name. |
static java.io.File |
getSettingsFile(java.lang.String filename)
Convenience method to get a File object for the specified filename inside the settings folder. |
static java.io.File |
getSettingsFolder()
|
static java.io.File |
getSketchbookFolder()
|
static java.io.File |
getSketchbookLibrariesFolder()
|
static java.awt.Image |
getThemeImage(java.lang.String name,
java.awt.Component who)
Get an image associated with the current color theme. |
static java.io.File |
getToolsFolder()
|
static java.lang.String |
getToolsPath()
|
void |
handleAbout()
Show the About box. |
boolean |
handleClose(Editor editor)
Close a sketch as specified by its editor window. |
void |
handleNew()
Create a new untitled document in a new sketch window. |
void |
handleNewReplace()
Replace the sketch in the current window with a new untitled document. |
Editor |
handleOpen(java.lang.String path)
Open a sketch in a new window. |
void |
handleOpenPrompt()
Prompt for a sketch to open, and open it in a new window. |
void |
handleOpenReplace(java.lang.String path)
Open a sketch, replacing the sketch in the current window. |
void |
handlePrefs()
Show the Preferences window. |
boolean |
handleQuit()
Handler for File → Quit. |
static boolean |
isLinux()
true if running on linux. |
static boolean |
isMacOS()
returns true if Processing is running on a Mac OS X machine. |
static boolean |
isWindows()
returns true if running on windows. |
static java.lang.String[] |
listFiles(java.io.File folder,
boolean relative)
|
static java.lang.String[] |
listFiles(java.lang.String path,
boolean relative)
Recursively creates a list of all files within the specified folder, and returns a list of their relative paths. |
static byte[] |
loadBytesRaw(java.io.File file)
Same as PApplet.loadBytes(), however never does gzip decoding. |
static java.lang.String |
loadFile(java.io.File file)
Grab the contents of a file as a string. |
static void |
main(java.lang.String[] args)
|
static void |
openFolder(java.io.File file)
Implements the other cross-platform headache of opening a folder in the machine's native file browser. |
static void |
openURL(java.lang.String url)
Implements the cross-platform headache of opening URLs TODO This code should be replaced by PApplet.link(), however that's not a static method (because it requires an AppletContext when used as an applet), so it's mildly trickier than just removing this method. |
void |
rebuildExamplesMenu(javax.swing.JMenu menu)
|
void |
rebuildImportMenu(javax.swing.JMenu importMenu)
|
static void |
registerWindowCloseKeys(javax.swing.JRootPane root,
java.awt.event.ActionListener disposer)
Registers key events for a Ctrl-W and ESC with an ActionListener that will take care of disposing the window. |
static void |
removeDescendants(java.io.File dir)
Recursively remove all files within a directory, used with removeDir(), or when the contents of a dir should be removed, but not the directory itself. |
static void |
removeDir(java.io.File dir)
Remove all files in a directory and the directory itself. |
static void |
saveFile(java.lang.String str,
java.io.File file)
Spew the contents of a String object out to a file. |
static java.io.File |
selectFolder(java.lang.String prompt,
java.io.File folder,
java.awt.Frame frame)
Prompt for a fodler and return it as a File object (or null). |
static void |
setIcon(java.awt.Frame frame)
Give this Frame a Processing icon. |
static void |
showEnvironment()
|
static void |
showError(java.lang.String title,
java.lang.String message,
java.lang.Throwable e)
Show an error message that's actually fatal to the program. |
static void |
showMessage(java.lang.String title,
java.lang.String message)
"No cookie for you" type messages. |
static void |
showPlatforms()
|
static void |
showReference()
|
static void |
showReference(java.lang.String filename)
|
static void |
showTroubleshooting()
|
static void |
showWarning(java.lang.String title,
java.lang.String message,
java.lang.Exception e)
Non-fatal error message with optional stack trace side dish. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String librariesClassPath
Constructor Detail |
---|
public Base(java.lang.String[] args)
Method Detail |
---|
public static void main(java.lang.String[] args)
public void handleNew()
public void handleNewReplace()
public void handleOpenReplace(java.lang.String path)
path
- Location of the primary pde file for the sketch.public void handleOpenPrompt()
public Editor handleOpen(java.lang.String path)
path
- Path to the pde file for the sketch in question
public boolean handleClose(Editor editor)
editor
- Editor object of the sketch to be closed.
public boolean handleQuit()
public void rebuildImportMenu(javax.swing.JMenu importMenu)
public void rebuildExamplesMenu(javax.swing.JMenu menu)
public void handleAbout()
public void handlePrefs()
public static java.lang.String getPlatformName()
public static java.lang.String getPlatformName(int which)
which
- PConstants.WINDOWS, PConstants.MACOSX, PConstants.LINUX
public static int getPlatformIndex(java.lang.String what)
public static boolean isMacOS()
public static boolean isWindows()
public static boolean isLinux()
public static java.io.File getSettingsFolder()
public static java.io.File getSettingsFile(java.lang.String filename)
filename
- A file inside the settings folder.
public static java.io.File getBuildFolder()
public static java.io.File createTempFolder(java.lang.String name)
public static java.lang.String getExamplesPath()
public static java.lang.String getLibrariesPath()
public static java.io.File getToolsFolder()
public static java.lang.String getToolsPath()
public static java.io.File getSketchbookFolder()
public static java.io.File getSketchbookLibrariesFolder()
public static void openURL(java.lang.String url)
public static void openFolder(java.io.File file)
public static java.io.File selectFolder(java.lang.String prompt, java.io.File folder, java.awt.Frame frame)
public static void setIcon(java.awt.Frame frame)
public static void registerWindowCloseKeys(javax.swing.JRootPane root, java.awt.event.ActionListener disposer)
public static void showReference(java.lang.String filename)
public static void showReference()
public static void showEnvironment()
public static void showPlatforms()
public static void showTroubleshooting()
public static void showMessage(java.lang.String title, java.lang.String message)
public static void showWarning(java.lang.String title, java.lang.String message, java.lang.Exception e)
public static void showError(java.lang.String title, java.lang.String message, java.lang.Throwable e)
public static java.io.File getContentFile(java.lang.String name)
public static java.awt.Image getThemeImage(java.lang.String name, java.awt.Component who)
public static java.awt.Image getLibImage(java.lang.String name, java.awt.Component who)
public static java.io.InputStream getLibStream(java.lang.String filename) throws java.io.IOException
java.io.IOException
public static int countLines(java.lang.String what)
public static byte[] loadBytesRaw(java.io.File file) throws java.io.IOException
java.io.IOException
public static void copyFile(java.io.File sourceFile, java.io.File targetFile) throws java.io.IOException
java.io.IOException
public static java.lang.String loadFile(java.io.File file) throws java.io.IOException
java.io.IOException
public static void saveFile(java.lang.String str, java.io.File file) throws java.io.IOException
java.io.IOException
public static void copyDir(java.io.File sourceDir, java.io.File targetDir) throws java.io.IOException
java.io.IOException
public static void removeDir(java.io.File dir)
public static void removeDescendants(java.io.File dir)
public static int calcFolderSize(java.io.File folder)
public static java.lang.String[] listFiles(java.lang.String path, boolean relative)
public static java.lang.String[] listFiles(java.io.File folder, boolean relative)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |