public abstract class AbstractJSScriptContext
extends org.scripthelper.js.AbstractJSScriptable
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<javax.swing.JComponent,java.lang.String> |
compToNames |
protected ScriptHandle |
currentScript |
protected boolean |
isActive |
protected ScriptListener |
listener |
protected static java.util.regex.Pattern |
PAT_FUNCTION |
protected java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> |
scripts |
Modifier | Constructor and Description |
---|---|
protected |
AbstractJSScriptContext() |
Modifier and Type | Method and Description |
---|---|
void |
addScript(ScriptHandle script)
Add a script.
|
void |
alert(java.lang.String message,
javax.swing.JComponent root)
Alert with a message.
|
protected void |
fireListeners(XULWidget widget,
XULActionEvent event)
Do nothing by default.
|
ScriptHandle |
getCurrentScript() |
java.lang.String[] |
getFunctionProperties() |
abstract javax.swing.JComponent |
getRootComponent()
Return the root component which will be used to present the error messages of the Script execution.
|
ScriptListener |
getScriptListener()
Return the script listener.
|
abstract ScriptManager |
getScriptManager()
Return the ScriptManager.
|
java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> |
getScripts() |
java.util.List<ScriptHandle> |
getScriptsForClass(java.lang.Class<?> clazz)
Return the scripts for a specified Script interface.
|
void |
handleComponentAdjust(XULAdjustmentEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script,
such as Buttons and CheckBox. |
void |
handleComponentChange(XULChangeEvent e,
boolean hasCommand)
Handle a change action on a component that fire
ActionEvent s in the XUL Script,
such as Buttons and CheckBox. |
void |
handleComponentChange(XULWidget widget,
XULChangeEvent e,
boolean hasCommand)
Handle a change action on a component that fire
ActionEvent s in the XUL Script,
such as Buttons and CheckBox. |
void |
handleComponentCommand(XULCommandEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script,
such as Buttons and CheckBox. |
void |
handleComponentHover(XULHoverEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script. |
void |
handleComponentOut(XULExitEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script. |
void |
handleComponentSelected(XULSelectedEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script. |
void |
handleWindowLoad(XULLoadEvent e,
boolean hasCommand)
Handle an action on a component that fire
ActionEvent s in the XUL Script,
such as Buttons and CheckBox. |
boolean |
isActive()
Return true if the context is active.
|
void |
print(java.lang.String message)
print a message.
|
void |
removeScript(org.scripthelper.model.ScriptSource source) |
protected java.lang.Object |
runFunction(FunctionBinding binding,
javax.swing.JComponent comp)
Exexute a Javascript function call on a Component in the XUL File.
|
void |
setActive(boolean isActive)
Set the context as active or inactive.
|
void |
setComponentsToNames(java.util.Map<javax.swing.JComponent,java.lang.String> compToNames) |
void |
setScriptListener(ScriptListener listener)
Set the script listener.
|
addExternalFunction, createJSContext, defineBuiltIntFunctions, defineExternalFunctions, defineFunctionProperties, getClassName, getDefinedClasses, getExecutorInstance, getExecutorInstancesMap, getJSContext, jsFunction_call, runScriptMethod, setContext, setDefinedClasses
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected static final java.util.regex.Pattern PAT_FUNCTION
protected java.util.Map<javax.swing.JComponent,java.lang.String> compToNames
protected boolean isActive
protected ScriptListener listener
protected ScriptHandle currentScript
protected java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> scripts
public boolean isActive()
public void setActive(boolean isActive)
isActive
- true if the context must be activepublic abstract ScriptManager getScriptManager()
public void setScriptListener(ScriptListener listener)
listener
- the script listenerpublic ScriptListener getScriptListener()
public abstract javax.swing.JComponent getRootComponent()
public java.util.Map<org.scripthelper.model.ScriptSource,ScriptHandle> getScripts()
public ScriptHandle getCurrentScript()
public void print(java.lang.String message)
message
- public void alert(java.lang.String message, javax.swing.JComponent root)
message
- the message alterroot
- the root componentpublic java.lang.String[] getFunctionProperties()
public void addScript(ScriptHandle script)
script
- the script.public java.util.List<ScriptHandle> getScriptsForClass(java.lang.Class<?> clazz)
clazz
- the Script interface classpublic void removeScript(org.scripthelper.model.ScriptSource source)
public void setComponentsToNames(java.util.Map<javax.swing.JComponent,java.lang.String> compToNames)
protected void fireListeners(XULWidget widget, XULActionEvent event)
widget
- the widgetevent
- the eventpublic void handleWindowLoad(XULLoadEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script,
such as Buttons and CheckBox.e
- the ActionEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentHover(XULHoverEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script.e
- the ActionEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentOut(XULExitEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script.e
- the ActionEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentSelected(XULSelectedEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script.e
- the ActionEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentCommand(XULCommandEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script,
such as Buttons and CheckBox.e
- the ActionEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentAdjust(XULAdjustmentEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script,
such as Buttons and CheckBox.e
- the AdjustmentEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentChange(XULChangeEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script,
such as Buttons and CheckBox.e
- the ChangeEventhasCommand
- true if there is a command, which means that a script must be firedpublic void handleComponentChange(XULWidget widget, XULChangeEvent e, boolean hasCommand)
ActionEvent
s in the XUL Script,
such as Buttons and CheckBox.widget
- the widget which is at the origin of the evente
- the ChangeEventhasCommand
- true if there is a command, which means that a script must be firedprotected java.lang.Object runFunction(FunctionBinding binding, javax.swing.JComponent comp) throws java.lang.Exception
oncommand="buttonPressed()"
binding
- the Javascript bindingcomp
- the component firing the calljava.lang.Exception
- if the command failsCopyright © 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence