|
||||||||||
| 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 java.lang.String |
BACKUP_EXTENSION
the backup extension. |
| Constructor Summary | |
|---|---|
Script()
Initializes the script. |
|
Script(javax.swing.text.Document doc)
Initializes the script. |
|
Script(javax.swing.text.Document doc,
java.io.File file)
Initializes the script. |
|
| Method Summary | |
|---|---|
void |
addScriptFinishedListener(ScriptExecutionListener l)
Adds the given listener to its internal list. |
void |
empty()
Empties the document. |
java.lang.String |
getContent()
Returns the content. |
abstract java.lang.String |
getDefaultExtension()
Returns the default extension. |
java.io.File |
getFilename()
Returns the current filename. |
abstract ExtensionFileFilter[] |
getFilters()
Returns the extension filters for this type of script. |
java.lang.String |
getNewLine()
Returns the new line string in use. |
java.lang.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. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
abstract Script.ScriptThread |
newThread(java.lang.String[] args)
Returns a new thread to execute. |
boolean |
open(java.io.File file)
Tries to open the file. |
void |
removeScriptFinishedListener(ScriptExecutionListener l)
Removes the given listener from its internal list. |
void |
run(java.io.File file,
java.lang.String[] args)
Executes the script without loading it first. |
static void |
runScript(Script script,
java.lang.String[] args)
Runs the specified script. |
boolean |
save()
Saves the file under with the current filename. |
boolean |
saveAs(java.io.File file)
Saves the file under with the given filename (and updates the internal filename). |
void |
setContent(java.lang.String value)
Sets the content. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
start(java.lang.String[] args)
Executes the script. |
void |
stop()
Stops the execution of the script. |
java.lang.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 java.lang.String BACKUP_EXTENSION
| Constructor Detail |
|---|
public Script()
public Script(javax.swing.text.Document doc)
doc - the document to use as basis
public Script(javax.swing.text.Document doc,
java.io.File file)
doc - the document to use as basisfile - the file to load (if not null)| Method Detail |
|---|
public java.util.Enumeration listOptions()
listOptions in interface OptionHandler
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
setOptions in interface OptionHandleroptions - the list of options as an array of strings
java.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlerpublic abstract ExtensionFileFilter[] getFilters()
public abstract java.lang.String getDefaultExtension()
saveAs(File)public java.io.File getFilename()
public java.lang.String getNewLine()
public boolean isModified()
public java.lang.String getContent()
public void setContent(java.lang.String value)
value - the new contentpublic void empty()
public boolean open(java.io.File file)
file - the file to open
public boolean save()
public boolean saveAs(java.io.File file)
file - the filename to write the content to
public abstract Script.ScriptThread newThread(java.lang.String[] args)
args - optional commandline arguments
public void start(java.lang.String[] args)
throws java.lang.Exception
args - optional commandline arguments, can be null
java.lang.Exception - if checks or execution failpublic void stop()
public void run(java.io.File file,
java.lang.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 java.lang.String toString()
toString in class java.lang.Object
public static void runScript(Script script,
java.lang.String[] args)
throws java.lang.Exception
script - the script object to useargs - the commandline arguments
java.lang.Exception - if execution fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||