Home
Categories
Dictionnary
Download
Project Details
Changes Log
FAQ
License

Customizing the script factory


It is possible to use your own ScriptFactory rather than the default by using the following method in the ScriptManager:

Overview

scriptfactory

Creating a custom ScriptFactory

You should only override the AbstractScriptFactory class.

The only method that you should implement in your custom ScriptFactory is the ScriptFactory.createScriptLanguageFactoryImpl(short, int, ScriptSource):
  • The first parameter is the scriptType
  • The second parameter is the total number of scripts in the XULDocument
  • The last parameter is the ScriptSource which hold the URL or String content of the Script
These parameters allow to customize the creation of the ScriptWrapper as you need for you use case. For example:
  • In the simplest scenario, you use an unique ScriptLanguageFactory for all scripts. In this example, you only need the scriptType parameter to know which scripting language ScriptWrapper you must use, but all your scripts will implement the same interface
  • You can also choose the ScriptLanguageFactory depending on the scripting language. In this example, you only need the scriptType parameter to know which scripting language ScriptWrapper you must use, but also the interface you will implement
  • You can choose the ScriptLanguageFactory depending on the total number of scripts in your XULDocument

See also


Categories: scripts

Copyright 2008-2020 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence