|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.swath.UserDefinedScript
User Defined Script base class.
| Constructor Summary | |
UserDefinedScript()
Constructor. |
|
| Method Summary | |
boolean |
atPrompt(int validPrompts)
Checks if you are at any of the valid prompts. |
void |
endScript(boolean finished)
Called by the framework when the script is finished. |
void |
execInstance()
Executes a script instance. |
java.lang.String |
getClassName()
Gets the class name. |
java.lang.String |
getDescription()
Called by the framework to get the description of the script. |
java.lang.String |
getName()
Called by the framework to get the name of the script. |
java.util.Enumeration |
getParams()
Gets the script parameters. |
java.net.URL |
getResource(java.lang.String resource)
Finds a resource with a given name. |
void |
initInstance()
Initialises a script instance. |
boolean |
initScript()
Called by the framework to initialise the script. |
void |
postEvent(UserDefinedEvent event)
This method posts an event in the SWATH event queue. |
void |
printTrace(java.lang.Exception e)
Print an exception and the complete stack trace in the SWATH console window. |
void |
printTrace(java.lang.String text)
Print trace text in the SWATH console window. |
void |
registerParam(Parameter param)
This method is used to register a script parameter. |
boolean |
runScript()
Called by the framework to run the script. |
boolean |
showUserParamWindow(javax.swing.JPanel panel,
int width,
int height)
Displays a Swing frame window for script parameter input. |
boolean |
showUserParamWindow(java.awt.Panel panel,
int width,
int height)
Displays an AWT frame window for script parameter input. |
void |
sleep(long ms)
Wait and sleep for a while. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public UserDefinedScript()
| Method Detail |
public final java.lang.String getClassName()
public final void registerParam(Parameter param)
throws ScriptException
param - The parameter to register.
ScriptException - If no more parameters could be added.public final java.util.Enumeration getParams()
public final void initInstance()
throws ScriptException,
java.lang.Exception
exec() methods.
ScriptException - If the script initialisation fails for some reason.
java.lang.ExceptionexecInstance()
public final void execInstance()
throws ScriptException,
java.lang.Exception
exec() methods.
ScriptException - If the script execution fails for some reason.
java.lang.ExceptioninitInstance()
public final boolean atPrompt(int validPrompts)
throws java.lang.Exception
validPrompts - The valid prompts. (Combine several prompts with logical OR)
true if you are at a valid prompt,
otherwise false.
java.lang.ExceptionSwath.NO_PROMPT,
Swath.COMMAND_PROMPT,
Swath.COMPUTER_PROMPT,
Swath.PLANET_PROMPT,
Swath.CITADEL_PROMPT,
Swath.CORP_PROMPT,
Swath.STARDOCK_PROMPT,
Swath.ALL_PROMPTSpublic final void sleep(long ms)
ms - The time to sleep in milliseconds.public final java.net.URL getResource(java.lang.String resource)
resource - The name of the wanted resource.
null if not found.public final void postEvent(UserDefinedEvent event)
event - The event to post.
public final void printTrace(java.lang.String text)
throws java.lang.Exception
text - The text to print.
java.lang.Exception
public final void printTrace(java.lang.Exception e)
throws java.lang.Exception
e - The exception to print.
java.lang.Exception
public final boolean showUserParamWindow(java.awt.Panel panel,
int width,
int height)
throws java.lang.Exception
panel - The user defined panel that holds all components
that should be displayed in the client area of the window.width - The width of the window.height - The height of the window.
true if the user choosed to start the script,
otherwise false.
java.lang.ExceptionTools.createPanel(),
showUserParamWindow(JPanel,int,int)
public final boolean showUserParamWindow(javax.swing.JPanel panel,
int width,
int height)
throws java.lang.Exception
panel - The user defined panel that holds all components
that should be displayed in the client area of the window.width - The width of the window.height - The height of the window.
true if the user choosed to start the script,
otherwise false.
java.lang.ExceptionTools.createJPanel(),
showUserParamWindow(Panel,int,int)public java.lang.String getName()
public java.lang.String getDescription()
"http://www.swath.net/Help.html"
"file:///C:/HelpDir/Help.html"
"<html>This <b>script</b> will...</html>"
"This script will..."
public boolean initScript()
throws java.lang.Exception
true if the initialisation was successful,
otherwise false.
java.lang.ExceptionatPrompt(int),
showUserParamWindow(Panel,int,int),
showUserParamWindow(JPanel,int,int)
public boolean runScript()
throws java.lang.Exception
true if the script finished correctly,
otherwise false.
java.lang.Exception
public void endScript(boolean finished)
throws java.lang.Exception
finished - true if the script finished correctly or
false if the script was interrupted in some way.
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||