public abstract class AbstractScriptManager extends java.lang.Object implements ScriptManager, ScriptManagerProperties, XULScriptManagerContext
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
active
True if the manager is active.
|
protected java.util.Map<java.lang.String,java.util.Map<org.scripthelper.model.CachedMethodKey,org.scripthelper.model.ScriptWrapper<?>>> |
callSites
The map of call sites.
|
protected XULScriptContext |
context
The ScriptContext.
|
protected ScriptFactory |
factory
The script factory.
|
protected java.util.List<ScriptManagerListener> |
listeners
The script manager listeners.
|
protected java.util.Map<java.lang.String,XULDocument> |
xulscripts
The scripts.
|
LOADING_GLOBAL, LOADING_LOCALALLOW_DISPOSE, ALLOW_EXIT, ALLOW_FILE_ACCESS| Constructor and Description |
|---|
AbstractScriptManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addManagerListener(ScriptManagerListener listener)
Add a listener to the Script manager.
|
boolean |
addScript(java.lang.String mime,
java.net.URL url,
XULDocument xuldoc,
ScriptFactory factory)
Add a script on XUL documents.
|
XULDocument |
addXULScript(java.io.File file)
Add a new XUL Script initialized with the content of a XUL XML File.
|
XULDocument |
addXULScript(java.lang.String name,
java.net.URL xulscript)
Add a new XUL Script initialized with the content of a XUL XML File.
|
XULDocument |
addXULScript(java.net.URL xulscript)
Add a new XUL Script initialized with the content of a XUL XML File.
|
java.lang.Object |
evalScript(ScriptHandle script,
java.lang.String scriptMethod)
Evaluate a Script.
|
java.lang.Object |
evalScript(ScriptHandle script,
java.lang.String scriptMethod,
java.lang.Object arg)
Evaluate a Script.
|
java.lang.Object |
evalScript(ScriptHandle script,
java.lang.String scriptMethod,
java.lang.Object[] args)
Evaluate a Script.
|
java.lang.Object |
evalScript(java.lang.String scriptMethod,
java.lang.Object... args)
Evaluate a Script method.
|
java.util.Map<java.lang.String,java.util.Map<org.scripthelper.model.CachedMethodKey,org.scripthelper.model.ScriptWrapper<?>>> |
getCallSites()
Return the call sites.
|
XULDocument |
getCurrentDocument()
Return the document from which the last user event originates.
|
XULWidget |
getCurrentWidget()
Return the widget from which the last user event originates.
|
java.util.Map<java.net.URL,ScriptHandle> |
getGlobalScripts()
Return the Map of global scripts.
|
java.util.List<ScriptManagerListener> |
getListeners()
Return the list of manager listeners.
|
javax.swing.JMenuBar |
getMenuBar()
Return the Menubar.
|
ParserErrorReporter |
getParserErrorReporter()
Return the XUL parser error reporter.
|
java.lang.Object |
getPropertyValue(java.lang.String key)
Return a property value.
|
XULScriptContext |
getScriptContext()
Return the script context.
|
org.scripthelper.exceptions.ScriptExceptionListener |
getScriptExceptionListener()
Return the script exception listener.
|
ScriptFactory |
getScriptFactory()
Return the script factory.
|
ScriptListener |
getScriptListener()
Return the script listener.
|
org.scripthelper.context.ScriptLogger |
getScriptLogger()
Return the script logger.
|
java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> |
getScripts()
Return the scripts.
|
short |
getScriptsLoadingType()
Return the scripts loading type
|
javax.swing.LookAndFeel |
getSelectedLookAndFeel()
Return the Look and Feel of the viewer.
|
java.util.List<javax.swing.JToolBar> |
getToolBars()
Return the toolbars.
|
XULDocument |
getXULScript(java.lang.String scriptName)
Return the XULScript of a specified name.
|
java.util.Map<java.lang.String,XULDocument> |
getXULScripts()
Return the XUL Scripts managed by the manager.
|
boolean |
hasXULScript(java.lang.String scriptName)
Return true if it exist a XUL script of the defined name.
|
java.awt.Container |
install(javax.swing.JFrame parent)
Install the manager content in a parent frame.
|
java.awt.Container |
install(javax.swing.JFrame parent,
boolean scrollable)
Install the manager content in a parent frame.
|
java.awt.Container |
install(javax.swing.JFrame parent,
boolean scrollable,
boolean hasLoggerArea,
int loggerRows)
Install the manager content in a parent frame.
|
boolean |
isActive()
Return true if the manager is active.
|
boolean |
isListingAllScriptTypes()
Return true if all script methods are returned by the
XULDocument.getFunctionNames() method. |
boolean |
isValidatingXULSchemas()
Return true if the XUL scripts schemas must be validated.
|
void |
listAllScriptTypes(boolean listAllScripts)
Set if all script methods are returned by the
XULDocument.getFunctionNames() method. |
void |
removeManagerListener(ScriptManagerListener listener)
Remove a listener from the Script manager.
|
void |
removeXULScript(java.lang.String name)
Remove a script.
|
void |
setActive(boolean active)
Set the activation of the manager.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the classLoader to use to load the script classes
|
void |
setCurrentWidget(XULWidget widget)
Set the widget from which the last user event originates.
|
void |
setLookAndFeel(javax.swing.LookAndFeel lf)
Set the Look and Feel of the viewer.
|
void |
setLookAndFeel(java.lang.String name)
Set the Look and Feel of the viewer.
|
void |
setParserErrorReporter(ParserErrorReporter errorReporter)
Set the XUL parser error reporter.
|
boolean |
setProperty(java.lang.String key,
java.lang.Object value)
Set the value of a Script manager property.
|
void |
setScriptContext(XULScriptContext context)
Set the script context.
|
void |
setScriptExceptionListener(org.scripthelper.exceptions.ScriptExceptionListener exceptionListener)
Set the script exception listener.
|
void |
setScriptFactory(ScriptFactory factory)
Set the script factory.
|
void |
setScriptListener(ScriptListener listener)
Set the script listener.
|
void |
setScriptLogger(org.scripthelper.context.ScriptLogger scriptLogger)
Set the script logger.
|
void |
setScriptsLoadingType(short type)
Set the scripts loading type.
|
void |
validateXULSchema(boolean isValidating)
Set if the XUL scripts schemas must be validated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddScript, addScript, addScript, addScript, addScript, addXULScript, evalScript, getCurrentWindow, getPropertyValueAsBoolean, hasGlobalScriptprotected java.util.Map<java.lang.String,XULDocument> xulscripts
protected boolean active
protected XULScriptContext context
protected java.util.List<ScriptManagerListener> listeners
protected java.util.Map<java.lang.String,java.util.Map<org.scripthelper.model.CachedMethodKey,org.scripthelper.model.ScriptWrapper<?>>> callSites
protected ScriptFactory factory
public void validateXULSchema(boolean isValidating)
validateXULSchema in interface ScriptManagerisValidating - true if the XUL scripts schemas must be validatedpublic boolean isValidatingXULSchemas()
isValidatingXULSchemas in interface ScriptManagerpublic void setClassLoader(java.lang.ClassLoader classLoader)
setClassLoader in interface ScriptManagerclassLoader - the classLoaderpublic boolean setProperty(java.lang.String key,
java.lang.Object value)
ScriptManagerProperties.ALLOW_FILE_ACCESS allows files access (read and write) by scripts. Default is trueScriptManagerProperties.ALLOW_DISPOSE allows dispose of the current window access by scriprs. Default is falseScriptManagerProperties.ALLOW_EXIT allows System.exist(0) by scriprs. Default is falsesetProperty in interface ScriptManagerkey - the property keyvalue - the property valuepublic java.lang.Object getPropertyValue(java.lang.String key)
getPropertyValue in interface ScriptManagerkey - the property keypublic void listAllScriptTypes(boolean listAllScripts)
XULDocument.getFunctionNames() method. By default
only Javascript scripts methods and functions are listed.listAllScriptTypes in interface ScriptManagerlistAllScripts - the scripts loading typepublic boolean isListingAllScriptTypes()
XULDocument.getFunctionNames() method. By default
only Javascript scripts methods and functions are listed.isListingAllScriptTypes in interface ScriptManagerXULDocument.getFunctionNames() methodpublic void setScriptsLoadingType(short type)
setScriptsLoadingType in interface ScriptManagertype - the scripts loading typepublic short getScriptsLoadingType()
getScriptsLoadingType in interface ScriptManagerpublic java.util.Map<java.net.URL,ScriptHandle> getGlobalScripts()
getGlobalScripts in interface ScriptManagerpublic final void setScriptFactory(ScriptFactory factory)
setScriptFactory in interface ScriptManagerfactory - the script factorypublic ScriptFactory getScriptFactory()
getScriptFactory in interface ScriptManagerpublic void setScriptContext(XULScriptContext context)
setScriptContext in interface ScriptManagercontext - the script contextpublic XULScriptContext getScriptContext()
getScriptContext in interface ScriptManagerpublic org.scripthelper.exceptions.ScriptExceptionListener getScriptExceptionListener()
getScriptExceptionListener in interface ScriptManagerpublic void setScriptExceptionListener(org.scripthelper.exceptions.ScriptExceptionListener exceptionListener)
setScriptExceptionListener in interface ScriptManagerexceptionListener - the script exception listenerpublic void setScriptLogger(org.scripthelper.context.ScriptLogger scriptLogger)
setScriptLogger in interface ScriptManagerscriptLogger - the script loggerpublic org.scripthelper.context.ScriptLogger getScriptLogger()
getScriptLogger in interface ScriptManagerpublic void setParserErrorReporter(ParserErrorReporter errorReporter)
setParserErrorReporter in interface ScriptManagererrorReporter - the parser error reporterpublic ParserErrorReporter getParserErrorReporter()
getParserErrorReporter in interface ScriptManagerpublic java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> getScripts()
getScripts in interface ScriptManagerpublic java.util.Map<java.lang.String,java.util.Map<org.scripthelper.model.CachedMethodKey,org.scripthelper.model.ScriptWrapper<?>>> getCallSites()
getCallSites in interface ScriptManagerpublic void setScriptListener(ScriptListener listener)
setScriptListener in interface ScriptManagerlistener - the script listenerpublic ScriptListener getScriptListener()
getScriptListener in interface ScriptManagerpublic java.lang.Object evalScript(java.lang.String scriptMethod,
java.lang.Object... args)
evalScript in interface ScriptManagerscriptMethod - the Script method nameargs - the argumentspublic java.lang.Object evalScript(ScriptHandle script, java.lang.String scriptMethod, java.lang.Object arg) throws java.lang.Exception
evalScript in interface XULScriptManagerContextscript - the Script with one argument.scriptMethod - the Script method namearg - the argumentjava.lang.Exception - if the evaluation failspublic java.lang.Object evalScript(ScriptHandle script, java.lang.String scriptMethod, java.lang.Object[] args) throws java.lang.Exception
evalScript in interface XULScriptManagerContextscript - the Script with several arguments.scriptMethod - the Script method nameargs - the argumentsjava.lang.Exception - if the evaluation failspublic java.lang.Object evalScript(ScriptHandle script, java.lang.String scriptMethod) throws java.lang.Exception
evalScript in interface XULScriptManagerContextscript - the Script without any argument.scriptMethod - the Script method namejava.lang.Exception - if the evaluation failspublic XULWidget getCurrentWidget()
getCurrentWidget in interface ScriptManagerpublic XULDocument getCurrentDocument()
getCurrentDocument in interface ScriptManagerpublic void setCurrentWidget(XULWidget widget)
setCurrentWidget in interface ScriptManagerwidget - the widget from which the last user event originatespublic void addManagerListener(ScriptManagerListener listener)
addManagerListener in interface ScriptManagerlistener - the listenerpublic java.util.List<ScriptManagerListener> getListeners()
getListeners in interface ScriptManagerpublic void setLookAndFeel(javax.swing.LookAndFeel lf)
lf - the Look and Feelpublic void setLookAndFeel(java.lang.String name)
name - the Look and Feel namepublic javax.swing.LookAndFeel getSelectedLookAndFeel()
public javax.swing.JMenuBar getMenuBar()
getMenuBar in interface ScriptManagerpublic java.util.List<javax.swing.JToolBar> getToolBars()
getToolBars in interface ScriptManagerpublic java.awt.Container install(javax.swing.JFrame parent)
parent - the parent framepublic java.awt.Container install(javax.swing.JFrame parent,
boolean scrollable)
parent - the parent framescrollable - true if the content must be scrollablepublic java.awt.Container install(javax.swing.JFrame parent,
boolean scrollable,
boolean hasLoggerArea,
int loggerRows)
parent - the parent framescrollable - true if the content must be scrollablehasLoggerArea - true if the frame must have a logger arealoggerRows - the number of rows in the logger (will only be used if hasLoggerArea is true)public void removeManagerListener(ScriptManagerListener listener)
removeManagerListener in interface ScriptManagerlistener - the listenerpublic void removeXULScript(java.lang.String name)
removeXULScript in interface ScriptManagername - the script namepublic boolean hasXULScript(java.lang.String scriptName)
hasXULScript in interface ScriptManagerscriptName - the script namepublic XULDocument getXULScript(java.lang.String scriptName)
getXULScript in interface XULScriptManagerContextscriptName - the script namepublic XULDocument addXULScript(java.io.File file)
addXULScript in interface ScriptManagerfile - the XUL Filepublic XULDocument addXULScript(java.net.URL xulscript)
addXULScript in interface ScriptManagerxulscript - the XUL Filepublic XULDocument addXULScript(java.lang.String name, java.net.URL xulscript)
addXULScript in interface ScriptManagername - the script namexulscript - the XUL Filepublic boolean addScript(java.lang.String mime,
java.net.URL url,
XULDocument xuldoc,
ScriptFactory factory)
addScript in interface ScriptManagerurl - the script URLxuldoc - the XUL document on which the script must be addedfactory - the ScriptFactory (can be null)mime - the MIME typepublic java.util.Map<java.lang.String,XULDocument> getXULScripts()
getXULScripts in interface ScriptManagerpublic boolean isActive()
isActive in interface ScriptManagerpublic void setActive(boolean active)
setActive in interface ScriptManageractive - true if the manager is activatedCopyright © 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence