@interface name="KitBoards" alias="$ENV">
Extension point for defining kit design boards
(c) SAP AG 2003-2006. All rights reserved.
+
# For complete description of board
definition see @env:KitBoards!BOARD_DEF
?
*
# Represents a property of the board
You can assign the 'type' attribute for
evaluating the value of the property
as a function
Example
core.svg:GmlDrawing
Drawing Board
SVG
#URL[core.svg:boards.DrawingBoard.htm]
function defineBoard(def) {
if (!def) return null;
if (typeof def != 'object' || !def.id) return raiseKitError('Invalid board definition near %where%', STR(def));
if (!isValidId(def.id)) return raiseKitError('Invalid namespace specification of Id:'+ def.id + " in kit :" + _currentPackage);
var id = UPPER(def.id);
if (id in _kitBoards) return raiseKitError('Board "'+id+'" is already defined');
if (def.priority === undefined) def.priority = 9999;
_kitBoards[id] = def;
if(def.aspect)
_aspectIndex[def.aspect] = id;
if ((def.isDefault == true) || (_defaultBoardId == null)) _defaultBoardId = id;
return def;
}
function setDefaultBoard(def) {
if (!def) return null;
if (typeof def != 'object' || !def.id) return raiseKitError('Invalid board definition near %where%', STR(def));
if (!isValidId(def.id)) return raiseKitError('Invalid namespace specification of Id:'+ def.id + " in kit :" + _currentPackage);
var id = UPPER(def.id);
_defaultBoardId = id;
}
<@method name="getBoard">
Returns a specified board definition
Board Id
The requested board definition
function getBoard(id) {
return _kitBoards[UPPER(id)] || null;
}
function getBoardId(aspect) {
return _aspectIndex[aspect] || null;
}
<@method name="getDefaultBoard">
Returns a defintion of the default board
The requested board definition, or ~null if there are no boards
function getDefaultBoard() {
return _kitBoards[_defaultBoardId] || null;
}
<@method name="getBoardsTable">
Returns the complete boards definitions table
Table of boards definitions, indexed by id
Board id's are stored in uppercase. Use @lib:Basic!UPPER macro to convert the board name to uppercase
before using it as the index in this table.
function getBoardsTable() {
return _kitBoards;
}
<@method name="removeBoard">
Removes a specified board definition
The id of the board to remove
function removeBoard(id) {
var board = getBoard(id); if (!board) return;
var bid = UPPER(board.id);
if(_kitBoards[bid].aspect) delete _aspectIndex[_kitBoards[bid].aspect];
delete _kitBoards[bid];
if (bid == _defaultBoardId) {
_defaultBoardId = null;
for (var iter in _kitBoards) {
_defaultBoardId = _kitBoards[iter].id;
break;
}
}
}
<@method name="parseBoard" scope="private">
Parses the given board node and returns a string which represents its details
Board node to parse
function parseBoard(boardNode) {
var map = getNodeProps(boardNode);
var res = "$ENV.defineBoard(" + __xmlMap2Str(map) + ");";
return res;
}
<@method name="removeAllBoards">
Removes all boards
function removeAllBoards() {
_kitBoards = {};
_aspectIndex = {};
_defaultBoardId = null;
}
<@struct name="BOARD_DEF">
Represents a %STUDIO% board definition
The BOARD_DEF structure is made of:
Name | Type | Description
id | QName | Unique board Id - must be prefixed with namespace e.g. com.sap.mypackage:uniqId
aspect | QName | Associated aspect role
name | String | Board name
type | @BOARD_TYPE | Board implementation type
impl | String | Board implementation url
tag | String | Board implementation tag name (for HTC boards)
priority | Number | Board's priority
isDefault | Boolean | ~true if this board should be default board (if specified, replaces previous default)
visible | Function | Board's dynamic visibility state. Can be ~true, ~false or a function: flag = visible(definition)
Where ~definition is this board's definition. If the function returns ~true the board will be visible; otherwise, it will be hidden. If this parameter is omitted, the board will be visible by default.
<@enum name="BOARD_TYPE">
An enumeration of the possible board implementation types
Name | Description
SVG | A graphical board implemented using SVG (e.g., design board)
HTM | A visual board implemented using HTML (e.g., layout board, simulator board)
HTC | A visual board implemented using HTC component
CODE | A non-visual board implemented in code (e.g., code generator, model validator, usability analyzer, etc.)