@doc hierarchy="GMLDOM">
Aspect for drawing zoomable textboxes
(c) SAP AG 2003-2006. All rights reserved.
///////////////////////////////////////////////////////////////////////
// ASPECT HEADER
Aspect ZText for ZDrawing;
inherit ZShape;
//////////////////////////////////////////////////////////////////////////////////////
// BASE PROPERTIES
<@doc group="Instance Properties">
Gets or sets the textbox's font size
The font size is expressed as a percentage of the default font size (e.g., 50 means half-size font, 200 means double-size font, etc.).
property fontSize = 90;
<@doc>
Gets or sets the dash pattern for the textbox's frame
The ~dash property controls the pattern of dashes and gaps used to stroke the textbox frame.
The ~dash property value can be either 'none' (indicating that the frame is to be drawn solid),
or a list of whitespace-separated numbers that specify the lengths of alternating dashes and gaps.
property frameDash = 'none';
<@doc type="Enum">
Gets or sets the textbox's alignment
The ~textAlign property values are defined by the following enumeration:
Value | Description
start | The textbox contents are aligned along the left margin
middle | The textbox contents are centered around the shape's middle
end | The textbox contents are aligned along the right margin
property textAlign = 'start';
<@doc type="RGB">Gets or sets the graphic's text color
The ~textColor is typically used for drawing text in the graphic
property textColor = '#546374';
//////////////////////////////////////////////////////////////////////////////////////
// OVERRIDDEN PROPERTIES
override property fillColor = '#FFFFFF';
override property strokeColor = '#D4D0C8';
override static readonly property boundingBox = {defWidth:120, defHeight:30};
override static readonly property framePadding = {top:5, right:10, bottom:7, left:5};
override static readonly property resizeMode = #[SVG_KEEP_SIZE];
override static readonly property rotateMode = #[SVG_ROTATE_FULL];
override static readonly property frameParts = [
{type:'rect', x:'-@w/2', y:'-@h/2', width:'@w', height:'@h', fill:'@fillColor', stroke:'currentColor', 'stroke-dasharray':'@frameDash'}
];
override static readonly property bodyParts = [
{type:'text', amtext:'@notes', x:'(@textAlign=="start" ? 8-@w/2 : @textAlign=="end" ? @w/2-4 : 0)', 'font-size':'@fontSize+"%"', fill:'@textColor', stroke:'none', 'font-family':#[SVG_DEFAULT_FONT], 'text-anchor':'@textAlign'}
];
//////////////////////////////////////////////////////////////////////////////////////
// PAINTING METHODS
override virtual method repaint(prop)
var flags = this.supercall();
if ((flags & #[SVG_REPAINT_SIZE]) || prop == '@textAlign') {
var tnode=this.partNodes[1], tx=tnode.getAttribute('x');
for (var i=0, C=tnode.childNodes, len=C.length; i