Sample JSON Structure for UI Definition
A sample JSON spec for the PM property ("SEBL_COMPONENT_CONFIG") would appear as below:
{
"imports": [
"...",
"..."
],
"variables": {
"key": "value"
},
"container": "...",
"component": "div",
"attributes" {
"class": "siebui-applet-title"
},
"children": [
{
"component": "...",
"attributes": { ... },
"children": [ { ... }, { ... } ]
}
]
}
The various properties in JSON specifications are as:
-
imports:
Define List of Strings of required modules to be loaded for the configuration.
Definition of imports:
{ "imports": [ "oj-sp/foldout-layout/loader", "oj-sp/foldout-panel-summarizing/loader", "oj-sp/empty-state/loader", "oj-sp/horizontal-overview/loader", "oj-c/input-text", "ojs/ojformlayout" ] } -
variables:
Define key-value pair that can be referenced anywhere within the configuration using the `$var`:
Definition of variables:
{ "variables": { "Applet": "Customer 360 Dashboard Account Form Applet", "itemTitle": "Name", "StreetAddress": "Street Address", "City": "City" } } -
container: Ideally, this is not a required field. DOM element selector can be defined where the component will be rendered.
If not defined, the default selector is used. For example,
"container":"#s_A2_div". -
JSON specifications configuration Recursive at N-levels
-
component
- The Component (e.g. div, oj-sp-foldout-layout)
- "component": "oj-sp-foldout-layout"
- or, Reference to Applet
- "component": "$Applet(AppletName)"
- This means that we want to do the applet rendering at that place in the DOM.
- or, Reference to a component registered in Model-View
Factory
- "component": "$WebComp:(ComponentName)"
- This means that it is a special component registered in the
ModelViewfactory. - The "attributes" defined will be passed as prop to the defined component.
- The Component (e.g. div, oj-sp-foldout-layout)
-
attributes:
- A Pair of HTML attribute key and value which the component expects (more on this in later sections).
-
-
Dynamic Data Binding with Siebel OpenUI
-
Shorthand Syntax: Data Binding with Siebel OpenUINote: The AppletName (AppletPM) (or ViewPM) can almost always be referenced with "
$" symbol which signifies the PM you are writing the configuration for. This is helpful when you don't want to write the current AppletName again and can just directly reference the Applet context in which the configuration is written for.The places where the AppletName can't be referenced will be called out in the documentation below.
The AppletName and ControlName can almost always be referenced via the Applet and Control index ( eg. "#1", "#2") this signifies that we are interested in the Applet and Control not by their name but by the View Web-Template Item and Applet Web-Template Item, although this feature is not complete yet.- literals
- Literals are static values which is not a Open UI binding, it can be a string, array, object, boolean, number.
- If the top level object is a literal, the whole object hierarchy is treated as literal.
$fn:value-
Define binding to get data from an Applet Control, this can be the controls DisplayName, Value, CanInvoke property.
-
Possible Syntax:
$fn:value(AppletName , ControlName , Value)$fn:value(AppletName , ControlName , DisplayName)$fn:value(AppletName , ControlName , CanInvoke)$fn:value($ , ControlName , Value)$fn:value($ , #2 , DisplayName)
-
$fn:property-
Define binding to get data from a PM Property.
-
Possible Syntax:
$fn:property(AppletName , PropertyName)$fn:property($ , PropertyName)$fn:property(#1 , PropertyName)
-
$fn:execute-
Define binding to execute a Control Method or PM Method.
-
This will also be used for Business Service execution binding.
-
Possible Syntax:
$fn:execute(AppletName , ControlName)$fn:execute(AppletName , PMMethodName)$fn:execute(AppletName , #2)$fn:execute(#1 , #2)$fn:execute($ , PMMethodName)
-
$fn:Applet-
Define binding to reference to some PM.
-
Used inside attributes definition then it gets resolved to the Applet's PM.
-
Possible Syntax:
$fn:Applet(AppletName)$fn:Applet($)
-
- literals
-
Longform Syntax: Functions for combining / building / manipulating dynamic data
The Placeholder,<Can be any dynamic value from ShortHand or LongForm Syntax>indicates that you can use any value. For example:$fn:execute( AppletName, MethodName )$fn:property( AppletName, PropertyName )$fn:Applet( AppletName )$fn:value( AppletName, ControlName, CanInvoke ){ "$type": "$fn:join", "value": [ ... ], "combiner" : ", " }{ "$type": "$fn:map", "value": "...", "mapper" : "$fn:execute($, SomePMMethod)" }
- $type: It is a decision factor to know if the defined data is a dynamic data or static data.
- join
- Value needs to be constructed from a list of element
- combiner: : specify the combiner (e.g. use space to join the list of element)
- join definition:
{ "$type": "$fn:join", "value": [ "<Can be any dynamic value from ShortHand or LongForm Syntax>", "<Can be any dynamic value from ShortHand or LongForm Syntax>" ], "combiner": ", " }
- map
- Value gets mapped to another value using the defined mapper.
- map definition:
{ "$type": "$fn:map", "value": "<Can be any dynamic value from ShortHand or LongForm Syntax>", "mapper": "$fn:execute($, SomePMMethod)" }
- object
- An object constructed from dynamic values.
- object definition:
{ "$type": "$fn:object", "value": { "key1": "<Can be any dynamic value from ShortHand or LongForm Syntax>", "key2": "<Can be any dynamic value from ShortHand or LongForm Syntax>" } }
- array
- An array constructed from dynamic values
- array definition:
{ "$type": "$fn:array", "value": [ "<Can be any dynamic value from ShortHand or LongForm Syntax>", "<Can be any dynamic value from ShortHand or LongForm Syntax>" ] }
-
Example on Dynamic Data
The following table provides JSON configuration samples:
| Description | JSON Config | Output |
|---|---|---|
| Joining DisplayName and Value of Control |
|
Account Name: Acme Corp |
| Build Address from City, State and Postal |
|
Redwood Shores, CA, 94065 |
| Map Status value to oj-badge color |
|
danger |
| Build Object |
|
|
| Build Array |
|
|
| Mix-and-match |
|
|
| Complex One |
|
|
Points on Children Definition
The children array can directly take dynamic values, as described
above, using both long-form and shorthand syntax.
For rendering something like the following, notice that
AppletControl-DisplayName becomes the text content in the
div, and AppletControl-Value is the text
content in the b tag.
<div>
AppletControl-DisplayName
<b>
AppletControl-Value
</b>
</div>
{
"component": "div",
"children": [
// The below can be full fledged long form syntax with $fn:join, $fn:map and others
"$fn:value($, Control, DisplayName)",
" ",
{
"component": "b",
"children": [
"$fn:value($, Control, Value)"
]
}
]
}