NaturalONE Version 8.3.7
 —  Natural for Ajax  —

Some Common Rules for all Controls

This document covers the following topics:


Name and Text ID

Every time a control needs a static text definition (the name of a button or the name of a label), there are always two possibilities to define this text:

Top of page

Table, Row, Column, Control

Most controls that allow dynamic sizing offer the following properties:

These properties influence the way how controls are placed into container rows.

Top of page

Explicit Alignment

Controls are put into table columns. If the column is wider or higher than the control itself, then you can explicitly control the vertical and horizontal alignment of the control inside the columns.

Most controls offer two properties:

Pay attention: valign and align only affect the position of the control inside the column in which it is positioned if the column is larger than the control. If the column is exactly as wide and high as the control itself, which is the typical case, then they do not have any visual effects - and also need not be defined.

align/valign do not affect the control's internal alignment.

Top of page

Binding to Adapter Parameters

Most controls provide properties to specify the binding to the adapter processing. There is a naming convention, which is:

The type of the adapter parameter which is referenced by a control depends on the control itself:

The type of adapter parameter is described with each control.

Top of page

Directly Influencing the Control Style

All controls that incorporate textual information - such as labels, buttons or fields - offer the possibility to influence directly the style that is used for displaying the information.

The normal style is derived from the definition inside a cascading style definition file (file layout.css inside the html/general directory of the server). Overwrite or enhance this style information for your controls by passing the style information inside the corresponding style properties.

The properties specifying the style information end with the suffix "style", e.g. there is a property labelstyle for the label tag. The value of the property can be any kind of a valid HTML style specification. If you want to change the display style of a label to be large and blue, define the label in the following way:

<label name="Test" width="150" labelstyle="font-size: 24pt; color: #0000FF">
</label>

Top of page

Dynamically Controlling the Visibility and the Display Status of Controls

It is possible to influence the visibility of all input controls (FIELD, BUTTON, etc.) by adapter parameters.

For some of these controls there is a property visibleprop, specifying an adapter parameter that returns "true" or "false". By this, you can control whether you want to display the control within the client or not.

Input controls support a property statusprop and a property displayprop. Using the corresponding adapter parameters, you can dynamically control the display status of the input control. The adapter parameter for the statusprop can contain the following values:

INVISIBLE
ERROR
ERROR_NO_FOCUS
FOCUS
FOCUS_NO_SELECT

The adapter parameter for the displayprop specifies whether the control is display-only (TRUE) or whether it can be edited (FALSE). The adapter parameter can contain the values "TRUE" and "FALSE".

The combination of these two parameter values dynamically defines how the controls are rendered at runtime. The following table defines the rendering of the control for the different combinations:

displayprop statusprop Control Status
FALSE (default)   EDIT
FALSE (default) EDIT (deprecated) 1 EDIT
FALSE (default) INVISIBLE INVISIBLE
FALSE (default) ERROR ERROR
FALSE (default) ERROR_NO_FOCUS ERROR_NO_FOCUS
FALSE (default) FOCUS FOCUS
FALSE (default) FOCUS_NO_SELECT FOCUS_NO_SELECT
TRUE   DISPLAY
TRUE DISPLAY (deprecated) 1 DISPLAY
TRUE INVISIBLE INVISIBLE
TRUE ERROR ERROR_DISPLAY
TRUE ERROR_NO_FOCUS ERROR_DISPLAY
TRUE FOCUS DISPLAY
TRUE FOCUS_NO_SELECT DISPLAY

1 For statusprop, the above-mentioned deprecated values are still supported to ensure compatibility with older versions. In case you use these deprecated values for statusprop, the values for displayprop are ignored.

The difference in behavior between "FOCUS" and "FOCUS_NO_SELECT" affects only the FIELD and TEXT controls. For these controls, FOCUS set the focus and selects the complete text inside the control. "FOCUS_NO_SELECT" sets the focus to the control, but does not select the text. For all other controls, "FOCUS_NO_SELECT" behaves like "FOCUS".

For all other controls - and for more complex manipulations of what is visible and not - use the possibility to be able to control the visibility of rows (ITR, TR) or containers (ROWAREA, ROWTABLE0): these controls provide for a visibility parameter and consequently can be switched on and off.

There is an extended management of what the control status "INVISIBLE" means. Most input controls (FIELD, CHECKBOX, etc.) supporting a statusprop or a visibleprop also support a property invisiblemode. The allowed values of invisiblemode are:

Top of page

Focus Management

Sometimes you want to control the keyboard focus inside a page. Here are the internal rules how a page finds out where to put the focus on.

The default reaction is - if a page is displayed for the first time - to put the focus on the first input control (FIELD, CHECKBOX, RADIOBUTTON, etc.) that is available inside a page. After that, you can navigate through the input controls - and the focus is kept stable when interacting with the server.

With statusprop - as mentioned in the previous section - you can interrupt this default reaction; there are two possibilities:

If several input controls are requesting the focus at the same time, the focus is put on the first corresponding input control.

Sometimes you want to change the focus management behavior of the framework for specific server round trips. For TABPAGE controls, you sometimes want the framework not only to set the focus to the first focus-requesting input control but also to open the corresponding tab. For some events, you sometimes do not want the framework to automatically set the focus to the first focus-requesting control. The focusmgtprop property of the NATPAGE control allows you to control the focus management for single server round trips. Depending on the executed event, the application can define different focus management modes for corresponding server round trips. For more information, see the description of the focusmgtprop property of the NATPAGE control.

Top of page

Flushing of Inputs

Most input controls (FIELD, CHECKBOX, RADIOBUTTON, COMBOFIX, etc.) support a property named flush. This property controls whether data input from a user causes an immediate synchronisation with the server or whether data input from a user is stored internally within the client and is synchronized with the next flushing event (e.g. when choosing a button).

There are three different values that can be specified with the flush property:

Tip:
On the one hand, it is useful to flush information in a very fine granular way; you can react on wrong entered data immediately - on the other hand, you have to remember that each flush causes network traffic. The screen's data is sent to the server side processing and the screen waits for the response of the server. During this time, the page is blocked for input and the user sees an hour glass popping up in the left top corner of the screen.

Top of page

Tab Sequence

By default, the tab sequence of the controls of a page is defined by the order of the controls inside the page's XML layout definition. Using the property tabindex, this order can be overridden and the order of the tab index can be explicitly defined.

The following example shows a page with three fields and one button with an explicitly defined tab sequence:

graphics/image059.png

The XML layout definition is:

<rowarea name="Simple Tab Sequence">
    <itr takefullwidth="true">
        <coltable0 width="50%">
            <itr>
                <label name="First" width="120">
                </label>
                <field valueprop="first" width="120" tabindex="1">
                </field>
            </itr>
            <itr>
                <label name="Third" width="120">
                </label>
                <field valueprop="third" width="120" tabindex="3">
                </field>
            </itr>
        </coltable0>
        <coltable0 width="50%">
            <itr>
                <label name="Second" width="120">
                </label>
                <field valueprop="second" width="120" tabindex="2">
                </field>
            </itr>
            <itr>
                <hdist width="120">
                </hdist>
                <button name="OK" method="onOK" tabindex="4">
                </button>
            </itr>
        </coltable0>
    </itr>
</rowarea>

According to the sequence of controls inside the layout definition, the default tab sequence would be: field First, field Third, field Second and button OK.

Due to explicitly defining the tabindex property for the fields and the button, the tab sequence is now correct: field First, field Second, field Third and button OK.

Pay attention:

The tab index usually is a positive integer value. You may define tab index "-1" for excluding certain controls from the tab sequence at all. In this case, the corresponding controls may only be reached by mouse clicking.

Conclusion:

Top of page

Tooltips

Tooltips can be applied to many controls. If the user hovers with the mouse cursor over a control for some seconds, a small yellow box appears showing some more detailed explanation.

The corresponding controls offer two properties:

Top of page

Images

This section describes how to apply images that are contained in binary variables on the Natural server to your page layout. The images can be applied statically and dynamically.

Static Images

Many controls provide properties for loading images. In the corresponding image properties, you usually specify an absolute or relative URL such as "../myproject/images/myicon.gif". For images which are contained in binary variables on the Natural server, however, you must use a different URL value such as "nat:myimage1". Example:

<itr>
  <icon image="nat:myimage1">
  </icon>
</itr>

The prefix "nat:" indicates that the image is contained in a binary variable on the Natural server. "myimage1" is the name that your Natural application uses for this image. There is no need to download or copy the image manually from the Natural server to the application server or web container. This is done automatically by the Natural for Ajax framework.

You simply add an NJX:OBJECTS control to your page layout and provide the image data in the corresponding Natural data fields as shown below:

<natpage>
    <njx:objects>
    </njx:objects>
...
    <pagebody>
...
      <itr>
        <icon image="nat:myimage1">
        </icon>
      </itr>

For information on how to load the image into the data structure of the NJX:OBJECTS control, see the description of the NJX:OBJECTS control.

Dynamic Images

Dynamic images are specified in the same way as static images. You also add an NJX:OBJECTS control to your page layout. This time, you specify the images that are contained in a binary variable on the Natural server in the corresponding dynamic image properties of the control as shown below:

<natpage>
    <njx:objects>
    </njx:objects>
...
    <pagebody>
...
      <itr>
        <imageout valueprop="myimageprop">
        </imageout>
      </itr>

This allows your Natural program to apply images which are contained in a binary variable on the Natural server and images which reside in the web application layer alternatively to the same dynamic image property at runtime ("myimageprop" in the above example).

For information on how to load the image into the data structure of the NJX:OBJECTS control, see the description of the NJX:OBJECTS control.

Top of page

Documents

This section describes how to embed, download and upload documents that are contained in binary variables on the Natural server to your page layout.

Embedding and Downloading Documents

As with images, you add an NJX:OBJECTS control to your page layout and load the document into the corresponding data structure of the NJX:OBJECTS control. For further information, see the description of the NJX:OBJECTS control.

To embed a document into your page layout, you add a SUBPAGE control to your page. In the valueprop property of the SUBPAGE control, you have to specify the corresponding document URL dynamically at runtime. If you want to force downloading instead of opening the document, add the parameter DOWNLOAD=TRUE to the URL (for example, "nat:mydoc.pdf?DOWNLOAD=TRUE").

Via the NJX:DOCUMENTLINK control, you can integrate hyperlinks to documents. When clicking on a hyperlink, the corresponding document is opened in a pop-up dialog.

As an alternative to the NJX:DOCUMENTLINK control, you can use the predefined event showDocumentForXXX in all controls which support a method property. XXX is the name of a property you can choose. For XXX, a corresponding Natural field will automatically be generated in your Natural adapter. To show a document, when the showDocumentForXXX event is triggered, the Natural program must apply a valid document URL to the XXX field. This URL can refer to documents transported in the data structure of the NJX:OBJECTS control. It can also be a normal browser URL for a document which is accessible from within the web application.

Via the NJX:NJXFILEDOWNLOAD control, you can integrate hyperlinks which are directly executed by the browser. To force downloading the document, add the parameter DOWNLOAD=TRUE to the URL (for example, "nat:mydoc.pdf?DOWNLOAD=TRUE").

See also the naturaldocument example in the Natural for Ajax demos.

Uploading Documents

Via the NJX:NJXFILEUPLOAD2 control you can upload documents from the client to the NJX:OBJECTS data structure. You can also upload dynamically generated PDF documents to the NJX:OBJECTS data structure by triggering corresponding built-in events in the REPORT control.

Top of page