Start page
Start page

Start page / Template development / Template syntax / Data types / Area

Data type AreaAvailable from FirstSpirit Version 5.1R2

Value range of the data type Area

In FirstSpirit it is possible to create link-sensitive graphics (also called “image map”). A link-sensitive graphic can have one or more areas which can be selected or opened by use of an input device (for example mouse, trackball). When selecting the area the link which is stored on the area will be opened .

The IMAGEMAP input component can be used to create and manage link-sensitive graphics. This input component returns an object of the data type MappingMedium.

The hot-spots or active areas are output using the .getAreas() method (in Bean syntax: .areas). This returns a list of objects of the data type Area (List<Area>). See also API documentation, interface Area.

As several hot-spots or active areas can be entered within a CMS_INPUT_IMAGEMAP input component, the instruction $CMS_FOR(...)$ is used to enable the attributes of each individual area to be output:

$CMS_FOR(AREA, st_imagemap.areas)

The following forms are supported:

Different methods can be used, according to the form which was selected by the editor. The selected form can be identified in advanced for the output using a $CMS_FOR(...) instruction or the if(...) method, in combination with the method .getShape() (in Bean syntax: .shape), for example:

$CMS_IF(AREA.shape=="CIRCLE")$
...
$CMS_END_IF$

Methods on Area objects

The table below lists all methods which can be invoked on objects of data type Area:

Method name Return type Brief description Available since
compareTo(Comparable) int
equals(Object) boolean
getClass Class Class of the invoking object
getCoordinates String Coordinates of the hot-spots 5.1.207
getLink Link Link which is referenced to the hot-spot
getShape String Form of the hotspot 5.1.207
isCase(Object) boolean
isNull boolean Checks whether an expression is null (zero)
print void
receive(Area$Visitor) Object
set(String, Object) Object
toJson String Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings) 4.2.14
toString String
type String

compareTo(Comparable)

Method name Return type Available since
compareTo(Comparable) int

equals(Object)

Method name Return type Available since
equals(Object) boolean

getClass

The .getClass() (in Bean syntax: .class) method returns the class of the invoking object (cf. java.lang.Class).

Invocation:

$CMS_VALUE(myString.class)$
$CMS_VALUE(myString.getClass())$

Output:

java.lang.String
Method name Return type Available since
getClass Class

getCoordinates

The method .getCoordinates() (in Bean syntax: .coordinates) returns – in dependency of the form which is selected by the editor – a comma-separated list of the hot-spot's coordinates in pixels, for example.

$CMS_VALUE(AREA.coordinates)$

Rectangular hotspots
If the hot-spot is a rectangle the x and y coordinates of the top left-hand and of the bottom right-hand corner are returned, for example:

30,322,130,422

The x and y coordinate of the top left-hand corner can be determined using

$CMS_VALUE(AREA.leftTop)$

the x and y coordinate of the bottom right-hand corner can be determined using

$CMS_VALUE(AREA.rightBottom)$

See also interface RectArea.

Circular hot-spots
If the hot-spot is a circle the x and y coordinates of the centre of the circle and the radius are returned, for example:

260,252,50

The x and y coordinate of the centre can be determined using

$CMS_VALUE(AREA.center)$

the radius can be determined using

$CMS_VALUE(AREA.radius)$

See also interface CircleArea.

Polygonal hot-spots
If the hot-spot is a polygon the x and y coordinates of each point are returned, for example:

369,215,427,182,449,223,417,264,350,265

for a pentagon.

The x and y coordinate of the corners can be determined using

$CMS_VALUE(AREA.points)$ 

As a polygon have many vertices the $CMS_FOR(...)$ instruction must be used for being able to output all vertices:

$CMS_FOR(point, AREA.points)$
x: $CMS_VALUE(point.x)$, y: $CMS_VALUE(point.y)$
$CMS_END_FOR$

See also interface PolyArea.

Method name Return type Available since
getCoordinates String 5.1.207

getLink

The method .getLink() (in Bean syntax: .link) returns the link which is referenced to the hot-spot.

The link destination (reference) and link text can be resolved using

$CMS_VALUE(AREA.link.LINKDESTINATION)$ 

and

$CMS_VALUE(AREA.link.LINKTEXT)$

with LINKDESTINATION is the identifier of the input component in which the destination of the link (reference) is stored, and LINKTEXT is the identifier of the input component in which the text of the link is stored, for example:

<a title="$CMS_VALUE(AREA.link.lt_text)$" href="$CMS_VALUE(AREA.link.lt_reference)>

(cf. also Chapter Link templates).

Method name Return type Available since
getLink Link

getShape

The method .getShape() (in Bean syntax: .shape) returns the form of the selected hot-spot:

  • RECT (rectangle)
  • CIRCLE (circle)
  • POLY (polygon)

Specific methods are available for each of these forms. They must be used case-related. See also

Method name Return type Available since
getShape String 5.1.207

isCase(Object)

Method name Return type Available since
isCase(Object) boolean

isNull

The .isNull() (in Bean syntax: .isNull) method checks whether an expression or object is null , e.g. storeElement.isNull(). In the case of objects with complex values or objects, the object decides when it is null. The data type DomElement for example always contains an empty document, thus it is never null. For this reason, checking an empty DOM editor input component by using the method .isNull() returns the value false, whereas checking the component with .isEmpty() would return the value true.

The method .isNull() returns a Boolean value as the check result. true is the check result if the expression or object is null and false if not.

Method name Return type Available since
isNull boolean

print

Method name Return type Available since
print void

receive(Area$Visitor)

Method name Return type Available since
receive(Area$Visitor) Object

set(String, Object)

Method name Return type Available since
set(String, Object) Object

toJson

Convert to JSON string representtion (only handles Maps, Collections, Arrays, Numbers, and Strings)
Method name Return type Available since
toJson String 4.2.14

toString

Method name Return type Available since
toString String

type

Method name Return type Available since
type String

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-07-17