@doc hierarchy="GMLDOM">
Base aspect for all graphic primitives in a zoomable drawing
(c) SAP AG 2003-2006. All rights reserved.
///////////////////////////////////////////////////////////////////////
// ASPECT HEADER
abstract Aspect ZGraphic for ZDrawing;
constructor(diagram, parent)
this.id = base.id;
this.board = diagram.board;
this.parentID = parent && parent.id || diagram.id;
this.diagramID = diagram.id;
this.canvas = this.board.canvas;
this.canvas.setWidget(this);
end
virtual method getParent()
return this.canvas.getWidget(this.parentID)||this.getDiagram();
end
virtual method getDiagram()
return this.canvas.getWidget(this.diagramID);
end
//////////////////////////////////////////////////////////////////////////////////////
// BASE PROPERTIES
<@doc type="RGB" group="Instance Properties">
Gets or sets the graphic's stroke color
The ~strokeColor is typically used for drawing the graphic frame
property strokeColor = '#718398';
<@doc type="RGB">
Gets or sets the graphic's current color
The ~currentColor can be used as a secondary color for the graphic when it is unselected.
When the graphic is selected, the both the ~currentColor and the ~strokeColor are replaced with ~hilightColor.
If omitted, ~currentColor will default to ~strokeColor.
property currentColor = '';
//////////////////////////////////////////////////////////////////////////////////////
// ASPECT PROPERTIES
<@doc scope="private">Gets the graphic's Id
virtual property id = '';
<@doc type="RGB" scope="private">Gets the graphic's hilight color (inherited from the diagram hilight color)
virtual property hilightColor = '';
// Associated objects
<@doc type="@Board!" scope="private">Gets the current drawing board object
virtual property board = null;
<@doc type="@Canvas!" scope="private">Gets the canvas object
virtual property canvas = null;
<@doc scope="private">Gets the containing diagram object id
virtual property diagramID = null;
<@doc scope="private">Gets the innermost block (or diagram) id that contains this graphic
virtual property parentID = '';
// Status flags
<@doc scope="private">Indicates whether the graphic is currently in focus (primary selection)
virtual property inFocus = false;
<@doc scope="private">Indicates whether the graphic is being animated
virtual property isAnimated = false;
<@doc scope="private">Indicates whether the graphic is currently selected
virtual property isSelected = false;
// SVG painting objects
<@doc type="SVGNode" scope="private">Gets the graphic's svg node
virtual property graphicNode = null;
//////////////////////////////////////////////////////////////////////////////////////
// MODEL EVENTS
<@doc scope="private">
Handles an update of a graphic property
abstract virtual method onModelUpdate(evt);
<@doc scope="private">
Handles an insertion of a child graphic into this graphic
abstract virtual method onModelInsert(evt);
<@doc scope="private">
Handles a removal of a child graphic from this graphic
abstract virtual method onModelRemove(evt);
//////////////////////////////////////////////////////////////////////////////////////
// INTERACTIVE EFFECTS
<@doc scope="private">
Shows indication that the mouse is over the graphic
abstract virtual method showHoverEffect();
<@doc scope="private">
Hides indication that the mouse is over the graphic
abstract virtual method hideHoverEffect();
<@doc scope="private">
Shows indication that the graphic is selected
abstract virtual method showSelectionEffect();
<@doc scope="private">
Hides indication that the graphic is selected
abstract virtual method hideSelectionEffect();
<@doc scope="private">
Shows indication that the graphic is in focus
abstract virtual method showFocusEffect();
<@doc scope="private">
Hides indication that the graphic is in focus
abstract virtual method hideFocusEffect();
<@doc scope="private">
Flies the graphic into view
abstract virtual method flyIntoView()
//METHODS
//
<@doc scope="private">
Parses the shape's parts definitions and prepares the required data structures and dynamic formulas
virtual method parseParts(aspectClass, baseClass, frameParts)
var baseName=baseClass.fullname, alldefs=aspectClass.allShapeDefs;
if (alldefs && alldefs[baseName]) return alldefs[baseName];
if (!alldefs) alldefs = aspectClass.allShapeDefs = {};
// prepare data structures
var shapeParts = [];
var formulas = {};
var wireParts = [];
var wireFormula = null;
var PA = aspectClass.properties; // table of aspect class properties
var PB = baseClass.properties; // table of base class properties
// parse frame parts
var fparts = frameParts || baseClass.prototype.@frameParts;
for (var i=0, len=(fparts && fparts.length || 0); i