@interface name="KitSkins" alias="$ENV">
Extension point for defining kit skins
(c) SAP AG 2003-2006. All rights reserved.
+
# For complete description of skin
definition see @env:KitSkins!SKIN_DEF
?
*
# Represents a property of the skin
You can assign the 'type' attribute for
evaluating the value of the property
as a function
function defineSkin(def) {
if (!def) return null;
if (typeof def != 'object' || !def.id) return raiseKitError('Invalid skin definition near %where%', STR(def));
var id=UPPER(def.id);
if (!isValidId(def.id)) return raiseKitError('Invalid namespace specification of Id:'+ def.id + " in kit :" + _currentPackage);
if (id in _kitSkins) return raiseKitError('Skin "'+id+'" is already defined');
_kitSkins[id] = def;
return def;
}
<@method name="getSkin">
Returns a specified skin object
Skin Id
The requested skin object
function getSkin(id) {
return _kitSkins[UPPER(id)] || null;
}
<@method name="getCurrentSkin">
Gets the current skin object
The current skin object
function getCurrentSkin() {
var id = UPPER(GETVAR('CurrentSkin'));
if (id in _kitSkins) return getSkin(id);
if ('standard' in _kitSkins) return getSkin('standard');
for (k in _kitSkins) return _kitSkins[k];
return null;
}
<@method name="setCurrentSkin">
Sets the current skin object
The skin Id to set as current
function setCurrentSkin(id) {
id = UPPER(id);
if (!getSkin(id)) return;
SETVAR('CurrentSkin', id);
}
<@method name="getSkinsTable">
Returns the complete skins table
Table of skin objects, indexed by skin id
Skin id's are stored in uppercase. Use @lib:Basic!UPPER macro to convert the skin id to uppercase
before using it as the index in this table.
function getSkinsTable() {
return _kitSkins;
}
<@method name="removeSkin">
Removes a specified skin definition
The id of the skin to remove
function removeSkin(id) {
delete _kitSkins[UPPER(id)];
}
<@method name="parseSkin" scope="private">
Parses the given skin node and returns a string which represents its details
Command node to parse
function parseSkin(skinNode) {
var map = getNodeProps(skinNode);
var res = "$ENV.defineSkin(" + __xmlMap2Str(map) + ");";
return res;
}
<@struct name="SKIN_DEF">
Represents a %STUDIO% skin definition
The SKIN_DEF structure is made of:
Name | Type | Description
id | QName | Skin Id - must be prefixed with namespace e.g. com.sap.mypackage:id
base | String | Base path, containing common skin resources
path | String | Skin path, containing skin-specific resources
icon | String | Skin icon