dspcontainer

The dspcontainer DSP widget provides a mechanism for embedding multiple DSPs in a web page.

Example Logical Widget

Uniface provides a default logical widget called DspContainer, which mapped to this physical widget.

Triggers

  • webtrigger OnChange—executed by the browser when a new DSP instance is assigned to the field. It is not fired when ProcScript is used to assign a new DSP instance to the field.
  • webtrigger onSyntaxError —executed in response to the OnChange event in browser

Widget Properties

The DSP container widget supports the specified HTML attribute and style properties. For more information, see Widget Properties for the Dynamic Server Page.

It also supports the Uniface Component Name (componentname) property. For more information, see Component Name (componentname).

HTML Properties

This widget supports the following HTML properties:

Common HTML Properties
Property Technical Name W3C Description
Access Key html:accesskey accesskey
Style Class html:class class
Disable the Widget html:disabled disabled
Read Only html:readonly readonly
Tab Index html:tabindex tabindex
Tool Tip Text html:title title

Uniface Properties

The following properties represent Uniface properties that have no equivalent in HTML or CSS, or which are used when a form is converted to a DSP.

Uniface Properties

Uniface Property

Technical Name

Background Color (BackColor)

backcolor

Syntax Check on Browser (ClientSyntaxCheck)

clientsyntaxcheck

Component Name (componentname)

componentname

Foreground Color (ForeColor)

forecolor

CSS Properties

The following tables described the supported CSS properties that can be used to style the dspcontainer widget and the logical widgets that map to it.

Description

The dspcontainer allows you to implement your web page using multiple DSP components. This enables you to:

  • Isolate and limit the data that needs to be updated in a web page. For example, while one DSP is being updated, the rest of the page remains the same and the user can continue with other activities.
  • Control page loading by adding or changing components in your page dynamically. For example, you can postpone loading components that are initially not visible. This is called on-demand or delayed loading, and increases the response of the initial page loading.
  • Build tab constructions, in which each tab page is a DSP component that is loaded into a DspContainer field, or each tab is a different instance of the same DSP.
  • Show multiple instances of the same component in a single web page.
  • Define the same entity more than once in a web page.

You need to define one DSP that acts as the master component. It can have one or more fields that are defined as dspcontainers.

The value of a DSP container field is mapped to the instance name of a DSP component. Assigning the instance name to the field attaches the instance to the dspcontainer and displays the layout of the instance inside the dspcontainer. The dspcontainer automatically instantiates the contained DSP component if this is not yet done.

The other component becomes a child of the first DSP. At runtime, the layout of the child component is displayed at the location of the dspcontainer field in the layout of the parent.

The componentname widget property specifies the DSP component to instantiate. If the componentname is not defined, the instance name is used as component name.

Assigning a DSP to the DspContainer

  1. In a DSP component that will be used as the parent or master DSP, create a field and select DspContainer as the Widget Type.
  2. Assign the instance name of another DSP component to this field's value. You can do this in the Initial Value field or in ProcScript, for example in the Execute trigger.
  3. If you intend to assign different instances of the same DSP to the field, set the componentname property to the DSP component name and assign an instance name to the field value.

Instantiating, Attaching, and Detaching the DSP Instance

When DSP component instance name is assigned to the dspContainer:

  • If the instance does not yet exist, it is instantiated and its exec operation is activated. The exec operation is responsible for returning a layout, web definitions, and data, just as it does for normal DSP components.
  • If the instance is already available on the browser, and it has an attach operation defined, the attach operation is executed (instead of the exec operation). If no attach operation is implemented, the exec operation is activated.
  • If an instance is already attached to the dspcontainer, it is detached and replaced by the new DSP component instance. If the old DSP component instance has the detach operation defined, it is executed. The old DSP component instance is then no longer attached to any dspcontainer and therefore not visible. To make it visible again, simply assign it to a dspcontainer field.
  • If a DSP component instance is moved from one dspcontainer to another, its original dspcontainer fires its OnChange trigger because it no longer contains a DSP component instance and its field value will be empty.

Only attached DSP component instances are visible.

The attach and detach operations are predefined operations that you can optionally implement in the contained DSP to perform desired actions such as refreshing the data when the instance is attached, or issuing a message about unsaved data when it is detached. For more information, see operation attach and operation detach.

Layout and Style of Contained DSP

The location of the dspcontainer widget in the layout determines where the layout of the contained DSP component instance will be shown in the web page. The layout of both the parent and child components is handled by merging the HTML (I-Frames are not used).

During this merge:

  • If the contained DSP has a header, it is removed.
  • The <body> element of the contained DSP is replaced by a <span> element which contains the content of the DSP.
  • HTML attributes set on the <body> are removed, and the contained DSP instance inherits class and style attributes from the parent.

Any link elements included in the layout of a contained DSP will be included in the whole page at runtime. If this link is to a CSS style sheet, the styles defined in the CSS are applied to the whole page, not just to the contained DSP.