Text

Using Text presentation shape, you can put labels with some comments or descriptions on presentation diagram.

Texts can appear not only in 2D presentation, but also in 3D animation:

 To add a text onto presentation

  1. Drag the  Text element from the  Presentation palette onto the graphical editor.
  2. After you drop the element onto the graphical editor, the text field appears. In the text field, type the text you want to be displayed by this text shape. To apply changes, click outside of the field or press Ctrl+Enter (Mac OS: Cmd+Return). To discard changes, press Esc.

    Alternatively, navigate to the the Text section of the shape's Properties view. In the box, type the text you want to be displayed by this text shape.

  3. By default text shapes do not appear in 3D animation, if you want the text to be shown also in 3D animation scene, open the Advanced section of the text Properties and choose In 2D and 3D in the option Show in. This will enable displaying the text in your 3D window
  4. In the Position and size section of the Properties you can change the Z-coordinate of the text shape in the field Z.

Properties

General

Name – The name of the shape. It is used to identify and access the shape from code.

Ignore – If selected, the shape is excluded from the model.

Visible on upper level – If selected, the shape is also visible on the upper level where this agent lives.

Icon – If selected, the shape is considered as a part of the agent's icon. Please note that icon shapes are not shown in 3D animation.

Lock – If selected, the shape is locked. Locked shapes do not react to mouse clicks - it is impossible to select them in the graphical editor until you unlock them. It is frequently needed when you use a shape as a background image for your animation and you want to prevent editing this shape while drawing other shapes over it

Visible – Here you specify whether the shape is visible on the animation at the model runtime, or not. Choose yes or no using the control. If you expect visibility to change dynamically or to depend on some conditions, you may specify the expression defining the shape's visibility here. This expression will be dynamically reevaluated at the model runtime. It should return boolean value. The shape is visible when the specified expression evaluates to true, and not visible otherwise.

Text

Here you specify the content of the text shape: the text itself.

If necessary, you can specify the text directly in the graphical editor. To do this, double click the text shape and provide the required text in the text field. To apply changes, click outside of the field or press Ctrl+Enter (Mac OS: Cmd+Return). To discard changes, press Esc.

Appearance

Color – Static value | dynamic expression of the text color. Click inside the control and choose a color using the Colors dialog box. Otherwise, specify here the expression defining the text color. The expression should return an instance of Java class Color

Alignment – Text alignment. Using the buttons to the right, choose, whether the text should be aligned to the left, center or right. 

Font – Specifies the font family for the text. You can adjust the size of the text font using the control to the right.

Italic – If selected, the text is italicized.

Bold – If selected, the text is emphasized in bold.

Position and size

X – X-coordinate of the text's upper left corner.

Y – Y-coordinate of the text's upper left corner.

Z – Z-coordinate of the text shape.

Rotation – Shape's rotation angle in XY plane. 

Scale X – Here you can specify the expression returning the X-direction scale factor for the shape.*

Scale Y – Here you can specify the expression returning the Y-direction scale factor for the shape.*

You can dynamically scale the shape at the model runtime by specifying expressions in the Scale X and Scale Y parameters.

Advanced

Show in - Here you can choose whether you want this shape to be shown both In 2D and 3D animation, or in 2D only, or in 3D only.

Replication – The replication factor of the shape. Here you specify how many copies of the shape will be created (the integer number). If you leave this field empty, only one shape will be created.

On click – Code that will be called each time a user clicks on the shape at the model runtime.

Show name – If selected, the shape's name will be displayed on the presentation diagram.

Functions

You can dynamically modify shape properties at model runtime using the following API. 
Location

Function

Description

double getX()

double getY()

double getZ()

Returns the X (Y, Z) coordinate of the shape (namely, the X coordinate of its upper left corner).

void setX(double x)

void setY(double y)

void setZ(double z)

Sets the X (Y, Z) coordinate of the shape.

Parameters:
x - the new value of X coordinate
y - the new value of Y coordinate
z - the new value of Z coordinate

void setPos(double x, double y)

Sets new X, Y coordinates for the shape. Z coordinate stays unchanged.

Parameters:
x - the new value of X coordinate
y - the new value of Y coordinate

void setPos(double x, double y, double z)

Sets new X, Y, Z coordinates for the shape.

Parameters:
x - the new value of X coordinate
y - the new value of Y coordinate
z - the new value of Z coordinate

Scaling

Function

Description

double getScaleX()

double getScaleY()

double getScaleZ()

Returns the scale of the shape along X (Y, Z) axis.

void setScaleX(double sx)

void setScaleY(double sy)

void setScaleZ(double sz)

Sets the scale of the shape along X (Y, Z) axis.

Parameters:
sx - the new value of scale along X axis* 
sy - the new value of scale along Y axis* 
sz - the new value of scale along Z axis* 

* 1 = keep original size

void setScale(double sx, double sy)

Sets the scales of the shape along X and Y axes.

Parameters:
sx - the new value of scale along X axis* 
sy - the new value of scale along Y axis* 

* 1 = keep original size

void setScale(double sx, double sy,
double sz)

Sets the scale of the shape.

Parameters:
sx - the new value of scale along X axis* 
sy - the new value of scale along Y axis* 
sz - the new value of scale along Z axis* 

* 1 = keep original size

void setScale(double s)

Sets the same scale of the shape along all axes.

Parameter:
s - the new value of scale along all axis, 1 = keep original size

Rotation

Function

Description

double getRotation()

Returns the rotation of the shape in radians, clockwise.

void setRotation(double r)

Sets the rotation of the shape.

Parameter:
r - the new value of rotation in radians

Visibility

Function

Description

boolean isVisible()

Checks the visibility of the shape. If the shape is visible, returns true, otherwise returns false.

void setVisible(boolean v)

Sets the visibility of the shape.

Parameter:
v - visibility: if true - the shape is set to be visible, if false - not visible.

Text contents

Function

Description

String getText()

Returns the text of the text shape. 

void setText(Object text)

Sets the text of the text shape.

Parameter:
text - the new text of the text shape

Text font, color, alignment

Function

Description

Font getFont()

Returns the font of the text shape. 

void setFont(Font font)

Sets the font of the text shape.

Parameter:
font - the new font of the text shape

Color getColor()

Returns the color of the text. 

void setColor(Color color)

Sets the color of the text.

Parameter:
color - the new color, if null, the text is not drawn

int getAlignment()

Returns the alignment of the text shape. Possible values are:

ALIGNMENT_LEFT
ALIGNMENT_CENTER
ALIGNMENT_RIGHT

void setAlignment(int alignment)

Sets the alignment of the text shape.

Parameter:
alignment - the new alignment of the text shape, one of:

ALIGNMENT_LEFT
ALIGNMENT_CENTER
ALIGNMENT_RIGHT


Related topics

Moving presentation shapes

Rotating presentation shapes

Changing shape color

Changing shape's position in stacking order

 Aligning shapes