The Design object represents a design context in TMLScript and offers various related functionalities, for example to fetch additional design resources relative to this context.
The design context retrieved by WGA.design() (without parameter) points to the OpenWGA design in which the current script is defined and from which it fetches additional script resources. Calling WGA.design() with different parameters creates design objects that instead may point to specific designs of other applications.
Besides addressing the design of a special OpenWGA application the design context may hold additional design reference information which is called its base reference. This points to a specific resource name as a "starting point". The base reference is used by the design object to locate other resources in a relative way (manually via Design.resolve()) or to retrieve design resources at the base reference position (for example Design.getFileContainer()).
This adressation functionality is mostly used implicitly in WebTML/TMLScript. For example: The action id given to WGA.callAction() is automatically resolved using the local design context of the script without explicitly using the Design object. However in some cases you need to manually resolve design references, for example when you need another design context than the one of the current script, or if you want to use WGAPI design functionalities which are not aware of WebTML addressation.
In those cases the method Design.resolve(), maybe in combination with direct retrieval methods like Design.getFileContainer() can be used to safely address and retrieve design resources in a way which takes all possible forms of relative addressation in WebTML like local and overlay references into account (see examples).
The string representation of this object is an absolute design reference to the design addressed by the design context. So you can use this object at any place where a design reference string is expected.
|Via method WGA.design()
|Allowed in script types
|Properties and methods
Using the design context to safely address a WGAPI file container:
var fc = WGA.design().resolve("images").getFileContainer();
This theoretically could also be done directly via WGAPI:
var fc = db().getFileContainer("images");
But as the WGAPI does not know about WebTML addressation this might fail in some situations, for example if the script runs from an overlay design. In that case the real name of the file container to retrieve would be "overlay:images" so the WGAPI method would not find the container. The design context however knows about its location in an overlay design and is able to use the complete name.