pp108 : Image

Image


The Image control is used to display images in an XForm. You can add an image by specifying the URL denoting the location of the image. The location that you define can be an absolute or a relative path, or you can also specify a file from a different domain.

Process Platform uses multi-size icons, wherein an image file contains a single image in three different sizes. When using Process Platform icons in your application, you must define the icon size to be used. If you need to change the icon size in an application, you can achieve this by modifying the icon size specified in the image property sheet.

The Image control is a free-form element, by default. However, if the URL of the image specifies its path from a data source, the control is said to be data-bound.

You can bind an Image control to a model by setting the Reference property of the associated business object in the control's property sheet. To do so, specify the XPath of the business object's data to be bound. If no model is set for the control, then the control is bound to the model of its parent control, by default.

Properties, Events, and Methods of the Control


The Image control has certain properties, events, and methods associated with it. They define the behavior of the control. They can be set through the property page of the control or through the programming APIs.

Table 1. List of Properties

Design-time property

Runtime property

Description

ID

Sets the string that identifies the control on an XForm. If not specified, a unique ID is automatically generated.

URL

src

Sets the location of the image to be displayed on the control.

Model

Sets the ID of the data model from which the data (specified using the Reference property) is displayed in the control. If model is not specified, it is inherited from the parent control's model.

Reference (xql)

Sets the location or expression for the XPath that contains the data (value) displayed in the control. The XPath refers to the child node or descendants of the immediate parent control's reference.

Class Name

className

Sets or retrieves the class name applied on the control.

Tooltip

title

Sets the tool tip that appears on a control when the mouse is moved over it. Programmatically, this property is set by specifying the title property of the control.

businessObject

Retrieves the root node of the XML data associated with the control; the location of the data is specified by the Reference property.

currentContext

Retrieves the immediate parent of the data that the control represents. This data is the child node of the business object.

data

Retrieves the XML node of the data (value) that the control represents. The location (XPath) of this XML inside the business object is set through the Reference property.

Task Part

Sets whether the control can be associated with a task part. For details, see Property Sheet of Controls, Regions, and AppPalettes and Creating a Task Part for a Control.

Type

Sets the type of image.

  • Set as Simple if a single-sized image is to be used.
  • Set as Multi-size if a multi-size icon is to be used.

Icon Size

Sets the image size to be used in case of multi-size icons. This option is available if Type is set as Multi-size.

  • If set as Small, the smallest multi-size icon is used.
  • If set as Medium, the medium multi-size icon is used.
  • If set as Large, the largest multi-size icon is used.

    Note: If the image type is Multi-size, the size of the image will be automatically set as small for tables and Xgrid.


Table 2. List of Events

Event

Description

Click

This event is activated when you click the image.

Data Bind

This event is activated before the data is bound to the control.


Table 3. List of Methods

Method

Description

addListener()

This method registers the control to receive notifications for an event.

create()

This method is available for data-bound controls only. It creates an instance of the business object for the control.

disable()

This method disables the control on which it is invoked.

enable()

This method enables the control on which it is invoked.

getBusinessObject()

This method retrieves data or business object.

getFormattedValue()

This method returns the value that is to be displayed in the control.

getValue()

This method returns the original value of the control, as available in the database.

hide()

This method hides controls and all associated child controls.

isEnabled()

This method retrieves the value that denotes whether the control is enabled or not.

rebind(oBusinessObject)

This method is available for all controls bound to a model. This method refreshes the control with data from the business object that is passed as a parameter. If no parameter is passed, the business object of the model's activeTuple node is used and the control is refreshed.

remove()

This method is available only for data-bound controls. It removes the instances marked for deletion.

removeListener()

This method unregisters the control to cease receiving notifications for its events.

setValue(sValue)

This method sets the value of the control. The sValue parameter denotes the value to be set for the control.

show()

This method makes the control and its child controls visible.