@interface name="KitTabs" alias="$ENV">
Extension point for defining kit design tabs
(c) SAP AG 2003-2006. All rights reserved.
+
# For complete description of Tab
definition see @env:KitTabs!TAB_DEF
?
*
# Represents a property of the Tab
You can assign the 'type' attribute for
evaluating the value of the property
as a function
Example
core.svg:GmlDrawing
Drawing Tab
SVG
#URL[core.svg:boards.DrawingBoard.htm]
function defineTab(def) {
if (!def) return null;
if (typeof def != 'object' || !def.id) return raiseKitError('Invalid Tab 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 _kitTabs) return raiseKitError('Tab "'+id+'" is already defined');
_kitTabs[id] = def;
return def;
}
<@method name="getTab">
Returns a specified Tab definition
Tab Id
The requested Tab definition
function getTab(id) {
return _kitTabs[UPPER(id)] || null;
}
<@method name="getTabsTable">
Returns the complete Tabs definitions table
Table of Tabs definitions, indexed by id
Tab id's are stored in uppercase. Use @lib:Basic!UPPER macro to convert the Tab name to uppercase
before using it as the index in this table.
function getTabsTable() {
return _kitTabs;
}
<@method name="removeTab">
Removes a specified Tab definition
The id of the Tab to remove
function removeTab(id) {
var Tab = getTab(id);
if (Tab) delete _kitTabs[UPPER(Tab.id)];
}
<@method name="parseTab" scope="private">
Parses the given Tab node and returns a string which represents its details
Tab node to parse
function parseTab(TabNode) {
var map = getNodeProps(TabNode);
var res = "$ENV.defineTab(" + __xmlMap2Str(map) + ");";
return res;
}
<@method name="getSelectedTabs">
Returns the Tab definitions that belong to a given category, sorted by priority
The requested editors category
Array of selected Tab definitions
function getSelectedTabs(category) {
var E=[], cat=UPPER(category);
for (var k in _kitTabs) {
var edt=_kitTabs[k];
if (UPPER(edt.category) == cat) E.push(edt)
}
SORT(E, 'priority');
return E;
}
<@struct name="TAB_DEF">
Represents a %STUDIO% Tab definition
The TAB_DEF structure is made of:
Name | Type | Description
id | QName | Unique Tab Id - must be prefixed with namespace e.g. com.sap.mypackage:uniqId
aspect | QName | Associated aspect role
name | String | Tab name
type | @TAB_TYPE | Tab implementation type
impl | String | Tab implementation url
tag | String | Tab implementation tag name (for HTC Tabs)
visible | Function | Tab's dynamic visibility state. Can be ~true, ~false or a function: flag = visible(definition)
Where ~definition is this Tab's definition. If the function returns ~true the Tab will be visible; otherwise, it will be hidden. If this parameter is omitted, the Tab will be visible by default.
priority | Number | Tab's priority
category | String | Tab category
<@enum name="TAB_TYPE">
An enumeration of the possible Tab implementation types
Name | Description
SVG | A graphical Tab implemented using SVG (e.g., design Tab)
HTM | A visual Tab implemented using HTML (e.g., layout Tab, simulator Tab)
HTC | A visual Tab implemented using HTC component
CODE | A non-visual Tab implemented in code (e.g., code generator, model validator, usability analyzer, etc.)