|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.gui.scripting.Script
public abstract class Script
A simple helper class for loading, saving scripts.
| Nested Class Summary | |
|---|---|
static class |
Script.ScriptThread
The Thread for running a script. |
| Field Summary | |
|---|---|
static String |
BACKUP_EXTENSION
the backup extension. |
| Constructor Summary | |
|---|---|
Script()
Initializes the script. |
|
Script(Document doc)
Initializes the script. |
|
Script(Document doc,
File file)
Initializes the script. |
|
| Method Summary | |
|---|---|
void |
addScriptFinishedListener(ScriptExecutionListener l)
Adds the given listener to its internal list. |
void |
empty()
Empties the document. |
String |
getContent()
Returns the content. |
abstract String |
getDefaultExtension()
Returns the default extension. |
File |
getFilename()
Returns the current filename. |
abstract ExtensionFileFilter[] |
getFilters()
Returns the extension filters for this type of script. |
String |
getNewLine()
Returns the new line string in use. |
String[] |
getOptions()
Gets the current settings of the script. |
boolean |
isModified()
Returns whether the script is modified. |
boolean |
isRunning()
Returns whether the script is still running. |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
abstract Script.ScriptThread |
newThread(String[] args)
Returns a new thread to execute. |
boolean |
open(File file)
Tries to open the file. |
void |
removeScriptFinishedListener(ScriptExecutionListener l)
Removes the given listener from its internal list. |
void |
run(File file,
String[] args)
Executes the script without loading it first. |
static void |
runScript(Script script,
String[] args)
Runs the specified script. |
boolean |
save()
Saves the file under with the current filename. |
boolean |
saveAs(File file)
Saves the file under with the given filename (and updates the internal filename). |
void |
setContent(String value)
Sets the content. |
void |
setOptions(String[] options)
Parses a given list of options. |
void |
start(String[] args)
Executes the script. |
void |
stop()
Stops the execution of the script. |
String |
toString()
Returns the content as string. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String BACKUP_EXTENSION
| Constructor Detail |
|---|
public Script()
public Script(Document doc)
doc - the document to use as basis
public Script(Document doc,
File file)
doc - the document to use as basisfile - the file to load (if not null)| Method Detail |
|---|
public Enumeration listOptions()
listOptions in interface OptionHandler
public void setOptions(String[] options)
throws Exception
setOptions in interface OptionHandleroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String[] getOptions()
getOptions in interface OptionHandlerpublic abstract ExtensionFileFilter[] getFilters()
public abstract String getDefaultExtension()
saveAs(File)public File getFilename()
public String getNewLine()
public boolean isModified()
public String getContent()
public void setContent(String value)
value - the new contentpublic void empty()
public boolean open(File file)
file - the file to open
public boolean save()
public boolean saveAs(File file)
file - the filename to write the content to
public abstract Script.ScriptThread newThread(String[] args)
args - optional commandline arguments
public void start(String[] args)
throws Exception
args - optional commandline arguments, can be null
Exception - if checks or execution failpublic void stop()
public void run(File file,
String[] args)
file - the script to executeargs - the commandline parameters for the scriptpublic boolean isRunning()
public void addScriptFinishedListener(ScriptExecutionListener l)
l - the listener to addpublic void removeScriptFinishedListener(ScriptExecutionListener l)
l - the listener to removepublic String toString()
toString in class Object
public static void runScript(Script script,
String[] args)
throws Exception
script - the script object to useargs - the commandline arguments
Exception - if execution fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||