;(function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['rave'], factory);
} else if (typeof exports === 'object') {
module.exports = factory(require('rave'));
} else {
root.raveLibrary = factory(root.rave);
}
}(this, function(rave) {
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
The loader gets the contents of the JSON configuration files and saves them in the config. We then add a call back to the loader so once it's done loading the resources we can setup the palettes and defualt id to use
*/ var com_ibm_rave_library_palette_internal_PaletteManager = rave['internal']['Declare']({ //obj : null, //paletteConfig : null, getPaletteManagerData : function() { var paletteManagerData = rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().getData("PALETTE_MANAGER_DATA_KEY"); if (!paletteManagerData) { paletteManagerData = new com_ibm_rave_library_palette_internal_PaletteManager.PaletteManagerData(); rave['internal']['RaveContextManager'].INSTANCE.getRaveContext().putData("PALETTE_MANAGER_DATA_KEY", paletteManagerData); this.populate(this.obj); } return paletteManagerData; }, constructor : function() { this.obj = require("./configuration/configuration.json"); }, /** * Populate the palette manager from a JSON configuration object. This object must contain a "paletteConfiguration" property that contains a "palettes" property containing an array of palette information. * @param (Object) config JSON configuration containing palette information. */ populate : function(config) { if (config) { this.paletteConfig = config["paletteConfiguration"]; if (this.paletteConfig) { this.getPaletteManagerData().palettes.populate(this.paletteConfig["palettes"]); var defaultPaletteId = this.paletteConfig["defaultPaletteID"]; if (defaultPaletteId != null) { this.getPaletteManagerData().defaultPalette = ""+(defaultPaletteId); } } } }, /** * Set the default palette * @param (String) paletteId The default palette id */ setDefaultPalette : function(paletteId) { this.getPaletteManagerData().defaultPalette = paletteId; }, /** * get the default id * @return (String) the default palette id */ getDefaultId : function() { return this.getPaletteManagerData().defaultPalette; }, /** * get the default palette object * @return (com.ibm.rave.library.palette.Palette) the default palette object */ getDefaultPalette : function() { var paletteManagerData = this.getPaletteManagerData(); return paletteManagerData.palettes.get(paletteManagerData.defaultPalette); }, /** * get the default with the given id * @return (com.ibm.rave.library.palette.Palette) the default palette object with the given id */ getPalette : function(paletteId) { return this.getPaletteManagerData().palettes.get(paletteId); }, /** * Creates a palette with colors adjusted by the adjustment amount This is useful when a slightly darker or lighter color is needed for a border or stroke * @param (String) paletteId Palette to start with * @param (double) adjustment Percentage to adjust the color, negative is darker, positive is lighter * @return (com.ibm.rave.library.palette.Palette) adjusted palette */ getAdjustedColorPalette : function(paletteId, adjustment) { var originalPalette = this.getPaletteManagerData().palettes.getPaletteJSON(paletteId); var adjustedPaletteId = originalPalette["id"] + "_" + adjustment; var adjustedPalette = this.getPaletteManagerData().palettes.get(adjustedPaletteId); if (!adjustedPalette) { var adjustedPaletteClone = {}; adjustedPaletteClone["id"] = adjustedPaletteId; adjustedPaletteClone["valueType"] = originalPalette["valueType"]; var fillType = originalPalette["fillType"]; adjustedPaletteClone["fillType"] = fillType; var simpleFill = fillType.localeCompare("simple") == 0 ? true : false; var originalFills = originalPalette["fills"]; var newFills = []; adjustedPaletteClone["fills"] = newFills; for (var i = 0; i < originalFills.length; ++i) { if (simpleFill) { var fill = originalFills[i]; if (adjustment < 0) { fill = rave.rgb(fill).darker(adjustment * -1).toString(); } else { fill = rave.rgb(fill).brighter(adjustment).toString(); } newFills.push(fill); } else { var oFill = originalFills[i]; var fill = oFill["fill"]; if (adjustment < 0) { fill = rave.rgb(fill).darker(adjustment * -1).toString(); } else { fill = rave.rgb(fill).brighter(adjustment).toString(); } var newFill = {}; newFill["at"] = (oFill["at"]); newFill["fill"] = fill; newFills.push(newFill); } } this.getPaletteManagerData().palettes.add(adjustedPaletteClone); adjustedPalette = this.getPaletteManagerData().palettes.get(adjustedPaletteId); } return adjustedPalette; }, /** * add a new palette to the palette manager * @param (Object) palette the json representation of the palette */ addPalette : function(palette) { this.getPaletteManagerData().palettes.add(palette); }, /** * remove a new palette from the palette manager * @param (String) paletteId the id of the palette * @param (com.ibm.rave.library.service.LibraryError) error the library error */ removePalette : function(paletteId, error) { this.getPaletteManagerData().palettes.remove(paletteId, error); }, /** * add an array of new palette to the palette manager * @param (Array) palettes the json representation of an array of palettes */ addPalettes : function(palettes) { var paletteSet = this.getPaletteManagerData().palettes; for (var __i_enFor0 = 0, __exp_enFor0 = palettes, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var palette = __exp_enFor0[__i_enFor0]; paletteSet.add(palette); } }, /** * get every palette in the palette manager * @return (Array) an array of palettes */ getAllPalettes : function() { return this.getPaletteManagerData().palettes.getAll(); }, /** * get every palette id in the palette manager * @return (Array) an array of palettes ids */ getAllPaletteIds : function() { return this.getPaletteManagerData().palettes.getAllIds(); }, /** * Get the JSON definition of a palette as JSON */ getJSONPalette : function(id) { return this.getPaletteManagerData().palettes.getPaletteJSON(id); } }); com_ibm_rave_library_palette_internal_PaletteManager.PaletteManagerData = rave['internal']['Declare']({ /** * PaletteSet to hold the library level palettes */ //palettes : null, /** * The default palette id */ //defaultPalette : null, constructor : function() { this.palettes = new com_ibm_rave_library_palette_internal_PaletteSet(); } }); //com_ibm_rave_library_palette_internal_PaletteManager.PALETTE_MANAGER_DATA_KEY = "PALETTE_MANAGER_DATA_KEY"; // $source: com/ibm/rave/library/palette/internal/PaletteSet /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isJSONObject //@import com/ibm/rave/library/Library (runtime) // logError //@import com/ibm/rave/library/palette/internal/CategoricalPalette (runtime) // new //@import com/ibm/rave/library/palette/internal/ContinuousPalette (runtime) // new //@import com/ibm/rave/library/palette/internal/ConditionalPalette (runtime) // new /** *This class allows for the creation of an set of palettes, and allows a new Palette to be added and an existing Palette to be retrieved by providing its id.
Each {@link (com.ibm.rave.library.palette.Palette) Palette} is created from a JSONObject in the JSONArray passed in as an argument to the constructor. Also passed in is a {@link (com.ibm.rave.library.service.LibraryError) LibraryError} object which will record the specifics of any error that occurs. Any error triggers the end of the creation of the palettes in the constructor.
The ids of the palettes are mapped to the palettes themselves so that palettes can be retrieved using {@link #this.get(String this.id)} with their matching id.
*/ var com_ibm_rave_library_palette_internal_PaletteSet = rave['internal']['Declare']({ //palettes : null, /** * Create an empty Palette set. See {@link #this.populate(Array)} to populate the set with palettes. */ constructor : function() { this.palettes = {}; }, /** * Creates the palettes based upon the contents of the palettes array. If an error occurs, the creation of the palettes will stop immediately and the cause of the error will be stored in the error object. * @param (Array) palettes A JSONArray of palettes as JSONObjects */ populate : function(palettes) { if (!palettes) { return; } for (var i = 0; i < palettes.length; ++i) { var obj = palettes[i]; if (com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj)) { var jsonPalette = obj; var passed = this.add(jsonPalette); if (!passed) { return; } } } }, /** * Adds a new Palette, or if one of that id already exists, replaces it. If there is no id, we set the error. * @param (Object) palette The new Palette * @return (boolean) The new Palette */ add : function(palette) { var id = ""+(palette["id"]); if (id != null && id.length > 0) { this.palettes[id] = palette; return true; } com_ibm_rave_library_Library.logError(5); return false; }, /** * Remove a Palette. If there is no id, we set the error. * @param (String) paletteId The Palette to remove * @param (com.ibm.rave.library.service.LibraryError) error indicates if an error occurs, and what the error was */ remove : function(paletteId, error) { if (paletteId != null && paletteId.length > 0) { delete this.palettes[paletteId]; } else { com_ibm_rave_library_Library.logError(5, "PaletteSet remove"); } }, /** * Return the JSON representation of a palette * @param (String) paletteId * @return (Object) palette */ getPaletteJSON : function(paletteId) { return this.palettes[paletteId]; }, /** * This method returns the Palette with the corresponding id. * @param (String) id The id to match * @return (com.ibm.rave.library.palette.Palette) the Palette with the matching id */ get : function(id) { var palette; if (id != null) { var jsonPalette = this.palettes[id]; if (jsonPalette) { if ("simple" == jsonPalette["fillType"]) { palette = new com_ibm_rave_library_palette_internal_CategoricalPalette(jsonPalette); } else if ("continuous" == jsonPalette["fillType"] || "discrete" == jsonPalette["fillType"]) { palette = new com_ibm_rave_library_palette_internal_ContinuousPalette(jsonPalette); } else if ("conditional" == jsonPalette["fillType"]) { palette = new com_ibm_rave_library_palette_internal_ConditionalPalette(jsonPalette); } } } return palette; }, /** * Retrieve all palettes as an array. Note, this constructs a new array containing the palettes in this set. * @return (Array) All palettes */ getAll : function() { var paletteArray = []; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.palettes), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; paletteArray.push(this.get(key)); } return paletteArray; }, /** * Retrieve all palette Ids as an array. Note, this constructs a new array containing the palette Ids in this set. * @return (Array) All palettes Ids */ getAllIds : function() { var paletteIds = []; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.palettes), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; paletteIds.push(key); } return paletteIds; } }); // $source: com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2015 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ var com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils = (function() { //constructor : function() {} }); /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.parse = function(jString) { var json = null; try { json = JSON.parse(jString); } catch (e) { com_ibm_rave_library_Library.logError(com_ibm_rave_library_LibraryError.PROPERTY_JSON_PARSE_ERROR, "PropertyNativeUtils parse"); } return json; }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject = function(obj) { return (obj != null && obj instanceof Object && !com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray(obj)); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray = function(obj) { return (obj instanceof Array); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isNumber = function(object) { return (typeof object == 'number' || object instanceof Number); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString = function(object) { return (typeof object == 'string' || object instanceof String); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isBoolean = function(object) { return (typeof object == 'boolean' || object instanceof Boolean); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.stringMatchesRexExp = function(str, regexp) { var re = new RegExp(regexp); var match = re.exec(str); if (match[0] == str) { return true; } return false; }; // $source: com/ibm/rave/library/palette/Palette /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/framework/internal/ScaleManager (runtime) // ordinalDomain //@import com/ibm/rave/library/framework/internal/OrdinalCoordinateScaleDatum (runtime) // new /** * A palette class the palette will hold colors to be used by the bundles */ var com_ibm_rave_library_palette_Palette = rave_library_externs["Palette"] = rave['internal']['Declare']({ /** * The palette id */ //_id : null, /** * The palette label */ //_label : null, /** * The palette description */ //_description : null, /** * The palette icon */ //_icon : null, /** * null value color */ /** @expose */ nullColor : null, /** * The accessor function to get the data for the palette */ /** @expose */ dataAccessor : null, /** * The palette type */ /** @expose */ type : null, /** * TODO: */ //_originalDomain : null, //_originalDomainLabelAccessor : null, /** * the validity of the domain */ _domainValidity : 0, /** * Palette constructor which takes a json representation of the palette * @param (Object) jsonPalette the json representation of the palette */ /** @expose */ constructor : function(jsonPalette) { this._id = (jsonPalette["id"]); this._label = (jsonPalette["label"]); this._description = (jsonPalette["description"]); this._icon = (jsonPalette["icon"]); this.nullColor = null; this._domainValidity = com_ibm_rave_library_palette_Palette.VALID_DOMAIN; this.dataAccessor = function(data) { return data; }; }, /** * Get the palettes id * @return (String) the id */ /** @expose */ getId : function() { return this._id; }, /** * Get the palettes label * @return (String) the label */ /** @expose */ getLabel : function() { return this._label; }, /** * Get the palettes description * @return (String) the description */ /** @expose */ getDescription : function() { return this._description; }, /** * Get the palettes icon * @return (String) the icon */ /** @expose */ getIcon : function() { return this._icon; }, /** * Get the palettes type * @return (String) the type */ /** @expose */ getType : function() { return this.type; }, /** * @return (int) the _domainValidity */ /** @expose */ getDomainValidity : function() { return this._domainValidity; }, /** * Set the data accessor function * @param (rave['internal']['SingleValueFunction']) singleValueFunction value function */ /** @expose */ setAccessor : function(singleValueFunction) { this.dataAccessor = singleValueFunction; }, /** * set the data for the palette with the included domain * @param (Array) domain the data domain * @param (com.ibm.rave.library.datamodel.DataSet) dataSet the data set to be used in the palette's domain * @param (String) slot the data slot in the data set */ setData$0 : function(domain, dataSet, slot) { var dataSlot = dataSet.slot(slot); this.setDomain(domain, dataSlot ? dataSlot.entry() : null, null, null); }, /** * set the data for the palette from the data set * @param (com.ibm.rave.library.datamodel.DataSet) dataSet the data set to be used in the palette's domain * @param (String) slot the data slot in the data set */ setData$1 : function(dataSet, slot) { var dataSlot = dataSet.slot(slot); var colorAccessor = dataSlot ? dataSlot.entry() : null; var data = dataSet.data(); var originalDomain; var originalDomainLabelAccessor; var domain; if (colorAccessor) { if ("numeric" == colorAccessor.type$0()) { domain = com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, colorAccessor, true); } else { domain = com_ibm_rave_library_framework_internal_ScaleManager.ordinalDomain$0(data, colorAccessor, false); } if (domain) { var originalDomainMap = rave['internal']['ES6Map'].create(); for (var __i_enFor0 = 0, __exp_enFor0 = domain, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; originalDomainMap.set(key, new com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum(key)); } for (var __i_enFor1 = 0, __exp_enFor1 = data, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var o = __exp_enFor1[__i_enFor1]; var key = colorAccessor(o); var datum = originalDomainMap.get(key); if (datum) { datum.push(o); } } originalDomain = []; for (var __i_enFor2 = 0, __exp_enFor2 = domain, __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var d = __exp_enFor2[__i_enFor2]; originalDomain.push(originalDomainMap.get(d)); } originalDomainLabelAccessor = function(data, index, groupIndex) { var key = (data).key(); return ""+(key); }; } } this.setDomain(domain, colorAccessor, originalDomain, originalDomainLabelAccessor); }, /** * validate the domain and set it accordingly * @param (Array) domain the data domain * @param label the label for the data if no valid domain is used * @param (com.ibm.rave.library.datamodel.DataSlotEntry) colorAccessor the accessor for the color slot */ setDomain : function(domain, colorAccessor, originalDomain, originalDomainLabelAccessor) { if (!domain) { this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL; this.invalidateDomain(); } else if (domain.length <= 0) { this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_EMPTY; this.invalidateDomain(); } else if (!(this.canHandleDataType(colorAccessor ? colorAccessor.type$0() : null))) { this._domainValidity = com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_DATATYPE; this.invalidateDomain(); } else { this._domainValidity = com_ibm_rave_library_palette_Palette.VALID_DOMAIN; this.domain(domain); this._originalDomain = originalDomain; this._originalDomainLabelAccessor = originalDomainLabelAccessor; } }, /** * set the palettes null value color * @param (String) color the null color */ /** @expose */ setNullColor : function(color) { this.nullColor = color; }, /** * Adds a single color into the palette * @param (Object) color a json object representing a color */ /** @expose */ addColor : function(color) {}, /** * Adds an array of colors into the palette * @param (Array) colors a json object representing a color */ /** @expose */ addAllColors : function(colors) {}, /** * removed a single color from the palette * @param (Object) color a json object representing a color to remove */ /** @expose */ removeColor : function(color) {}, /** * set the domain of the palette * @param (Array) domain the domain to be set on the palette */ /** @expose */ domain : function(domain) {}, /** * Set domain to be invalid */ /** @expose */ invalidateDomain : function() {}, /** * get the scale for the palette * @return (rave['internal']['AbstractScale']) the scale */ /** @expose */ getScale : function() {}, /** * Can the palette handle the data type * @return (boolean) whether the palette can handle the data type */ /** @expose */ canHandleDataType : function(type) {}, /** * TODO: */ /** @expose */ originalDomain : function() { return this._originalDomain; }, /** * TODO: Copied from OrdinalCoordinateScale Set a label accessor function to be used with an "original domain" (See {@link #this.originalDomain()} ). The provided format function should return a String when provided with an original data value. */ originalDomainLabelAccessor$0 : function(format) { this._originalDomainLabelAccessor = format; }, /** * TODO: Copied from OrdinalCoordinateScale Retrieve the label accessor function. May be null if no accessor was supplied through {@link #this.originalDomainLabelAccessor(rave['internal']['ValueFunction'])} . */ originalDomainLabelAccessor$1 : function() { return this._originalDomainLabelAccessor; }, /** @expose */ setData : function(a0, a1, a2) { var args = arguments; if (args.length == 2) { return this.setData$1(a0, a1); } return this.setData$0(a0, a1, a2); }, /** @expose */ originalDomainLabelAccessor : function(a0) { var args = arguments; if (args.length == 0) { return this.originalDomainLabelAccessor$1(); } return this.originalDomainLabelAccessor$0(a0); } }); /** * numeric data type */ //com_ibm_rave_library_palette_Palette.DATATYPE_NUMERIC = "numeric"; /** * string data type */ //com_ibm_rave_library_palette_Palette.DATATYPE_STRING = "string"; /** * valid domain */ /** @expose */ com_ibm_rave_library_palette_Palette.VALID_DOMAIN = 0; /** * the reason for the invalid domain is the datatype */ /** @expose */ com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_DATATYPE = 1; /** * the reason for the invalid domain is its empty */ /** @expose */ com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_EMPTY = 2; /** * the reason for the invalid domain is it is null. Null domain means color slot isn't defined in data. Empty domain means color slot is defined, but returns null in all cases. */ /** @expose */ com_ibm_rave_library_palette_Palette.INVALID_DOMAIN_NULL = 3; // $source: com/ibm/rave/library/framework/internal/CoordinateScaleImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2018 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** *A CoordinateScaleImpl simplifies using scales for coordinates where the data values may be ordinal or non-ordinal. It wraps a RAVE core scale and delegates to that scale. Instances are obtained from the factory methods.
The scale is not an AbstractScale. The {@link #this.scale()} method gives access to the internal scale, so that it can be used with axes and related core code. This scale should not be directly modified, although it is safe to use it in pan-zoom.
Conceptually each input value is scaled to a band of output pixel coordinates using the {@link #this.range(, , Number, Number)} . All bands are the same width. The coordinate methods {@link #this.center(Object)} , {@link #this.lower(Object)} , and {@link #this.upper(Object)} give the center and two endpoints of these bands, and {@link #this.width()} gives the band width. For continuous scales the width is by default 0, and the coordinate methods all return the center; however the width can be changed by the bundle, for example by setting the column width.
For example, a point component can use either ordinal or non-ordinal scales on the two axes. The point component is passed the two CoordinateScales wrapping those scales, and uses {@link #this.center(Object)} to get the coordinate of the center of the point element. An interval element would similarly use the {@link #this.lower(Object)} and {@link #this.upper(Object)} for the span of the interval.
Methods are also provided to modify the input domain by including zero or by expanding the domain by a percentage or by pixels. These methods only modify continuous scales.
*/ var com_ibm_rave_library_framework_internal_CoordinateScaleImpl = rave['internal']['Declare']({ /** * Returns the internal scale used by the coordinate scale; for clustered scales this is the first scale. This may be used for axes and pan-zoom. Changing the domain or range of this scale may have unexpected effects. * @return (rave['internal']['AbstractScale']) The scale passed to the factory method */ /** @expose */ scale : function() {}, /** * Base class returns false. * @return (boolean) Whether the scale is continuous (linear or time) */ isContinuous : function() { return false; }, /** * Base class returns false. * @return (boolean) Whether the scale is the ordinal subclass */ /** @expose */ isOrdinal : function() { return false; }, /** * Base class returns false. * @return (boolean) Whether the scale is the linear subclass */ /** @expose */ isLinear : function() { return false; }, /** * Base class returns false. * @return (boolean) Whether the scale is the time subclass */ /** @expose */ isTime : function() { return false; }, /** * Base class returns false. * @return (boolean) Whether the scale is the clustered subclass */ /** @expose */ isClustered : function() { return false; }, /** *Expands the domain of a non-ordinal scale by the given fraction at both ends. For example if the domain is [0,10] and the fraction is 0.10, the domain becomes [-1,11]. If the domain has more than two values, only the end values are changed. Ordinal and clustered scales are not changed.
If keepZero is true, any endpoint with value zero will not be changed. In the above example with domain [0,10], if keepZero is true the domain becomes [0,11].
The base class implementation does nothing.
* @param (double) fraction Fraction of the current domain by which to expand the domain * @param (boolean) keepZero If true, a zero value is not modified by the expansion * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ expandFraction : function(fraction, keepZero) { return this; }, /** *Expands the domain of a non-ordinal scale at both ends so that the original endpoints of the domain are the given number of pixels from the ends of the range. The range of the scale must be set before calling this method. For example if the original domain was [0,10] with range [0,500] and pixels is 50, the domain becomes [-1.25,11.25] (since that now maps 0 to 50 and 10 to 450).
If keepZero is true, any endpoint with value zero will not be changed. In the above example with domain [0,10], if keepZero is true the domain becomes [0,11.111]; domain 0.0 still maps to range 0.0, and domain 10.0 now maps to range 450.
The domain is not changed if pixels is non-positive, or if the range is too small to allow the expansion. Ordinal and clustered scales are not changed.
The base class implementation does nothing.
* @param (double) pixels Number of pixels on the ends of the domain * @param (boolean) keepZero If true and an endpoint is zero, the endpoint is not changed * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ expandPixels : function(pixels, keepZero) { return this; }, /** *Expands the domain of a non-ordinal scale to include zero. If the domain has more than two values, only the end values are changed. The domain is not changed if it already includes zero. Ordinal and clustered scales are not changed.
The base class implementation does nothing.
* @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ includeZero : function() { return this; }, /** *If the domain is continuous and has zero extent (e.g. [X,X]), expands the extent so the domain is valid for use with an axis. The new domain contains X.
If keepZero is true and the domain is [0,0] (only possible with numbers), the domain becomes [0,1]; this is mostly for charts that have included zero, where the expectation is that 0 will remain at one end of the domain.
The base class implementation does nothing.
* @param (boolean) keepZero * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) this */ expandZeroExtent : function(keepZero) { return this; }, /** *Extends the domain so that it starts and ends on nice round values of multiple of 10 ^ tickMagnitude. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value considering the tick magnitude.
The base class implementation does nothing.
* @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ nice$0 : function(tickMagnitude) { return this; }, /** *Extends the domain so that it starts and ends on nice round values. This method typically modifies the scale's domain, and may only extend the bounds to the nearest round value.
The base class implementation does nothing.
* @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ nice$1 : function() { return this; }, /** *Get the center value for the data. If the internal scale is ordinal or clustered, this is the center of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null.
* @param (Object) data Value to be scaled * @return (Number) Coordinate for the center of that value */ /** @expose */ center : function(data) {}, /** *Get the lower value for the data. If the internal scale is ordinal or clustered, this is the start of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null. This value is always less than or equal to the center value, even if the scale is configured with a reverse pixel range.
* @param (Object) data Value to be scaled * @return (Number) Coordinate for the lower end of that value */ /** @expose */ lower : function(data) {}, /** *Get the upper value for the data. If the internal scale is ordinal or clustered, this is the end of the range band for the data. Otherwise it is the value of the scale for the data. The method can return null. This value is always greater than or equal to the center value, even if the scale is configured with a reverse pixel range.
* @param (Object) data Value to be scaled * @return (Number) Coordinate for the lower end of that value */ /** @expose */ upper : function(data) {}, /** *Get the width in pixels of the band for the data. As the core scales are not configured with variable widths (yet), this is the same for all data values. It is the difference of the {@link #this.upper(Object)} and {@link #this.lower(Object)} values, with the {@link #this.center(Object)} halfway between.
For ordinal scales, this is the width allocated to each value by the core scale range bands. For continuous scales it is the width set by {@link #this.setWidth()} .
*/ /** @expose */ width : function() {}, /** *Set the width in pixels of the band for the data. This is the difference of the {@link #this.upper(Object)} and {@link #this.lower(Object)} values, with the {@link #this.center(Object)} halfway between.
For ordinal scales this does nothing unless {@link #this.applyWidth()} is called with true, since the band widths are fixed by default by the range bands of the core scales. Ordinal scales will also revert to default behavior if the value passed in here is 0 or less.
For continuous scales, if the argument width is negative the scale's width is not changed.
The base class implementation does nothing.
* @param (double) w The width */ setWidth : function(w) {}, /** *Allow the width set in {@link #this.setWidth()} to affect even ordinal scales. If this is false, or it is never called, ordinal scales will not be affected by the width, which is their default behavior.
This affects only ordinal scales, and does nothing for continuous scales.
The base class implementation does nothing.
* @param (boolean) apply */ applyWidth : function(apply) {}, /** * Retrieve the list of client data that this scale's domain is based upon. Will return null if the scale is not Ordinal or Clustered, or was not constructed from external client data. */ originalDomain : function() { return null; }, /** * Set a label accessor function to be used with an "original domain" (See {@link #this.originalDomain()} ). The provided format function should return a String when provided with an original data value. Note this only effects Ordinal and Clustered Coordinate scales. Numeric scales do not support original data domains. */ originalDomainLabelAccessor$0 : function(format) {}, /** * Retrieve the label accessor function. May be null if no accessor was supplied through {@link #this.originalDomainLabelAccessor(rave['internal']['ValueFunction'])} . Note this only effects Ordinal and Clustered Coordinate scales. Numeric scales do not support original data domains. */ originalDomainLabelAccessor$1 : function() { return null; }, nice : function(a0) { var args = arguments; if (args.length == 0) { return this.nice$1(); } return this.nice$0(a0); }, originalDomainLabelAccessor : function(a0) { var args = arguments; if (args.length == 0) { return this.originalDomainLabelAccessor$1(); } return this.originalDomainLabelAccessor$0(a0); } /** * Set the coordinate range of the scale to the given interval [v1,v2] with padding arguments as used with a core ordinal scale. If the internal scale is non-ordinal these arguments are ignored. * @param (double) v1 First end of range * @param (double) v2 Second end of range * @param (Number) padding Padding, see OrdinalScale documentation * @param (Number) outerPadding Outer padding, see OrdinalScale documentation * @return (com.ibm.rave.library.framework.internal.CoordinateScaleImpl) This scale */ //range : function(v1, v2, padding, outerPadding) {} }); /** * Determines if rangeRoundBands should be used in favor or rangeBands for ordinal coordinate scales (i.e. OrdinalCoordinateScale, ClusteredCoordinateScale). * @param (double) v1 Interval starting value. Note, this need not be the "minimum" value. * @param (double) v2 Interval ending value. Note, this need not be the "maximum" value. * @param (int) domainSize The number of data values to be represented in the provided interval range (e.g. the length of an ordinal scale's domain array). * @param (Number) padding Padding percentage. See OrdinalScale#rangeBands for more detail. * @param (Number) outerPadding Outer padding percentage. See OrdinalScale#rangeBands for more detail. * @return (boolean) True if range rounding should be used. False otherwise. */ com_ibm_rave_library_framework_internal_CoordinateScaleImpl.useRounding = function(v1, v2, domainSize, padding, outerPadding) { var pad = padding != null ? padding : 0.0; var oPad = outerPadding != null ? outerPadding : 0.0; return (Math.abs(v2 - v1) / (domainSize - pad + 2 * oPad)) >= 10.0; }; com_ibm_rave_library_framework_internal_CoordinateScaleImpl.ROUND_TOLERANCE = 10; // $source: com/ibm/rave/library/framework/internal/OrdinalCoordinateScaleDatum /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** * A data object to be attached to ordinal axis ticks. Example usage:bundleInstance .node("#bundleNode") .render(); rave.select("#bundleNode") .selectAll(".axis.bottom .tick") .on("click", function(d) { console.log(d.originalData()); });The resulting output is an array containing all data values associated with the category of the "clicked" axis tick. */ var com_ibm_rave_library_framework_internal_OrdinalCoordinateScaleDatum = rave['internal']['Declare']({ //_key : null, //_values : null, /** * Construct a new datum for the given key value. The key is the value that will be converted to a string and displayed as the axis tick label. */ constructor : function(key) { this._key = key; this._values = []; }, /** * Add a value to the list of client values associated with this datum's key (category). */ push : function(v) { this._values.push(v); }, /** * Retrieve this datum's key value. */ key : function() { return this._key; }, originalData : function() { return this._values; }, originalDataList : function() { return this._values; }, toString : function() { return this._key.toString(); } }); // $source: com/ibm/rave/library/action/ActionOperation /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED var com_ibm_rave_library_action_ActionOperation = rave_library_externs["ActionOperation"] = rave['internal']['Declare']({ /** * Returns useful state information from the action(Should the information exist), such as the zoom behavior object in the case of the pan/zoom operation. * @param (String) id the ID of the object * @return (Object) the state object for the operation. */ /** @expose */ get : function(id) { return null; } }); // $source: com/ibm/rave/library/action/FiltersUtil /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED var com_ibm_rave_library_action_FiltersUtil = rave_library_externs["FiltersUtil"] = rave['internal']['Declare']({ /** * Selection filter utility, This is used to filter out elements with the "selected" flag from the rest of the elements, keeping them in the "selected" state intead of allowing them to fade out with the background elements. * @param (rave['internal']['Selector']) context All the other element in the context. * @param (boolean) flag a boolean to decide whether the return should be selected/unselected elements true: unselected, false: selected. * @return (rave['internal']['Selector']) Filtered Selection (selected elements.) */ /** @expose */ selectionFilter : function(context, flag) { return context.filter(flag ? function(data, i, groupIndext) { var selected = rave.select(this).property("selected"); return (selected == null); } : function(data, i, groupIndext) { var selected = rave.select(this).property("selected"); return ((selected) == true); }); } }); /** @expose */ com_ibm_rave_library_action_FiltersUtil.INSTANCE = new com_ibm_rave_library_action_FiltersUtil(); // $source: com/ibm/rave/library/property/PropertySet /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/property/PropertyProcessor (runtime) // processProperties //@import com/ibm/rave/library/property/ObjectPropertyImpl (runtime) // new //@import com/ibm/rave/library/property/PropertyImpl (runtime) // new /** *
This class allows for the creation of an set of properties, and allows a new property to be added and an existing property to be retrieved by providing its id.
Each {@link (com.ibm.rave.library.property.PropertyImpl) PropertyImpl} is created from a JSONObject in the containing properties JSONObject passed in as an argument to the populate method, or from a each of properties meta types in the passed list.
The fully qualified ids of the properties are mapped to the properties themselves so that properties can be retrieved using {@link #this.property(String this.id)} with their matching fully qualified id.
*/ var com_ibm_rave_library_property_PropertySet = rave_library_externs["PropertySet"] = rave['internal']['Declare']({ /** * Map containing all property definitions. */ //_flattennedPropMap : null, /** * List containing all visible (public API) property definitions; null when it needs to be re-created. */ //_visibleProperties : null, /** * List containing all visible (public API) property metainformation; null when it needs to be re-created. */ //_visibleMeta : null, /** * Create an empty property set. See {@link #this.populate(Array)} and {@link #this.populate(Object, com_ibm_rave_library_i18n_MessagesRegistry, )} to populate the set with properties. */ /** @expose */ constructor : function() { this._flattennedPropMap = {}; this._visibleProperties = null; this._visibleMeta = null; }, populate$0 : function(properties) { for (var __i_enFor0 = 0, __exp_enFor0 = properties, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var propertyMeta = __exp_enFor0[__i_enFor0]; this.addTopLevelProperty(propertyMeta.copy(null)); } this._visibleProperties = null; this._visibleMeta = null; }, /** * Creates the properties based upon the contents of the props array. If an error occurs, the creation of the properties will stop immediately and the cause of the error will be stored in the error object. * @param (Object) props A JSONArray of properties as JSONObjects * @param (boolean) validate Whether or not validation is on. */ populate$1 : function(props, messages, validate) { var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(props, messages, validate); this.populate$0(info.properties); }, addTopLevelProperty : function(propertyType) { var prop = this._flattennedPropMap[propertyType.id()]; if (!prop) { this.addProperty(propertyType, null); } else { this.mergeProperty(prop, propertyType, null); } }, addProperty : function(propertyType, parent) { var newProperty; if (propertyType.typeId() == 21) { var objPropType = propertyType; newProperty = new com_ibm_rave_library_property_ObjectPropertyImpl(objPropType, parent); this._flattennedPropMap[propertyType.id()] = newProperty; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objPropType._childProperties), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; var childProperty = objPropType._childProperties[key]; this.addProperty(childProperty, newProperty); } } else { newProperty = new com_ibm_rave_library_property_PropertyImpl(propertyType, parent); this._flattennedPropMap[propertyType.id()] = newProperty; } if (parent && parent.meta().typeId() == 21) { (parent).childProperties()[newProperty.meta().simpleId()] = newProperty; } }, mergeProperty : function(existingProperty, newPropertyType, parent) { if (existingProperty.meta().typeId() == 21 && newPropertyType.typeId() == 21) { var existingObj = existingProperty; var newObjType = newPropertyType; var newObjectTypeChildIds = {}; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(newObjType._childProperties), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; newObjectTypeChildIds[key] = 1; var newChildPropertyType = newObjType._childProperties[key]; var existingChildProperty = existingObj.childProperties()[key]; if (existingChildProperty) { this.mergeProperty(existingChildProperty, newChildPropertyType, existingObj); } else { this.fuseProperty(newChildPropertyType, existingObj); } } for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(newObjectTypeChildIds), __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var key = __exp_enFor1[__i_enFor1]; delete newObjType._childProperties[""+(key)]; } } else { this.overwriteProperty(existingProperty, newPropertyType, parent); } }, overwriteProperty : function(existingProperty, newPropertyType, parent) { if (existingProperty.meta().typeId() == 21) { var objProperty = existingProperty; var children = objProperty.childProperties(); for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(children), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var propertyId = __exp_enFor0[__i_enFor0]; var childProperty = children[propertyId]; this.removePropertyFromFlatMap(childProperty); } } if (parent && parent.meta().typeId() == 21) { this.fuseProperty(newPropertyType, parent); } else { newPropertyType._parent = (existingProperty.meta())._parent; this.addProperty(newPropertyType, parent); } (existingProperty.meta())._parent = null; }, fuseProperty : function(newChildPropertyType, existingParentObj) { this.addProperty(newChildPropertyType, existingParentObj); var existingParentObjType = existingParentObj.meta(); existingParentObjType._childProperties[newChildPropertyType.simpleId()] = newChildPropertyType; newChildPropertyType._parent = existingParentObjType; var defaultInstance = existingParentObj.meta().defaultValue(); defaultInstance[newChildPropertyType.simpleId()] = newChildPropertyType.defaultValue(); var valueInstance = existingParentObj.value(); valueInstance[newChildPropertyType.simpleId()] = newChildPropertyType.defaultValue(); }, removePropertyFromFlatMap : function(property) { delete this._flattennedPropMap[property.meta().id()]; if (property.meta().typeId() == 21) { var objProperty = property; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(objProperty.childProperties()).arrayIterator(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var propertyId = __exp_enFor0[__i_enFor0]; var childProperty = objProperty.childProperties()[propertyId]; this.removePropertyFromFlatMap(childProperty); } } }, /** *Configure properties from the given JSON. If it does not have a "properties" property, nothing is done.
Otherwise, the "properties" is an array of objects describing the properties configuration, as in the schema. The array is traversed and used to set initial property values and to mark properties hidden and readonly.
*/ /** @expose */ configure : function(json) { var v = json["properties"]; if (v != null) { for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var o = __exp_enFor0[__i_enFor0]; var config = o; var prop = this._flattennedPropMap[""+(config["id"])]; if (prop) { var value = config["value"]; if (value != null && !(prop._readonly)) { prop.value(value); prop.meta().setDefaultValue(value); } var b = (config["hidden"]); if (b != null && b) { prop.setHidden(); } b = (config["readonly"]); if (b != null && b) { prop.setReadonly(); } } } this._visibleProperties = null; this._visibleMeta = null; } }, /** * This method returns the property with the corresponding id, or null if there is no such id. * @param (String) id The id to match * @return (com.ibm.rave.library.property.Property) the property with the matching id */ /** @expose */ property : function(id) { if (id != null) { return this._flattennedPropMap[id]; } return null; }, /** * Get a list of all visible (public API) properties. * @return (Array) List of visible properties */ /** @expose */ properties : function() { if (!this._visibleProperties) { this.buildVisibleProperties(); } return this._visibleProperties; }, /** * Get a list of all visible (public API) property meta. * @return (Array) List of visible property metadata */ /** @expose */ meta : function() { if (!this._visibleMeta) { this.buildVisibleProperties(); } return this._visibleMeta; }, /** * Builds _visibleProperties and _visibleMeta. Both contain only the leaf properties that are not hidden. */ buildVisibleProperties : function() { this._visibleProperties = []; this._visibleMeta = []; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this._flattennedPropMap), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var id = __exp_enFor0[__i_enFor0]; var prop = this._flattennedPropMap[id]; if (prop.meta().typeId() != 21 && !(prop._hidden)) { this._visibleProperties.push(prop); this._visibleMeta.push(prop.meta()); } } }, /** @expose */ populate : function(a0, a1, a2) { var args = arguments; if (args.length == 1) { return this.populate$0(a0); } return this.populate$1(a0, a1, a2); } }); /** * Given a list of meta type loaded from different JSON files, the merge method will try to perform a very simple merge of these properties if it detects a fully qualified id collision amongst them. The rules of the simple merge are as follows: 1- If the colliding properties are both objects, then the child properties of the object that shows up later in the list will be added to the children of the object that showed up earlier, resolving collision amongst those children recursively using the same rules. The meta type of both objects and their properties will change as well in order to maintain the parent child relationship amongst them. 2- If at lease one of the properties is not an object, then the property that comes later in the list will completely overwrite the previous one. It is important to keep in mind that in case of collision, the passed properties will change structurally in terms of their parent-child relationship. Also, it is important to keep in mind that the order of meta properties affect the final result. * @param (Array) properties the list of meta properties to merge * @return (Array) a new list of the merged properties. In case of no collision then the returned list have the exact same properties as the passed list. */ /** @expose */ com_ibm_rave_library_property_PropertySet.merge = function(properties) { var propertySet = new com_ibm_rave_library_property_PropertySet(); propertySet.populate(properties); var props = propertySet.properties(); var mergedMeta = []; for (var __i_enFor0 = 0, __exp_enFor0 = props, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var p = __exp_enFor0[__i_enFor0]; mergedMeta.push(p.meta()); } return mergedMeta; }; // $source: com/ibm/rave/library/property/PropertyProcessingInfo /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** * When parsing a JSON properties file to create meta properties, the PropertyProcesser return this structure as a result */ var com_ibm_rave_library_property_PropertyProcessingInfo = rave_library_externs["PropertyProcessingInfo"] = rave['internal']['Declare']({ /** * The list of top level meta properties that got processed from the properties JSON file */ /** @expose */ properties : null, //error : null, /** * Indicates whether any of the properties processed from the JSON file is invalid */ /** @expose */ hasInvalidProperties : false, /** * Indicates whether the PropertyProcessor generated this info while validating the properties JSON file */ /** @expose */ validate : false, constructor : function(validate) { this.properties = []; { this.validate = validate; } }, processError : function() { this.hasInvalidProperties = true; } }); // $source: com/ibm/rave/library/property/PropertyUtil /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/Library (runtime) // logError //@import com/ibm/rave/library/internal/nativeImpl/PropertyNativeUtils (runtime) // isBoolean, isJSONArray, isNumber, isString, isJSONObject /** */ var com_ibm_rave_library_property_PropertyUtil = rave['internal']['Declare']({ constructor : function() { com_ibm_rave_library_property_PropertyUtil.propertyTypes["string"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["boolean"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["numeric"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["enum"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["font"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["color"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["array"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["palette"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["length"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["padding"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["dasharray"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["object"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["jsonobject"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["geojson"] = 1; com_ibm_rave_library_property_PropertyUtil.propertyTypes["shadow"] = 1; }, validateNumeric : function(obj, decimal) { if (!(this.validateBasicType(obj, 11))) { return false; } var num = + (obj); if (isNaN(num)) { com_ibm_rave_library_Library.logError(6, "Property Validator"); return false; } if (!decimal) { return this.validateIsInteger(num); } return true; }, validateObjectExistInList : function(list, value) { if (list.indexOf(value) == -1) { com_ibm_rave_library_Library.logError(7, "Property Validator"); return false; } return true; }, validateNumericProperties : function(_options, value, decimal) { if (_options.length == 0) { return true; } for (var i = 0; i < _options.length; ++i) { var listVal = _options[i]; if (decimal) { if (listVal.value() == value) { return true; } } else { if (listVal.value() == value) { return true; } } } com_ibm_rave_library_Library.logError(7, "Property Validator"); return false; }, validateMinMaxPropertyValue : function(min, max, decimal, value) { if (value != null) { if (!decimal) { if (!(this.validateIsInteger(value))) { return false; } } if (min != null && min > value) { com_ibm_rave_library_Library.logError(8, "Property Validator"); return false; } if (max != null && max < value) { com_ibm_rave_library_Library.logError(9, "Property Validator"); return false; } } return true; }, validateMinMaxProperties : function(minObj, maxObj, decimal, allowNegatives) { var min; var max; if (minObj != null) { if (!(this.validateNumeric(minObj, decimal))) { return false; } min = + (minObj); if (!allowNegatives) { if (min < 0) { com_ibm_rave_library_Library.logError(10, "Property Validator"); return false; } } } if (maxObj != null) { if (!(this.validateNumeric(maxObj, decimal))) { return false; } max = + (maxObj); if (!allowNegatives) { if (max < 0) { com_ibm_rave_library_Library.logError(11, "Property Validator"); return false; } } if (min != null && min > max) { com_ibm_rave_library_Library.logError(12, "Property Validator"); return false; } } return true; }, validateSimpleOptions : function(optionsArray, property) { var len = optionsArray.length; if (len == 0) { com_ibm_rave_library_Library.logError(13, "Property Validator"); return false; } var optionsSet = {}; for (var i = 0; i < len; ++i) { var obj = optionsArray[i]; if (optionsSet.hasOwnProperty(obj)) { com_ibm_rave_library_Library.logError(14, "Property Validator"); return false; } optionsSet[obj] = 1; if (!(property.validateValue(obj))) { return false; } } return true; }, validateStringOptions : function(optionsArray, property) { var len = optionsArray.length; if (len == 0) { com_ibm_rave_library_Library.logError(13, "Property Validator"); return false; } var optionsSet = {}; for (var i = 0; i < len; ++i) { var value = (optionsArray[i])["value"]; if (optionsSet.hasOwnProperty(value)) { com_ibm_rave_library_Library.logError(14, "Property Validator"); return false; } optionsSet[value] = 1; if (!(property.validateValue(value))) { return false; } } return true; }, validateBasicType : function(obj, typeId) { switch (typeId) { case 10: { if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString(obj))) { com_ibm_rave_library_Library.logError(15, "Property Validator"); return false; } return true; } case 11: { if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isNumber(obj))) { com_ibm_rave_library_Library.logError(16, "Property Validator"); return false; } return true; } case 12: { if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isBoolean(obj))) { com_ibm_rave_library_Library.logError(17, "Property Validator"); return false; } return true; } case 20: { if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONArray(obj))) { com_ibm_rave_library_Library.logError(18, "Property Validator"); return false; } return true; } case 21: { if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(obj))) { com_ibm_rave_library_Library.logError(19, "Property Validator"); return false; } return true; } default: { return false; } } }, validateIsInteger : function(num) { if ((~~ (num) != num)) { com_ibm_rave_library_Library.logError(20, "Property Validator"); return false; } return true; }, validatePropertySimpleId : function(simpleId) { if (simpleId == null) { com_ibm_rave_library_Library.logError(21, "PropertySet.populate"); return false; } if (simpleId.indexOf(".") != -1) { com_ibm_rave_library_Library.logError(22, "PropertySet.populate"); return false; } return true; }, validType : function(type) { if (!(com_ibm_rave_library_property_PropertyUtil.propertyTypes.hasOwnProperty(type))) { com_ibm_rave_library_Library.logError(23, "PropertySet.populate"); return false; } return true; }, propertyEntry : function(propertyJSON, propertyId) { var propertyEntry = propertyJSON[propertyId]; if (propertyEntry == null) { com_ibm_rave_library_Library.logError(24, "PropertySet.populate"); return null; } if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isJSONObject(propertyEntry))) { com_ibm_rave_library_Library.logError(25, "PropertySet.populate"); return null; } return propertyEntry; }, type : function(propertyJSON) { var type = propertyJSON["type"]; if (type == null) { com_ibm_rave_library_Library.logError(26, "PropertySet.populate"); return null; } if (!(com_ibm_rave_library_internal_nativeImpl_PropertyNativeUtils.isString(type))) { com_ibm_rave_library_Library.logError(27, "PropertySet.populate"); return null; } var typeStr = ""+(type); if (!(this.validType(typeStr))) { return null; } return typeStr; } }); com_ibm_rave_library_property_PropertyUtil.propertyTypes = {}; com_ibm_rave_library_property_PropertyUtil.INSTANCE = new com_ibm_rave_library_property_PropertyUtil(); // $source: com/ibm/rave/library/framework/meta/PropertyMeta /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** * Interface to meta data for a bundle Property. * @param < (java.lang.Object) E > The type of options this property accepts. */ var com_ibm_rave_library_framework_meta_PropertyMeta = rave_library_externs["PropertyMeta"] = rave['internal']['Declare']({ /** * The fully qualified id of the property (starting from its parent if any). When requesting a property, this is the field you query by. * @return (String) the Property ID. */ /** @expose */ id : function() {}, /** * The simple (non-qualified) id of the property. This is how the property's parent refers to it. If the property has no parent, then this would be equivalent to its fully qualified id * @return (String) (non-qualified) property id */ /** @expose */ simpleId : function() {}, /** * @return (String) the Property Name. This name is used as a label for some properties--for example, in labelled PropertyArrayTypes. */ /** @expose */ name : function() {}, /** * @return (String) the Property Description */ /** @expose */ description : function() {}, /** * @return (String) the Property Icon string, which is the URL of the icon file used in the property editor */ /** @expose */ icon : function() {}, /** * Gets the parent's property if any * @return (com.ibm.rave.library.framework.meta.PropertyMeta) the parent property, or null if this is a top level property */ /** @expose */ parent : function() {}, /** * @return (String) the property type as string */ /** @expose */ type : function() {}, /** * @return (int) the property type as an integer */ /** @expose */ typeId : function() {}, /** * Indicates if this property is required. * @return (boolean) true if it is required, false otherwise */ /** @expose */ required : function() {}, /** * @return (Object) the default value of the property */ /** @expose */ defaultValue : function() {}, /** * @param (Object) defaultValue the default value of the property */ /** @expose */ setDefaultValue : function(defaultValue) {}, /** * @return (Array) list of property options. */ /** @expose */ options : function() {}, /** * Validates if the passed object meets all the constraints imposed on this property * @param (Object) obj the value to validate * @return (boolean) true if the object is valid, false otherwise */ /** @expose */ validateValue : function(obj) {}, /** * Does the change of property value require resetting the view? Resetting view means recalculating data and redrawing components. Some properties change the layout/scales, for instance, layout padding. Some properties involve no data change but need redrawing the components. For instance, background color. * @return (String) one of 3 values: data---need to recalculate data and redraw components layout---no data recalculation is required, but need to reset layout/scales and redraw components none----no data or layout/scales change, but redraw components to show style changes */ /** @expose */ resetView : function() {}, /** * Performs a deep copy of this property meta. Changing anything on the copy will not affect this object. * @return (com.ibm.rave.library.framework.meta.PropertyMeta) a deep copy of this property meta. */ /** @expose */ copy : function(parent) {}, /** * Get the tags from the property */ /** @expose */ tags : function() {} }); /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.STRING = "string"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.BOOLEAN = "boolean"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.NUMERIC = "numeric"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.ENUM = "enum"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.FONT = "font"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.COLOR = "color"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.PALETTE = "palette"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.LENGTH = "length"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.PADDING = "padding"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.DASHARRAY = "dasharray"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.ARRAY = "array"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.OBJECT = "object"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.JSONOBJECT = "jsonobject"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.GEOJSON = "geojson"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.SHADOW = "shadow"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.UNKNOWN_TYPE = "UNKNOWN_TYPE"; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.STRING_ID = 10; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.NUMERIC_ID = 11; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.BOOLEAN_ID = 12; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.ENUM_ID = 13; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.FONT_ID = 14; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.COLOR_ID = 15; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.PALETTE_ID = 16; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.LENGTH_ID = 17; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.PADDING_ID = 18; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.DASHARRAY_ID = 19; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.ARRAY_ID = 20; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.OBJECT_ID = 21; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.JSONOBJECT_ID = 22; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.GEOJSON_ID = 23; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.SHADOW_ID = 24; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.NONE = -1; /** @expose */ com_ibm_rave_library_framework_meta_PropertyMeta.UNKNOWN_TYPE_ID = -1; // $source: com/ibm/rave/library/property/EnumPropertyOption /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** *A property option value for enum properties. The value of the property is the enum integer value, and the label is the uninternationalized enum label. If the label is ever internationalized (i.e. the label becomes a message ID), the only modification needed will be in the label() method, to look up the message ID in the messages.
*/ var com_ibm_rave_library_property_EnumPropertyOption = rave_library_externs["EnumPropertyOption"] = rave['internal']['Declare']({ //_value : null, //_label : null, //_messages : null, /** * Construct. * @param (Number) value The value of the option * @param (String) label The label of the option * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map */ /** @expose */ constructor : function(value, label, messages) { this._value = value; this._label = label; this._messages = messages; }, /** @expose */ value : function() { return this._value; }, /** @expose */ id : function() { return this._value; }, /** @expose */ label : function() { return this._label; } }); // $source: com/ibm/rave/library/property/NumberPropertyOption /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** * A property option value that is a number. The option is created with the numeric value as used in the code. The label is the number as a string; the messages map is not used. Example JSON: "options": [ 0, 2.2, 10.0 ]
*/
var com_ibm_rave_library_property_NumberPropertyOption = rave_library_externs["NumberPropertyOption"] = rave['internal']['Declare']({
//_value : null,
/**
* Construct.
* @param (Number) value The property value as used in the code
*/
/** @expose */
constructor : function(value) {
this._value = value;
},
/** @expose */
value : function() {
return this._value;
},
/** @expose */
id : function() {
return this._value;
},
/** @expose */
label : function() {
return ""+(this._value);
}
});
// $source: com/ibm/rave/library/property/PalettePropertyOption
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2017
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
/**
* A string property option value for use in palette properties. The "options" in the palette property JSON is an array of palette types, but the options stored in the property itself are the palette IDs for those types. Palettes are not yet internationalized, so the option label is the palette's label and the messages are not used. They are included in the constructor so that the signature of this class is the same as StringPropertyOption, and if palette labels are ever internationalized this class can be replaced with the StringPropertyOption.
*/
var com_ibm_rave_library_property_PalettePropertyOption = rave_library_externs["PalettePropertyOption"] = rave['internal']['Declare']({
//_value : null,
//_label : null,
//_messages : null,
/**
* Construct.
* @param (String) value The value of the option
* @param (String) label The label of the option
* @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map, unused (but included so the constructor signature is that of StringPropertyOption)
*/
/** @expose */
constructor : function(value, label, messages) {
this._value = value;
this._label = label;
this._messages = messages;
},
/** @expose */
value : function() {
return this._value;
},
/** @expose */
id : function() {
return this._value;
},
/** @expose */
label : function() {
return this._messages._nls(this._label, this._label);
}
});
// $source: com/ibm/rave/library/property/StringPropertyOption
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2017
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
/**
* A property option value that is a string. The option is created with the string value as used in the code, and with a message ID and messages map. The label is the result of looking up the message ID in the messages, using the value as the alternate/default if the message ID is not found.
*/
var com_ibm_rave_library_property_StringPropertyOption = rave_library_externs["StringPropertyOption"] = rave['internal']['Declare']({
//_value : null,
//_messageID : null,
//_messages : null,
/**
* Construct.
* @param (String) value The property value as used in the code
* @param (String) messageID The message ID used to look up the property label
* @param (com.ibm.rave.library.i18n.MessagesRegistry) messages Messages map
*/
/** @expose */
constructor : function(value, messageID, messages) {
this._value = value;
this._messageID = messageID;
this._messages = messages;
},
/** @expose */
value : function() {
return this._value;
},
/** @expose */
label : function() {
return this._messages._nls(this._messageID, this._value);
},
/** @expose */
id : function() {
return this.value();
}
});
// $source: com/ibm/rave/library/framework/Bundle
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2017
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
//@import com/ibm/rave/library/framework/meta/internal/GenericMetadataImpl (runtime) // new
//@import com/ibm/rave/library/framework/meta/internal/PreviewsMetadataImpl (runtime) // new
//@import com/ibm/rave/library/datamodel/internal/BundleDataModels (runtime) // new
//@import com/ibm/rave/library/framework/meta/internal/BundleConfigurationManager (runtime) // new
//@import com/ibm/rave/library/i18n/MessagesRegistry (runtime) // new
//@import com/ibm/rave/library/internal/nativeImpl/LoaderNativeUtils (runtime) // getMessagesPath
//@import com/ibm/rave/library/framework/internal/AbstractController (runtime) // new
//@import com/ibm/rave/library/Library (runtime) // logError, _generateId, Library
//@import com/ibm/rave/library/framework/internal/BundleContext (runtime) // new
//@import com/ibm/rave/library/framework/meta/ActionMeta (runtime) // parse
//@import com/ibm/rave/library/framework/meta/internal/PropertyPresentationMetaImpl (runtime) // new
//@import com/ibm/rave/library/property/PropertyProcessor (runtime) // processProperties
//@import com/ibm/rave/library/property/PropertySet (runtime) // merge
//@import com/ibm/rave/library/i18n/Messages (runtime) // createFromCatalog
//@import com/ibm/rave/library/framework/BundleInfo (runtime)
/**
* Access point for Bundle metadata and creation of visualization instances.
Bundle meta data can be accessed through the {@link this.Bundle#this.info()} API.
Bundle visualization instances can be created through {@link this.Bundle#this.create()} .
*/
var com_ibm_rave_library_framework_Bundle = rave_library_externs["Bundle"] = rave['internal']['Declare']({
/**
* Metadata (using same class as in an instance)
*/
//_metadata : null,
//_previewsMeta : null,
/**
* Property metadata
*/
//_properties : null,
/**
* Property presentations metadata
*/
//_propertyPresentations : null,
/**
* Actions metadata
*/
//_actions : null,
/**
* Data models metadata (using same class as in an instance)
*/
//_dataModels : null,
/**
* Configurations available in the bundle
*/
//_configurations : null,
/**
* Bundle information API (metadata, properties, actions, data models, configurations)
*/
//_info : null,
/**
* Default localization messages
*/
//_messages : null,
//_locale : null,
/**
* Copy of the messages manifest for the bundle
*/
/** @expose */
_manifest : null,
/**
* Need to hang on to this for Swift.
*/
//messageXhr : null,
/**
* Bundle version
*/
_version : "0.0.0",
/**
* Bundle build
*/
_build : "development",
/**
* Bundle Path -- used to load messages
*/
_path : "development",
constructor : function() {
this._metadata = new com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl();
this._previewsMeta = new com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl();
this._properties = [];
this._propertyPresentations = [];
this._actions = [];
this._dataModels = new com_ibm_rave_library_datamodel_internal_BundleDataModels();
this._configurations = new com_ibm_rave_library_framework_meta_internal_BundleConfigurationManager();
this._messages = new com_ibm_rave_library_i18n_MessagesRegistry();
this._locale = com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE;
/**
* Only used by subclasses.
*/
{
var self = this;
this._info = new (rave['internal']['Declare']({
meta : function() {
return self._metadata;
},
properties : function() {
return self._properties;
},
propertyPresentations : function() {
return self._propertyPresentations;
},
actions : function() {
return self._actions;
},
dataModels : function() {
return self._dataModels.getDataModels();
},
getPreview$2 : function(format, tags) {
return self._previewsMeta.getPreview(format, tags);
},
getPreviewTags : function() {
return self._previewsMeta.getAllTags();
},
getPreviews$1 : function(format) {
return self._previewsMeta.getPreviews(format);
},
getPreview$1 : function(format) {
return self._previewsMeta.getPreview(format, null);
},
getPreview$0 : function() {
return self._previewsMeta.getPreview("svg", null);
},
getPreviews$0 : function() {
return self._previewsMeta.getPreviews("svg");
},
previews : function() {
return self._previewsMeta;
},
getPreview : function(a0, a1) {
var args = arguments;
if (args.length == 0) {
return this.getPreview$0();
}
if (args.length == 1) {
return this.getPreview$1(a0);
}
return this.getPreview$2(a0, a1);
},
getPreviews : function(a0) {
var args = arguments;
if (args.length == 0) {
return this.getPreviews$0();
}
return this.getPreviews$1(a0);
}
}))();
this._configurations.setBundleInfo(this, this._info);
}
},
/**
* @return (com.ibm.rave.library.framework.BundleInfo) Access point to bundle meta data information.
*/
/** @expose */
info : function() {
return this._info;
},
/**
* @return (String) The version of this bundle.
*/
/** @expose */
version : function() {
return this._version;
},
/**
* @return (String) The build label of this bundle.
*/
/** @expose */
build : function() {
return this._build;
},
/**
* A bundle instance ( {@link (com.ibm.rave.library.framework.Controller) Controller} will always return a non-null but empty list.
* @return (Array) List of all configurations this bundle provides.
*/
/** @expose */
configurations : function() {
return this._configurations._configList;
},
/**
* Create an instance of this bundle for rendering.
* @return (com.ibm.rave.library.framework.Controller) A Controller interface to control the visualization.
*/
create$0 : function() {
return this.doCreate(null, true);
},
/**
* Create an instance of this bundle for rendering, using the configuration with the given ID. If the ID is null no configuration is applied (it is the same as {@link #this.create()} ). If there is no configuration with the given ID an error is reported to the Library and null is returned.
* @param (String) configID ID of the configuration
* @return (com.ibm.rave.library.framework.Controller) A Controller interface to control the visualization.
*/
create$1 : function(configID) {
return this.doCreate(configID, true);
},
create$2 : function(configID, viewRequired) {
return this.doCreate(configID, viewRequired);
},
/**
* Returns the current default locale for the bundle. Any new bundle instances created will use this locale.
Defaults to 'en'. * @return (String) String representing the default locale for bundle. */ locale$0 : function() { return this._locale; }, /** * Sets the current default locale for the bundle. If never called, the locale defaults to 'en'. */ locale$1 : function(locale) { this._locale = locale; }, locale$2 : function(locale, url, userCallback) { var self = this; var path = com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.getMessagesPath(locale, url); if (self._messages.locale$0(locale)) { if (userCallback) { userCallback(); } return; } self.messageXhr = rave.json(path, function(error, response) { if (!error) { self.setMessageCatalog(locale, (response)); self._messages.locale(locale); if (userCallback) { userCallback(); } } }); }, /** * This API is used to pass in configurations to the bundle. The bundle can use those configurations to tweak some settings including updating the properties dynamically prior to the bundle creation {@link #this.create()} . this method should be called and its callback function can be used to initialize the bundle etc. current expected properties for the configurations json "mapboxkey" : "your access token here" "mapboxaccountname" : "your account name here" * @param (Object) configurations A JSON object containing various settings for the bundle * @param (com.ibm.rave.library.framework.Controller.Callback) userCallback the function to be called after the configuration is completed */ /** @expose */ configure : function(configurations, userCallback) { if (configurations) { this._doConfigure(configurations, userCallback, this); } else if (userCallback) { userCallback(); } }, /** * This function will use the configurations object to setup a bundle based on the specific bundle implementation on this method by default this method does nothing and calls the passed in callback * @param (Object) configurations A JSON object containing required info that bundles may need * @param (com.ibm.rave.library.framework.Controller.Callback) userCallback the function to be called after the setup is completed */ /** @expose */ _doConfigure : function(configurations, userCallback, bundle) { if (userCallback) { userCallback(); } }, /** * Retrieve the String name for this bundle. */ /** @expose */ getName : function() {}, /** * Create an instance of the View for this bundle. */ /** @expose */ createView : function(ctx) {}, /** * A bundle author may override this method if a bundle requires its own controller implementation. * @param (String) bundleName String bundle identifier. * @param (com.ibm.rave.library.framework.internal.BundleContext) ctx The context instantiated from the Bundle metadata descriptions. * @param (com.ibm.rave.library.framework.internal.AbstractView) view A bundle view instance (see {@link this.Bundle#this.createView(com_ibm_rave_library_framework_internal_BundleContext)} ). * @return (com.ibm.rave.library.framework.internal.AbstractController) Visualization Controller instance. */ /** @expose */ createController : function(bundleName, ctx, view) { return new com_ibm_rave_library_framework_internal_AbstractController(bundleName, ctx, view); }, /** *
Bundle instance creation.
If the configuration ID is non-null and the requested configuration does not exist, an error is reported to the Library and null is returned.
* @param (String) configID ID of the configuration * @param messages The Messages catalog to assign to the visualization instance (this can be different from the messages currently assigned to this Bundle). * @return (com.ibm.rave.library.framework.Controller) Controller for the visualization instance. */ doCreate : function(configID, viewRequired) { var instanceId = com_ibm_rave_library_Library._generateId(); var ctx = this.createBundleContext(instanceId); if (configID != null) { var configuration = this._configurations.configuration(configID); if (!configuration) { com_ibm_rave_library_Library.logError(204, configID); return null; } var configJSON = configuration._json; (ctx._metadata).populate(configJSON); if (viewRequired) { ctx._metadata.configure(configJSON); } (ctx._previewsMeta).populate(configJSON); (ctx._metadata)._messages = this._messages; ctx.datamodels.configure(configJSON); ctx.properties.configure(configJSON); ctx.propertyPresentations.configure(configJSON); ctx.actions.configure(configJSON); this.validatePresentations(ctx); } var view = viewRequired ? this.createView(ctx) : null; return this.createController(this.getName(), ctx, view); }, validatePresentations : function(ctx) { var presentations = ctx.propertyPresentations.meta(); for (var __i_enFor0 = 0, __exp_enFor0 = presentations, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var p = __exp_enFor0[__i_enFor0]; (p).validateProperties(ctx.properties); } }, getMessageCatalog : function() { var catalog = this._messages.get(this._locale); if (!catalog) { catalog = this._messages.get(com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE); } return catalog; }, createBundleContext : function(instanceId) { var ctx = new com_ibm_rave_library_framework_internal_BundleContext(instanceId, this._messages, this._dataModels.copy(), this._metadata.copy(), this._previewsMeta.copy()); for (var __i_enFor0 = 0, __exp_enFor0 = this._propertyPresentations, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var property = __exp_enFor0[__i_enFor0]; ctx.propertyPresentations.put((property).copy()); } ctx.actions.populate$1(this._actions); ctx.properties.populate(this._properties); return ctx; }, parseActions : function(list) { for (var i = 0; i < list.length; ++i) { var a = com_ibm_rave_library_framework_meta_ActionMeta.parse(list[i], this._messages); this._actions.push(a); } }, parsePropertyPresentations : function(list) { for (var i = 0; i < list.length; ++i) { var PP = new com_ibm_rave_library_framework_meta_internal_PropertyPresentationMetaImpl(this._messages); this._propertyPresentations.push(PP.parse(list[i])); } }, /** * Initialize this bundle using configuration information in a JSON object. See documentation for more details on valid property names and values. * @param (Object) config JSON object containing configuration information. See documentation for more details on valid property names and values. */ /** @expose */ initialize : function(config) { if (!config) { return; } this._metadata.populate(config); this._metadata._messages = this._messages; this._previewsMeta.populate(config); this._dataModels.populate(config, this._messages); var resourceObject = config["properties"]; if (resourceObject) { var info = com_ibm_rave_library_property_PropertyProcessor.processProperties(resourceObject, this._messages, false); for (var __i_enFor0 = 0, __exp_enFor0 = info.properties, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var p = __exp_enFor0[__i_enFor0]; this._properties.push(p); } } var resourceArray = config["propertyPresentations"]; if (resourceArray) { this.parsePropertyPresentations(resourceArray); } resourceArray = config["actions"]; if (resourceArray) { this.parseActions(resourceArray); } resourceArray = config["colorpalettes"]; if (resourceArray) { com_ibm_rave_library_Library.palettes.addPalettes(resourceArray); } this._configurations.populate(config, this._messages); this._properties = com_ibm_rave_library_property_PropertySet.merge(this._properties); var version = ""+(config["version"]); if (version != null) { this._version = ""+(version); } var build = ""+(config["build"]); if (build != null) { this._build = ""+(build); } }, /** * Populate this bundle with localized id->value key/value pairs of translated strings. All new instances of this bundle will inherit this set of translated strings. 'en-us' is the default locale for all bundles.
* @param (String) locale String representing the locale (ie 'en-us')
* @param (Object) catalog JSONObject in the following format: { "id" : "Translated String", ... }
*/
/** @expose */
setMessageCatalog : function(locale, catalog) {
var message = com_ibm_rave_library_i18n_Messages.createFromCatalog(catalog, locale);
this._messages.add(locale, message);
},
/** @expose */
create : function(a0, a1) {
var args = arguments;
if (args.length == 0) {
return this.create$0();
}
if (args.length == 1) {
return this.create$1(a0);
}
return this.create$2(a0, a1);
},
/** @expose */
locale : function(a0, a1, a2) {
var args = arguments;
if (args.length == 0) {
return this.locale$0();
}
if (args.length == 1) {
return this.locale$1(a0);
}
return this.locale$2(a0, a1, a2);
}
});
/**
* Default locale
*/
/** @expose */
com_ibm_rave_library_framework_Bundle.DEFAULT_LOCALE = "en";
// $source: com/ibm/rave/library/framework/meta/internal/GenericMetadataImpl
/************************************************************************
** IBM Confidential
**
** IBM Business Analytics: Rapidly Adaptive Visualization Engine
**
** (C) Copyright IBM Corp. 2017
**
** The source code for this program is not published or otherwise divested of its trade secrets,
** irrespective of what has been deposited with the U.S. Copyright Office.
************************************************************************/
// GENERATED
/**
*
Implementation of GenericMetadata. An example of what a json file would look like for generic metadata:
{ "genericMeta": { "id": "greatBundle", "label": "IDS_LABEL", "author": "Stephen D. Gibson", "createdOn": "2015-01-01", "version": 5, "description": "IDS_DESC", "tags": ["IDS_MAP", "IDS_RS"] } }*/ var com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl = rave['internal']['Declare']({ /** * Map from key to value, does not include "tags" */ //metadataInfo : null, /** * Tags, may include duplicates */ //metadataTags : null, /** * Messages lookup required for internationalization */ //_messages : null, constructor : function() { this.metadataInfo = rave['internal']['ES6Map'].create(); this.metadataTags = []; }, /** @expose */ ids : function() { var keys = this.metadataInfo.keys(); var keyArray = keys; for (var i = 0; i < keyArray.length; ++i) { keyArray[i] = this._messages._nls(keyArray[i], keyArray[i]); } return keyArray; }, /** @expose */ id : function(id) { var str = this.metadataInfo.get(id); if ("name" == id || "label" == id || "description" == id) { str = this._messages._nls(str, str); } return str; }, /** @expose */ tags : function() { var newTags = []; for (var __i_enFor0 = 0, __exp_enFor0 = this.metadataTags, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var tag = __exp_enFor0[__i_enFor0]; newTags.push(this._messages._nls(tag, tag)); } return newTags; }, /** * Populate the metadata from the given object. If the object has a key "genericMeta", that is used to populate key-value pairs and tags; otherwise nothing is done. * @param (Object) o The object */ populate : function(o) { this.process(o, true); }, /** * Configure the metadata from the given object. This works exactly like populate, except that the "id" field cannot be changed. Any tags are appended to the existing array. * @param (Object) o The object */ /** @expose */ configure : function(o) { this.process(o, false); }, /** * Set the message registry for displaying the meta data in the current locale. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry */ setMessages : function(messages) { this._messages = messages; }, /** * Returns the message registry--needed for copying * @return (com.ibm.rave.library.i18n.MessagesRegistry) the MessagesRegistry */ getMessages : function() { return this._messages; }, /** * Do processing for populate and configure. * @param (Object) o JSON description of the meta * @param (boolean) isPopulate Whether this is for populate */ process : function(o, isPopulate) { var genericMeta = o["genericMeta"]; if (genericMeta) { for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(genericMeta), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var k = __exp_enFor0[__i_enFor0]; var key = (k); if (key == "tags") { var tagsArray = genericMeta[key]; if (tagsArray) { var l = tagsArray.length; for (var i = 0; i < l; ++i) { var tag = ""+(tagsArray[i]); if (!(this.metadataTags.indexOf(tag)> -1)) { this.metadataTags.push(tag); } } } } else { if (isPopulate || !("id" == key)) { var v = genericMeta[key]; if (v != null) { this.metadataInfo.set(key, ""+(v)); } } } } } }, /** * Create a copy of this metadata. The collections (meta and tags) are deep-copied, so the copy's version can be modified without affecting the original. * @return (com.ibm.rave.library.framework.meta.internal.GenericMetadataImpl) Copy of the metadata */ copy : function() { var c = new com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl(); for (var __i_enFor0 = 0, __exp_enFor0 = this.metadataInfo.keys(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; c.metadataInfo.set(key, this.metadataInfo.get(key)); } for (var __i_enFor1 = 0, __exp_enFor1 = this.metadataTags, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var t = __exp_enFor1[__i_enFor1]; c.metadataTags.push(t); } c._messages = this._messages; return c; } }); //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.GENERIC_META = "genericMeta"; //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.ID = "id"; //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.NAME = "name"; //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.LABEL = "label"; //com_ibm_rave_library_framework_meta_internal_GenericMetadataImpl.DESCRIPTION = "description"; // $source: com/ibm/rave/library/framework/meta/internal/PreviewsMetadataImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/framework/meta/internal/PreviewMeta (runtime) // new //@import com/ibm/rave/library/Library (runtime) // logError /** *
An example of what a json file would look like for preview metadata:
"previews" : { "svg" : [ { "file": "resources/svgPreviewNoText.svg", "tags": [ "small", "notext" ] }, { "file": "resources/svgPreview.svg", "tags": [ "large", "text" ] } ], "image" : [ { "file": "resources/imageNoTextSmall.png", "tags": [ "small", "notext" ] }, { "file": "resources/imageLarge.png", "tags": [ "large", "text" ] } ] }*/ var com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl = rave['internal']['Declare']({ //svgPreview : null, //imgPreview : null, //allTags : null, constructor : function() { this.svgPreview = []; this.imgPreview = []; this.allTags = []; }, populate : function(o) { this.svgPreview.length = 0; this.imgPreview.length = 0; var previews = o["previews"]; if (previews) { for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(previews), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var k = __exp_enFor0[__i_enFor0]; var key = (k); if (key == "svg") { var svgArray = previews[key]; for (var __i_enFor1 = 0, __exp_enFor1 = svgArray, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var svg = __exp_enFor1[__i_enFor1]; this.processPreview(svg, "svg"); } } else { var imgArray = previews[key]; for (var __i_enFor2 = 0, __exp_enFor2 = imgArray, __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var img = __exp_enFor2[__i_enFor2]; this.processPreview(img, "image"); } } } } }, processPreview : function(object, format) { var jsonObj = object; var file = ""+(jsonObj["file"]); var tagsArray = jsonObj["tags"]; var tags = []; for (var __i_enFor0 = 0, __exp_enFor0 = tagsArray, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var t = __exp_enFor0[__i_enFor0]; var tag = ""+(t); tags.push(tag); if (!(this.allTags.indexOf(tag)> -1)) { this.allTags.push(tag); } } if (format == "svg") { this.svgPreview.push(new com_ibm_rave_library_framework_meta_internal_PreviewMeta(file, tags, format)); } else { this.imgPreview.push(new com_ibm_rave_library_framework_meta_internal_PreviewMeta(file, tags, format)); } }, /** @expose */ configure : function(o) { this.populate(o); }, /** @expose */ getAllTags : function() { return this.allTags; }, /** @expose */ getPreviews : function(format) { var previews = format == "svg" ? this.svgPreview : this.imgPreview; var result = []; for (var __i_enFor0 = 0, __exp_enFor0 = previews, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var view = __exp_enFor0[__i_enFor0]; result.push(view.file()); } return result; }, /** @expose */ getPreview : function(format, tags) { var previews; if (format == null || format == "svg") { previews = this.svgPreview; } else if (format == "image") { previews = this.imgPreview; } if (!previews) { com_ibm_rave_library_Library.logError(302); return null; } if (!tags) { return previews.length > 0 ? previews[0].file() : null; } var maxCount = -1; var result; for (var __i_enFor0 = 0, __exp_enFor0 = previews, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var meta = __exp_enFor0[__i_enFor0]; var metaTags = meta.tags(); var count = this.MatchTags(metaTags, tags); if (count > maxCount) { maxCount = count; result = meta; } } return !result ? null : result.file(); }, getSvgPreviewMeta : function() { var result = []; for (var __i_enFor0 = 0, __exp_enFor0 = this.svgPreview, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var view = __exp_enFor0[__i_enFor0]; result.push(view); } return result; }, MatchTags : function(available, expected) { var result = 0; for (var __i_enFor0 = 0, __exp_enFor0 = expected, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var tag = __exp_enFor0[__i_enFor0]; if (available.indexOf(tag)> -1) { result++; } } return result; }, copy : function() { var result = new com_ibm_rave_library_framework_meta_internal_PreviewsMetadataImpl(); for (var __i_enFor0 = 0, __exp_enFor0 = this.allTags, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var t = __exp_enFor0[__i_enFor0]; result.allTags.push(t); } for (var __i_enFor1 = 0, __exp_enFor1 = this.svgPreview, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var meta = __exp_enFor1[__i_enFor1]; var m = meta.copy(); result.svgPreview.push(m); } for (var __i_enFor2 = 0, __exp_enFor2 = this.imgPreview, __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var meta = __exp_enFor2[__i_enFor2]; var m = meta.copy(); result.imgPreview.push(m); } return result; } }); // $source: com/ibm/rave/library/framework/meta/internal/PreviewMeta /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** *
Preview metadata stores information about the bundle. It consists of preview properties as well as an array of tags.
*/ var com_ibm_rave_library_framework_meta_internal_PreviewMeta = rave['internal']['Declare']({ //_file : null, //_tags : null, //_format : null, constructor : function(file, tags, format) { this._file = file; this._tags = tags; this._format = format; }, file : function() { return this._file; }, tags : function() { return this._tags; }, copy : function() { var tag = []; for (var __i_enFor0 = 0, __exp_enFor0 = this.tags(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var t = __exp_enFor0[__i_enFor0]; tag.push(t); } var result = new com_ibm_rave_library_framework_meta_internal_PreviewMeta(this._file, tag, this._format); return result; } }); // $source: com/ibm/rave/library/datamodel/internal/DataModelDescriptorImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/datamodel/internal/DataSetDescriptorImpl (runtime) // create /** * Implementation of the {@link DataModelDescriptor} . This is the only implementation of the interface used by VizLibrary. */ var com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl = rave['internal']['Declare']({ /** * The id, set in the constructor */ //_id : null, /** * The label, set in the constructor */ //_label : null, /** * The descriptor, set in the constructor */ //_description : null, /** * The tags, set in the constructor; never null, empty array if no tags defined */ //_tags : null, /** * The data sets, set in the constructor; never null, empty array if no sets defined */ //_dataSets : null, /** * Map from set name to index */ //_setIndexes : null, /** * Localization strings */ //_messages : null, /** * Private constructor used by factory methods. The data sets array is allocated but empty. * @param (String) id The id * @param (String) label The label * @param (String) description The description * @param (Array) tags The array of tags */ constructor : function(id, label, description, tags) { this._id = id; this._label = label; this._description = description; this._tags = tags; this._dataSets = []; this._setIndexes = {}; }, /** * Processes all data slot configurations from the configuration file, setting slots to be hidden and limiting their types if the model id matches this model and the set ids match any of the datasets for this model. * @param (Array) dataSlotConfigs The JSONArray of data slot configurations * @return (com.ibm.rave.library.datamodel.DataModelDescriptor) this DataModelDescriptor */ configure : function(dataSlotConfigs) { for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var dataSet = __exp_enFor0[__i_enFor0]; (dataSet).clearConfiguration(); } for (var __i_enFor1 = 0, __exp_enFor1 = dataSlotConfigs, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var configObj = __exp_enFor1[__i_enFor1]; var config = configObj; if (this._id == config["dataModelId"]) { for (var __i_enFor2 = 0, __exp_enFor2 = this._dataSets, __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var dataSet = __exp_enFor2[__i_enFor2]; if (dataSet.id() == config["dataSetId"]) { (dataSet).configure(config); } } } } return this; }, /** * Set the message registry for displaying the data in the current locale. * @param (com.ibm.rave.library.i18n.MessagesRegistry) messages - the MessagesRegistry */ setMessages : function(messages) { this._messages = messages; for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var set = __exp_enFor0[__i_enFor0]; (set).setMessages(messages); } }, /** @expose */ id : function() { return this._id; }, /** @expose */ label : function() { if (!this._messages) { return this._label; } return this._messages._nls(this._label, this._label); }, /** @expose */ description : function() { if (!this._messages) { return this._description; } return this._messages._nls(this._description, this._description); }, /** @expose */ tags : function() { if (!this._messages) { return this._tags; } var msgTags = []; for (var __i_enFor0 = 0, __exp_enFor0 = this._tags, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var tag = __exp_enFor0[__i_enFor0]; msgTags.push(this._messages._nls(tag, tag)); } return msgTags; }, /** @expose */ dataSets : function() { return this._dataSets; }, copy : function() { var descriptor = new com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl(this._id, this._label, this._description, this._tags); var ct = 0; for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var desc = __exp_enFor0[__i_enFor0]; descriptor._dataSets.push(desc.copy()); descriptor._setIndexes[desc.id()] = ct++; } descriptor.setMessages(this._messages); return descriptor; }, /** * @param (String) dataSetId A set identifier * @return (Number) Index of that set in the descriptor array, or -1 if not defined */ dataSetIndex : function(dataSetId) { return this._setIndexes[dataSetId]; } }); /** * Create the data model description from the JSON, which conforms to the schema for data models. This code assumes that the JSON has been checked against that schema and is valid (all required fields present, no illegal types or enum values, etc.). * @param (Object) json Description of data model */ com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl.create = function(json) { var id = (json["id"]); var label = (json["label"]); var description = (json["description"]); var tags = []; var a = json["tags"]; if (a) { var l = a.length; for (var i = 0; i < l; ++i) { tags.push(""+(a[i])); } } var dmd = new com_ibm_rave_library_datamodel_internal_DataModelDescriptorImpl(id, label, description, tags); a = json["datasets"]; if (a) { var l = a.length; for (var i = 0; i < l; ++i) { var set = com_ibm_rave_library_datamodel_internal_DataSetDescriptorImpl.create(a[i]); dmd._dataSets.push(set); dmd._setIndexes[set._id] = i; } } return dmd; }; // $source: com/ibm/rave/library/datamodel/DataSetDescriptor /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** *Metadata describing a data set within a {@link (com.ibm.rave.library.datamodel.DataModelDescriptor) DataModelDescriptor} . The data set represents a collection of related data. The data set properties include the id, label, description, icon, tags, type, cardinality, and data slots (see {@link (com.ibm.rave.library.datamodel.DataSlotDescriptor) DataSlotDescriptor} ).
The type indicates what type of data is expected to be bound to this data set using {@link (com.ibm.rave.library.datamodel.DataModel) DataModel} . The data type is not checked when data is bound, but if the wrong type of data is bound an error will be raised when the chart is run. The supported types are integer constants in this file.
*/ var com_ibm_rave_library_datamodel_DataSetDescriptor = rave_library_externs["DataSetDescriptor"] = rave['internal']['Declare']({ /** * The id is neither translatable nor intended for display to users. It identifies the data set within a model and is unique within the model. The id will never be null (it is a required property of the schema). * @return (String) Data set id */ /** @expose */ id : function() {}, /** * The label is a translatable string that names or labels the data set, for display to end-users. The label may be null. * @return (String) Data set label */ /** @expose */ label : function() {}, /** * The description is a translatable string with a brief description of the data set, for display to end-users. The description may be null. * @return (String) Data set description */ /** @expose */ description : function() {}, /** * The tags are an array of strings that give various categories or classifiers for the data set, for display to the end-users. If the data set has no tags, an empty array is returned. Do not modify the array or its contents. * @return (Array) Data set tags */ /** @expose */ tags : function() {}, /** * The icon is a reference to resources. TODO: What is the object type, and how would it be used by authors or integrators? * @return (Object) Data set icon. */ /** @expose */ icon : function() {}, /** * The cardinality is one of {@link this.DataSetDescriptor#"0..1"} or {@link this.DataSetDescriptor#"1"} and defines whether data must be bound to the data set. This is a required property of the schema and there is no default value. * @return (String) Data set cardinality */ /** @expose */ cardinality : function() {}, /** * The type is one of {@link this.DataSetDescriptor#"tabular"} or {@link this.DataSetDescriptor#"hierarchy"} , with other types to be implemented. This is a required property of the schema and there is no default value. * @return (String) Data set type */ /** @expose */ type : function() {}, /** * Perform a true deep copy of this descriptor, creating and copying the contents to the new one. * @return (com.ibm.rave.library.datamodel.DataSetDescriptor) A copy of this DataSetDescriptor */ /** @expose */ copy : function() {}, /** * The data slots are the data items of the data set. If the data set has no slots, an empty array is returned. Do not modify the array or its contents. * @return (Array) Data set data slots */ /** @expose */ dataSlots : function() {} }); /** * Data set cardinality 0..1. The set takes 0 or 1 value, so is optional and does not have to be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSetDescriptor.OPTIONAL = "0..1"; /** * Data slot cardinality 1. The slot takes 1 value, so is required and must be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSetDescriptor.REQUIRED = "1"; /** * Data set type tabular. The Object bound to the data set with {@link this.DataModel#this.setData(String, Object)} must be an array of objects. Data slots in the data set are accessors to the objects in that array. */ /** @expose */ com_ibm_rave_library_datamodel_DataSetDescriptor.TABULAR = "tabular"; /** * Data set type hierarchy. The Object bound to the data set with {@link this.DataModel#this.setData(String, Object)} is a hierarchical structure. The use of data slots in this type of data set is being developed. */ /** @expose */ com_ibm_rave_library_datamodel_DataSetDescriptor.HIERARCHY = "hierarchy"; // $source: com/ibm/rave/library/datamodel/DataSlotDescriptor /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** *Metadata describing a data slot within a {@link (com.ibm.rave.library.datamodel.DataSetDescriptor) DataSetDescriptor} . The data slot properties include the id, label, description, icon, tags, permitted data types, and cardinality.
The data types and cardinality are integer constants defined in this class, and determine the types and number of accessors which may be bound to the slot.
*/ var com_ibm_rave_library_datamodel_DataSlotDescriptor = rave_library_externs["DataSlotDescriptor"] = rave['internal']['Declare']({ /** * The id is neither translatable nor intended for display to users. It identifies the data slot within a data set and is unique within the data set. The id is never null (it is a required property in the schema). * @return (String) Slot id */ /** @expose */ id : function() {}, /** * The label is a translatable string that names or labels the data slot, for display to end-users. The label may be null. * @return (String) Slot label */ /** @expose */ label : function() {}, /** * The description is a translatable string with a brief description of the data slot, for display to end-users. The description may be null. * @return (String) Slot description */ /** @expose */ description : function() {}, /** * The tags are an array of strings that give various categories or classifiers for the data slot, for display to the end-users. If the slot has no tags, an empty array is returned. Do not modify the array or its contents. * @return (Array) Slot tags */ /** @expose */ tags : function() {}, /** * The icon is a reference to resources. TODO: What is the object type, and how would it be used by authors or integrators? * @return (String) Slot icon. */ /** @expose */ icon : function(type) {}, /** * The cardinality is one of {@link this.DataSlotDescriptor#"0..1"} , {@link this.DataSlotDescriptor#"1"} , {@link this.DataSlotDescriptor#"0..n"} , or {@link this.DataSlotDescriptor#"1..n"} and defines how many data values may/must be set in the data slot. This is a required property of the schema and there is no default value. * @return (String) Slot cardinality */ /** @expose */ cardinality : function() {}, /** * Check if the slot is required, with cardinality {@link this.DataSlotDescriptor#"1"} or {@link this.DataSlotDescriptor#"1..n"} * @return (boolean) Whether the slot has required cardinality */ /** @expose */ isRequired : function() {}, /** * Check if the slot allows multiple values, with cardinality {@link this.DataSlotDescriptor#"0..n"} or {@link this.DataSlotDescriptor#"1..n"} * @return (boolean) Whether the slot has multiple cardinality */ /** @expose */ isMultiple : function() {}, /** * Check if the slot is hidden by the configuration. If so, it will be null and have no accessor. * @return (boolean) Whether the slot has multiple cardinality */ /** @expose */ isHidden : function() {}, /** * The data types are {@link this.DataSlotDescriptor#"numeric"} , {@link this.DataSlotDescriptor#"string"} , {@link this.DataSlotDescriptor#"date"} , {@link this.DataSlotDescriptor#"object"} , and {@link this.DataSlotDescriptor#"array"} . The data slot can be set to any of the types in the array. Setting it to any other type will raise an error. This is a required property of the schema and must have at least one item, so the returned array will never be empty. Do not modify the array or its contents. * @return (Array) Allowed data types */ /** @expose */ dataTypes : function() {}, /** * Create a new DataSlot and perform a deep copy into it * @return (com.ibm.rave.library.datamodel.DataSlotDescriptor) A copy of this DataSlotDescriptor */ /** @expose */ copy : function() {} }); /** * Data slot cardinality 0..1. The slot takes 0 or 1 value, so is optional and does not have to be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.OPTIONAL = "0..1"; /** * Data slot cardinality 1. The slot takes 1 value, so is required and must be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.REQUIRED = "1"; /** * Data slot cardinality 0..n. The slot takes any number of values, and does not have to be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.MULTIPLE = "0..n"; /** * Data slot cardinality 1..n. The slot takes any number of values, and must be set in order to use the model. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.MULTIPLE_REQUIRED = "1..n"; /** * Data slot type numeric. The slot accessor returns a numeric value (Java Number) and nulls are allowed. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.NUMERIC = "numeric"; /** * Data slot type string. The slot accessor returns a string value (Java String) and nulls are allowed. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.STRING = "string"; /** * Data slot type date. The slot accessor returns a date value (Java {@link IDate} ) and nulls are allowed. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.DATE = "date"; /** * Data slot type object. The slot accessor returns an object value (Java Object) and nulls are allowed. Requirements for the object are documented by the bundle. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.OBJECT = "object"; /** * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.ARRAY = "array"; /** * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.IMAGE = "image"; /** * Data slot type array. The slot accessor returns an array value (Java List or ArrayEx) and nulls are allowed. Requirements for the array elements are documented by the bundle. */ /** @expose */ com_ibm_rave_library_datamodel_DataSlotDescriptor.SVG = "svg"; // $source: com/ibm/rave/library/datamodel/internal/DataModelImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/datamodel/internal/DataSetImpl (runtime) // new //@import com/ibm/rave/library/Library (runtime) // error //@import com/ibm/rave/library/service/LibraryError (runtime) // create /** *Implementation of the data model API. Instances are created by the Controller when an integrator or author requests a data model. The model is constructed with a {@link DataModelDescriptor} which defines the data sets and data slots of the model.
In addition to the public API methods, the model has a data-changed flag which is set true when any of the data sets, slots, or entries change. I {@link #this.dataUpdated()} returns the value, and {@link #this.dataUpdated()} can be used to clear it. */ var com_ibm_rave_library_datamodel_internal_DataModelImpl = rave['internal']['Declare']({ /** * The data descriptor of the model. */ //_descriptor : null, /** * The data sets of the model */ //_dataSets : null, /** * Whether the data has been changed */ _dataChanged : false, /** *
Construct the model from a descriptor.
* @param (com.ibm.rave.library.datamodel.DataModelDescriptor) descriptor Descriptor, may not be null */ constructor : function(descriptor) { this._descriptor = descriptor; this._dataChanged = false; this._dataSets = []; for (var __i_enFor0 = 0, __exp_enFor0 = descriptor.dataSets(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var dsd = __exp_enFor0[__i_enFor0]; this._dataSets.push(new com_ibm_rave_library_datamodel_internal_DataSetImpl(dsd, this)); } }, /** @expose */ error : function(error) { com_ibm_rave_library_Library.error(error); }, /** @expose */ getDescriptor : function() { return this._descriptor; }, /** @expose */ dataset : function(dataSetId) { var ix = this._descriptor.dataSetIndex(dataSetId); if (ix == null) { this.error(com_ibm_rave_library_service_LibraryError.create(106, this._descriptor._id + "." + dataSetId)); return null; } return this._dataSets[ix]; }, /** @expose */ datasets : function() { return this._dataSets; }, /** @expose */ validate : function() { var OK = true; for (var __i_enFor0 = 0, __exp_enFor0 = this._dataSets, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var ds = __exp_enFor0[__i_enFor0]; if (!((ds).validate())) { OK = false; } } return OK; }, /** @expose */ dataslot : function(dataSetId, dataSlotId) { var dataSet = this.dataset(dataSetId); return dataSet ? dataSet.slot(dataSlotId) : null; }, /** @expose */ setData : function(dataSetId, data) { var dataSet = this.dataset(dataSetId); if (dataSet) { dataSet.data(data); return true; } return false; }, /** @expose */ clearData : function(dataSetId) { var dataSet = this.dataset(dataSetId); if (dataSet) { dataSet.clear(); return true; } return false; }, /** @expose */ getData : function(dataSetId) { var dataSet = this.dataset(dataSetId); return dataSet ? dataSet.data() : null; }, setDataSlot$0 : function(dataSetId, dataSlotId, type, accessor, domain) { var slot = this.dataslot(dataSetId, dataSlotId); if (!slot) { return -1; } var entry = slot.push().type$1(type).accessor$1(accessor).domain$1(domain); if (!(entry.isValid())) { return -1; } return slot.size() - 1; }, setDataSlot$1 : function(dataSetId, dataSlotId, type, accessor) { return this.setDataSlot$0(dataSetId, dataSlotId, type, accessor, null); }, /** @expose */ clearDataSlot : function(dataSetId, dataSlotId) { var slot = this.dataslot(dataSetId, dataSlotId); if (slot) { slot.clear(); return true; } return false; }, /** @expose */ getDataSlotValue : function(dataSetId, dataSlotId) { var slot = this.dataslot(dataSetId, dataSlotId); return slot ? slot.entry() : null; }, /** @expose */ getDataSlotValues : function(dataSetId, dataSlotId) { var slot = this.dataslot(dataSetId, dataSlotId); return slot ? slot.entries() : null; }, /** * Record that the data has changed. This is called by the data sets, slots, and entries belonging to the model. */ dataModelDataChanged : function() { this._dataChanged = true; }, /** * @return (boolean) The value of the data-changed flag */ dataUpdated$0 : function() { return this._dataChanged; }, /** * @param (boolean) b The new value of the data-changed flag */ dataUpdated$1 : function(b) { this._dataChanged = b; }, /** @expose */ setDataSlot : function(a0, a1, a2, a3, a4) { var args = arguments; if (args.length == 4) { return this.setDataSlot$1(a0, a1, a2, a3); } return this.setDataSlot$0(a0, a1, a2, a3, a4); }, dataUpdated : function(a0) { var args = arguments; if (args.length == 0) { return this.dataUpdated$0(); } return this.dataUpdated$1(a0); } }); // $source: com/ibm/rave/library/datamodel/internal/DataSetImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/datamodel/internal/DataSlotImpl (runtime) // new //@import com/ibm/rave/library/service/LibraryError (runtime) // create /** * Internal implementation of the {@link (com.ibm.rave.library.datamodel.DataSet) DataSet} API. */ var com_ibm_rave_library_datamodel_internal_DataSetImpl = rave['internal']['Declare']({ /** * The data model containing this entry */ //_dataModel : null, /** * The descriptor */ //_descriptor : null, /** * The array of data slots */ //_slots : null, /** * The data set location "modelId.dataSetId" used for error reporting */ //_errorLocation : null, /** * The data */ //_data : null, /** * Construct a data set. No arguments may be null. * @param (com.ibm.rave.library.datamodel.DataSetDescriptor) descriptor Descriptor for the data set * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this data set */ constructor : function(descriptor, dataModel) { this._dataModel = dataModel; this._descriptor = descriptor; this._slots = []; for (var __i_enFor0 = 0, __exp_enFor0 = descriptor.dataSlots(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var slotDescriptor = __exp_enFor0[__i_enFor0]; this._slots.push(new com_ibm_rave_library_datamodel_internal_DataSlotImpl(slotDescriptor, this._dataModel, this)); } this._errorLocation = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + this._descriptor._id; }, /** @expose */ descriptor : function() { return this._descriptor; }, /** @expose */ slot : function(dataSlotId) { var ix = this._descriptor.dataSlotIndex(dataSlotId); if (ix == null) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(107, this._errorLocation + "." + dataSlotId)); return null; } return this._slots[ix]; }, /** @expose */ slots : function() { return this._slots; }, data$0 : function() { return this._data; }, data$1 : function(data) { if (data != null) { this._data = data; this._dataModel.dataModelDataChanged(); } return this; }, /** @expose */ clear : function() { this._data = null; this._dataModel.dataModelDataChanged(); return this; }, /** * Validate the data set. If it is required and does not have data, an error is reported. Each data slot is also validated. * @return (boolean) True if the data set and all slots are valid, false otherwise */ validate : function() { var OK = true; if ("1" == this._descriptor._cardinality && this._data == null) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(109, this._errorLocation)); OK = false; } for (var __i_enFor0 = 0, __exp_enFor0 = this._slots, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var ds = __exp_enFor0[__i_enFor0]; if (!((ds).validate())) { OK = false; } } return OK; }, /** @expose */ data : function(a0) { var args = arguments; if (args.length == 0) { return this.data$0(); } return this.data$1(a0); } }); // $source: com/ibm/rave/library/datamodel/internal/DataSlotImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/datamodel/internal/DataSlotEntryImpl (runtime) // new //@import com/ibm/rave/library/service/LibraryError (runtime) // create /** * Implementation of the {@link DataSlot} API. */ var com_ibm_rave_library_datamodel_internal_DataSlotImpl = rave['internal']['Declare']({ /** * The data model containing this entry */ //_dataModel : null, /** * The data set containing this entry */ //_dataSet : null, /** * The descriptor */ //_descriptor : null, /** * The array of entries */ //_entries : null, /** * The data slot location "modelId.dataSetId.dataSlotId" used for error reporting */ //_errorLocation : null, /** * Override label for data slot (used when meta label from descriptor is not useful) */ //_overrideLabel : null, /** * Construct a data slot. No arguments may be null. * @param (com.ibm.rave.library.datamodel.DataSlotDescriptor) descriptor Descriptor for the data slot * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this slot * @param (com.ibm.rave.library.datamodel.internal.DataSetImpl) dataSet Data set containing this slot */ constructor : function(descriptor, dataModel, dataSet) { this._descriptor = descriptor; this._dataModel = dataModel; this._dataSet = dataSet; this._entries = []; this._errorLocation = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + (this._dataSet ? this._dataSet.descriptor().id() : "null") + "." + this._descriptor._id; if ((descriptor).isRequired()) { var defaultType = descriptor.dataTypes()[0]; this._entries.push(new com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl(this._descriptor, this._dataModel, this._dataSet, this, 0).type$1(defaultType).accessor$1(com_ibm_rave_library_datamodel_internal_DataSlotImpl.makeDefaultAccessor(descriptor.id(), defaultType))); } }, overrideLabel$0 : function(label) { this._overrideLabel = label; }, overrideLabel$1 : function() { return this._overrideLabel; }, /** @expose */ descriptor : function() { return this._descriptor; }, /** @expose */ push : function() { if (!(this._descriptor.isMultiple())) { this.clear(); } var e = new com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl(this._descriptor, this._dataModel, this._dataSet, this, this._entries.length); if (!(this._descriptor._hidden)) { this._entries.push(e); this._dataModel.dataModelDataChanged(); } return e; }, /** @expose */ size : function() { return this._entries.length; }, /** @expose */ entries : function() { return this._entries; }, entry$0 : function() { return this._entries.length > 0 ? this._entries[0] : null; }, entry$1 : function(index) { return this._entries.length > index ? this._entries[index] : null; }, /** @expose */ clear : function() { this._entries.length = 0; this._dataModel.dataModelDataChanged(); return this; }, /** * Validate the data slot. If it is required and does not have entries, an error is reported. Each data entry is also validated. * @return (boolean) True if the data slot and all entries are valid, false otherwise */ validate : function() { var OK = true; if (this._descriptor.isRequired() && this._entries.length == 0) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(110, this._errorLocation)); OK = false; } for (var __i_enFor0 = 0, __exp_enFor0 = this._entries, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var entry = __exp_enFor0[__i_enFor0]; if (!((entry).validate())) { OK = false; } } return OK; }, /** @expose */ overrideLabel : function(a0) { var args = arguments; if (args.length == 0) { return this.overrideLabel$1(); } return this.overrideLabel$0(a0); }, /** @expose */ entry : function(a0) { var args = arguments; if (args.length == 0) { return this.entry$0(); } return this.entry$1(a0); } }); com_ibm_rave_library_datamodel_internal_DataSlotImpl.makeDefaultAccessor = function(dataslotId, type) { if ("numeric" == type) { return function(data) { if (data == null) { return null; } var v = (data)[dataslotId]; return v == null ? null : + (v); }; } if ("string" == type) { return function(data) { if (data == null) { return null; } var v = (data)[dataslotId]; return v == null ? null : ""+(v); }; } if ("date" == type) { return function(data) { if (data == null) { return null; } var v = (data)[dataslotId]; return v == null ? null : new Date(v); }; } return function(data) { return data == null ? null : (data)[dataslotId]; }; }; // $source: com/ibm/rave/library/datamodel/internal/DataSlotEntryImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2018 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/service/LibraryError (runtime) // create /** *Implementation of the {@link DataSlotEntry} API.
In order to keep the original data model API while still allowing chained setters, the entry has a flag that is set when an invalid value is provided to a setter.
*/ var com_ibm_rave_library_datamodel_internal_DataSlotEntryImpl = rave['internal']['Declare']({ /** * The data model containing this entry */ //_dataModel : null, /** * The data set containing this entry */ //_dataSet : null, /** * The data slot containing this entry */ //_dataSlot : null, /** * The descriptor for the slot containing this entry */ //_descriptor : null, /** * The data slot location "modelId.dataSetId.dataSlotId[entryIndex]". */ //_qualifiedId : null, /** * The type */ //_type : null, /** * The accessor function */ //_accessor : null, /** * The domain */ //_domain : null, /** * The sub domain division, 10 ^ _subDomainMagnitude */ //_subDomainMagnitude : null, /** * The label */ //_label : null, /** * The unit */ //_unit : null, /** * The position index of this data slot entry within it's parent data slot. */ _dataSlotIndex : 0, /** * Set true when a bad value is provided to a setter */ _badValue : false, _$functionClassMethod : function() { var _$self = function(data) { return _$self._accessor ? _$self._accessor(data) : null; }; return _$self; }, /** * Construct; the type, accessor, and domain are undefined. * @param (com.ibm.rave.library.datamodel.internal.DataSlotDescriptorImpl) descriptor Descriptor of the slot * @param (com.ibm.rave.library.datamodel.internal.DataModelImpl) dataModel Data model containing this entry * @param (com.ibm.rave.library.datamodel.internal.DataSetImpl) dataSet Data set containing this entry * @param (com.ibm.rave.library.datamodel.internal.DataSlotImpl) dataSlot Data slot containing this entry * @param (int) index The position index of this entry in its parent data slot. */ constructor : function(descriptor, dataModel, dataSet, dataSlot, index) { this._dataModel = dataModel; this._dataSet = dataSet; this._dataSlot = dataSlot; this._dataSlotIndex = index; this._descriptor = descriptor; this._qualifiedId = (this._dataModel ? this._dataModel._descriptor.id() : "null") + "." + (this._dataSet ? this._dataSet.descriptor().id() : "null") + "." + (this._dataSlot ? this._dataSlot._descriptor.id() : "null") + "[" + this._dataSlotIndex + "]"; this._type = null; this._accessor = null; this._domain = null; this._label = null; this._unit = null; this._badValue = false; this._subDomainMagnitude = null; }, /** @expose */ dataModel : function() { return this._dataModel; }, /** @expose */ dataSet : function() { return this._dataSet; }, /** @expose */ dataSlot : function() { return this._dataSlot; }, type$0 : function() { return this._type; }, type$1 : function(type) { if (type == null) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId)); this._badValue = true; } else if (!(this._descriptor.isValidType(type))) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(108, this._qualifiedId)); this._badValue = true; } else { this._type = type; this._dataModel.dataModelDataChanged(); } return this; }, accessor$0 : function() { return this._accessor; }, accessor$1 : function(accessor) { if (!accessor) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId)); this._badValue = true; } else { this._accessor = accessor; this._dataModel.dataModelDataChanged(); } return this; }, domain$0 : function() { return this._domain; }, /** @expose */ subDomainDivision : function() { return this._subDomainMagnitude; }, domain$1 : function(domain) { if (domain && domain.length == 0) { this._domain = null; } else { this._domain = domain; } this._dataModel.dataModelDataChanged(); return this; }, domain$2 : function(domain, subDomainDivision) { if (domain && domain.length == 0) { this._domain = null; } else { this._domain = domain; } this._subDomainMagnitude = subDomainDivision; this._dataModel.dataModelDataChanged(); return this; }, label$0 : function() { return this._label; }, label$1 : function(label) { this._label = label; this._dataModel.dataModelDataChanged(); return this; }, unit$0 : function() { return this._unit; }, unit$1 : function(unit) { this._unit = unit; this._dataModel.dataModelDataChanged(); return this; }, /** @expose */ isValid : function() { var b = !this._badValue; this._badValue = false; return b; }, /** @expose */ qualifiedId : function() { return this._qualifiedId; }, /** * Validate the data slot. If the required type or accessor is null, an error is reported. If the type is not valid for the slot, an error is reported. * @return (boolean) True if the entry is valid */ validate : function() { if (this._type == null || !this._accessor) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(111, this._qualifiedId)); return false; } if (!(this._descriptor.isValidType(this._type))) { this._dataModel.error(com_ibm_rave_library_service_LibraryError.create(108, this._qualifiedId)); return false; } return true; }, /** @expose */ type : function(a0) { var args = arguments; if (args.length == 0) { return this.type$0(); } return this.type$1(a0); }, /** @expose */ accessor : function(a0) { var args = arguments; if (args.length == 0) { return this.accessor$0(); } return this.accessor$1(a0); }, /** @expose */ domain : function(a0, a1) { var args = arguments; if (args.length == 0) { return this.domain$0(); } if (args.length == 1) { return this.domain$1(a0); } return this.domain$2(a0, a1); }, /** @expose */ label : function(a0) { var args = arguments; if (args.length == 0) { return this.label$0(); } return this.label$1(a0); }, /** @expose */ unit : function(a0) { var args = arguments; if (args.length == 0) { return this.unit$0(); } return this.unit$1(a0); } }); // $source: com/ibm/rave/library/framework/meta/internal/BundleConfigurationManager /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED //@import com/ibm/rave/library/framework/meta/internal/BundleConfigurationImpl (runtime) // new /** * Stores the ConfigurationImpl objects defined for a bundle. Configurations are defined by JSON files. */ var com_ibm_rave_library_framework_meta_internal_BundleConfigurationManager = rave['internal']['Declare']({ //_bundle : null, /** * The BundleInfo for the bundle that owns these configurations */ //_bundleInfo : null, /** * Map from id to defined configuration */ //_configMap : null, /** * List of all defined configurations */ //_configList : null, /** * Create the configuration manager. It has no configurations. */ constructor : function() { this._configMap = {}; this._configList = []; this._bundleInfo = null; }, /** * Set the BundleInfo of the bundle which owns this configuration manager. This is not done in the constructor to avoid a circular initialization issue in JS. * @param (com.ibm.rave.library.framework.BundleInfo) bundleInfo The bundle's info */ setBundleInfo : function(bundle, bundleInfo) { this._bundle = bundle; this._bundleInfo = bundleInfo; }, /** *Populate configurations from the given JSON, which may be a configuration schema. If it does not have a "configurations" property, nothing is done.
Otherwise, the "configuration" property is taken as an array of objects describing data models, as in the schema. If the object "id" is already defined, it is skipped (no overwrite of existing configurations). Otherwise a new Configuration for the object is created and added to the collection.
* @param (Object) json The configuration JSON, not null */ populate : function(json, messages) { var v = json["configurations"]; if (v == null) { return; } for (var __i_enFor0 = 0, __exp_enFor0 = v, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var o = __exp_enFor0[__i_enFor0]; if (o == null) { continue; } var meta = (o)["genericMeta"]; if (meta == null) { continue; } var id = ((meta)["id"]); if (id != null && !(this._configMap.hasOwnProperty(id))) { var config = new com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl(this._bundle, this._bundleInfo, o, messages); this._configMap[id] = config; this._configList.push(config); } } }, /** * Get the list of all defined configurations. The order is that in which configurations were defined. * @return (Array) List of configurations */ configurations : function() { return this._configList; }, /** * Get a configuration by ID. If the ID is not known, returns null. * @param (String) id Configuration ID * @return (com.ibm.rave.library.framework.meta.BundleConfiguration) Configuration, or null */ configuration : function(id) { return this._configMap[id]; } }); // $source: com/ibm/rave/library/framework/meta/internal/BundleConfigurationImpl /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2017 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ // GENERATED /** * Implementation of the BundleConfiguration. * @param < (java.lang.Object) S > */ var com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl = rave['internal']['Declare']({ /** * Configuration id */ //_id : null, /** * Configuration name */ //_label : null, /** * Configuration description */ //_description : null, /** * JSON of the configuration */ //_json : null, /** * Bundle that owns this configuration */ //_bundle : null, /** * Bundle information for the bundle that owns this configuration */ //_bundleInfo : null, /** * Non-renderable instance representing this configuration */ //_configInstance : null, /** * metadata for the instance, computed when first requested */ //_meta : null, //_previewsMeta : null, /** * List of visible property presentation IDs, computed when first requested */ //_propertyPresentations : null, /** * List of visible data models for the instance, computed when first requested */ //_dataModels : null, /** * List of modifications to dataSlots across dataModels */ //_dataSlots : null, /** * List of enabled actions for the instance, computed when first requested */ //_enabledActions : null, //_messages : null, /** * Construct the configuration from a JSON specification. The spec is non-null and assumed to conform to the schema. * @param (com.ibm.rave.library.framework.BundleInfo) bundleInfo The bundle info for the bundle that owns this configuration * @param (Object) json The configuration spec */ constructor : function(bundle, bundleInfo, json, messages) { this._json = json; this._bundle = bundle; this._bundleInfo = bundleInfo; this._messages = messages; var meta = json["genericMeta"]; this._id = (meta["id"]); this._label = (meta["label"]); this._description = (meta["description"]); this._configInstance = null; this._meta = null; this._previewsMeta = null; this._propertyPresentations = null; this._dataModels = null; this._enabledActions = null; }, /** @expose */ id : function() { return this._id; }, /** @expose */ name : function() { return this.label(); }, /** @expose */ label : function() { return (!this._bundle) ? this._label : this.info().meta().id("label"); }, /** @expose */ description : function() { return (!this._bundle) ? this._description : this.info().meta().id("description"); }, /** * @return (Object) The JSON of the configuration */ json : function() { return this._json; }, /** @expose */ toJSON : function() { var meta = this.meta(); var info = this.info(); var json = {}; json["bundleId"] = this._bundle._info.meta().id("id"); var ids = meta.ids(); for (var i = 0; i < ids.length; ++i) { json[ids[i]] = meta.id(ids[i]); } json["tags"] = this.convertStringArrayEx(meta.tags()); var preview = info.previews(); var imageMap = rave['internal']['ES6Map'].create(); var svgMap = rave['internal']['ES6Map'].create(); var a = []; var path; for (var __i_enFor0 = 0, __exp_enFor0 = preview.getAllTags(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var s = __exp_enFor0[__i_enFor0]; a.length = 0; a.push(s); path = preview.getPreview("image", a); if (!(imageMap.has(path))) { imageMap.set(path, []); } imageMap.get(path).push(s); path = preview.getPreview("svg", a); if (!(svgMap.has(path))) { svgMap.set(path, []); } svgMap.get(path).push(s); } var jPreviews = {}; json["previews"] = jPreviews; var images = []; var svg = []; jPreviews["images"] = images; jPreviews["svg"] = svg; for (var __i_enFor1 = 0, __exp_enFor1 = imageMap.entries(), __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var entry = __exp_enFor1[__i_enFor1]; var o = {}; images.push(o); o["file"] = entry.key; o["tags"] = entry.value; } for (var __i_enFor2 = 0, __exp_enFor2 = svgMap.entries(), __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var entry = __exp_enFor2[__i_enFor2]; var o = {}; svg.push(o); o["file"] = entry.key; o["tags"] = entry.value; } var jDataModels = []; json["dataModels"] = jDataModels; for (var __i_enFor3 = 0, __exp_enFor3 = info.dataModels(), __len_enFor3 = __exp_enFor3.length; __i_enFor3 < __len_enFor3; ++__i_enFor3) { var dm = __exp_enFor3[__i_enFor3]; var jDm = {}; jDataModels.push(jDm); jDm["id"] = dm.id(); jDm["label"] = dm.label(); jDm["description"] = dm.description(); jDm["tags"] = this.convertStringArrayEx(dm.tags()); var jDss = []; jDm["dataSets"] = jDss; for (var __i_enFor4 = 0, __exp_enFor4 = dm.dataSets(), __len_enFor4 = __exp_enFor4.length; __i_enFor4 < __len_enFor4; ++__i_enFor4) { var ds = __exp_enFor4[__i_enFor4]; var jDs = {}; jDss.push(jDs); jDs["id"] = ds.id(); jDs["label"] = ds.label(); jDs["description"] = ds.description(); jDs["cardinality"] = ds.cardinality(); jDs["type"] = ds.type(); jDs["tags"] = this.convertStringArrayEx(ds.tags()); var jDataSlots = []; jDs["dataSlots"] = jDataSlots; var slots = ds.dataSlots(); for (var __i_enFor5 = 0, __exp_enFor5 = slots, __len_enFor5 = __exp_enFor5.length; __i_enFor5 < __len_enFor5; ++__i_enFor5) { var dsD = __exp_enFor5[__i_enFor5]; var jSlot = {}; jDataSlots.push(jSlot); jSlot["id"] = dsD.id(); jSlot["label"] = dsD.label(); jSlot["description"] = dsD.description(); jSlot["cardinality"] = dsD.cardinality(); var o = {}; jSlot["icon"] = o; o["image"] = dsD.icon("image"); o["svg"] = dsD.icon("svg"); jSlot["dataTypes"] = this.convertStringArrayEx(dsD.dataTypes()); jSlot["tags"] = this.convertStringArrayEx(dsD.tags()); } } } var ap = info.properties(); var properties = rave['internal']['ES6Map'].create(); for (var __i_enFor6 = 0, __exp_enFor6 = ap, __len_enFor6 = __exp_enFor6.length; __i_enFor6 < __len_enFor6; ++__i_enFor6) { var p = __exp_enFor6[__i_enFor6]; properties.set(p.id(), p); } var jPps = []; json["propertyPresentations"] = jPps; for (var __i_enFor7 = 0, __exp_enFor7 = info.propertyPresentations(), __len_enFor7 = __exp_enFor7.length; __i_enFor7 < __len_enFor7; ++__i_enFor7) { var pp = __exp_enFor7[__i_enFor7]; var o = {}; jPps.push(o); o["id"] = pp.id(); o["name"] = pp.name(); o["description"] = pp.description(); o["tags"] = this.convertStringArray(pp.tags()); this.toJsonPresentationItems(properties, o, pp.presentationItems()); } return json; }, toJsonPresentationItems : function(properties, parent, items) { if (items.length > 0) { var array = []; parent["presentationItems"] = array; for (var i = 0; i < items.length; ++i) { var object = {}; array.push(object); if (items[i].type().localeCompare("reference") == 0) { var p = properties.get(items[i].id()); if (p) { var property = {}; object["property"] = property; property["id"] = items[i].id(); property["name"] = p.name(); property["description"] = p.description(); property["type"] = p.type(); property["defaultValue"] = p.defaultValue(); property["required"] = p.required(); property["resetView"] = p.resetView(); property["tags"] = this.convertStringArrayEx(p.tags()); } } else if (items[i].type().localeCompare("group") == 0) { var group = {}; object["propertyGroup"] = group; group["id"] = items[i].id(); group["name"] = items[i].name(); group["description"] = items[i].description(); group["tags"] = this.convertStringArray(items[i].tags()); this.toJsonPresentationItems(properties, group, items[i].presentationItems()); } } } }, /** * TODO: Currently used only for testing, so no messages are passed to the configure call. If this is ever used in production code, messages will have to be passed to the meta.configure call! */ /** @expose */ meta : function() { if (!this._bundle) { if (!this._meta) { this._meta = (this._bundleInfo.meta()).copy(); (this._meta).populate(this._json); (this._meta)._messages = (this._bundleInfo.meta())._messages; } return this._meta; } else { return this.info().meta(); } }, previews : function() { if (!this._previewsMeta) { this._previewsMeta = (this._bundleInfo.previews()).copy(); this._previewsMeta.configure(this._json); } return this._previewsMeta; }, /** @expose */ propertyPresentations : function() { if (!this._propertyPresentations) { this._propertyPresentations = []; var hidden = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["propertyPresentations"], "hidden", true); for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.propertyPresentations(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var pp = __exp_enFor0[__i_enFor0]; if (!(hidden.hasOwnProperty((pp).id()))) { this._propertyPresentations.push((pp).id()); } } } return this._propertyPresentations; }, /** @expose */ dataModels : function() { if (!this._dataModels) { this._dataModels = []; var hidden = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["datamodels"], "hidden", true); for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.dataModels(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var dmd = __exp_enFor0[__i_enFor0]; if (!(hidden.hasOwnProperty(dmd.id()))) { this._dataModels.push(dmd.id()); } } } return this._dataModels; }, /** @expose */ dataSlots : function() { if (!this._dataSlots) { this._dataSlots = this._json["dataSlots"]; } return this._dataSlots; }, /** @expose */ enabledActions : function() { if (!this._enabledActions) { this._enabledActions = []; var disabled = com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet(this._json["actions"], "enabled", false); for (var __i_enFor0 = 0, __exp_enFor0 = this._bundleInfo.actions(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var a = __exp_enFor0[__i_enFor0]; if (!(disabled.hasOwnProperty(a.id()))) { this._enabledActions.push(a.id()); } } } return this._enabledActions; }, /** * Return BundleInfo specific to this configuration. This information is populated 'on demand' when requested from the configuration. In general, this will be a subset of the information contained in the bundle (i.e. _bundleInfo) * @return (com.ibm.rave.library.framework.BundleInfo) BundleInfo specific to this configuration */ /** @expose */ info : function() { if (!this._bundle) { return null; } if (!this._configInstance) { this._configInstance = this._bundle.create(this._id, false); } return this._configInstance.info(); }, convertStringArrayEx : function(a) { var r = []; for (var __i_enFor0 = 0, __exp_enFor0 = a, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var s = __exp_enFor0[__i_enFor0]; r.push(s); } return r; }, convertStringArray : function(a) { var r = []; for (var __i_enFor0 = 0, __len_enFor0 = a.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var s = a[__i_enFor0]; r.push(s); } return r; } }); /** * Traverse the array which may be null or empty. The objects have a string "id" property, and may have a boolean key property. Collect the IDs of all objects which have the given value as key. * @param (Array) array JSON array * @param (String) key Boolean-valued property * @param (boolean) value Whether the key must be true or false * @return (Object) Set of IDs for which the key has the given value */ com_ibm_rave_library_framework_meta_internal_BundleConfigurationImpl.makeIdSet = function(array, key, value) { var result = {}; if (array) { for (var __i_enFor0 = 0, __exp_enFor0 = array, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var o = __exp_enFor0[__i_enFor0]; if (o != null) { var id = ((o)["id"]); var v = ((o)[key] != null) ? ((o)[key]) : null; if (id != null && v != null && v == value) { result[id] = 1; } } } } return result; }; // $source: com/ibm/rave/library/internal/nativeImpl/LoaderNativeUtils /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2015 ** ** The source code for this program is not published or otherwise divested of its trade secrets, ** irrespective of what has been deposited with the U.S. Copyright Office. ************************************************************************/ //@import com/ibm/rave/library/service/LibraryError (runtime) // new var com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils = (function () { /* no code, all static */ }); /** @expose */ com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundleCode = function( /* String */ uri, /* list of string uris in prerequisite order */ dependencies, /* LibraryError.ReportError */ errorReporter) { com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadPrerequisites(uri, dependencies, errorReporter); }; com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundle = function( /* String */ uri, /* LibraryError.ReportError */ errorReporter) { insertScript(uri, null, // On successful load, errorReporter with no error function() { errorReporter(null); }, // On failure load, errorReporter with the error message function(e) { com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri); } ); }; com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadPrerequisites = function( /* String */ uri, /* list of string uris in prerequisite order */ dependencies, /* LibraryError.ReportError */errorReporter) { // recursive load function load(index) { // bottom of the dependencies stack if (!dependencies || dependencies.length == index){ com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundle(uri,errorReporter ); return; } insertScript(dependencies[index], false, function() { load(index + 1); }, // On failure load, errorReporter with the error message function(e) { com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri); } ); } load(0); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.loadBundleStylesheet = function( /*String*/ uri, /*LibraryError.ReportError*/ errorReporter) { // Add a tag to the document, otherwise similar to loading the code var link = document.createElement("link"); link.setAttribute("rel", "stylesheet"); link.setAttribute("href", uri); link.onload = function() { errorReporter(null); }; link.onerror = function(e) { com_ibm_rave_library_Library.logError(com_ibm_rave_library_service_LibraryError.BUNDLE_LOAD_ERROR, "loading " + uri); }; document.head.appendChild(link); }; /** @expose */ com_ibm_rave_library_internal_nativeImpl_LoaderNativeUtils.getMessagesPath = function( /*String*/ locale, /*String*/ url) { return url + "/i18n/messages_" + locale + ".json"; }; var _cachedScripts = []; function insertScript(src, async, onLoadFunction, onErrorFunction) { var cachedScript = _cachedScripts[src]; if (!cachedScript) { // cache the entry _cachedScripts[src] = {status: "loading", onload: [onLoadFunction], onerror: [onErrorFunction]}; // wrap the onLoad and onError var onload = function() { // mark script as loaded var cached = _cachedScripts[src]; cached.status = "loaded"; // run all onLoad functions associated with this script, then remove from stack while (cached.onload.length > 0) { cached.onload.pop()(); } }; var onerror = function() { // mark script as error var cached = _cachedScripts[src]; cached.status = "error"; // run all onError functions associated with this script, then remove from stack while (cached.onerror.length > 0) { cached.onerror.pop()(); } }; // insert script createScriptNode(src, async, onload, onerror); } else { if (cachedScript.status == "loaded") { // the script loaded successfully, run the onLoad function onLoadFunction(); } else if (cachedScript.status == "loading") { // the cached script is still loading, save the onLoad and onError functions cachedScript.onload.push(onLoadFunction); cachedScript.onerror.push(onErrorFunction); } else if (cachedScript.status == "error") { // the script didn't load, run the onError function onErrorFunction(); } } }; function createScriptNode(uri, async, onLoadFunction, onErrorFunction) { // Add a