CT 4.0 Upgrade Guide: Code
This page details the set of changes you will have to make to upgrade an App from CT version 3.11.2 to version 4.0.
Details of CT 4.0 Configuration changes are here. You will need to implement these first, otherwise pages will not load. |
- CT uses the BRJS ServiceRegistry
- CT no longer ships with an OEM licensed version of Extjs
- BRJS wraps all "namespace-style" files in a define(){} block
- Format change for URL passed to caplin.popout.Popout
- APP.VERSION
- Images cannot be referenced in XML configuration files
- BRJS changes the order of CSS bundling
- Changes to bundling of code included with <@js.bundle> tag
- Aspects and conformant user libraries are no longer able to define classes outside of their namespace.
- Global classes are no longer allowed
- Alias names can no longer be the same as the class they point to, and they must also conform to namespace rules
- All references to ko must be replaced with presenter_knockout
CT uses the BRJS ServiceRegistry
The BRJS ServiceRegistry no longer supports the retrieval of services via an interface. Code must now always use the alias.
CT no longer ships with an OEM licensed version of Extjs
If your application relies upon functionality provided by Extjs or overrides Extjs style declarations, you will need to modify your code.
In addition to the removal of Extjs, the following package/classes that relied upon this library have also been removed:
-
caplin.component.composite.* (previously deprecated)
-
caplin.presenter.control.selectionfield.ExtJsSelectBoxControl
-
caplin.presenter.control.selectionfield.ExtJsSelectBoxControlAdaptor
-
caplin.presenter.control.selectionfield.ExtJsComboBoxControl
-
caplin.presenter.control.selectionfield.ExtJsComboBoxControlAdaptor
BRJS wraps all "namespace-style" files in a define(){} block
This means that if your code has any intentional globals (apart from the class itself) then you will need to remove the var
statement and change function declarations to function expressions, if you still need them to be global.
Format change for URL passed to caplin.popout.Popout
The URL must now end with a trailing slash.
APP.VERSION
Replace <base href="@APP.VERSION@"/>
with <@base.tag@/>
in index.html/index.jsp
files
Replace @APP.VERSION@
with @appVersion@
everywhere else.
Images cannot be referenced in XML configuration files
You will now need to reference these images in CSS
BRJS changes the order of CSS bundling
The order has changed from: libs → bladeset → blade → aspect to libs → blade → bladeset → aspect
If you want to keep the old order: replace <@css.bundle theme="noir"@/
> with <@ct-css.bundle theme="noir"@/>
in your index page.
Changes to bundling of code included with <@js.bundle> tag
By default multiple files are served in development and a single concatenated bundle is written into the deployable artifact. To mimic existing behaviour, add the following attributes:
<@js.bundle dev-minifier="combined" prod-minifier="closure-simple"@/>
Aspects and conformant user libraries are no longer able to define classes outside of their namespace.
If your aspect defines a global MyClass.js
instead of novox/MyClass.js
then an exception will be thrown. You will have to rename your classes inside the appropriate namespace.
Global classes are no longer allowed
So for example:
fixtures("PreferencesFixtureFactory");
should be changed to:
fixtures("caplinx.fxtrader.preferences.PreferencesFixtureFactory");
Also in this example, make sure to change PreferencesFixtureFactory
to caplinx.fxtrader.preferences.PreferencesFixtureFactory
everywhere and also create folders as necessary for the namespace e.g. caplinx/fxtrader/preferences/
Alias names can no longer be the same as the class they point to, and they must also conform to namespace rules
You must create unique names. The names must also be correctly namespaced in accordance to the requirePrefix set in br-lib.conf.