(function() { // During the rave-canvas.js build, this file is added to the top. // Create an inner self-executing function that will be run with the global scope // On browsers, this is 'window'. Everywhere else should use 'this' if available. // Need to run eval('this') "indirectly" by having eval returned by (1,eval). OBVIOUSLY :) var _window = (1, eval)('this'); (function (global, factory) { // dynamically determine how 'rave' variable should be loaded depeneding on loader type var _rave; if (typeof module === "object" && typeof module.exports === "object" && typeof require == "function") { // CommonJS/node.js module.exports = factory(global,require("rave")); } else if (typeof define === "function" && define.amd) { // AMD define(['rave'], function(rave) { return factory(global,rave); }); } else { // probably loading via script tag. run as is, setting stuff on rave factory(global,global['rave']); } }(_window, function (_global, _rave) {// $source: com/ibm/rave/core/canvas/internal/nativeImpl/ModuleHeader /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2014, 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. ************************************************************************/ // setup "use strict"; // _global and _rave are initialized in the wrapping rave-canvas.js-header.js code /** @expose */ var global = typeof _global !== "undefined" ? _global : (1, eval)('this'); var rave = typeof _rave !== "undefined" ? _rave : global['rave']; var window = global; var rave_externs={}, com_ibm_rave_core_Rave = rave, com_ibm_rave_core_nativeImpl_Declare = rave["_"]["com_ibm_rave_core_nativeImpl_Declare"], com_ibm_rave_core_nativeImpl_Object = rave["_"]["com_ibm_rave_core_nativeImpl_Object"], com_ibm_rave_core_internal_nativeImpl_Lang = rave["_"]["com_ibm_rave_core_internal_nativeImpl_Lang"], com_ibm_rave_core_geom_PointStruct = rave["_"]["com_ibm_rave_core_geom_PointStruct"], com_ibm_rave_core_geom_RectStruct = rave["internal"]["RectStruct"], com_ibm_rave_core_geom_RaveRect = rave["internal"]["RaveRect"], com_ibm_rave_core_transform_MatrixUtil = rave["internal"]["MatrixUtil"], com_ibm_rave_core_scene_SceneNodeType = rave["_"]["com_ibm_rave_core_scene_SceneNodeType"], com_ibm_rave_core_internal_css_CSSUtil = rave["_"]["com_ibm_rave_core_internal_css_CSSUtil"], com_ibm_rave_core_internal_css_CSSTransformParser = rave["_"]["com_ibm_rave_core_internal_css_CSSTransformParser"], com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl = rave["_"]["com_ibm_rave_core_internal_css_om_CSSStyleDeclarationImpl"], com_ibm_rave_core_internal_css_CSSParser = rave["_"]["com_ibm_rave_core_internal_css_CSSParser"], com_ibm_rave_core_context_RaveContextManager = rave["internal"]["RaveContextManager"], com_ibm_rave_core_context_RaveOperationalMode = rave["internal"]["RaveOperationalMode"], rave_document = rave["_"]["rave_document"]; // $source: com/ibm/rave/core/internal/util/CollectionsUtil /************************************************************************ ** 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_core_internal_util_CollectionsUtil = { //constructor : function() {} }; /** * Removes the value from the list. * @param (Array) list the list to remove the value from * @param (Object) value the value to remove * @return (boolean) true if the value was found in the list, false otherwise */ com_ibm_rave_core_internal_util_CollectionsUtil.remove = function(list, value) { var i = list.indexOf(value); if (i >= 0) { list.splice(i, 1); return true; } return false; }; // $source: com/ibm/rave/core/internal/css/CSSStyle /************************************************************************ ** 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_core_internal_css_CSSStyle = function(id, name, inheritable) { this.id = id; this.name = name; this.inheritable = inheritable; }; // $source: com/ibm/rave/core/internal/css/CSSConstants /************************************************************************ ** 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_core_internal_css_CSSConstants = { }; com_ibm_rave_core_internal_css_CSSConstants.TRANSFORM = "transform"; com_ibm_rave_core_internal_css_CSSConstants.ID = "id"; com_ibm_rave_core_internal_css_CSSConstants.IMPORTANT = "important"; com_ibm_rave_core_internal_css_CSSConstants.INITIAL = "initial"; com_ibm_rave_core_internal_css_CSSConstants.INHERIT = "inherit"; com_ibm_rave_core_internal_css_CSSConstants.NONE = "none"; com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT = "transparent"; com_ibm_rave_core_internal_css_CSSConstants.IN_PX = 96.0; com_ibm_rave_core_internal_css_CSSConstants.PT_IN = 0.0138888889; com_ibm_rave_core_internal_css_CSSConstants.PC_IN = 0.1666666667; com_ibm_rave_core_internal_css_CSSConstants.CM_IN = 0.3937007874; com_ibm_rave_core_internal_css_CSSConstants.MM_IN = 0.0393700787; com_ibm_rave_core_internal_css_CSSConstants.NORMAL = "normal"; com_ibm_rave_core_internal_css_CSSConstants.BOLD = "bold"; com_ibm_rave_core_internal_css_CSSConstants.OBLIQUE = "oblique"; com_ibm_rave_core_internal_css_CSSConstants.ITALIC = "italic"; com_ibm_rave_core_internal_css_CSSConstants.BOLDER = "bolder"; com_ibm_rave_core_internal_css_CSSConstants.LIGHTER = "lighter"; com_ibm_rave_core_internal_css_CSSConstants.SMALLCAPS = "small-caps"; // $source: com/ibm/rave/render/internal/properties/SceneNodeStyles /************************************************************************ ** 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 list of public style properties for scene nodes. These style attributes are also "presentation attributes", meaning they can be defined as a style (style="fill:red") or an attribute (fill="red"). */ var com_ibm_rave_render_internal_properties_SceneNodeStyles = { }; /** * Is the style represented by 'index' one that affects layout? For instance, x, y, etc styles all affect layout. * @param (int) index style index to search * @return (boolean) true if this index represents a 'layout' style, false otherwise. */ com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle = function(index) { return index <= 27; }; com_ibm_rave_render_internal_properties_SceneNodeStyles.x = 0; com_ibm_rave_render_internal_properties_SceneNodeStyles.y = 1; com_ibm_rave_render_internal_properties_SceneNodeStyles.width = 2; com_ibm_rave_render_internal_properties_SceneNodeStyles.height = 3; com_ibm_rave_render_internal_properties_SceneNodeStyles.x1 = 4; com_ibm_rave_render_internal_properties_SceneNodeStyles.x2 = 5; com_ibm_rave_render_internal_properties_SceneNodeStyles.r = 6; com_ibm_rave_render_internal_properties_SceneNodeStyles.y1 = 7; com_ibm_rave_render_internal_properties_SceneNodeStyles.y2 = 8; com_ibm_rave_render_internal_properties_SceneNodeStyles.cx = 9; com_ibm_rave_render_internal_properties_SceneNodeStyles.cy = 10; com_ibm_rave_render_internal_properties_SceneNodeStyles.transform = 11; com_ibm_rave_render_internal_properties_SceneNodeStyles.rx = 12; com_ibm_rave_render_internal_properties_SceneNodeStyles.ry = 13; com_ibm_rave_render_internal_properties_SceneNodeStyles.line_height = 14; com_ibm_rave_render_internal_properties_SceneNodeStyles.dx = 15; com_ibm_rave_render_internal_properties_SceneNodeStyles.dy = 16; com_ibm_rave_render_internal_properties_SceneNodeStyles.offset = 17; com_ibm_rave_render_internal_properties_SceneNodeStyles.fx = 18; com_ibm_rave_render_internal_properties_SceneNodeStyles.fy = 19; com_ibm_rave_render_internal_properties_SceneNodeStyles.font = 20; com_ibm_rave_render_internal_properties_SceneNodeStyles.font_family = 21; com_ibm_rave_render_internal_properties_SceneNodeStyles.font_size = 22; com_ibm_rave_render_internal_properties_SceneNodeStyles.font_style = 23; com_ibm_rave_render_internal_properties_SceneNodeStyles.font_weight = 24; com_ibm_rave_render_internal_properties_SceneNodeStyles.font_variant = 25; com_ibm_rave_render_internal_properties_SceneNodeStyles.display = 26; com_ibm_rave_render_internal_properties_SceneNodeStyles.text_anchor = 27; com_ibm_rave_render_internal_properties_SceneNodeStyles.LAYOUT_INDEX = 27; com_ibm_rave_render_internal_properties_SceneNodeStyles.fill = 28; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke = 29; com_ibm_rave_render_internal_properties_SceneNodeStyles.opacity = 30; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_width = 31; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_opacity = 32; com_ibm_rave_render_internal_properties_SceneNodeStyles.fill_opacity = 33; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dasharray = 34; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_dashoffset = 35; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linecap = 36; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_linejoin = 37; com_ibm_rave_render_internal_properties_SceneNodeStyles.stroke_miterlimit = 38; com_ibm_rave_render_internal_properties_SceneNodeStyles.text_decoration = 39; com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_color = 40; com_ibm_rave_render_internal_properties_SceneNodeStyles.stop_opacity = 41; com_ibm_rave_render_internal_properties_SceneNodeStyles.pointer_events = 42; com_ibm_rave_render_internal_properties_SceneNodeStyles.cursor = 43; com_ibm_rave_render_internal_properties_SceneNodeStyles.clip_path = 44; com_ibm_rave_render_internal_properties_SceneNodeStyles.visibility = 45; com_ibm_rave_render_internal_properties_SceneNodeStyles.text_shadow = 46; com_ibm_rave_render_internal_properties_SceneNodeStyles.shape_rendering = 47; com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames = ["x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "transform", "rx", "ry", "line-height", "dx", "dy", "offset", "fx", "fy", "font", "font-family", "font-size", "font-style", "font-weight", "font-variant", "display", "text-anchor", "fill", "stroke", "opacity", "stroke-width", "stroke-opacity", "fill-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "text-decoration", "stop-color", "stop-opacity", "pointer-events", "cursor", "clip-path", "visibility", "text-shadow", "shape-rendering"]; // $source: com/ibm/rave/render/internal/nodes/NodeUtil /************************************************************************ ** 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/render/internal/RendererConfiguration (runtime) // RendererConfiguration var com_ibm_rave_render_internal_nodes_NodeUtil = { }; /** * Find the referenced scene node matching the expected type. The search is performed from the root of the given context node. * @param (com.ibm.rave.core.scene.SceneNode) context the context node in which to search * @param (String) id the node ID to search for * @param (int[]) expectedTypes array of expected node types (of type from SceneNodeType) * @return (com.ibm.rave.core.scene.SceneNode) the matching scene node, or null if not found or expected type differs */ com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode = function(context, id, expectedTypes) { var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(context); if (id != null && rootProvider) { var cm = rootProvider.getCacheManager(); if (cm) { var match = cm.matchId(1000, id, rootProvider.getRoot()); if (match) { for (var __i_enFor0 = 0, __len_enFor0 = expectedTypes.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var expectedType = expectedTypes[__i_enFor0]; if (match.rave_getDrawType() == expectedType) { return match; } } } } } return null; }; // $source: com/ibm/rave/core/internal/svg/SVGConstants /************************************************************************ ** 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_core_internal_svg_SVGConstants = { }; com_ibm_rave_core_internal_svg_SVGConstants.ELLIPSE = "ellipse"; com_ibm_rave_core_internal_svg_SVGConstants.RECT = "rect"; com_ibm_rave_core_internal_svg_SVGConstants.CIRCLE = "circle"; com_ibm_rave_core_internal_svg_SVGConstants.LINE = "line"; com_ibm_rave_core_internal_svg_SVGConstants.TEXT = "text"; com_ibm_rave_core_internal_svg_SVGConstants.TEXTPATH = "textPath"; com_ibm_rave_core_internal_svg_SVGConstants.G = "g"; com_ibm_rave_core_internal_svg_SVGConstants.PATH = "path"; com_ibm_rave_core_internal_svg_SVGConstants.POLYGON = "polygon"; com_ibm_rave_core_internal_svg_SVGConstants.POLYLINE = "polyline"; com_ibm_rave_core_internal_svg_SVGConstants.DEFS = "defs"; com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT = "linearGradient"; com_ibm_rave_core_internal_svg_SVGConstants.STOP = "stop"; com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT = "radialGradient"; com_ibm_rave_core_internal_svg_SVGConstants.IMAGE = "image"; com_ibm_rave_core_internal_svg_SVGConstants.CLIP_PATH = "clipPath"; com_ibm_rave_core_internal_svg_SVGConstants.STOP_COLOR = "stop-color"; com_ibm_rave_core_internal_svg_SVGConstants.OFFSET = "offset"; com_ibm_rave_core_internal_svg_SVGConstants.TSPAN = "tspan"; //com_ibm_rave_core_internal_svg_SVGConstants.MOVE_TO = "M"; //com_ibm_rave_core_internal_svg_SVGConstants.LINE_TO = "L"; //com_ibm_rave_core_internal_svg_SVGConstants.CLOSE_PATH = "Z"; //com_ibm_rave_core_internal_svg_SVGConstants.PATH_SEPARATOR = ","; // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/Dashing /************************************************************************ ** 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/core/canvas/internal/nativeImpl/render/canvas/BezierUtils (runtime) var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing = { /** * Split the points into curve segments. * * @param ctx * the canvas context * @param dash * the dash array * @param newPoints * an array to be filled with curve info * @param prevResidue * optional object containing previous dash info */ splitToDashedBezier : function(points, dash, newPoints, prevResidue) { var residue = 0, t = 0, da, i = 0; if (prevResidue) { da = prevResidue.l; i = prevResidue.i; } else { da = dash[0]; } while (t < 1) { // get the 't' corresponding to the given dash value. t = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.tAtLength(points, da); if (t == 1) { var rl = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.computeLength(points); residue = { l : da - rl, i : i }; } // split bezier at t: left part is the "dash" curve, right part is the remaining bezier points var curves = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.splitBezierAtT(points, t); if (!(i % 2)) { // only keep the "dash" curve newPoints.push(curves[0]); } points = curves[1]; ++i; da = dash[i % dash.length]; } return residue; }, /** * Builds a set of bezier (cubic || quadratic)CurveTo' canvas instructions * that represents a dashed stroke of the specified bezier geometry. * * @param ctx * the canvas context * @param dash * the dash array * @param x * the start x coordinate * @param y * the start y coordinate * @param points * the control points * @param prevResidue * optional object containing previous dash info */ toDashedCurveTo : function(ctx, dash, x, y, points, prevResidue) { var pts = [x, y].concat(points), quadratic = points.length === 4, api = quadratic ? "quadraticCurveTo" : "bezierCurveTo", curves = []; var residue = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_Dashing.splitToDashedBezier(pts, dash, curves, prevResidue); for (var c = 0; c < curves.length; ++c) { var curve = curves[c]; ctx.moveTo(curve[0], curve[1]); ctx[api].apply(ctx, curve.slice(2)); } return residue; }, /** * Builds a set of moveTo/lineTo' canvas instructions that represents a * dashed stroke of the specified line geometry. * * @param ctx * the canvas context * @param dash * the dash array * @param x1 * the start x coordinate * @param y1 * the start y coordinate * @param x2 * the end x coordinate * @param y2 * the end y coordinate * @param prevResidue * optional object containing previous dash info */ toDashedLineTo : function(ctx, dash, x1, y1, x2, y2, prevResidue) { var residue = 0, r = 0, da = 0, tlength = com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils.distance(x1, y1, x2, y2), i = 0, prevx = x1, prevy = y1, x, y; if (prevResidue) { da = prevResidue.l; i = prevResidue.i; } else { da += dash[0]; } while (Math.abs(1 - r) > 0) { if (da > tlength) { residue = { l : da - tlength, i : i }; da = tlength; } r = da / tlength; x = x1 + (x2 - x1) * r; y = y1 + (y2 - y1) * r; if (!(i++ % 2)) { ctx.moveTo(prevx, prevy); ctx.lineTo(x, y); } prevx = x; prevy = y; da += dash[i % dash.length]; } if (!residue && i) { residue = {l: dash[i % dash.length], i: i}; } return residue; } }; // $source: com/ibm/rave/core/canvas/internal/nativeImpl/render/canvas/BezierUtils /************************************************************************ ** 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. ************************************************************************/ // From dojo without the gfx dependency. // Required to support non-native dashing. var com_ibm_rave_core_canvas_internal_nativeImpl_render_canvas_BezierUtils = (function() { var bu = {}, error = 0.1; bu.tAtLength = function(points, length){ // summary: // Returns the t corresponding to the given length for the specified bezier curve. // points: Number[] // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve. // length: Number // The length. var t = 0, quadratic = points.length == 6, currentLen = 0, splitCount = 0, splitFunc = quadratic ? splitQBezierAtT : splitBezierAtT; var _compute = function(p, error){ // control points polygon length var pLen = 0; for(var i = 0; i < p.length-2; i+=2) pLen += distance(p[i],p[i+1],p[i+2],p[i+3]); // chord length var chord = quadratic ? distance(points[0],points[1],points[4],points[5]) : distance(points[0],points[1],points[6],points[7]); // if needs more approx. or if currentLen is greater than the target length, // split the curve one more time if(pLen - chord > error || currentLen + pLen > length + error){ ++splitCount; var newbezier = splitFunc(p, .5); // check 1st subpath _compute(newbezier[0], error); // the 1st subcurve was the good one, we stop if(Math.abs(currentLen - length) <= error){ return; } // need to continue with the 2nde subcurve _compute(newbezier[1], error); return ; } currentLen += pLen; t += 1.0 / (1 << splitCount); }; if(length) _compute(points, 0.5); return t; }; var computeLength = bu.computeLength = function(/*Array*/points){ // summary: // Returns the length of the given bezier curve. // points: Number[] // The bezier points. Should be [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y] for a cubic // bezier curve or [p1x, p1y, cx, cy, p2x, p2y] for a quadratic bezier curve. var quadratic = points.length == 6, pLen=0; // control points polygon length for(var i = 0; i < points.length-2; i+=2) pLen += distance(points[i],points[i+1],points[i+2],points[i+3]); // chord length var chord = quadratic ? distance(points[0],points[1],points[4],points[5]) : distance(points[0],points[1],points[6],points[7]); // split polygons until the polygon and the chord are "the same" if(pLen-chord>error){ var newBeziers = quadratic ? splitQBezierAtT(points,.5) : splitCBezierAtT(points,.5); var length = computeLength(newBeziers[0], quadratic); length += computeLength(newBeziers[1], quadratic); return length; } // pLen is close enough, done. return pLen; }; var distance = bu.distance = function(x1, y1, x2, y2){ // summary: // Returns the distance between the specified points. return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); }; var splitQBezierAtT = function(points, t){ // summary: // Split a quadratic bezier curve into 2 sub-quadratic beziers at the specified t. // de Casteljau var r = 1-t, r2 = r*r, t2 = t*t, p1x = points[0], p1y = points[1], cx = points[2], cy = points[3], p2x = points[4], p2y = points[5], ax = r*p1x + t*cx, ay = r*p1y + t*cy, bx = r*cx + t*p2x, by = r*cy + t*p2y, px = r2*p1x + 2*r*t*cx + t2*p2x, py = r2*p1y + 2*r*t*cy + t2*p2y; return [ [ p1x, p1y, ax, ay, px, py ], [ px, py, bx, by, p2x, p2y ] ]; }; var splitCBezierAtT = function(points, t){ // summary: // Split a cubic bezier curve into 2 sub-cubic beziers at the specified t. // de Casteljau var r = 1-t, r2 = r*r, r3 = r2*r, t2 = t*t, t3 = t2*t, p1x = points[0], p1y = points[1], c1x = points[2], c1y = points[3], c2x = points[4], c2y = points[5], p2x = points[6], p2y = points[7], ax = r*p1x + t*c1x, ay = r*p1y + t*c1y, cx = r*c2x + t*p2x, cy = r*c2y + t*p2y, mx = r2*p1x + 2*r*t*c1x + t2*c2x, my = r2*p1y + 2*r*t*c1y + t2*c2y, nx = r2*c1x + 2*r*t*c2x + t2*p2x, ny = r2*c1y + 2*r*t*c2y + t2*p2y, px = r3*p1x + 3*r2*t*c1x + 3*r*t2*c2x+t3*p2x, py = r3*p1y + 3*r2*t*c1y + 3*r*t2*c2y+t3*p2y; return [ [ p1x, p1y, ax, ay, mx, my, px, py ], [ px, py, nx, ny, cx, cy, p2x, p2y ] ]; }; var splitBezierAtT = bu.splitBezierAtT = function(points, t){ return points.length == 6 ? splitQBezierAtT(points, t) : splitCBezierAtT(points, t); }; return bu; })(); // $source: com/ibm/rave/render/internal/select/jsoup/select/QueryParser /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/context/RaveContextManager (runtime) // RaveContextManager //@import com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator (runtime) // new //@import com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator (runtime) // new //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (runtime) // new //@import com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue (runtime) // new, unescape /** * Parses a CSS selector into an Evaluator tree. */ var com_ibm_rave_render_internal_select_jsoup_select_QueryParser = com_ibm_rave_core_nativeImpl_Declare({ //tq : null, //evals : null, constructor : function(query) { this.evals = []; /** * Create a new QueryParser. * @param (String) query CSS query */ { this.tq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(query); } }, getQueryParserRegExps : function() { var queryParserRegExps = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("QUERY_PARSER_REG_EXP_KEY"); if (!queryParserRegExps) { queryParserRegExps = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps(); com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("QUERY_PARSER_REG_EXP_KEY", queryParserRegExps); } return queryParserRegExps; }, /** * Parse the query * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator */ parse$1 : function() { this.tq.consumeWhitespace(); if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root()); this.combinator(this.tq.consume$0()); } else { if (!(this.findElements())) { return null; } } while (!(this.tq.isEmpty())) { var seenWhite = this.tq.consumeWhitespace(); if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) { this.combinator(this.tq.consume$0()); } else if (seenWhite) { this.combinator(32); } else { if (!(this.findElements())) { return null; } } } if (this.evals.length == 1) { return this.evals[0]; } return new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals); }, combinator : function(combinator) { this.tq.consumeWhitespace(); var subQuery = this.consumeSubQuery(); var rootEval; var currentEval; var newEval = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery); var replaceRightMost = false; if (this.evals.length == 1) { rootEval = currentEval = this.evals[0]; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(rootEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or) && combinator != 44) { currentEval = (currentEval).rightMostEvaluator(); replaceRightMost = true; } } else { rootEval = currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(this.evals); } this.evals = []; if (combinator == 62) { currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent(currentEval)]); } else if (combinator == 32) { currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent(currentEval)]); } else if (combinator == 43) { currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling(currentEval)]); } else if (combinator == 126) { currentEval = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And([newEval, new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling(currentEval)]); } else if (combinator == 44) { var or; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(currentEval, com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or)) { or = currentEval; or.add(newEval); } else { or = new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or(null); or.add(currentEval); or.add(newEval); } currentEval = or; } else { return; } if (replaceRightMost) { (rootEval).replaceRightMostEvaluator(currentEval); } else { rootEval = currentEval; } this.evals.push(rootEval); }, consumeSubQuery : function() { var sq = ""; while (!(this.tq.isEmpty())) { if (this.tq.matchesChar(40)) { sq += "(" + this.tq.chompBalanced(40, 41) + ")"; } else if (this.tq.matchesChar(91)) { sq += "[" + this.tq.chompBalanced(91, 93) + "]"; } else if (this.tq.matchesAnyChar.apply(this.tq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators)) { break; } else { sq += String.fromCharCode(this.tq.consume$0()); } } return sq; }, findElements : function() { if (this.tq.matchCharChomp(46)) { this.byClass(); } else if (this.tq.matchCharChomp(35)) { this.byId(); } else if (this.tq.matchCharChomp(42)) { this.allElements(); } else if (this.tq.matchesChar(91)) { this.byAttribute(); } else if (this.tq.matchesWord()) { this.byTag(); } else if (this.tq.matchesChar(58)) { if (this.tq.matchChomp(":lt(")) { this.indexLessThan(); } else if (this.tq.matchChomp(":gt(")) { this.indexGreaterThan(); } else if (this.tq.matchChomp(":eq(")) { this.indexEquals(); } else if (this.tq.matches(":has(")) { this.has(); } else if (this.tq.matches(":contains(")) { this.contains(false); } else if (this.tq.matches(":containsOwn(")) { this.contains(true); } else if (this.tq.matches(":matches(")) { this.matches(false); } else if (this.tq.matches(":matchesOwn(")) { this.matches(true); } else if (this.tq.matches(":not(")) { this.not(); } else if (this.tq.matchChomp(":nth-child(")) { this.cssNthChild(false, false); } else if (this.tq.matchChomp(":nth-last-child(")) { this.cssNthChild(true, false); } else if (this.tq.matchChomp(":nth-of-type(")) { this.cssNthChild(false, true); } else if (this.tq.matchChomp(":nth-last-of-type(")) { this.cssNthChild(true, true); } else if (this.tq.matchChomp(":first-child")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild()); } else if (this.tq.matchChomp(":last-child")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild()); } else if (this.tq.matchChomp(":first-of-type")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(0, 1)); } else if (this.tq.matchChomp(":last-of-type")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(0, 1)); } else if (this.tq.matchChomp(":only-child")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild()); } else if (this.tq.matchChomp(":only-of-type")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType()); } else if (this.tq.matchChomp(":empty")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty()); } else if (this.tq.matchChomp(":root")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot()); } else { return false; } return true; } else { return false; } return true; }, byId : function() { var id = this.tq.consumeCssIdentifier(); this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id(id)); }, byClass : function() { var className = this.tq.consumeCssIdentifier(); this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class(className.trim())); }, byTag : function() { var tagName = this.tq.consumeElementSelector(); if (0 <= tagName.indexOf("|")) { tagName = tagName.replace("|", ":"); } this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag(tagName.trim())); }, byAttribute : function() { var cq = new com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue(this.tq.chompBalanced(91, 93)); var key = cq.consumeToAny.apply(cq, com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals); cq.consumeWhitespace(); if (cq.isEmpty()) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute(key)); } else { if (cq.matchChomp("=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue(key, cq.remainder())); } else if (cq.matchChomp("!=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot(key, cq.remainder())); } else if (cq.matchChomp("^=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting(key, cq.remainder())); } else if (cq.matchChomp("$=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding(key, cq.remainder())); } else if (cq.matchChomp("*=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining(key, cq.remainder())); } else if (cq.matchChomp("~=")) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching(key, new RegExp(cq.remainder(), "i"))); } else { return; } } }, allElements : function() { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements()); }, indexLessThan : function() { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan(this.consumeIndex())); }, indexGreaterThan : function() { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan(this.consumeIndex())); }, indexEquals : function() { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals(this.consumeIndex())); }, cssNthChild : function(backwards, ofType) { var argS = this.tq.chompTo(")").trim().toLowerCase(); var queryParserRegExps = this.getQueryParserRegExps(); var mAB = queryParserRegExps.NTH_AB.exec(argS); var mB = queryParserRegExps.NTH_B.exec(argS); var a, b; if ("odd" == argS) { a = 2; b = 1; } else if ("even" == argS) { a = 2; b = 0; } else if (mAB && mAB.length > 0) { a = mAB[3] != null ? ~~ (mAB[1].replace("^\\+", "")) : 1; b = mAB[4] != null ? ~~ (mAB[4].replace("^\\+", "")) : 1; } else if (mB && mB.length > 0) { a = 0; b = ~~ (mB[0].replace("^\\+", "")); } else { return; } if (ofType) { if (backwards) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType(a, b)); } else { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType(a, b)); } } else { if (backwards) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild(a, b)); } else { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild(a, b)); } } }, consumeIndex : function() { var indexS = this.tq.chompTo(")").trim(); return parseInt(indexS); }, has : function() { this.tq.consume$1(":has"); var subQuery = this.tq.chompBalanced(40, 41); this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery))); }, contains : function(own) { this.tq.consume$1(own ? ":containsOwn" : ":contains"); var searchText = com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape(this.tq.chompBalanced(40, 41)); if (own) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText(searchText)); } else { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText(searchText)); } }, matches : function(own) { this.tq.consume$1(own ? ":matchesOwn" : ":matches"); var regex = this.tq.chompBalanced(40, 41); if (own) { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn(new RegExp(regex, ""))); } else { this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches(new RegExp(regex, ""))); } }, not : function() { this.tq.consume$1(":not"); var subQuery = this.tq.chompBalanced(40, 41); this.evals.push(new com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not(com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(subQuery))); }, parse : function() { var args = arguments; return this.parse$1(); } }); /** * Parse a CSS query into an Evaluator. * @param (String) query CSS query * @return (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) Evaluator */ com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0 = function(query) { var p = new com_ibm_rave_render_internal_select_jsoup_select_QueryParser(query); return p.parse$1(); }; com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse = function(a0) { var args = arguments; return com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(a0); }; com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QueryParserRegExps = com_ibm_rave_core_nativeImpl_Declare({ //NTH_AB : null, //NTH_B : null, constructor : function() { this.NTH_AB = new RegExp("((\\+|-)?(\\d+)?)n(\\s*(\\+|-)?\\s*\\d*)?", "i"); this.NTH_B = new RegExp("(\\+|-)?(\\d+)", ""); } }); //com_ibm_rave_render_internal_select_jsoup_select_QueryParser.QUERY_PARSER_REG_EXP_KEY = "QUERY_PARSER_REG_EXP_KEY"; com_ibm_rave_render_internal_select_jsoup_select_QueryParser.combinators = [44, 62, 43, 126, 32]; com_ibm_rave_render_internal_select_jsoup_select_QueryParser.AttributeEvals = ["=", "!=", "^=", "$=", "*=", "~="]; // $source: com/ibm/rave/render/internal/select/jsoup/select/Evaluator /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * Evaluates that an SceneNode matches the selector. */ var com_ibm_rave_render_internal_select_jsoup_select_Evaluator = com_ibm_rave_core_nativeImpl_Declare({ /** * Test if a SceneNode has been cached for this evaluator. * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) manager The external cache manager * @param (com.ibm.rave.core.scene.SceneNode) element The element currently being tested for a match. * @return (Array) list of cached scene nodes. */ cached : function(manager, element) { return null; } //constructor : function() {}, /** * Test if the SceneNode meets the evaluator's requirements. * @param (com.ibm.rave.core.scene.SceneNode) root Root of the matching subtree * @param (com.ibm.rave.core.scene.SceneNode) element tested SceneNode * @return (boolean) true if it matches, false otherwise. */ //matches : function(root, element) {} }); /** * Evaluator for tag name */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Tag = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //tagName : null, constructor : function(tagName) { this.tagName = tagName; }, matches : function(root, element) { if (root == element) { return false; } return (element.rave_getName() == this.tagName); } }); /** * Evaluator for SceneNode id */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Id = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //id : null, constructor : function(id) { this.id = id; }, matches : function(root, element) { return (this.id == (element).getId()); }, cached : function(cache, root) { if (!cache) { return null; } var cached = cache.matchId(1000, this.id, root); return !cached ? null : [cached]; } }); /** * Evaluator for SceneNode class */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Class = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //className : null, constructor : function(className) { this.className = className; }, cached : function(cache, root) { return null; }, matches : function(root, element) { return (element).getClassList().indexOf(this.className)> -1; } }); /** * Abstract evaluator for attribute name/value matching */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //key : null, //value : null, isIdKey : false, isClassKey : false, constructor : function(key, value) { var _value = value; this.key = key.trim().toLowerCase(); if (_value != null) { if ((_value.match("^[\"'].*") && _value.match(".*[\"']$"))) { _value = _value.substring(1, _value.length - 1); } this.value = _value.trim(); } if (this.key == "id") { this.isIdKey = true; } else if (this.key == "class") { this.isClassKey = true; } }, cached : function(node, root) { return null; } }); /** * Evaluator for attribute name matching */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Attribute = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { matches : function(root, element) { if (root == element) { return false; } if (this.isIdKey) { return (element).getId() != null; } return element.getAttribute(this.key) != null; }, cached : function(node, root) { return null; } //constructor : function(key) {} }); /** * Evaluator for attribute name/value matching */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValue = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { cached : function(cache, root) { if (!cache) { return null; } if (this.isIdKey) { var cached = cache.matchId(1000, this.value, root); return !cached ? null : [cached]; } else if (this.isClassKey) { return cache.matchClass(1001, this.value, root); } return null; }, matches : function(root, element) { if (root == element) { return false; } if (this.isIdKey) { return this.value == (element).getId(); } var val = element.getAttribute(this.key); var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key)); return this.value.toUpperCase() == attributeValue.toUpperCase(); } //constructor : function(key, value) {} }); /** * Evaluator for attribute name != value matching */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueNot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { matches : function(root, element) { var val = element.getAttribute(this.key); var attributeValue = val == null ? "" : ""+(element.getAttribute(this.key)); return !(this.value.toUpperCase() == attributeValue.toUpperCase()); } //constructor : function(key, value) {} }); /** * Evaluator for attribute name/value matching (value prefix) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueStarting = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { matches : function(root, element) { var attributeValue = element.getAttribute(this.key); if (attributeValue == null) { return false; } var elementValue = ""+(attributeValue); return elementValue.match("^" + this.value + ".*"); } //constructor : function(key, value) {} }); /** * Evaluator for attribute name/value matching (value ending) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueEnding = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { matches : function(root, element) { var attributeVal = element.getAttribute(this.key); if (attributeVal == null) { return false; } var elementValue = ""+(attributeVal); return elementValue.match(".*" + this.value + "$"); } //constructor : function(key, value) {} }); /** * Evaluator for attribute name/value matching (value containing) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueContaining = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeKeyPair, { matches : function(root, element) { var attributeValue = element.getAttribute(this.key); if (attributeValue == null) { return false; } var elementValue = ""+(attributeValue); return 0 <= elementValue.indexOf(this.value); } //constructor : function(key, value) {} }); /** * Evaluator for attribute name/value matching (value regex matching) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AttributeWithValueMatching = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //key : null, //pattern : null, constructor : function(key, pattern) { this.key = key.trim().toLowerCase(); this.pattern = pattern; }, matches : function(root, element) { return element.getAttribute(this.key) != null && this.pattern.test(""+(element.getAttribute(this.key))); } }); /** * Evaluator for any / all SceneNode matching */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { return element != root; } }); /** * Abstract evaluator for sibling index matching * @author ant */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { index : 0, constructor : function(index) { this.index = index; } }); /** * Evaluator for matching by sibling index number (e < idx) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexLessThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, { matches : function(root, element) { return (element).getSiblingIndex() < this.index; } //constructor : function(index) {} }); /** * Evaluator for matching by sibling index number (e > idx) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexGreaterThan = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, { matches : function(root, element) { return (element).getSiblingIndex() > this.index; } //constructor : function(index) {} }); /** * Evaluator for matching by sibling index number (e = idx) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEquals = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IndexEvaluator, { matches : function(root, element) { return (element).getSiblingIndex() == this.index; } //constructor : function(index) {} }); /** * Evaluator for matching the last sibling (css :last-child) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { var p = element.rave_getParentNode(); return element != root && p && ((element).getSiblingIndex() == p.rave_getChildNodes().length - 1); } }); com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { a : 0, b : 0, constructor : function(a, b) { this.a = a; this.b = b; }, matches : function(root, element) { var p = element.rave_getParentNode(); if (!p) { return false; } var pos = this.calculatePosition(root, element); if (this.a == 0) { return pos == this.b; } return (pos - this.b) * this.a >= 0 && (pos - this.b) % this.a == 0; } //calculatePosition : function(root, element) {} }); com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, { calculatePosition : function(root, element) { var pos = 0; var family = element.rave_getParentNode().rave_getChildNodes(); for (var i = (element).getSiblingIndex(); i < family.length; ++i) { if (family[i].rave_getName() == element.rave_getName()) { pos++; } } return pos; } //constructor : function(a, b) {} }); /** * css pseudo class nth-of-type */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, { calculatePosition : function(root, element) { var pos = 0; var family = element.rave_getParentNode().rave_getChildNodes(); for (var i = 0; i < family.length; ++i) { if (family[i].rave_getName() == element.rave_getName()) { pos++; } if (family[i] == element) { break; } } return pos; } //constructor : function(a, b) {} }); /** * css-compatible Evaluator for :eq (css :nth-child) * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, { calculatePosition : function(root, element) { return (element).getSiblingIndex() + 1; } //constructor : function(a, b) {} }); /** * css pseudo class :nth-last-child) * @see (com.ibm.rave.render.internal.select.jsoup.select.Evaluator.IndexEquals) IndexEquals */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsNthLastChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator.CssNthEvaluator, { calculatePosition : function(root, element) { return element.rave_getParentNode().rave_getChildNodes().length - (element).getSiblingIndex(); } //constructor : function(a, b) {} }); /** * Evaluator for matching the first sibling (css :first-child) */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsFirstChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { var p = element.rave_getParentNode(); return p && (element).getSiblingIndex() == 0; } }); /** * css3 pseudo-class :root * @see :root selector */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsRoot = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { return !element.rave_getParentNode(); } }); com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyChild = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { var p = element.rave_getParentNode(); return p && !element.rave_getPreviousSibling() && !element.rave_getNextSibling(); } }); com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsOnlyOfType = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { var p = element.rave_getParentNode(); if (!p) { return false; } var pos = 0; var family = p.rave_getChildNodes(); for (var i = 0; i < family.length; ++i) { if (family[i].rave_getName() == element.rave_getName()) { pos++; } } return pos == 1; } }); com_ibm_rave_render_internal_select_jsoup_select_Evaluator.IsEmpty = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { return !(element.rave_hasChildNodes()); } }); /** * Evaluator for matching SceneNode (and its descendants) text */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //searchText : null, constructor : function(searchText) { this.searchText = searchText.toLowerCase(); }, matches : function(root, element) { if (root == element) { return false; } if (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)) { return true; } for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (this.matches(element, child)) { return true; } } return false; } }); /** * Evaluator for matching SceneNode's own text */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.ContainsOwnText = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //searchText : null, constructor : function(searchText) { this.searchText = searchText.toLowerCase(); }, matches : function(root, element) { return (0 <= element.rave_getText().toLowerCase().indexOf(this.searchText)); } }); /** * Evaluator for matching SceneNode (and its descendants) text with regex */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.Matches = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //pattern : null, constructor : function(pattern) { this.pattern = pattern; }, matches : function(root, element) { if (this.pattern.test(element.rave_getText())) { return true; } for (var __i_enFor0 = 0, __exp_enFor0 = element.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (this.matches(element, child)) { return true; } } return false; } }); /** * Evaluator for matching SceneNode's own text with regex */ com_ibm_rave_render_internal_select_jsoup_select_Evaluator.MatchesOwn = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //pattern : null, constructor : function(pattern) { this.pattern = pattern; }, matches : function(root, element) { return this.pattern.test(element.rave_getText()); } }); // $source: com/ibm/rave/render/internal/select/jsoup/select/StructuralEvaluator /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // new, superclass //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect /** * Base structural evaluator. */ var com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //evaluator : null }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Root = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { matches : function(root, element) { return root == element; } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Has = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, element) { for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(new com_ibm_rave_render_internal_select_jsoup_select_Evaluator.AllElements(), element, null), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var e = __exp_enFor0[__i_enFor0]; if (e != element && this.evaluator.matches(root, e)) { return true; } } return false; } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Not = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, node) { return !(this.evaluator.matches(root, node)); } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.Parent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, element) { if (root == element) { return false; } var parent = element.rave_getParentNode(); while (parent) { if (this.evaluator.matches(root, parent)) { return true; } parent = parent.rave_getParentNode(); } return false; } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediateParent = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, element) { if (root == element) { return false; } var parent = element.rave_getParentNode(); return parent && this.evaluator.matches(root, parent); } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.PreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, element) { if (root == element) { return false; } var prev = element.rave_getPreviousSibling(); while (prev) { if (this.evaluator.matches(root, prev)) { return true; } prev = prev.rave_getPreviousSibling(); } return false; } }); com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator.ImmediatePreviousSibling = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_StructuralEvaluator, { constructor : function(evaluator) { this.evaluator = evaluator; }, matches : function(root, element) { if (root == element) { return false; } var prev = element.rave_getPreviousSibling(); return prev && this.evaluator.matches(root, prev); } }); // $source: com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * Depth-first node traversor. Use to iterate through all nodes under and including the specified root node. */ var com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor = com_ibm_rave_core_nativeImpl_Declare({ //visitor : null, /** * Create a new traversor. * @param (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) visitor a class implementing the {@link (com.ibm.rave.render.internal.select.jsoup.select.NodeVisitor) NodeVisitor} interface, to be called when visiting each node. */ constructor : function(visitor) { this.visitor = visitor; }, /** * Start a depth-first traverse of the root and all of its descendants. * @param (com.ibm.rave.core.scene.SceneNode) root the root node point to traverse. */ traverse : function(root) { if (!root) { return; } var node = root; var depth = 0; this.visit(node, depth); }, visit : function(node, depth) { if (!node) { return; } this.visitor.head(node, depth); for (var __i_enFor0 = 0, __exp_enFor0 = node.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; this.visit(child, depth + 1); } this.visitor.tail(node, depth); } }); // $source: com/ibm/rave/render/internal/select/jsoup/select/Collector /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/select/NodeTraversor (static) // new /** * Collects a list of elements that match the supplied criteria. * @author Jonathan Hedley */ var com_ibm_rave_render_internal_select_jsoup_select_Collector = com_ibm_rave_core_nativeImpl_Declare({ //constructor : function() {} }); /** * Build a list of elements, by visiting root and every descendant of root, and testing it against the evaluator. * @param (com.ibm.rave.render.internal.select.jsoup.select.Evaluator) evaluator Evaluator to test elements against * @param (com.ibm.rave.core.scene.SceneNode) root root of tree to descend * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache * @return (Array) list of matches; empty if none */ com_ibm_rave_render_internal_select_jsoup_select_Collector.collect = function(evaluator, root, cache) { var elements = []; if (evaluator) { var cachedVals = evaluator.cached(cache, root); if (cachedVals) { for (var __i_enFor0 = 0, __exp_enFor0 = cachedVals, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var node = __exp_enFor0[__i_enFor0]; elements.push(node); } } else { new com_ibm_rave_render_internal_select_jsoup_select_NodeTraversor(new com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator(root, elements, evaluator)).traverse(root); } } return elements; }; com_ibm_rave_render_internal_select_jsoup_select_Collector.Accumulator = com_ibm_rave_core_nativeImpl_Declare({ //root : null, //elements : null, //evaluator : null, constructor : function(root, elements, evaluator) { this.root = root; this.elements = elements; this.evaluator = evaluator; }, head : function(node, depth) { if (this.evaluator && this.evaluator.matches(this.root, node)) { this.elements.push(node); } }, tail : function(node, depth) {} }); // $source: com/ibm/rave/render/internal/select/jsoup/select/CombiningEvaluator /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/select/Evaluator (loadtime) // superclass /** * Base combining (and, or) evaluator. */ var com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_Evaluator, { //evaluators : null, num : 0, constructor : function(evaluators) { this.evaluators = []; { if (evaluators) { for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var evaluator = __exp_enFor0[__i_enFor0]; this.evaluators.push(evaluator); } } this.updateNumEvaluators(); } }, rightMostEvaluator : function() { return this.num > 0 ? this.evaluators[this.num - 1] : null; }, replaceRightMostEvaluator : function(replacement) { this.evaluators[this.num - 1] = replacement; }, updateNumEvaluators : function() { this.num = this.evaluators.length; } }); com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, { matches : function(root, node) { for (var i = 0; i < this.num; ++i) { var s = this.evaluators[i]; if (!(s.matches(root, node))) { return false; } } return true; } //constructor : function(evaluators) {} }); com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.Or = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator, { /** * Create a new Or evaluator. The initial evaluators are ANDed together and used as the first clause of the OR. * @param (Array) evaluators initial OR clause (these are wrapped into an AND evaluator). */ constructor : function(evaluators) { if (this.num > 1) { this.evaluators.push(new com_ibm_rave_render_internal_select_jsoup_select_CombiningEvaluator.And(evaluators)); } else if (evaluators) { for (var __i_enFor0 = 0, __exp_enFor0 = evaluators, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var evaluator = __exp_enFor0[__i_enFor0]; this.evaluators.push(evaluator); } } this.updateNumEvaluators(); }, add : function(e) { this.evaluators.push(e); this.updateNumEvaluators(); }, matches : function(root, node) { for (var i = 0; i < this.num; ++i) { var s = this.evaluators[i]; if (s.matches(root, node)) { return true; } } return false; } }); // $source: com/ibm/rave/render/internal/select/jsoup/parser/TokenQueue /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/helper/StringUtil (runtime) // regionMatches, isWhitespace, startsWith //@import com/ibm/rave/core/context/RaveContextManager (static) // RaveContextManager /** * A character queue with parsing helpers. * @author Jonathan Hedley */ var com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue = com_ibm_rave_core_nativeImpl_Declare({ //queue : null, pos : 0, /** * Create a new TokenQueue. * @param (String) data string of data to back queue. */ constructor : function(data) { this.queue = data; }, /** * Is the queue empty? * @return (boolean) true if no data left in queue. */ isEmpty : function() { return this.remainingLength() == 0; }, remainingLength : function() { return this.queue.length - this.pos; }, /** * Tests if the next characters on the queue match the sequence. Case insensitive. * @param (String) seq String to check queue for. * @return (boolean) true if the next characters match. */ matches : function(seq) { return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(this.queue, true, this.pos, seq, 0, seq.length); }, /** * Case sensitive match test. * @param (String) seq string to case sensitively check for * @return (boolean) true if matched, false if not */ matchesCS : function(seq) { return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith(this.queue, seq, this.pos); }, /** * Tests if the next characters match any of the sequences. Case insensitive. * @param (java.lang.String[]) seq list of strings to case insensitively check for * @return (boolean) true of any matched, false if none did */ matchesAny : function(seq) { if (seq !== null || arguments.length > 1){ seq = Array.prototype.slice.call(arguments); } { for (var __i_enFor0 = 0, __len_enFor0 = seq.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var s = seq[__i_enFor0]; if (this.matches(s)) { return true; } } return false; } }, matchesAnyChar : function(cs) { if (cs !== null || arguments.length > 1){ cs = Array.prototype.slice.call(arguments); } { var c = this.queue.charCodeAt(this.pos); for (var i = 0; i < cs.length; ++i) { if (cs[i] == c) { return true; } } return false; } }, matchesChar : function(cs) { return this.queue.charCodeAt(this.pos) == cs; }, /** * Tests if the queue matches the sequence (as with match), and if they do, removes the matched string from the queue. * @param (String) seq String to search for, and if found, remove from queue. * @return (boolean) true if found and removed, false if not found. */ matchChomp : function(seq) { if (this.matches(seq)) { this.pos += seq.length; return true; } return false; }, matchCharChomp : function(c) { if (this.matchesChar(c)) { this.pos++; return true; } return false; }, /** * Tests if queue starts with a whitespace character. * @return (boolean) if starts with whitespace */ matchesWhitespace : function() { return !(this.isEmpty()) && com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace(this.queue.charCodeAt(this.pos)); }, /** * Test if the queue matches a word character (letter or digit). * @return (boolean) if matches a word character */ matchesWord : function() { var c = this.queue.charCodeAt(this.pos); return (c >= 97 && c <= 122) || (c >= 65 && c <= 90) || (c >= 48 && c <= 57); }, /** * Consume one character off queue. * @return (char) first character on queue. */ consume$0 : function() { return this.queue.charCodeAt(this.pos++); }, /** * Consumes the supplied sequence of the queue. If the queue does not start with the supplied sequence, will throw an illegal state exception -- but you should be running match() against that condition.

Case insensitive. * @param (String) seq sequence to remove from head of queue. */ consume$1 : function(seq) { var len = seq.length; this.pos += len; }, /** * Pulls a string off the queue, up to but exclusive of the match sequence, or to the queue running out. * @param (String) seq String to end on (and not include in return, but leave on queue). Case sensitive. * @return (String) The matched data consumed from queue. */ consumeTo : function(seq) { var offset = this.queue.indexOf(seq, this.pos); if (offset != -1) { var consumed = this.queue.substring(this.pos, offset); this.pos += consumed.length; return consumed; } return this.remainder(); }, /** * Consumes to the first sequence provided, or to the end of the queue. Leaves the terminator on the queue. * @param (java.lang.String[]) seq any number of terminators to consume to. Case insensitive. * @return (String) consumed string */ consumeToAny : function(seq) { if (seq !== null || arguments.length > 1){ seq = Array.prototype.slice.call(arguments); } { var start = this.pos; while (!(this.isEmpty()) && !(this.matchesAny.apply(this, seq))) { this.pos++; } var data = this.queue.substring(start, this.pos); return data; } }, /** * Pulls a string off the queue (like consumeTo), and then pulls off the matched string (but does not return it).

If the queue runs out of characters before finding the seq, will return as much as it can (and queue will go isEmpty() == true). * @param (String) seq String to match up to, and not include in return, and to pull off queue. Case sensitive. * @return (String) Data matched from queue. */ chompTo : function(seq) { var data = this.consumeTo(seq); this.matchChomp(seq); return data; }, /** * Pulls a balanced string off the queue. E.g. if queue is "(one (two) three) four", (,) will return "one (two) three", and leave " four" on the queue. Unbalanced openers and closers can be escaped (with \). Those escapes will be left in the returned string, which is suitable for regexes (where we need to preserve the escape), but unsuitable for contains text strings; use unescape for that. * @param (char) open opener * @param (char) close closer * @return (String) data matched from the queue */ chompBalanced : function(open, close) { var start = -1; var end = -1; var depth = 0; var last = 0; do { if (this.isEmpty()) { break; } var c = this.consume$0(); if (last == 0 || last != 92) { if (c == open) { depth++; if (start == -1) { start = this.pos; } } else if (c == close) { depth--; } } if (depth > 0 && last != 0) { end = this.pos; } last = c; } while (depth > 0); return (end >= 0) ? this.queue.substring(start, end) : ""; }, /** * Pulls the next run of whitespace characters of the queue. */ consumeWhitespace : function() { var seen = false; while (this.matchesWhitespace()) { this.pos++; seen = true; } return seen; }, /** * Retrieves the next run of word type (letter or digit) off the queue. * @return (String) String of word characters from queue, or empty string if none. */ consumeWord : function() { var start = this.pos; while (this.matchesWord()) { this.pos++; } return this.queue.substring(start, this.pos); }, /** * Consume an tag name off the queue (word or :, _, -) * @return (String) tag name */ consumeTagName : function() { var start = this.pos; while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(58, 95, 45))) { this.pos++; } return this.queue.substring(start, this.pos); }, /** * Consume a CSS element selector (tag name, but | instead of : for namespaces, to not conflict with :pseudo selects). * @return (String) tag name */ consumeElementSelector : function() { var start = this.pos; while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(124, 95, 45))) { this.pos++; } return this.queue.substring(start, this.pos); }, /** * Consume a CSS identifier (ID or class) off the queue (letter, digit, -, _) http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier * @return (String) identifier */ consumeCssIdentifier : function() { var start = this.pos; while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95))) { this.pos++; } return this.queue.substring(start, this.pos); }, /** * Consume an attribute key off the queue (letter, digit, -, _, :") * @return (String) attribute key */ consumeAttributeKey : function() { var start = this.pos; while (!(this.isEmpty()) && (this.matchesWord() || this.matchesAnyChar(45, 95, 58))) { this.pos++; } return this.queue.substring(start, this.pos); }, /** * Consume and return whatever is left on the queue. * @return (String) remained of queue. */ remainder : function() { var remainder = this.queue.substring(this.pos, this.queue.length); this.pos = this.queue.length; return remainder; }, consume : function(a0) { var args = arguments; if (args.length == 0) { return this.consume$0(); } return this.consume$1(a0); } }); com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.getTokenQueueRegExp = function() { var regexp = com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().getData("TOKEN_QUEUE_REG_EXP_KEY"); if (!regexp) { regexp = new RegExp("[A-Z\\d]", "i"); com_ibm_rave_core_context_RaveContextManager.INSTANCE.getRaveContext().putData("TOKEN_QUEUE_REG_EXP_KEY", regexp); } return regexp; }; /** * Unescaped a \ escaped string. * @param (String) text backslash escaped string * @return (String) unescaped string */ com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.unescape = function(text) { var out = ""; var last = 0; for (var i = 0; i < text.length; ++i) { var c = text.charCodeAt(i); if (c == 92) { if (last != 0 && last == 92) { out += String.fromCharCode(c); } } else { out += String.fromCharCode(c); } last = c; } return out.valueOf(); }; com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.ESC = 92; com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.NIL = 0; //com_ibm_rave_render_internal_select_jsoup_parser_TokenQueue.TOKEN_QUEUE_REG_EXP_KEY = "TOKEN_QUEUE_REG_EXP_KEY"; // $source: com/ibm/rave/render/internal/select/jsoup/helper/StringUtil /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * A minimal String utility class. Designed for internal jsoup use only. */ var com_ibm_rave_render_internal_select_jsoup_helper_StringUtil = com_ibm_rave_core_nativeImpl_Declare({ }); /** * Tests if a code point is "whitespace" as defined in the HTML spec. * @param (int) c code point to test * @return (boolean) true if code point is whitespace, false otherwise */ com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.isWhitespace = function(c) { return c == 32 || c == 9 || c == 10 || c == 12 || c == 13; }; /** * Translatable version of Java String#regionMaches(). * @param (String) original String to * @param (boolean) ignoreCase ignore case or not * @param (int) toffset starting offset of the original string * @param (String) other the string to compare * @param (int) ooffset starting offset of the subregion in the string * @param (int) len number of chars to compare * @return (boolean) true if regions match. */ com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches = function(original, ignoreCase, toffset, other, ooffset, len) { if (original.length < toffset + len || original.length < ooffset + len) { return false; } var substring1 = original.substring(toffset, toffset + len); var substring2 = other.substring(ooffset, ooffset + len); if (ignoreCase) { return substring1.toLowerCase() == substring2.toLowerCase(); } return substring1 == substring2; }; /** * @param (String) queue * @param (String) seq * @param (int) pos * @return (boolean) true if starts with, false otherwise. */ com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.startsWith = function(queue, seq, pos) { return com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.regionMatches(queue, false, 0, seq, 0, pos); }; com_ibm_rave_render_internal_select_jsoup_helper_StringUtil.padding = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]; // $source: com/ibm/rave/render/internal/RendererConfiguration /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * Configuration specific to native renderers and scene nodes. */ var com_ibm_rave_render_internal_RendererConfiguration = com_ibm_rave_core_nativeImpl_Declare({ //roots : null, constructor : function() { this.roots = []; }, /** * Return all registered root providers. * @return (Array) A list of all registered root providers. */ getRootProviders : function() { return this.roots; }, /** * Return the root provider that contains a specific node. * @param (com.ibm.rave.core.scene.SceneNode) node Return the provider that contains this node. * @return (com.ibm.rave.render.internal.nodes.RootProvider) Matching root provider, or null if none found. */ getRootProviderForNode : function(node) { for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var root = __exp_enFor0[__i_enFor0]; if (node.rave_getOwner() == root.getRoot().rave_getOwner()) { return root; } } return null; }, /** * Add a root provider to the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to add to the system. */ addRootProvider : function(rootProvider) { this.roots.push(rootProvider); }, /** * Remove a root provider from the list of providers system-wide. Root providers are containers for a single root node that holds a scene tree. * @param (com.ibm.rave.render.internal.nodes.RootProvider) rootProvider Root provider to remove from the system. */ removeRootProvider : function(rootProvider) { var i = this.roots.indexOf(rootProvider); if (i >= 0) { this.roots.splice(i, 1); } }, /** * Remove the root provider that contains a specific node. * @param (com.ibm.rave.core.scene.SceneNode) node Find the root provider that contains this node and remove it from the list of root providers. */ removeRootProviderForNode : function(node) { var i = -1; var found = false; for (var __i_enFor0 = 0, __exp_enFor0 = this.roots, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var root = __exp_enFor0[__i_enFor0]; i++; if (node == root.getRoot().rave_getOwner()) { found = true; break; } } if (found) { this.roots.splice(i, 1); } } //constructor : function() {} }); /** * Singleton instance of this renderer configuration. */ com_ibm_rave_render_internal_RendererConfiguration.INSTANCE = new com_ibm_rave_render_internal_RendererConfiguration(); // $source: com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse //@import com/ibm/rave/render/internal/select/jsoup/select/Collector (runtime) // collect /** * CSS-like element selector, that finds elements matching a query.

Selector syntax

A selector is a chain of simple selectors, separated by combinators. Selectors are case insensitive (including against elements, attributes, and attribute values).

The universal selector (*) is implicit when no element selector is supplied (i.e. {@code *.header} and {@code .header} is equivalent).

Pattern Matches Example
* any element *
tag elements with the given tag name div
ns|E elements of type E in the namespace ns fb|name finds <fb:name> elements
#id elements with attribute ID of "id" div#wrap, #logo
.class elements with a class name of "class" div.left, .result
[attr] elements with an attribute named "attr" (with any value) a[href], [title]
[^attrPrefix] elements with an attribute name starting with "attrPrefix". Use to find elements with HTML5 datasets [^data-], div[^data-]
[attr=val] elements with an attribute named "attr", and value equal to "val" img[width=500], a[rel=nofollow]
[attr="val"] elements with an attribute named "attr", and value equal to "val" span[hello="Cleveland"][goodbye="Columbus"], a[rel="nofollow"]
[attr^=valPrefix] elements with an attribute named "attr", and value starting with "valPrefix" a[href^=http:]
[attr$=valSuffix] elements with an attribute named "attr", and value ending with "valSuffix" img[src$=.png]
[attr*=valContaining] elements with an attribute named "attr", and value containing "valContaining" a[href*=/search/]
[attr~=regex] elements with an attribute named "attr", and value matching the regular expression img[src~=(?i)\\.(png|jpe?g)]
The above may be combined in any order div.header[title]

Combinators

E F an F element descended from an E element div a, .logo h1
E > F an F direct child of E ol > li
E + F an F element immediately preceded by sibling E li + li, div.head + div
E ~ F an F element preceded by sibling E h1 ~ p
E, F, G all matching elements E, F, or G a[href], div, h3

Pseudo selectors

:lt(n) elements whose sibling index is less than n td:lt(3) finds the first 2 cells of each row
:gt(n) elements whose sibling index is greater than n td:gt(1) finds cells after skipping the first two
:eq(n) elements whose sibling index is equal to n td:eq(0) finds the first cell of each row
:has(selector) elements that contains at least one element matching the selector div:has(p) finds divs that contain p elements
:not(selector) elements that do not match the selector. See also Elements#not(String) div:not(.logo) finds all divs that do not have the "logo" class.
div:not(:has(div)) finds divs that do not contain divs.
:contains(text) elements that contains the specified text. The search is case insensitive. The text may appear in the found element, or any of its descendants. p:contains(jsoup) finds p elements containing the text "jsoup".
:matches(regex) elements whose text matches the specified regular expression. The text may appear in the found element, or any of its descendants. td:matches(\\d+) finds table cells containing digits. div:matches((?i)login) finds divs containing the text, case insensitively.
:containsOwn(text) elements that directly contain the specified text. The search is case insensitive. The text must appear in the found element, not any of its descendants. p:containsOwn(jsoup) finds p elements with own text "jsoup".
:matchesOwn(regex) elements whose own text matches the specified regular expression. The text must appear in the found element, not any of its descendants. td:matchesOwn(\\d+) finds table cells directly containing digits. div:matchesOwn((?i)login) finds divs containing the text, case insensitively.
The above may be combined in any order and with other selectors .light:contains(name):eq(0)

Structural pseudo selectors

:root The element that is the root of the document. In HTML, this is the html element :root
:nth-child(an+b)

elements that have an+b-1 siblings before it in the document tree, for any positive integer or zero value of n, and has a parent element. For values of a and b greater than zero, this effectively divides the element's children into groups of a elements (the last group taking the remainder), and selecting the bth element of each group. For example, this allows the selectors to address every other row in a table, and could be used to alternate the color of paragraph text in a cycle of four. The a and b values must be integers (positive, negative, or zero). The index of the first child of an element is 1.

In addition to this, :nth-child() can take odd and even as arguments instead. odd has the same signification as 2n+1, and even has the same signification as 2n.
tr:nth-child(2n+1) finds every odd row of a table. :nth-child(10n-1) the 9th, 19th, 29th, etc, element. li:nth-child(5) the 5h li
:nth-last-child(an+b) elements that have an+b-1 siblings after it in the document tree. Otherwise like :nth-child() tr:nth-last-child(-n+2) the last two rows of a table
:nth-of-type(an+b) pseudo-class notation represents an element that has an+b-1 siblings with the same expanded element name before it in the document tree, for any zero or positive integer value of n, and has a parent element img:nth-of-type(2n+1)
:nth-last-of-type(an+b) pseudo-class notation represents an element that has an+b-1 siblings with the same expanded element name after it in the document tree, for any zero or positive integer value of n, and has a parent element img:nth-last-of-type(2n+1)
:first-child elements that are the first child of some other element. div > p:first-child
:last-child elements that are the last child of some other element. ol > li:last-child
:first-of-type elements that are the first sibling of its type in the list of children of its parent element dl dt:first-of-type
:last-of-type elements that are the last sibling of its type in the list of children of its parent element tr > td:last-of-type
:only-child elements that have a parent element and whose parent element hasve no other element children
:only-of-type an element that has a parent element and whose parent element has no other element children with the same expanded element name
:empty elements that have no children at all
* @author Jonathan Hedley, jonathan@hedley.net * @see #this.select(String, com_ibm_rave_core_scene_SceneNode, com_ibm_rave_render_internal_nodes_cache_SceneNodeCacheManager) */ var com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector = com_ibm_rave_core_nativeImpl_Declare({ //evaluator : null, //root : null, //cache : null, constructor : function(query, root, cache) { var _query = query.trim(); this.evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(_query); this.root = root; this.cache = cache; }, selectAll : function() { return com_ibm_rave_render_internal_select_jsoup_select_Collector.collect(this.evaluator, this.root, this.cache); } }); /** * Find elements matching selector. * @param (String) query CSS selector * @param (com.ibm.rave.core.scene.SceneNode) root root element to descend into * @param (com.ibm.rave.render.internal.nodes.cache.SceneNodeCacheManager) cache Optional caching manager that contains caches for classes, ids, etc. * @return (Array) matching elements, empty if not */ com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select = function(query, root, cache) { return new com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector(query, root, cache).selectAll(); }; // $source: com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/select/jsoup/select/QueryParser (runtime) // parse //@import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration //@import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (static) // select /** * A CSS3 selection query engine for abstract scene tree/node type scene nodes. */ var com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare({ matches : function(context, selectorString) { if (selectorString != null) { var evaluator = com_ibm_rave_render_internal_select_jsoup_select_QueryParser.parse$0(selectorString); if (evaluator) { return evaluator.matches(context.rave_getOwner(), context); } } return false; }, querySelector$0 : function(match, rootNode) { if (match != null) { var results = this.querySelectorAll$1(match, rootNode); if (results.length > 0) { return results[0]; } } return null; }, querySelector$1 : function(match) { if (match != null) { var matches = this.querySelectorAll$0(match); if (matches && matches.length > 0) { return matches[0]; } } return null; }, querySelectorAll$0 : function(match) { return this.querySelectorAll$1(match, null); }, querySelectorAll$1 : function(match, rootNode) { var results = []; if (match != null) { com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, rootNode, ":root" == match); } return results; }, querySelector : function(a0, a1) { var args = arguments; if (args.length == 1) { return this.querySelector$1(a0); } return this.querySelector$0(a0, a1); }, querySelectorAll : function(a0, a1) { var args = arguments; if (args.length == 1) { return this.querySelectorAll$0(a0); } return this.querySelectorAll$1(a0, a1); } }); com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll = function(results, match, rootNode, includeRootInResults) { var _rootNode = rootNode; if (_rootNode) { var rootProvider = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviderForNode(_rootNode); var cache = null; if (rootProvider) { cache = rootProvider.getCacheManager(); if (_rootNode == rootProvider.getRoot().rave_getOwner()) { _rootNode = rootProvider.getRoot(); } for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(match, _rootNode, cache), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var node = __exp_enFor0[__i_enFor0]; if (!(includeRootInResults == false && node == _rootNode)) { results.push(node); } } } } else { var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders(); for (var __i_enFor1 = 0, __exp_enFor1 = providers, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var provider = __exp_enFor1[__i_enFor1]; com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine.doQuerySelectorAll(results, match, provider.getRoot(), true); } } }; // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CanvasSelectionQueryEngine /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2016 ** ** 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/core/nativeImpl/Declare (loadtime) // declare // @import com/ibm/rave/render/internal/query/SceneNodeSelectionQueryEngine (loadtime) var com_ibm_rave_core_canvas_internal_nativeImpl_CanvasSelectionQueryEngine = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_query_SceneNodeSelectionQueryEngine, { constructor : function(delegateQueryEngine) { this._delegateQueryEngine = delegateQueryEngine; }, matches : function(context, selectorString) { return this._delegateQueryEngine.querySelectorAll(selectorString, null).indexOf(context) >= 0; } }); // $source: com/ibm/rave/core/canvas/internal/nativeImpl/CustomRendererSelectionQueryEngine /************************************************************************ ** IBM Confidential ** ** IBM Business Analytics: Rapidly Adaptive Visualization Engine ** ** (C) Copyright IBM Corp. 2014, 2016 ** ** 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/core/nativeImpl/Declare (loadtime) // declare // @import com/ibm/rave/render/internal/RendererConfiguration (runtime) // RendererConfiguration // @import com/ibm/rave/render/internal/select/jsoup/select/JsoupSelector (runtime) // select // @import com/ibm/rave/core/internal/css/CSSParser (runtime) /* * This class provides query support at the DOM level and into the canvas scene tree allowing * query selectors to cross the boundary from DOM to non-DOM. * * Example: * "body .visualization .axis text" * * Lets assume that ".axis text" is within a canvas. * * Start by executing this query against the DOM. No matches. * Then for each root provider, execute the same query. No matches. * * Breakdown the query into parts: ['body', '.visualization', '.axis', 'text'] * * Remove the last part and execute the query on the DOM, ".body .visualization .axis". No matches. * Remove the last part again and execute the query on the DOM, ".body .visualization". We have a match. * * Now that we have a match reconstruct a query from the removed parts: ".axis text" * Find all root providers which are descendants of the DOM query matches. * * For all root providers which are descendants, execute the query ".axis text". We have a match. * Add the matches to the result. * * Keep breaking down the original query and performing the above steps until the query is empty. * * All the while making sure not to add duplicates to the results. * */ var com_ibm_rave_core_canvas_internal_nativeImpl_CustomRendererSelectionQueryEngine = (function() { return com_ibm_rave_core_nativeImpl_Declare({ constructor : function(domQueryEngine) { this._domQueryEngine = domQueryEngine; }, matches : function(context, query) { return this._domQueryEngine.matches(context, query) || this.querySelectorAll(query, null).indexOf(context) >= 0; }, querySelector : function(query, rootNode) { if (query){ var result = this._domQueryEngine.querySelector(query, rootNode); if (result) { return result; } // TODO optimize var result = this.querySelectorAll(query, rootNode); if (result && result.length) { return result[0]; } } return null; }, querySelectorAll : function(query, rootNode) { if (!query) { return []; } rootNode = rootNode || rave_document; var results = this._domQueryEngine.querySelectorAll(query, rootNode); if (!results.concat) { // since results from the DOM query engine is a NodeList, // convert it to an array such that we can use the Array#concat method results = Array.prototype.slice.call(results, 0) } var providers = com_ibm_rave_render_internal_RendererConfiguration.INSTANCE.getRootProviders(); for (var i = 0; i < providers.length; i++) { // Add jsoup selection to results var matches = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(query, providers[i].getRoot(), providers[i].getCacheManager()); if (matches && matches.length) { results = results.concat(matches); } } // break up the original query into parts var queries = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(query); for (var i = 0; i < queries.length; i++) { var queryParts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(queries[i]); if (queryParts.length > 1) { // this array holds all the query parts we pop var endParts = []; while (queryParts.length > 1) { // remove a query part and insert it at the start of the endParts endParts.unshift(queryParts.pop()); // construct the inner query from the end parts var innerQuery = endParts.join(' '); // execute the broken down query on the DOM var partialFind = this._domQueryEngine.querySelectorAll(queryParts.join(' '), rootNode); if (partialFind && partialFind.length) { // if we have matches we need to identify root providers were are descendants of the matches for (var i = 0; i < providers.length; i++) { var provider = providers[i]; for (var j = 0; j < partialFind.length; j++) { // check if the root node is a child of any partial find var nodeToCompare = partialFind[j], parent = provider.getRoot().rave_getOwner(); do { if (parent == nodeToCompare) { break; } } while (parent = parent.parentNode); if (parent) { // we have a match // now perform the remainder of the query on the provider's root node var innerResults = com_ibm_rave_render_internal_select_jsoup_select_JsoupSelector.select(innerQuery, provider.getRoot(), provider.getCacheManager()) if (innerResults && innerResults.length) { for (var k = 0; k < innerResults.length; k++) { // don't add duplicates if (results.indexOf(innerResults[k]) == -1) { results.push(innerResults[k]); } } } break; } } } } } } } return results; } }); })(); // $source: com/ibm/rave/render/SceneItemFactory /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/RectSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/CircleSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/LineSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/TextPathSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/GroupSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/PathSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/PolygonSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/PolylineSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/DefsSceneItem (runtime) // new //@import com/ibm/rave/core/internal/svg/SVGConstants (runtime) // SVGConstants //@import com/ibm/rave/render/internal/nodes/LinearGradientSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/RadialGradientSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/StopSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/ImageSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/EllipseSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/ClipPathSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/GenericSceneNode (runtime) // new var com_ibm_rave_render_SceneItemFactory = rave_externs["SceneItemFactory"] = com_ibm_rave_core_nativeImpl_Declare({ _$functionClassMethod : function() { var _$self = /** * Create items that can be appended to the root scene tree. Ultimately the renderer will draw these shapes. * @return (com.ibm.rave.core.scene.SceneNode) Returns a new scene node of the requested type. Returns null if this is an unsupported type. */ function(nsuri, name, parentContext) { if ("rect" == name) { return new com_ibm_rave_render_internal_nodes_RectSceneItem(nsuri, parentContext); } else if ("circle" == name) { return new com_ibm_rave_render_internal_nodes_CircleSceneItem(nsuri, parentContext); } else if ("line" == name) { return new com_ibm_rave_render_internal_nodes_LineSceneItem(nsuri, parentContext); } else if ("text" == name) { return new com_ibm_rave_render_internal_nodes_TextSceneItem(nsuri, parentContext); } else if ("textPath" == name) { return new com_ibm_rave_render_internal_nodes_TextPathSceneItem(nsuri, parentContext); } else if ("g" == name) { return new com_ibm_rave_render_internal_nodes_GroupSceneItem(nsuri, parentContext); } else if ("path" == name) { return new com_ibm_rave_render_internal_nodes_PathSceneItem(nsuri, parentContext); } else if ("polygon" == name) { return new com_ibm_rave_render_internal_nodes_PolygonSceneItem(nsuri, parentContext); } else if ("polyline" == name) { return new com_ibm_rave_render_internal_nodes_PolylineSceneItem(nsuri, parentContext); } else if ("defs" == name) { return new com_ibm_rave_render_internal_nodes_DefsSceneItem(nsuri, parentContext); } else if (com_ibm_rave_core_internal_svg_SVGConstants.LINEARGRADIENT == name) { return new com_ibm_rave_render_internal_nodes_LinearGradientSceneItem(nsuri, parentContext); } else if (com_ibm_rave_core_internal_svg_SVGConstants.RADIALGRADIENT == name) { return new com_ibm_rave_render_internal_nodes_RadialGradientSceneItem(nsuri, parentContext); } else if ("stop" == name) { return new com_ibm_rave_render_internal_nodes_StopSceneItem(nsuri, parentContext); } else if ("image" == name) { return new com_ibm_rave_render_internal_nodes_ImageSceneItem(nsuri, parentContext); } else if ("ellipse" == name) { return new com_ibm_rave_render_internal_nodes_EllipseSceneItem(nsuri, parentContext); } else if ("clipPath" == name) { return new com_ibm_rave_render_internal_nodes_ClipPathSceneItem(nsuri, parentContext); } else if ("tspan" == name) { return new com_ibm_rave_render_internal_nodes_TSpanSceneItem(nsuri, parentContext); } return new com_ibm_rave_render_internal_nodes_GenericSceneNode(nsuri, parentContext, name); }; return _$self; } }); // $source: com/ibm/rave/core/scene/SceneNode /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * The base type for all nodes. */ var com_ibm_rave_core_scene_SceneNode = rave_externs["SceneNode"] = com_ibm_rave_core_nativeImpl_Declare({ /** * Get the parent of this node. * @return (com.ibm.rave.core.scene.SceneNode) the parent of this node, or null if this node has no parent. */ /** @expose */ rave_getParentNode : function() { return this.rave_getParentNode.call(this); }, /** * Get this node's owner node. Depending on the backing implementation, the owner may be equal to the root. In other cases, the owner is a special node with application level capabilities such as handling of accessibility or interactions with the rest of the application. * @return (com.ibm.rave.core.scene.SceneNode) the owner node */ /** @expose */ rave_getOwner : function() {}, /** * Set the node's owner node. * @param (com.ibm.rave.core.scene.SceneNode) owner the owner node * @see #this.getOwner() */ /** @expose */ rave_setOwner : function(owner) {}, /** * Set this node's parent. Clients should not call this method directly. * @param (com.ibm.rave.core.scene.SceneNode) parent the parent node, may be null */ /** @expose */ rave_setParentNode : function(parent) {}, /** * Appends the given node to the end of the children. * @param (com.ibm.rave.core.scene.SceneNode) node the node to append */ /** @expose */ rave_appendChild : function(node) { this.appendChild.call(this, node); }, /** * Does this node have children. * @return (boolean) true if this node has children, false otherwise */ /** @expose */ rave_hasChildNodes : function() { return this.rave_hasChildNodes.call(this); }, /** * Get the children of this node. * @return (Array) a list of child nodes */ /** @expose */ rave_getChildNodes : function() { return this.rave_getChildNodes.call(this); }, /** * Get this node's next sibling. * @return (com.ibm.rave.core.scene.SceneNode) The next sibling node, or null if the parent contains no more nodes. */ /** @expose */ rave_getNextSibling : function() { return this.rave_getNextSibling.call(this); }, /** * Get this node's first child. * @return (com.ibm.rave.core.scene.SceneNode) The first child node, or null if this node has no children. */ /** @expose */ rave_getFirstChild : function() { return this.rave_getFirstChild.call(this); }, /** * Get this node's previous sibling. * @return (com.ibm.rave.core.scene.SceneNode) The previous sibling node, or null if the parent contains no more nodes. */ /** @expose */ rave_getPreviousSibling : function() { return this.rave_getPreviousSibling.call(this); }, /** * Insert the given node before the other specified node. * @param (com.ibm.rave.core.scene.SceneNode) node the node to insert * @param (com.ibm.rave.core.scene.SceneNode) before the node to insert before */ /** @expose */ rave_insertBefore : function(node, before) { this.insertBefore.call(this, node, before); }, /** * Set the text content. * @param (String) text the text content */ /** @expose */ rave_setText : function(text) { this.rave_setText.call(this, text); }, /** * Removes the node from the list of children. * @param (com.ibm.rave.core.scene.SceneNode) node the node to remove * @return (boolean) true if the node was a child node and removed, false otherwise */ /** @expose */ removeChild : function(node) { return this.removeChild.call(this, node); }, /** * Set the style for the given name. * @param (String) styleName the style name * @param (Object) value the style value This method sets a style using default priority */ rave_setStyle$0 : function(styleName, value) { this.rave_setStyle.call(this, styleName, value, ""); }, /** * Set the style for the given name. * @param (String) styleName the style name * @param (Object) value the style value * @param (String) priority the style priority (ie, "important") */ rave_setStyle$1 : function(styleName, value, priority) { this.rave_setStyle.call(this, styleName, value, priority); }, /** * Dispatches an event on this node. * @param (com.ibm.rave.core.internal.nativeImpl.event.Event) event the triggering event * @return (boolean) false if at least one of the event handlers which handled this event called {@link this.Event#this.preventDefault()} , true otherwise */ /** @expose */ dispatchEvent : function(event) {}, /** * Retrieve the event listener for the given event type. * @param (String) eventType the event type * @return (com.ibm.rave.core.event.EventListener) the event listener, may be null */ /** @expose */ rave_getEventListener : function(eventType) {}, /** * Removes all event listeners for the given qualifier. * @param (String) group a qualifier to the event type for grouping like events */ /** @expose */ rave_removeEventListeners : function(group) {}, /** * Get the attribute value for the given attribute name. * @param (String) attribute the attribute name * @return (Object) the attribute value */ /** @expose */ getAttribute : function(attribute) {}, /** * Get the attribute value for the given attribute name. * @param (String) namespace the namespace * @param (String) attribute the attribute name * @return (Object) the attribute value */ /** @expose */ getAttributeNS : function(namespace, attribute) {}, /** * Set the attribute value for the given attribute. * @param (String) namespace the namespace * @param (String) attribute the attribute name * @param (Object) value the attribute value */ /** @expose */ setAttributeNS : function(namespace, attribute, value) {}, /** * Remove the attribute for the given attribute name. * @param (String) attribute the attribute name */ /** @expose */ removeAttribute : function(attribute) {}, /** * Remove the attribute for the given attribute name. * @param (String) namespace the namespace * @param (String) attribute the attribute name */ /** @expose */ removeAttributeNS : function(namespace, attribute) {}, /** * Get the style for the given name. * @param (String) styleName the style name * @return (Object) the style value */ /** @expose */ rave_getStyle : function(styleName) {}, /** * Get the computed style for the given name. * @param (String) styleName the style name * @return (Object) the computed style value */ /** @expose */ rave_getComputedStyle : function(styleName) {}, /** * Remove the style for the given name. * @param (String) styleName the style name */ /** @expose */ rave_removeStyle : function(styleName) {}, /** * Get the text content. * @return (String) the text content */ /** @expose */ rave_getText : function() {}, /** * Get the html content. * @return (String) the html content */ /** @expose */ rave_getHtml : function() {}, /** * Set the html content. * @param (String) html the html content */ /** @expose */ rave_setHtml : function(html) {}, /** * Query whether the CSS class is set on the node. * @param (String) className the class to query * @return (boolean) true if the class is set, false otherwise */ /** @expose */ rave_containsClass : function(className) {}, /** * Set or unset the CSS class on the node. * @param (String) className the class to query * @return (boolean) true if the class changed, false otherwise */ /** @expose */ rave_addClass : function(className) {}, /** * Remove the CSS class on the node. * @param (String) className the class to query * @return (boolean) true if the class changed, false otherwise */ /** @expose */ rave_removeClass : function(className) {}, /** * Get the data associated with this node. * @return (Object) the associated data */ /** @expose */ rave_getData : function() { return this.rave_getProperty("__data__"); }, /** * Set the data for this node. * @param (Object) value the data value */ /** @expose */ rave_setData : function(value) { this.rave_setProperty("__data__", value); }, /** * Returns true if the data had been set on this element * @return (boolean) true if data has been set otherwise false */ /** @expose */ rave_hasData : function() { return this.rave_hasProperty("__data__"); }, /** * Store a value on this node for a given key. * @param (String) key the property key * @param (Object) value the property value */ /** @expose */ rave_setProperty : function(key, value) { this.rave_setProperty.call(this, key, value); }, /** * Remove a property from the node. * @param (String) key The property to remove. */ /** @expose */ rave_removeProperty : function(key) { this.removePropertyExt.call(this, key); }, /** * Set the attribute value for the given attribute. * @param (String) key the attribute key * @param (Object) value the attribute value */ /** @expose */ setAttribute : function(key, value) { this.setAttribute.call(this, key, value); }, /** * Get a stored value from this node for a given key. * @param (String) key the property key * @return (Object) the property value */ /** @expose */ rave_getProperty : function(key) {}, /** * Returns true if this element has a property with the same name as the string passed in * @param (String) proName property name to check * @return (boolean) true if the property exist otherwise false */ /** @expose */ rave_hasProperty : function(proName) {}, /** * Get the name of this node. * @return (String) the name of this node */ /** @expose */ rave_getName : function() {}, /** * Get the namespace URI of this node. * @return (String) the namespace URI, may be null */ /** @expose */ rave_getNamespaceURI : function() {}, /** * Get the qualified name of this node. The qualified name is a concatenation of the namespace URI and the name with a colon delimiter. * @return (String) the qualified name */ /** @expose */ rave_getQualifiedName : function() {}, /** * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other styles. */ /** @expose */ getBoundingClientRect : function() {}, /** * Returns the local bounds of this node in a rectangle geom relative to its parent node. Typically these are the set positioning properties (x,y,width,height,etc). Does not take transforms into account. Does not include stroke or other styles. * @return (com.ibm.rave.core.geom.RaveRect) Bounding box of this shape. Must never return null. */ /** @expose */ getBBox : function() {}, /** * Returns the draw type of node as an int. * @return (int) The integer representation of the type of drawable shape of this node. */ /** @expose */ rave_getDrawType : function() { return 0; }, /** * Returns the computed transform matrix of this node in screen coordinates. * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation. */ /** @expose */ getScreenCTM : function() { return this.getScreenCTM.call(this); }, /** * Returns the computed transform matrix of this node in local coordinates. * @return (com.ibm.rave.core.transform.Matrix) Matrix object that describes the transform matrix. In Javascript, this object may be a native Matrix object depending on implementation. */ /** @expose */ getCTM : function() { return this.getCTM.call(this); }, /** * Dispose of this node; allow any clean up to be performed. */ /** @expose */ rave_dispose : function() {}, /** * Return all scene nodes which intersect with the rectangle * @param (com.ibm.rave.core.geom.RectStruct) rect test rectangle * @return (Array) all scene nodes which intersect with the test rectangle */ /** @expose */ rave_intersectionList : function(rect) {}, /** @expose */ rave_getSizePx : function(size) {}, /** * Return a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates * @param (double) x coordinate x * @param (double) y coordinate y * @return (com.ibm.rave.core.scene.SceneNode) a single node from the the bottom of the node containment tree, which intersects with the x,y coordinates */ /** @expose */ rave_intersection : function(x, y) {}, /** @expose */ rave_initExtensions : function() {}, /** * Return a map of css property names to set property css values on this node. This mimics window.getComputedStyles(node) on the web. (We delegate to that API on Javascript). * @return (Object) map of css property names to set property css values */ /** @expose */ rave_getComputedStyles : function() {}, /** @expose */ rave_setStyle : function(a0, a1, a2) { var args = arguments; if (args.length == 2) { return this.rave_setStyle$0(a0, a1); } return this.rave_setStyle$1(a0, a1, a2); }, /** @expose */ rave_addEventListener : function(a0, a1, a2, a3) { var args = arguments; if (args.length == 2) { return this.rave_addEventListener$1(a0, a1); } if (args.length == 3) { return this.rave_addEventListener$2(a0, a1, a2); } return this.rave_addEventListener$0(a0, a1, a2, a3); }, /** @expose */ rave_removeEventListener : function(a0, a1) { var args = arguments; if (args.length == 1) { return this.rave_removeEventListener$0(a0); } return this.rave_removeEventListener$1(a0, a1); } /** * Adds an event listener for the given qualifier and event type. * @param (String) eventType the event type * @param (com.ibm.rave.core.event.EventListener) listener the event listener * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients * @param (String) group a qualified to the event type for grouping like events */ //rave_addEventListener$0 : function(eventType, listener, useCapture, group) {}, /** * Adds an event listener for the given event type. * @param (String) eventType the event type * @param (com.ibm.rave.core.event.EventListener) listener the event listener */ //rave_addEventListener$1 : function(eventType, listener) {}, /** * Adds an event listener for the given event type. * @param (String) eventType the event type * @param (com.ibm.rave.core.event.EventListener) listener the event listener * @param (boolean) useCapture whether or not the listener is to be added to the capture phase; not supported by all clients */ //rave_addEventListener$2 : function(eventType, listener, useCapture) {}, /** * Removes an event listener for the given type. * @param (String) eventType the event type */ //rave_removeEventListener$0 : function(eventType) {}, /** * Removes an event listener for the given qualifier and type. * @param (String) eventType the event type * @param (String) group a qualifier to the event type for grouping like events */ //rave_removeEventListener$1 : function(eventType, group) {} }); /** @expose */ com_ibm_rave_core_scene_SceneNode.DATA_PROPERTY = "__data__"; // $source: com/ibm/rave/render/internal/nodes/AbstractSceneNode /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/scene/SceneNode (loadtime) // superclass //@import com/ibm/rave/render/internal/properties/SceneNodeAttributes (runtime) // new //@import com/ibm/rave/core/internal/util/CollectionsUtil (runtime) // remove //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // getIndex //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isArray //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // identity, transformBounds, isIdentityMatrix //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode //@import com/ibm/rave/core/geom/RectStruct (runtime) // new //@import com/ibm/rave/core/geom/NodeRect (runtime) // new //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse //@import com/ibm/rave/render/internal/nodes/SceneNodeStyleManager (runtime) // new //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // parse /** * A base type for scene nodes. */ var com_ibm_rave_render_internal_nodes_AbstractSceneNode = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_core_scene_SceneNode, { //cachedBBox : null, //cachedBoundingClientRect : null, //parent : null, //owner : null, //children : null, //namespaceURI : null, //attributes : null, //propertyBag : null, //classList : null, //eventListeners : null, //listenersByGroup : null, //listenersByType : null, //qname : null, /** * Scene tree context used retrieve data about the scene tree. */ //sceneTreeContext : null, /** * Native object holding specific platform information for this node. For instance on AWT, this might be a Rectangle2d object. */ //nativeSceneNode : null, //styleManager : null, //cachedCTM : null, //cachedScreenCTM : null, text : "", html : "", invalidLayout : true, dirty : false, constructor : function(nsuri, context) { this.attributes = new com_ibm_rave_render_internal_properties_SceneNodeAttributes(); { this.rave_initExtensions(); this.namespaceURI = nsuri; if (context) { this.sceneTreeContext = (context).sceneTreeContext; } this.styleManager = new com_ibm_rave_render_internal_nodes_SceneNodeStyleManager(this); } }, /** * Return this node's 'id' attribute. Must return the same value as getAttribute('id'); * @return (String) String representation of this node's ID value. */ getId : function() { var id = this.attributes.getByIndex(0); if (id == null) { return null; } return ""+(id); }, /** @expose */ rave_hasProperty : function(propName) { return this.propertyBag ? this.propertyBag.hasOwnProperty(propName) : false; }, /** * Create an instance of our children list */ createChildren : function() { this.children = []; }, /** @expose */ rave_getEventListener : function(eventType) { var info = this.eventListeners ? this.eventListeners[eventType] : null; return info ? info.listener : null; }, rave_addEventListener$1 : function(eventType, listener) { this.rave_addEventListener$0(eventType, listener, false, null); }, rave_addEventListener$2 : function(eventType, listener, useCapture) { this.rave_addEventListener$0(eventType, listener, useCapture, null); }, rave_addEventListener$0 : function(eventType, listener, useCapture, group) { var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group); if (!this.eventListeners) { this.eventListeners = {}; this.listenersByGroup = {}; this.listenersByType = {}; } else if (this.eventListeners.hasOwnProperty(eventId)) { this.rave_removeEventListener$1(eventType, group); } var info = new com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo(eventId, eventType, listener, useCapture); this.eventListeners[eventId] = info; var groupList = this.listenersByGroup[group]; if (!groupList) { groupList = []; this.listenersByGroup[group] = groupList; } groupList.push(info); var typeList = this.listenersByType[eventType]; if (!typeList) { typeList = []; this.listenersByType[eventType] = typeList; var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null; if (renderer) { renderer.registerEvent(eventType, this); } } typeList.push(info); }, rave_removeEventListener$0 : function(eventType) { if (this.eventListeners) { this.rave_removeEventListener$1(eventType, null); } }, rave_removeEventListener$1 : function(eventType, group) { if (this.eventListeners) { var eventId = com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId(eventType, group); var info = this.eventListeners[eventId]; if (info) { delete this.eventListeners[eventId]; info.isRemoved = true; var byGroupList = this.listenersByGroup[group]; if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byGroupList, info) && byGroupList.length == 0) { delete this.listenersByGroup[group]; } var byTypeList = this.listenersByType[eventType]; if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info) && byTypeList.length == 0) { delete this.listenersByType[eventType]; var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null; if (renderer) { renderer.unregisterEvent(eventType, this); } } } } }, /** @expose */ rave_removeEventListeners : function(group) { if (this.listenersByGroup) { var list = this.listenersByGroup[group]; if (list) { var renderer = this.sceneTreeContext ? this.sceneTreeContext.getRenderer() : null; for (var __i_enFor0 = 0, __exp_enFor0 = list, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var info = __exp_enFor0[__i_enFor0]; delete this.eventListeners[info.id]; info.isRemoved = true; var byTypeList = this.listenersByType[info.type]; if (com_ibm_rave_core_internal_util_CollectionsUtil.remove(byTypeList, info)) { if (byTypeList.length == 0) { delete this.listenersByType[info.type]; if (renderer) { renderer.unregisterEvent(info.type, this); } } } } delete this.listenersByGroup[group]; } } }, /** @expose */ dispatchEvent : function(event) { if (!event) { throw new Error("Null event"); } if (event.type == null || event.type.length == 0) { throw new Error("Uninitialized event"); } var targetList = []; event.target = this; var targetParent = this.rave_getParentNode(); while (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(targetParent, com_ibm_rave_render_internal_nodes_AbstractSceneNode)) { targetList.push(targetParent); targetParent = targetParent.rave_getParentNode(); } event.eventPhase = 1; if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, true, false)) { event.eventPhase = 2; if (com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, this, false, true)) { if (event.bubbles && !event.propagationStopped) { event.eventPhase = 3; com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets(event, targetList, false, false); } } } event.currentTarget = null; event.eventPhase = 0; return event.defaultPrevented; }, /** @expose */ getAttribute : function(attribute) { return attribute != null ? this.attributes.get(attribute) : null; }, setSceneTreeContext : function(stc) { this.sceneTreeContext = stc; if (this.children) { for (var __i_enFor0 = 0, __exp_enFor0 = this.children, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; (child).setSceneTreeContext(stc); } } }, /** * Notify listeners of a 'type' notification change on this node. Happens after the change has been made. * @param (int) type The SceneItemNotificationType to notify listeners about. * @param (int) subType Optional SceneItemNotificationType to notify listeners about. * @param (String) key An optional key value that is being modified. For instance, this could be the attribute name. * @param (Object) toValue The value that the key is being updated to. * @param (Object) fromValue The value that the key is being updated from (will be null if this is a new property). */ notifyAfterUpdate : function(type, subType, key, toValue, fromValue) { if (this.sceneTreeContext) { if (this.sceneTreeContext.getCacheManager()) { this.sceneTreeContext.getCacheManager().afterUpdate(type, subType, key, toValue, fromValue, this); } if (this.sceneTreeContext.getRenderer()) { this.sceneTreeContext.getRenderer().handleDrawEvent(type, this); } } }, /** @expose */ rave_getStyle : function(attribute) { var style = this.styleManager.getStyleByName(attribute); if (style && !style.fromAttribute) { return style.value != null ? style.value.toString() : ""; } return ""; }, computeStyleValue : function(id) { this.computeStylesToRoot(); return this.styleManager.getComputedCSSStyle(id).value; }, computeCSSStyle : function(id) { this.computeStylesToRoot(); return this.styleManager.getComputedCSSStyle(id); }, /** * Get the value of a previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeStyleValue(). * @see #this.computeStyleValue( this.id) * @param (int) id The internal style id to look for. * @return (Object) The value of the CSSStyle associated with this computed style. The caller is responsible for properly casting. */ getComputedStyleValue : function(id) { return this.styleManager.getComputedStyleValue(id); }, /** * Get the previously computed style based on id. Does not re-calculate the style. If you need the styles recalculated, use computeCSSStyle(). * @see #this.computeCSSStyle( this.id) * @param (int) id The internal style id to look for. * @return (com.ibm.rave.core.internal.css.CSSStyle) The CSSStyle associated with this computed style. */ getComputedCSSStyle : function(id) { return this.styleManager.getComputedCSSStyle(id); }, /** @expose */ rave_getComputedStyle : function(attribute) { this.computeStylesToRoot(); var cssStyle = this.styleManager.getComputedCSSStyle(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(attribute)); return cssStyle ? cssStyle.value != null ? cssStyle.value.toString() : "" : undefined; }, /** @expose */ rave_getComputedStyles : function() { this.computeStylesToRoot(); var results = {}; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styleManager.computedStyles), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var index = __exp_enFor0[__i_enFor0]; var style = this.styleManager.computedStyles[index]; var value; if ((typeof style.value === "string" || style.value instanceof String) || (typeof style.value === "number" || style.value instanceof Number)) { value = ""+(style.value); } else if (com_ibm_rave_core_internal_nativeImpl_Lang.isArray(style.value)) { value = ""; var array = style.value; for (var i = 0; i < array.length; ++i) { value += array[i].toString(); if (i < array.length - 1) { value += ","; } } } else { value = style.value == null ? "" : style.value.toString(); } results[style.name] = value; } return results; }, /** * Compute all styles all the way up to the root. This ensures that inherited styles are up to date for this node. TODO we need a better way to determine if the styles have changed on a node and when to recompute. */ computeStylesToRoot : function() { var parentNode = this.rave_getParentNode(); if (parentNode) { (parentNode).computeStylesToRoot(); } this.computeStyles(); }, /** @expose */ rave_getText : function() { var result = this.text; for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; result += child.rave_getText(); } return result; }, /** @expose */ rave_getHtml : function() { var builder = ""; builder+=("<" + this.rave_getName() + " " + this.attributes.serialize() + " " + this.styleManager.serialize()); if (this.rave_hasChildNodes()) { builder+=(">"); for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; builder+=((child).rave_getHtml()); } builder+=(this.text + ""); } else { if (this.text != null && this.text.length > 0) { builder+=(">" + this.text + ""); } else { builder+=("/>"); } } return builder; }, /** @expose */ rave_setHtml : function(html) { this.setDirty(true, true); var newValue = html == null ? "" : html; this.html = newValue; this.notifyAfterUpdate(1000, 2003, "html", newValue, null); }, /** @expose */ rave_addClass : function(className) { return this.addClassAndUpdateClassAttr(className, true); }, addClassAndUpdateClassAttr : function(className, updateClassAttr) { var added = false; var classes = className.split(new RegExp("\\s+")); if (classes.length > 0) { if (!this.classList) { this.classList = []; } var newClassName = null; for (var __i_enFor0 = 0, __len_enFor0 = classes.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var clazz = classes[__i_enFor0]; if (clazz.length > 0 && !(this.classList.indexOf(clazz)> -1)) { if (!added) { added = true; this.setDirty(true, true); this.styleManager.dirtyExternalStyles = true; newClassName = this.attributes.getByIndex(2); if (newClassName == null) { newClassName = ""; } } if (newClassName.length > 0) { newClassName += " "; } newClassName += clazz; this.classList.push(clazz); this.notifyAfterUpdate(1001, 2001, "class", clazz, null); } } if (added && updateClassAttr) { this.attributes.setPropertyValue(2, newClassName); } } return added; }, /** @expose */ rave_removeClass : function(className) { var removed = false; if (this.classList && this.classList.length > 0) { var classes = className.split(new RegExp("\\s+")); if (classes.length > 0) { for (var __i_enFor0 = 0, __len_enFor0 = classes.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var clazz = classes[__i_enFor0]; if (clazz.length > 0 && this.classList.indexOf(clazz)> -1) { if (!removed) { removed = true; this.setDirty(true, true); this.styleManager.dirtyExternalStyles = true; } com_ibm_rave_core_internal_util_CollectionsUtil.remove(this.classList, clazz); this.notifyAfterUpdate(1002, 2001, "class", null, clazz); } } if (removed) { this.attributes.setPropertyValue(2, this.classList.join(" ")); } } } return removed; }, /** @expose */ rave_containsClass : function(className) { if (!this.classList) { return false; } var classes = className.trim().split(new RegExp("\\s")); for (var __i_enFor0 = 0, __len_enFor0 = classes.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var clazz = classes[__i_enFor0]; if (!(this.classList.indexOf(clazz.trim())> -1)) { return false; } } return true; }, /** @expose */ rave_getNamespaceURI : function() { return this.namespaceURI; }, /** @expose */ rave_getQualifiedName : function() { if (this.qname == null) { this.qname = this.namespaceURI + ":" + this.rave_getName(); } return this.qname; }, /** @expose */ getAttributeNS : function(namespace, attribute) { return this.getAttribute(namespace + ":" + attribute); }, /** @expose */ setAttributeNS : function(namespace, attribute, value) { this.setAttribute(namespace + ":" + attribute, value); }, /** @expose */ removeAttribute : function(attribute) { var oldValue = this.attributes.get(attribute); if (oldValue == null) { return; } this.setAttribute(attribute, null); this.notifyAfterUpdate(1002, 2000, attribute, null, oldValue); }, /** @expose */ removeAttributeNS : function(namespace, attribute) { this.removeAttribute(namespace + ":" + attribute); }, /** @expose */ rave_removeStyle : function(styleName) { this.styleManager.removeStyle(styleName); }, /** * Computes all styles for this node. The caller must ensure that all parent nodes have had their styles computed already. */ computeStyles : function() { this.styleManager.computeStyles(); }, /** @expose */ rave_getProperty : function(key) { return this.propertyBag ? this.propertyBag[key] : null; }, /** * @return (Array) List of class names on this node. */ getClassList : function() { if (!this.classList) { this.classList = []; } return this.classList; }, getPropertyBag : function() { if (!this.propertyBag) { this.propertyBag = {}; } return this.propertyBag; }, /** @expose */ rave_setParentNode : function(parent) { var rendererSet = false; if (!this.sceneTreeContext && parent) { var r = (parent).sceneTreeContext; if (r) { this.setSceneTreeContext(r); rendererSet = true; } } if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) { if ((!this.parent && parent) || rendererSet) { this.recursiveRegisterEventListeners(); } else if (this.parent && !parent) { this.recursiveUnregisterEventListeners(); } if (!parent) { this.setSceneTreeContext(null); } } this.parent = parent; }, /** @expose */ rave_getOwner : function() { if (this.owner) { return this.owner; } var p = this.rave_getParentNode(); return !p ? null : p.rave_getOwner(); }, /** @expose */ rave_setOwner : function(owner) { this.owner = owner; }, /** * @expose */ computeCTM : function(context, isScreenCTM) { var abstractContext = context; var ctm = com_ibm_rave_core_transform_MatrixUtil.identity(); var t = abstractContext.computeStyleValue(11); if (t) { ctm = t; } var parent = context.rave_getParentNode(); if (parent) { var pctm = isScreenCTM ? parent.getScreenCTM() : parent.getCTM(); if (pctm) { if (!ctm) { ctm = pctm; } else if (!(com_ibm_rave_core_transform_MatrixUtil.isIdentityMatrix(pctm))) { ctm = pctm.multiply(ctm); } } } return ctm ? ctm : com_ibm_rave_core_transform_MatrixUtil.identity(); }, recursiveRegisterEventListeners : function() { if (this.eventListeners) { var renderer = this.sceneTreeContext.getRenderer(); for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var type = __exp_enFor0[__i_enFor0]; renderer.registerEvent(type, this); } } if (this.children) { for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var child = __exp_enFor1[__i_enFor1]; (child).recursiveRegisterEventListeners(); } } }, recursiveUnregisterEventListeners : function() { if (this.eventListeners) { var renderer = this.sceneTreeContext.getRenderer(); for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.eventListeners), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var type = __exp_enFor0[__i_enFor0]; renderer.unregisterEvent(type, this); } } if (this.children) { for (var __i_enFor1 = 0, __exp_enFor1 = this.children, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var child = __exp_enFor1[__i_enFor1]; (child).recursiveUnregisterEventListeners(); } } }, /** * Removes the child from this parent but does not update the parent node of the child. * @param (com.ibm.rave.core.scene.SceneNode) child */ internalRemoveChild : function(child) { var idx = this.children.indexOf(child); if (idx >= 0) { this.children.splice(idx, 1); } }, /** * Helper method to append a child item. * @param (com.ibm.rave.core.scene.SceneNode) item the child item to append * @return (int) the index of the appended item */ internalAppendChild : function(item) { if (!this.children) { this.createChildren(); } this.setDirty(true, true); if (item.rave_getParentNode()) { item.rave_getParentNode().removeChild(item); } this.children.push(item); item.rave_setParentNode(this); return this.children.length - 1; }, /** * Helper method to insert a child item before another one. If the 'before' item isn't actually a child of this node, then insert 'item' at the end. * @param (com.ibm.rave.core.scene.SceneNode) item the item to insert * @param (com.ibm.rave.core.scene.SceneNode) before the item to insert before * @return (int) the index of the inserted item. */ insertChildBefore : function(item, before) { if (!this.children) { this.createChildren(); } var bidx = this.children.indexOf(before); if (before && bidx >= 0) { if (item == before) { return bidx; } this.setDirty(true, true); this.internalRemoveChild(item); bidx = this.children.indexOf(before); item.rave_setParentNode(this); this.children.splice(bidx, 0, item); return bidx; } this.setDirty(true, true); this.children.push(item); item.rave_setParentNode(this); return this.children.length - 1; }, /** * Get the sibling of this scene item at the specified index offset. The offset can be any integer, including 0 or negative values. For a negative offset, this method will return a sibling at a position preceding this item. * @param (int) offset Integer index offset. * @return (com.ibm.rave.core.scene.SceneNode) This item's sibling at the specified index offset. */ getSibling : function(offset) { var sibling; if (this.parent) { var c = this.parent.rave_getChildNodes(); var idx = c.indexOf(this); var idxOffset = idx + offset; if (idx > -1 && (idxOffset >= 0 && idxOffset < c.length)) { sibling = c[idxOffset]; } } return sibling; }, _detectHits : function(list, rectangle) { if (this._hitDetectionEntryTest()) { return; } if (this.rave_intersects(rectangle)) { if (this.rave_hasChildNodes()) { var childNodes = this.getChildrenArray(); for (var i = childNodes.length - 1; i >= 0; --i) { var child = childNodes[i]; var ctm = child.getComputedStyleValue(11); child._detectHits(list, ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle); } } else if (!("none" == this.getComputedStyleValue(42))) { list.push(this); } } }, _detectHit : function(rectangle) { if (this._hitDetectionEntryTest()) { return null; } if (this.rave_intersects(rectangle)) { if (this.rave_hasChildNodes()) { var childNodes = this.getChildrenArray(); for (var i = childNodes.length - 1; i >= 0; --i) { var child = childNodes[i]; var ctm = child.getComputedStyleValue(11); var hit = child._detectHit(ctm ? com_ibm_rave_core_transform_MatrixUtil.transformBounds(rectangle, ctm.inverse()) : rectangle); if (hit) { return hit; } } } else if (!("none" == this.getComputedStyleValue(42))) { return this; } return !this.rave_getParentNode() ? this : null; } return null; }, _hitDetectionEntryTest : function() { return !(this.isVisible()) || "none" == this.getComputedStyleValue(26); }, rave_intersects : function(rect) { if ("none" == this.computeStyleValue(26) || "none" == this.getComputedStyleValue(42) || !(this.intersectsClip(rect))) { return false; } var r = this.getBBox(); return r.intersects(rect); }, /** * Helper method to check if the given rect intersects with the clip on this node. If no clip is present, returns true. * @param (com.ibm.rave.core.geom.RectStruct) rect the rectangle hit testing region * @return (boolean) true if the rectangle intersects the clip or if no clip is present, false otherwise */ intersectsClip : function(rect) { var clip = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(this, this.getComputedStyleValue(44), [1014]); return !clip || clip.rave_intersects(rect); }, /** @expose */ rave_intersectionList : function(r) { var list = []; this._detectHits(list, r); return list; }, /** @expose */ rave_intersection : function(x, y) { return this._detectHit(new com_ibm_rave_core_geom_RectStruct(x, y, 0.5, 0.5)); }, /** @expose */ rave_initExtensions : function() { this.rave_setProperty = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT; this.removePropertyExt = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT; this.appendChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT; this.rave_getParentNode = com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT; this.insertBefore = com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT; this.rave_getNextSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT; this.rave_getPreviousSibling = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT; this.rave_getFirstChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD; this.rave_hasChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT; this.rave_getChildNodes = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT; this.removeChild = com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT; this.rave_setStyle = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT; this.setAttribute = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT; this.rave_setText = com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT; this.getCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT; this.getScreenCTM = com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT; }, /** * Return the index of this node relative to its siblings. * @return (int) The index of this node relative to its siblings. */ getSiblingIndex : function() { return this.parent.rave_getChildNodes().indexOf(this); }, /** * Called after painting of node and its children. By default, this does nothing. Nodes can override as needed. * @param (com.ibm.rave.render.AbstractRenderer) renderer The renderer to draw to */ postPaint : function(renderer) {}, /** * Is this a 'drawable' scene node. ie - one that can be drawn on a canvas. For instance, a "rect" shape is drawable, while a "defs" node is not. * @return (boolean) true if this is a drawable node, false otherwise. */ isDrawable : function() { return true; }, /** * Get the size from the computed style and convert to pixel value. * @param (com.ibm.rave.core.css.CSSSize) size the CSS size * @return (double) a pixel value of the size for the given style */ /** @expose */ rave_getSizePx : function(size) { var value = 0; if (size) { value = size.value; switch (size.unit.type) { case 1: break; case 2: break; case 4: value = 96.0 * 0.3937007874 * value; break; case 3: value = 96.0 * value; break; case 6: value = 96.0 * 0.0138888889 * value; break; case 7: value = 96.0 * 0.1666666667 * value; break; case 5: value = 96.0 * 0.0393700787 * value; break; } } return value; }, /** * Return a pixel size for the computed style information for the style referenced by styleId. * @param (int) styleId Style id from SceneNodeStyles. * @return (double) Computed pixel value for this style. */ getComputedSizePx : function(styleId) { return this.rave_getSizePx(this.getComputedCSSStyle(styleId).value); }, /** @expose */ getBBox : function() { if (this.invalidLayout) { this.layout(); } if (!this.cachedBBox) { this.cachedBBox = this.calculateBBox(); } return this.cachedBBox; }, /** * A method to get the bounding box to use in getBoundingClientRect() calculations. By default this method just calls getBBox(), but some scene node types may need to override this. For instance, text nodes change their x values based on text-anchor. * @return (com.ibm.rave.core.geom.RaveRect) Bounding box to be used in getBoundingClientRect() before transforms are applied. */ getBoundingClientRectBBox : function() { return this.getBBox(); }, /** * Perform a layout pass on this node and this node only. Invalidate our layout caches. */ layout : function() { if (this.invalidLayout) { this.computeStylesToRoot(); this.doLayout(); } this.invalidLayout = false; }, /** * We call invalidateLayout whenever an attribute or style changes that changes the bounding box of this node. */ invalidateLayout : function() { this.invalidLayout = true; this.cachedBBox = null; var parent = this; if ((parent = parent.rave_getParentNode()) && !(parent).invalidLayout) { (parent).invalidateLayout(); } }, /** * Called whenever transform information has changed. This invalidates our CTM and cached bounding client rect. */ invalidateTransform : function() { this.cachedBoundingClientRect = null; this.cachedScreenCTM = null; this.cachedCTM = null; if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; (child).invalidateTransform(); } } }, /** * Returns the size of this node in a rectangle geom and its position relative to the viewport. Takes all transforms into account - ie transform, translate, rotate, etc. Does not include stroke or other non-layout attributes. */ /** @expose */ getBoundingClientRect : function() { if (this.invalidLayout) { this.layout(); } if (!this.cachedBoundingClientRect) { var bb = this.getBoundingClientRectBBox(); var ownerLeft = 0; var ownerTop = 0; if (this.rave_getOwner() != this) { var ownerRect = this.rave_getOwner().getBoundingClientRect(); ownerLeft = ownerRect.left; ownerTop = ownerRect.top; } var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(bb.x, bb.y, bb.width, bb.height), this.getCTM()); var left = bstruct.x + ownerLeft; var right = left + bstruct.width; var top = bstruct.y + ownerTop; var bottom = top + bstruct.height; this.cachedBoundingClientRect = new com_ibm_rave_core_geom_NodeRect(left, right, bottom, top, bstruct.width, bstruct.height); } return this.cachedBoundingClientRect; }, /** * Is this node 'visible' meaning it will be fully drawn. This method only takes the visibility attribute into account. * @return (boolean) true if this node should be painted. false otherwise. */ isVisible : function() { return this.styleManager.isVisible(); }, isDirty : function() { return this.dirty; }, setDirty : function(dirty_, invalidateLayout) { if (dirty_) { var notifyChildren = false; if (!this.dirty) { this.dirty = true; notifyChildren = true; switch (this.rave_getDrawType()) { case -1: case 1004: case 1015: break; default: if (this.sceneTreeContext && this.sceneTreeContext.getRenderer()) { this.sceneTreeContext.getRenderer().makeDirty(this); } } } if (invalidateLayout) { this.invalidateLayout(); this.invalidateTransform(); } if (notifyChildren && this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; (child).setDirty(true, false); } } } else { this.dirty = false; } }, /** * Internal API to return raw children nodes collection (including mirrored groups if any). Can return null * @return (Array) raw children nodes collection (including mirrored groups if any). Can return null */ getChildrenArray : function() { return this.children; }, getShadow : function() { return com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow")); }, /** @expose */ rave_addEventListener : function(a0, a1, a2, a3) { var args = arguments; if (args.length == 2) { return this.rave_addEventListener$1(a0, a1); } if (args.length == 3) { return this.rave_addEventListener$2(a0, a1, a2); } return this.rave_addEventListener$0(a0, a1, a2, a3); }, /** @expose */ rave_removeEventListener : function(a0, a1) { var args = arguments; if (args.length == 1) { return this.rave_removeEventListener$0(a0); } return this.rave_removeEventListener$1(a0, a1); } //paint : function(renderer) {}, /** * Calculate the bounding box based on the currently set attributes. */ //calculateBBox : function() {}, /** * Perform a layout pass on this node. */ //doLayout : function() {} }); com_ibm_rave_render_internal_nodes_AbstractSceneNode.createEventId = function(eventType, group) { return eventType + (group != null ? "." + group : ""); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTargets = function(event, targetList, capturing, atTargetPhase) { var start = 0, inc = 1, end = targetList.length; if (capturing) { start = targetList.length - 1; inc = end = -1; } for (var i = start; i != end && !event.propagationStopped && !event.immediatePropagationStopped; i += inc) { com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget(event, targetList[i], capturing, atTargetPhase); } return !event.propagationStopped; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.dispatchToTarget = function(event, currentTarget, capturing, atTargetPhase) { if (currentTarget.listenersByType) { var list = currentTarget.listenersByType[event.type]; if (list) { list = list.slice(); var currentListener = list.length; while (--currentListener >= 0) { var info = list[currentListener]; if (!info.isRemoved && (atTargetPhase || info.capture == capturing)) { event.currentTarget = currentTarget; info.listener.call(currentTarget, event); } } } } return !event.propagationStopped; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.ListenerInfo = function(id, type, listener, capture) { this.id = id; this.type = type; this.listener = listener; this.capture = capture; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_PROPERTY_EXT = function(key, value) { if ("__rave-mirrored__" == key) { (this).invalidateLayout(); } (this).getPropertyBag()[key] = value; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_PROPERTY_EXT = function(key) { delete (this).getPropertyBag()[key]; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.APPEND_CHILD_EXT = function(node) { (this).internalAppendChild(node); (node).notifyAfterUpdate(1001, 3000, null, null, null); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.INSERT_BEFORE_EXT = function(node, before) { (this).insertChildBefore(node, before); (node).notifyAfterUpdate(1001, 3000, null, null, null); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_NEXT_SIBLING_EXT = function() { return (this).getSibling(1); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_PREVIOUS_SIBLING_EXT = function() { return (this).getSibling(-1); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_FIRST_CHILD = function() { var asc = this; if (asc.children && asc.children.length > 0) { return asc.children[0]; } return asc.getSibling(1); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.HAS_CHILD_NODES_EXT = function() { var asc = this; return asc.children && asc.children.length > 0; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CHILD_NODES_EXT = function() { var asc = this; if (!asc.children) { asc.createChildren(); } return asc.children; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.REMOVE_CHILD_EXT = function(node) { var asc = this; var removed = false; var idx = asc.children.indexOf(node); if (idx >= 0) { removed = true; (node).setDirty(true, true); asc.children.splice(idx, 1); (node).notifyAfterUpdate(1002, 3000, null, null, null); node.rave_setParentNode(null); } return removed; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.PARENT_NODE_EXT = function() { return (this).parent; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_TEXT_EXT = function(text) { (this).setDirty(true, true); var oldValue = (this).text; var newValue = text == null ? "" : text; var copy = []; for (var __i_enFor0 = 0, __exp_enFor0 = (this).rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; copy.push(child); } for (var __i_enFor1 = 0, __exp_enFor1 = copy, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var child = __exp_enFor1[__i_enFor1]; (this).removeChild(child); } (this).text = newValue; (this).notifyAfterUpdate(1000, 2004, "text", newValue, oldValue); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_ATTRIBUTE_EXT = function(key, value) { if (key != null) { var k = key.toLowerCase(); var acontext = this; var oldValue; var index = acontext.attributes.getIndex(k); switch (index) { case 2: if (acontext.classList) { acontext.classList = null; } if (value != null) { acontext.addClassAndUpdateClassAttr(""+(value), false); } else { acontext.setDirty(true, false); } break; case 1: acontext.styleManager.removeAllInlineStyles(); var styleSheet = com_ibm_rave_core_internal_css_CSSParser.parse("a{" + ""+(value) + "}"); for (var __i_enFor0 = 0, __exp_enFor0 = styleSheet.cssRules, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var rule = __exp_enFor0[__i_enFor0]; var styleDecl = rule.style; for (var i = 0; i < styleDecl.length; ++i) { var styleName = styleDecl.item(i); acontext.rave_setStyle(styleName, styleDecl.getPropertyValue(styleName), styleDecl.getPropertyPriority(styleName)); } } break; default: var styleIndex = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(k); if (styleIndex >= 0) { var style = acontext.styleManager.getStyleByIndex(styleIndex); if (!style) { acontext.rave_setStyle(k, value, null); style = acontext.styleManager.getStyleByIndex(styleIndex); if (style) { style.fromAttribute = true; } } else if (style.fromAttribute) { acontext.rave_setStyle(k, value, null); style.fromAttribute = true; } } else { acontext.setDirty(true, true); } } if (index == -1) { oldValue = acontext.attributes.get(k); index = acontext.attributes.put(k, value); } else { oldValue = acontext.attributes.getByIndex(index); acontext.attributes.setPropertyValue(index, value); } acontext.notifyAfterUpdate(1000, 2000, k, value, oldValue); } }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.SET_STYLE_EXT = function(styleName, value, priority) { (this).styleManager.setStyle(this, styleName, value, priority); }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_CTM_EXT = function() { var abstractContext = this; if (!abstractContext.cachedCTM) { abstractContext.cachedCTM = abstractContext.computeCTM(this, false); } return abstractContext.cachedCTM; }; com_ibm_rave_render_internal_nodes_AbstractSceneNode.GET_SCREEN_CTM_EXT = function() { var abstractContext = this; if (!abstractContext.cachedScreenCTM) { abstractContext.cachedScreenCTM = abstractContext.computeCTM(this, true); } return abstractContext.cachedScreenCTM; }; // $source: com/ibm/rave/render/internal/nodes/RectSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new /** * Rectangle shape. */ var com_ibm_rave_render_internal_nodes_RectSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { x : 0, y : 0, width : 0, height : 0, rx : 0, ry : 0, calculateBBox : function() { return new com_ibm_rave_core_geom_RaveRect(this.x, this.y, this.width, this.height); }, /** @expose */ rave_getDrawType : function() { return 1000; }, /** @expose */ rave_getName : function() { return "rect"; }, getX : function() { return this.x; }, getY : function() { return this.y; }, getWidth : function() { return this.width; }, getHeight : function() { return this.height; }, getRx : function() { return this.rx; }, getRy : function() { return this.ry; }, rave_intersects : function(rect) { var rx = this.getRx(); var ry = this.getRy(); if (rx < 1 && ry < 1) { return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect); } var x = this.getX(); var y = this.getY(); var w = this.getWidth(); var h = this.getHeight(); rx = (rx == 0) ? ry : rx; ry = (ry == 0) ? rx : ry; if (rx > w / 2) { rx = w / 2; } if (ry > h / 2) { ry = h / 2; } var kappa = 0.5522848; var ox = rx * kappa; var oy = ry * kappa; var xe = x + w; var ye = y + h; var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler(); pathHandler.moveTo(x + rx, y); pathHandler.lineTo(x + w - rx, y); pathHandler.bezierCurveTo(xe - rx + ox, y, xe, y + ry - oy, xe, y + ry); pathHandler.lineTo(x + w, y + h - ry); pathHandler.bezierCurveTo(xe, ye - ry + oy, xe - rx + ox, ye, xe - rx, ye); pathHandler.lineTo(x + rx, y + h); pathHandler.bezierCurveTo(x + rx - ox, ye, x, ye - ry + oy, x, ye - ry); pathHandler.lineTo(x, y + ry); pathHandler.bezierCurveTo(x, y + ry - oy, x + rx - ox, y, x + rx, y); pathHandler.closePath(); var shapes = pathHandler.getShapes(); return shapes[0].intersect$1(rect) && this.intersectsClip(rect); }, paint : function(renderer) { renderer.setStrokeAndFill(this); renderer.drawRect(this); }, doLayout : function() { this.x = this.rave_getSizePx(this.getComputedCSSStyle(0).value); this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value); this.width = this.rave_getSizePx(this.getComputedCSSStyle(2).value); this.height = this.rave_getSizePx(this.getComputedCSSStyle(3).value); this.rx = this.rave_getSizePx(this.getComputedCSSStyle(12).value); this.ry = this.rave_getSizePx(this.getComputedCSSStyle(13).value); } //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/properties/DynamicAttributesCollection /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * A representation of a set of attributes on a scene item. Uses a fixed array of 'propertyNames' and 'propertyValues'. The values can be modified, names cannot. This is done for speed because we can access the values by index which is much faster than using a string->object map. */ var com_ibm_rave_render_internal_properties_DynamicAttributesCollection = com_ibm_rave_core_nativeImpl_Declare({ //propNames : null, //propValues : null, //dynamicMap : null, allowUnknownProperties : true, getByIndex : function(i) { return this.propValues[i]; }, setPropertyValue : function(index, value) { this.propValues[index] = value; }, get : function(propName) { var i = this.getIndex(propName); if (i == -1) { return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap[propName.toLowerCase()] : null; } return this.propValues[i]; }, put : function(propName, value) { var i = this.getIndex(propName); if (i == -1) { if (this.allowUnknownProperties) { if (!this.dynamicMap) { this.dynamicMap = {}; } this.dynamicMap[propName] = value; } } else { this.setPropertyValue(i, value); } return i; }, getIndex : function(propName) { for (var i = 0, len = this.propNames.length; i < len; ++i) { if (this.propNames[i] == propName) { return i; } } return -1; }, /** * returns how many attributes exist in this attribute collection * @return (int) Number of properties in this collection. */ size : function() { return this.propNames.length + (!this.allowUnknownProperties || !this.dynamicMap ? 0 : Object.keys(this.dynamicMap).length); }, /** * Determine if this collection contains a property with the same name as the passed string The method implementation relies on the fact that string are interned so for example in java do not do containsProperty(new String("key")) performance is very important in this method * @param (String) propName property to check * @return (boolean) true if there is a property with the same name otherwise false */ containsProperty : function(propName) { var props = this.propNames; for (var index = 0; index < props.length; ++index) { if (props[index] == propName) { return true; } } return this.allowUnknownProperties && this.dynamicMap ? this.dynamicMap.hasOwnProperty(propName) : false; }, getKeys : function() { var result = []; for (var __i_enFor0 = 0, __exp_enFor0 = this.propNames, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var name = __exp_enFor0[__i_enFor0]; result.push(name); } if (this.dynamicMap) { for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.dynamicMap), __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var name = __exp_enFor1[__i_enFor1]; result.push(name); } } return result; }, /** * Return a serialized version of all set values in this collection in the form: "key="value" key="value"" * @return (String) serialized version in the form "key="value" key="value"" */ serialize : function() { var builder = ""; for (var __i_enFor0 = 0, __exp_enFor0 = this.getKeys(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; var val = this.get(key); if (val != null) { builder+=(key + "=\"" + val + "\"" + " "); } } return builder.trim(); } }); // $source: com/ibm/rave/render/internal/properties/SceneNodeAttributes /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/properties/DynamicAttributesCollection (loadtime) // superclass /** * A list of public attribute properties for scene nodes. Typically only used by renderers for quick access to properties. */ var com_ibm_rave_render_internal_properties_SceneNodeAttributes = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_properties_DynamicAttributesCollection, { constructor : function() { this.propNames = com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames; this.propValues = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]; } }); com_ibm_rave_render_internal_properties_SceneNodeAttributes.id = 0; com_ibm_rave_render_internal_properties_SceneNodeAttributes.style = 1; com_ibm_rave_render_internal_properties_SceneNodeAttributes.class_attr = 2; com_ibm_rave_render_internal_properties_SceneNodeAttributes.transform = 3; com_ibm_rave_render_internal_properties_SceneNodeAttributes.clip_path = 4; com_ibm_rave_render_internal_properties_SceneNodeAttributes.x = 5; com_ibm_rave_render_internal_properties_SceneNodeAttributes.y = 6; com_ibm_rave_render_internal_properties_SceneNodeAttributes.width = 7; com_ibm_rave_render_internal_properties_SceneNodeAttributes.height = 8; com_ibm_rave_render_internal_properties_SceneNodeAttributes.x1 = 9; com_ibm_rave_render_internal_properties_SceneNodeAttributes.x2 = 10; com_ibm_rave_render_internal_properties_SceneNodeAttributes.r = 11; com_ibm_rave_render_internal_properties_SceneNodeAttributes.y1 = 12; com_ibm_rave_render_internal_properties_SceneNodeAttributes.y2 = 13; com_ibm_rave_render_internal_properties_SceneNodeAttributes.cx = 14; com_ibm_rave_render_internal_properties_SceneNodeAttributes.cy = 15; com_ibm_rave_render_internal_properties_SceneNodeAttributes.d = 16; com_ibm_rave_render_internal_properties_SceneNodeAttributes.points = 17; com_ibm_rave_render_internal_properties_SceneNodeAttributes.propertyNames = ["id", "style", "class", "transform", "clip-path", "x", "y", "width", "height", "x1", "x2", "r", "y1", "y2", "cx", "cy", "d", "points"]; // $source: com/ibm/rave/render/internal/style/ShorthandStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * Abstract class describing a shorthand style definition. Basically just a set of key/value pairs that describe each piece of a shorthand property. For instance, the "font" style is a shorthanded way of defining "font-size", "font-weight", "font-family", etc. */ var com_ibm_rave_render_internal_style_ShorthandStyle = com_ibm_rave_core_nativeImpl_Declare({ //getKeys : function() {}, //getValue : function(key) {} }); // $source: com/ibm/rave/render/internal/style/FontStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/ShorthandStyle (loadtime) // superclass //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseFont, parseWeight, parseSize, parseFontFamily /** *

Represents CSS font information. Properties are:

font-size
A CSSSize with numeric value ( {@link #this.getSize()} ) and unit ( {@link #this.getUnit()} ).
font-family
A string ( {@link #this.getFamily()} ). The family is a comma-separated list of family names. The names in the input list may be quoted. The stored names are all quoted, using double-quotes if the original was not quoted.
font-style
A string ( {@link #this.getStyle()} ). Supported values are "normal", "oblique", or "italic".
font-weight
A string ( {@link #this.getWeight()} ). Supported values are "normal", "bold", "bolder", "lighter", or a multiple of 100 between 100 and 900 inclusive.
font-variant
A string ( {@link #this.getFontVariant()} ). Supported values are "normal", "small-caps".
lineHeight
A string ( {@link #this.getLineHeightAsString()} ), only available by the {@link #this.toString()} method.
*/ var com_ibm_rave_render_internal_style_FontStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_ShorthandStyle, { //values : null, //style : null, //size : null, //family : null, //lineHeight : null, //weight : null, //variant : null, constructor : function(style, family, size, weight, lineHeight, variant) { this.values = []; /** * A class that holds font styling information. Typically used only by external renderers but still needs to be public. This class is not responsible for ensuring the local system supports any or all font information. * @param (String) style The style in which the font is displayed. Valid values are "normal", "italic", "oblique". * @param (String) family The font face to display the font in. Must be a valid system/web font. Default depends on the renderer and system. * @param (com.ibm.rave.core.css.CSSSize) size The font size in 'unit' measurements. * @param (String) weight The 'boldness' of a font. Similar to a CSS font-weight value. Weights are interpolated over a range of 0-900 with steps of 100. Each step is more bold than the last, providing the font supports different weight values. For fonts that only support "normal" and "bold" 100-500 is normal and 600-900 is bold. * @param (String) lineHeight A string describing the height of each line of this font. * @param (String) variant The variant type of this font. Only options are "normal" or "small-caps". */ { var _style = style; var _family = com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(family); var _variant = variant; if (_style == null) { _style = ""; } this.values.push(_style); this.style = _style; this.values.push(size); this.size = size; if (_family == null) { _family = ""; } this.values.push(_family); this.family = _family; this.weight = weight; this.values.push(this.weight); if (_variant == null) { _variant = ""; } this.values.push(_variant); this.variant = _variant; this.values.push(lineHeight); this.lineHeight = lineHeight; } }, /** * Return the 'style' of this font. Valid current values are "normal", "italic", "oblique". * @return (String) style of this font. ("normal", "italic", "oblique"). */ getStyle : function() { return this.style; }, /** * Returns the current size of the font in the set unit. * @return (double) The size of the font in the current unit measurement. */ getSize : function() { return this.size.value; }, /** * Return the unit type set for this style. * @return (com.ibm.rave.core.css.CSSUnit) a {@link (com.ibm.rave.core.css.CSSUnit) CSSUnit} */ getUnit : function() { return this.size.unit; }, /** * @return (com.ibm.rave.core.css.CSSSize) The {@link (com.ibm.rave.core.css.CSSSize) CSSSize} of this font, with size and unit */ getCSSSize : function() { return this.size; }, /** * Return the set font family as a simple string. Typically follows CSS-style format (comma separated list). This class is not responsible for ensuring the local system supports any or all font family information. * @return (String) Font family as a comma separated (CSS-style) list. */ getFamily : function() { return this.family; }, /** * Return the weight type set for this style. * @return (String) String representing the font weight style. */ getWeight : function() { return this.weight; }, getLineHeightAsString : function() { if (this.lineHeight == null) { return "normal"; } return this.lineHeight; }, /** * Return the variant definition of this font style. * @return (String) font variant. Current values are "normal" or "small-caps". */ getFontVariant : function() { return this.variant; }, /** * Return the shorthand font CSS property of this style. */ toString : function() { var str = this.style + " " + this.variant + " " + this.weight + " " + (~~this.getSize()) + this.getUnit() + "/" + this.getLineHeightAsString() + " " + this.family; return str.trim(); }, getKeys : function() { return com_ibm_rave_render_internal_style_FontStyle.keys; }, getValue : function(key) { var i = com_ibm_rave_render_internal_style_FontStyle.keys.indexOf(key); if (i > -1) { return this.values[i]; } return null; } }); /** * Parse a shorthand font per the rules defined by W3 CSS.

[ [ <'font-style'> || <font-variant-css21> || <'font-weight'> || <'font-stretch'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar where <font-variant-css21> = [ normal | small-caps ] * @param (Object) value Font CSS style rule text. * @return (com.ibm.rave.render.internal.style.FontStyle) TextStyle representing font. Returns null if invalid specification (missing size or family, or invalid weight number) */ com_ibm_rave_render_internal_style_FontStyle.parseFont = function(value) { var parsed = com_ibm_rave_core_internal_css_CSSUtil.parseFont(value); var _size = com_ibm_rave_core_internal_css_CSSUtil.parseSize(parsed[3]); var _weight = com_ibm_rave_core_internal_css_CSSUtil.parseWeight(parsed[2]); var _family = parsed[5]; if (!_size || _family == null || _weight == null) { return null; } return new com_ibm_rave_render_internal_style_FontStyle(parsed[0], _family, _size, _weight, parsed[4], parsed[1]); }; com_ibm_rave_render_internal_style_FontStyle.keys = ["font-style", "font-size", "font-family", "font-weight", "font-variant", "line-height"]; // $source: com/ibm/rave/render/internal/style/AbstractStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/Rave (runtime) // rgba /** * An abstract implementation of a style. Includes things typically required in a style class like color, opacity, etc. */ var com_ibm_rave_render_internal_style_AbstractStyle = com_ibm_rave_core_nativeImpl_Declare({ opacity : 1, /** * Return opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque. * @return (double) opacity of this style between 0-1. */ getOpacity : function() { return this.opacity; }, /** * Set opacity of this styled object between 0-1. 0 means fully transparent. 1 means fully opaque. * @param (double) opacity Opacity to set. */ setOpacity : function(opacity) { this.opacity = opacity; }, /** * Does this style produce a style that is visible and should be drawn. * @return (boolean) true if this style is visible false otherwise. */ isVisible : function() { return this.opacity > 0; }, calculateColorWithOpacity : function() { var color = this.getColor(); return com_ibm_rave_core_Rave.rgba(color.r, color.g, color.b, color.a * this.opacity); } /** * Returns the type of style. * @return (int) enum value from StyleTypes * @see (com.ibm.rave.render.internal.style.StyleTypes) StyleTypes */ //getType : function() {}, /** * Some styles have a default color. * @return (com.ibm.rave.core.color.RGB) Color object for this style, this takes opacity and fill-opacity into account. May return null. */ //getColor : function() {} }); // $source: com/ibm/rave/render/internal/style/ShadowStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseShadowStyle /** * [offset_x offset_y blur-radius color] | none | initial | inherit */ var com_ibm_rave_render_internal_style_ShadowStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, { //offset_x : null, //offset_y : null, //blur_radius : null, //color : null, constructor : function(h_shadow, v_shadow, blur_radius, color) { this.offset_x = h_shadow; this.offset_y = v_shadow; this.blur_radius = blur_radius; this.color = color; }, getType : function() { return 1004; }, getColor : function() { return this.color; } }); /** * Parse a shorthand font per the rules defined by W3 CSS. offset_x offset_y blur-radius color| none | initial | inherit * @param (Object) value shadow CSS style rule text. * @return (com.ibm.rave.render.internal.style.ShadowStyle) ShadowStyle representing text shadow. Returns null if invalid specification */ com_ibm_rave_render_internal_style_ShadowStyle.parse = function(value) { var style = com_ibm_rave_core_internal_css_CSSUtil.parseShadowStyle(value); if (!style) { return null; } return new com_ibm_rave_render_internal_style_ShadowStyle(style[0], style[1], style[2], style[3]); }; // $source: com/ibm/rave/render/internal/DefaultStyleValueConverter /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/internal/css/CSSTransformParser (static) // parse //@import com/ibm/rave/core/internal/css/CSSUtil (static) // parseIdUrlLink, parseWeight, parseSize, parseDashArray, parseFontFamily //@import com/ibm/rave/core/internal/css/CSSConstants (static) // CSSConstants //@import com/ibm/rave/core/Rave (static) // rgb //@import com/ibm/rave/render/internal/style/FontStyle (static) // parseFont //@import com/ibm/rave/render/internal/style/ShadowStyle (static) // parse /** * Converts style values into generic objects. */ var com_ibm_rave_render_internal_DefaultStyleValueConverter = com_ibm_rave_core_nativeImpl_Declare({ }); com_ibm_rave_render_internal_DefaultStyleValueConverter.convert = function(index, styleName, value) { switch (index) { case 11: return com_ibm_rave_core_internal_css_CSSTransformParser.parse(""+(value)); case 38: case 30: case 32: case 33: case 41: return + (value); case 35: case 31: case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 16: case 15: case 9: case 10: case 22: case 12: case 13: case 17: case 18: case 19: return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value); case 14: if (value == null) { return "normal"; } var _value = ""+(value); _value = _value.trim(); if ("normal" == _value) { return "normal"; } return com_ibm_rave_core_internal_css_CSSUtil.parseSize(value).toString(); case 34: return com_ibm_rave_core_internal_css_CSSUtil.parseDashArray(value.toString()); case 28: var link = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value); if (link != null) { return value; } case 29: return com_ibm_rave_core_internal_css_CSSConstants.TRANSPARENT == value.toString().toLowerCase() || "none" == value.toString().toLowerCase() ? "none" : com_ibm_rave_core_Rave.rgb(value); case 24: return com_ibm_rave_core_internal_css_CSSUtil.parseWeight(value); case 44: return com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(value); case 20: return com_ibm_rave_render_internal_style_FontStyle.parseFont(value); case 21: return com_ibm_rave_core_internal_css_CSSUtil.parseFontFamily(value); case 46: return com_ibm_rave_render_internal_style_ShadowStyle.parse(value); default: return value; } }; // $source: com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (static) // convert //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (static) // SceneNodeStyles /** * Helper class for creating default style objects for nodes. */ var com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles = com_ibm_rave_core_nativeImpl_Declare({ }); com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle = function(id, name) { return new com_ibm_rave_core_internal_css_CSSStyle(id, name, com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[id].inheritable); }; com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle = function(id, name, value, inheritable) { var style = new com_ibm_rave_core_internal_css_CSSStyle(id, name, inheritable); style.value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, name, value); style.rawValue = value.toString(); return style; }; /** * Return the index of the passed style name from the list of default styles. Used to map into our maps of styles which should all share the same indexing. * @param (String) styleName The name of the style to get the index of. (ie - "fill") * @return (int) Index of this style in our default map. */ com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex = function(styleName) { return com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.indexOf(styleName); }; com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults = function() { var styles = []; styles[46] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(46, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[46], "none", true); styles[28] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(28, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[28], "#000000", true); styles[29] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(29, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[29], "none", true); styles[30] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(30, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[30], 1.0, false); styles[31] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(31, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[31], "1px", true); styles[32] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(32, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[32], 1, true); styles[33] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(33, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[33], 1.0, true); styles[26] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(26, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[26], "block", false); styles[21] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(21, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[21], "serif", true); styles[22] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(22, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[22], "16px", true); styles[23] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(23, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[23], "normal", true); styles[24] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(24, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[24], "normal", true); styles[25] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(25, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[25], "normal", true); styles[34] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(34, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[34], "none", true); styles[35] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(35, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[35], 0, true); styles[36] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(36, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[36], "butt", true); styles[37] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(37, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[37], "miter", true); styles[38] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(38, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[38], 4, true); styles[27] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(27, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[27], "start", true); styles[39] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(39, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[39], "none", false); styles[45] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(45, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[45], "visible", true); styles[40] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(40, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[40], "#000000", false); styles[41] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(41, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[41], 1.0, false); styles[42] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(42, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[42], "auto", true); styles[43] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(43, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[43], "auto", true); styles[20] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(20, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[20], "normal normal normal 16/normal serif", true); styles[47] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(47, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[47], "auto", true); styles[0] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(0, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[0], "", false); styles[1] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(1, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[1], "", false); styles[2] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(2, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[2], "", false); styles[3] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(3, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[3], "", false); styles[4] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(4, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[4], "", false); styles[5] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(5, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[5], "", false); styles[6] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(6, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[6], "", false); styles[7] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(7, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[7], "", false); styles[8] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(8, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[8], "", false); styles[9] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(9, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[9], "", false); styles[10] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(10, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[10], "", false); styles[11] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(11, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[11], "", false); styles[12] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(12, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[12], "", false); styles[13] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(13, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[13], "", false); styles[44] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(44, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[44], "", false); styles[14] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(14, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[14], "normal", true); styles[15] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(15, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[15], "", false); styles[16] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(16, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[16], "", false); styles[17] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(17, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[17], "", false); styles[18] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(18, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[18], "", false); styles[19] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createStyle(19, com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[19], "", false); return styles; }; com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createDefaults(); // $source: com/ibm/rave/render/internal/nodes/SceneNodeStyleManager /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/properties/SceneNodeStyles (runtime) // SceneNodeStyles, isLayoutStyle //@import com/ibm/rave/render/internal/properties/SceneNodeDefaultStyles (runtime) // SceneNodeDefaultStyles, getIndex, createCSSStyle //@import com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector (runtime) // collectAll //@import com/ibm/rave/render/internal/DefaultStyleValueConverter (runtime) // convert //@import com/ibm/rave/render/internal/style/ShorthandStyle (runtime) // new //@import com/ibm/rave/core/internal/css/CSSStyle (static) // new /** * A class for helping scene nodes keep track of styling information. */ var com_ibm_rave_render_internal_nodes_SceneNodeStyleManager = com_ibm_rave_core_nativeImpl_Declare({ //changedStyles : null, //importantChangedStyles : null, //computedStyles : null, //styles : null, //node : null, invalidStyles : true, dirtyExternalStyles : true, dirtyInlineStyles : true, constructor : function(abstractSceneNode) { this.computedStyles = {}; this.styles = {}; { this.node = abstractSceneNode; } }, updateStyle : function(style, index, important, newValue, rawValue, name) { this.styles[index] = style; this.dirtyInlineStyles = true; if (important) { if (!this.importantChangedStyles) { this.importantChangedStyles = {}; } this.importantChangedStyles[index] = style; if (this.changedStyles) { delete this.changedStyles[index]; } } else { if (!this.changedStyles) { this.changedStyles = {}; } this.changedStyles[index] = style; if (this.importantChangedStyles) { delete this.importantChangedStyles[index]; } } if (style) { style.value = newValue; style.rawValue = rawValue; style.important = important; style.fromAttribute = false; } else { this.dirtyExternalStyles = true; } this.node.setDirty(true, com_ibm_rave_render_internal_properties_SceneNodeStyles.isLayoutStyle(index)); var oldValue = (style ? style.value : null); this.node.notifyAfterUpdate(1000, 2002, name, newValue, oldValue); }, computeStyles : function() { if (this.dirtyInlineStyles || this.dirtyExternalStyles || this.invalidStyles) { var inheritableStyleChanges = null; if (this.dirtyInlineStyles) { if (this.importantChangedStyles) { for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.importantChangedStyles), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; var style = this.importantChangedStyles[key]; var styleId = style.id; var cstyle = this.computedStyles[styleId]; if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) { cstyle = style; this.computedStyles[cstyle.id] = style; } if (this.node.rave_hasChildNodes() && cstyle.inheritable) { if (!inheritableStyleChanges) { inheritableStyleChanges = []; } inheritableStyleChanges.push(styleId); } } this.importantChangedStyles = null; } if (this.changedStyles) { for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(this.changedStyles), __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var key = __exp_enFor1[__i_enFor1]; var style = this.changedStyles[key]; var styleId = key; var cstyle = this.computedStyles[styleId]; if (cstyle && cstyle.important) { continue; } if (!style) { if (cstyle && cstyle.owner == this.node) { this.computedStyles[styleId] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE; if (this.node.rave_hasChildNodes() && cstyle.inheritable) { if (!inheritableStyleChanges) { inheritableStyleChanges = []; } inheritableStyleChanges.push(styleId); } cstyle = null; this.invalidStyles = true; } } else if (!cstyle || cstyle == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || cstyle.owner != this.node) { cstyle = style; this.computedStyles[styleId] = cstyle; if (this.node.rave_hasChildNodes() && cstyle.inheritable) { if (!inheritableStyleChanges) { inheritableStyleChanges = []; } inheritableStyleChanges.push(styleId); } } } this.changedStyles = null; } } if (this.dirtyExternalStyles || this.invalidStyles) { var externalStyles = null; var parentNode = this.node.rave_getParentNode(); for (var i = 0, len = com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames.length; i < len; ++i) { var style = this.computedStyles[i]; if (style && style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE && this.node.rave_hasChildNodes() && style.inheritable) { if (!inheritableStyleChanges) { inheritableStyleChanges = []; } inheritableStyleChanges.push(i); } if (this.dirtyExternalStyles) { if (!externalStyles) { externalStyles = this.getExternalStyles(); } if (externalStyles.length > 0 && externalStyles[i]) { if (externalStyles[i].important || !style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE || style.owner != this.node || style.fromAttribute) { style = externalStyles[i]; this.computedStyles[i] = style; } } else if (style && style.owner == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) { style = null; this.computedStyles[i] = style; } } if (!style || style == com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE) { style = null; if (parentNode && com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i].inheritable && parentNode.rave_getDrawType() != -1) { style = parentNode.getComputedCSSStyle(i); } } if (!style) { style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.defaultStyles[i]; } this.computedStyles[i] = style; } this.invalidStyles = false; } if (inheritableStyleChanges) { for (var __i_enFor2 = 0, __exp_enFor2 = this.node.getChildrenArray(), __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var child = __exp_enFor2[__i_enFor2]; var achild = child; for (var __i_enFor3 = 0, __exp_enFor3 = inheritableStyleChanges, __len_enFor3 = __exp_enFor3.length; __i_enFor3 < __len_enFor3; ++__i_enFor3) { var key = __exp_enFor3[__i_enFor3]; var childStyle = achild.styleManager.computedStyles[key]; if (childStyle && childStyle.owner != child && childStyle.owner != com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER) { achild.styleManager.computedStyles[key] = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE; achild.styleManager.dirtyInlineStyles = true; achild.styleManager.invalidStyles = true; } } } } this.dirtyInlineStyles = false; this.dirtyExternalStyles = false; } }, /** * Returns a style structure with all applicable external styles. Mimics the same array and index of SceneNodeStyles. * @return (com.ibm.rave.core.internal.css.CSSStyle[]) an array of applicable external styles. */ getExternalStyles : function() { var styleValues; var rules = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll(this.node); if (rules.length > 0) { styleValues = []; for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var rule = __exp_enFor0[__i_enFor0]; var style = rule.style; for (var i = 0, len = style.length; i < len; ++i) { var item = style.item(i); this.updateExternalStyle(item, styleValues, style.getPropertyValue(item), "important" == style.getPropertyPriority(item)); } } } else { styleValues = []; } return styleValues; }, updateExternalStyle : function(item, styleValues, value1, isImportant) { var id = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(item); if (id != -1) { var existingStyle = styleValues[id]; if (!existingStyle || (isImportant && !existingStyle.important)) { var value = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(id, item, value1); if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(value, com_ibm_rave_render_internal_style_ShorthandStyle)) { for (var __i_enFor0 = 0, __exp_enFor0 = (value).getKeys(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; this.updateExternalStyle(key, styleValues, (value).getValue(key), isImportant); } } if (value != null) { styleValues[id] = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(id, item); styleValues[id].owner = com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER; styleValues[id].value = value; styleValues[id].rawValue = value.toString(); styleValues[id].important = isImportant; } } } }, /** * Remove all inline styles from this node's styles. */ removeAllInlineStyles : function() { for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; if (this.styles[key]) { this.node.rave_removeStyle(com_ibm_rave_render_internal_properties_SceneNodeStyles.propertyNames[key]); } } }, /** * @param (String) styleName */ removeStyle : function(styleName) { if (styleName != null) { var name = styleName.toLowerCase(); var idx = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName); var style = this.styles[idx]; if (style) { var hasNewStyle = false; if (!style.fromAttribute) { var attrValue = this.node.attributes.get(styleName); if (attrValue != null) { var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(idx, name, attrValue); if (newValue != null) { style.value = newValue; style.rawValue = newValue.toString(); style.fromAttribute = true; style.important = false; hasNewStyle = true; } } } if (!hasNewStyle) { this.updateStyle(null, idx, false, null, null, name); if (this.importantChangedStyles) { delete this.importantChangedStyles[idx]; } } } } }, setStyle : function(context, styleName, value, priority) { if (styleName != null) { if (value == null) { this.removeStyle(styleName); } else { var acontext = context; var name = styleName.toLowerCase(); var index = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(name); if (index >= 0) { var oldCssStyle = acontext.styleManager.getComputedCSSStyle(index); if (!oldCssStyle || !(value===oldCssStyle.rawValue)) { var newValue = com_ibm_rave_render_internal_DefaultStyleValueConverter.convert(index, name, value); if (newValue != null) { var important = priority != null && "important" == priority.toLowerCase(); if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(newValue, com_ibm_rave_render_internal_style_ShorthandStyle)) { for (var __i_enFor0 = 0, __exp_enFor0 = (newValue).getKeys(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var key = __exp_enFor0[__i_enFor0]; acontext.rave_setStyle(key, (newValue).getValue(key), priority); } } var style = this.styles[index]; if (!style) { style = com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.createCSSStyle(index, name); style.owner = acontext; } this.updateStyle(style, index, important, newValue, value, name); } } } } } }, getComputedStyleValue : function(id) { var style = this.getComputedCSSStyle(id); return !style ? null : style.value; }, getComputedCSSStyle : function(id) { return this.computedStyles[id]; }, setDirtyExternalStyles : function(dirtyExternalStyles) { this.dirtyExternalStyles = dirtyExternalStyles; }, getStyleByName : function(styleName) { return this.getStyleByIndex(com_ibm_rave_render_internal_properties_SceneNodeDefaultStyles.getIndex(styleName)); }, getStyleByIndex : function(styleIndex) { return this.styles[styleIndex]; }, isVisible : function() { return !("hidden" == this.getComputedStyleValue(45)); }, serialize : function() { var result = []; for (var __i_enFor0 = 0, __exp_enFor0 = Object.keys(this.styles), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var index = __exp_enFor0[__i_enFor0]; var val = this.styles[index]; if (val) { result.push(val.name + ":" + val.value + ";"); } } var str = ""; if (result.length > 0) { str = "style=\"" + result.join(" ") + "\""; } return str; } }); com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.EXTERNAL_STYLE_OWNER = {}; com_ibm_rave_render_internal_nodes_SceneNodeStyleManager.INVALIDATE_STYLE = new com_ibm_rave_core_internal_css_CSSStyle(-1, null, true); // $source: com/ibm/rave/render/internal/css/collector/CSSStyleRuleCollector /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/Rave (runtime) // Rave //@import com/ibm/rave/core/internal/css/CSSStyleSheetManager (runtime) // CSSStyleSheetManager /** * Responsible for collecting external stylesheet rules that apply to a particular SceneNode. Orders these results based on results from CSSStyleSheetManager based on specificity. */ var com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector = com_ibm_rave_core_nativeImpl_Declare({ }); /** * Returns a list of matching external CSS rules for a scene node. Note that this method does not take internal styles into account at all - it matches only external styles to scene nodes. This list is sorted by most significant style specificity to lowest. * @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node * @return (Array) List of matching CSSStyleRules. */ com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.collectAll = function(node) { var matches = []; var selectorCache = {}; var engine = com_ibm_rave_core_Rave.configuration.getQueryEngine(null); if (engine) { for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches(node), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var potentialMatch = __exp_enFor0[__i_enFor0]; var selectorText = potentialMatch.selectorText; if (!(selectorCache.hasOwnProperty(selectorText))) { if (engine.matches(node, selectorText)) { matches.push(potentialMatch); } selectorCache[selectorText] = 1; } } } return matches; }; com_ibm_rave_render_internal_css_collector_CSSStyleRuleCollector.getPotentialMatches = function(node) { var manager = com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE; var potentialMatches = []; var id = node.getId(); if (id != null) { var rules = manager.getPotentialMatchesById("#" + id); if (rules) { for (var __i_enFor0 = 0, __exp_enFor0 = rules, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var rule = __exp_enFor0[__i_enFor0]; potentialMatches.push(rule); } } } var classes = node.getClassList(); for (var __i_enFor1 = 0, __exp_enFor1 = classes, __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var className = __exp_enFor1[__i_enFor1]; if (className != null) { var rules = manager.getPotentialMatchesByClass("." + className); if (rules) { for (var __i_enFor2 = 0, __exp_enFor2 = rules, __len_enFor2 = __exp_enFor2.length; __i_enFor2 < __len_enFor2; ++__i_enFor2) { var rule = __exp_enFor2[__i_enFor2]; potentialMatches.push(rule); } } } } var tag = node.rave_getName(); if (tag != null) { var rules = manager.getPotentialMatchesByTag(tag); if (rules) { for (var __i_enFor3 = 0, __exp_enFor3 = rules, __len_enFor3 = __exp_enFor3.length; __i_enFor3 < __len_enFor3; ++__i_enFor3) { var rule = __exp_enFor3[__i_enFor3]; potentialMatches.push(rule); } } } return potentialMatches; }; // $source: com/ibm/rave/core/internal/css/CSSStyleSheetManager /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/internal/css/CSSParser (runtime) // splitSelectorText, deconstructSelectorText /** * This class is responsible for maintaining the state of all external stylesheets. It accepts parsed stylesheets and caches them based on selector. */ var com_ibm_rave_core_internal_css_CSSStyleSheetManager = com_ibm_rave_core_nativeImpl_Declare({ //idToStyleRules : null, //classToStyleRules : null, //tagToStyleRules : null, //allMaps : null, constructor : function() { this.allMaps = []; { this.initialize(); } }, /** * Add a CSSStyleSheet's rule list to our cached internal set of style rules. These can be used later to style scene nodes. * @param (com.ibm.rave.core.css.CSSStyleSheet) stylesheet CSSStyleSheet object parsed from CSS text. */ add : function(stylesheet) { for (var __i_enFor0 = 0, __exp_enFor0 = stylesheet.cssRules, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var rule = __exp_enFor0[__i_enFor0]; if (rule.selectorText != null) { this.addToCache(rule); } } }, initialize : function() { this.idToStyleRules = {}; this.classToStyleRules = {}; this.tagToStyleRules = {}; this.allMaps.length = 0; this.allMaps.push(this.idToStyleRules); this.allMaps.push(this.classToStyleRules); this.allMaps.push(this.tagToStyleRules); }, /** * Clears all StyleSheets from cache. */ clear : function() { this.initialize(); }, /** * For 'className', return all CSSStyleRules that may potentially match. The className must contain a leading ".". * @param (String) className Class name to check for potential matching CSSRules. Must contain a leading ".". * @return (Array) List of potential CSSStyleRule matches for this class. Returns null if no match found. */ getPotentialMatchesByClass : function(className) { return this.classToStyleRules[className]; }, /** * For 'id', return all CSSStyleRules that may potentially match. The id must contain a leading "#". * @param (String) id id name to check for potential matching CSSRules. Must contain a leading "#". * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found. */ getPotentialMatchesById : function(id) { return this.idToStyleRules[id]; }, /** * For node 'tag' name, return all CSSStyleRules that may potentially match. * @param (String) tag tag name to check for potential matching CSSRules. * @return (Array) List of potential CSSStyleRule matches for this id. Returns null if no match found. */ getPotentialMatchesByTag : function(tag) { return this.tagToStyleRules[tag]; }, addToCache : function(styleRule) { for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSParser.splitSelectorText(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var selector = __exp_enFor0[__i_enFor0]; var parts = com_ibm_rave_core_internal_css_CSSParser.deconstructSelectorText(selector); var dominant = parts[parts.length - 1]; var matches = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(dominant); for (var __i_enFor1 = 0, __len_enFor1 = matches.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var match = matches[__i_enFor1]; if (match.length == 0) { continue; } var matchingMap = null; switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(match)) { case 3: matchingMap = this.tagToStyleRules; break; case 2: matchingMap = this.idToStyleRules; break; case 1: matchingMap = this.classToStyleRules; break; case -1: default: break; } if (matchingMap) { var rules = matchingMap[match]; var insertIndex = 0; if (!rules) { rules = []; matchingMap[match] = rules; } else { for (var i = 0; i < rules.length; ++i) { var existingRule = rules[i]; if (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(styleRule) >= com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity(existingRule)) { break; } insertIndex++; } } rules.splice(insertIndex, 0, styleRule); } } } }, /** * Remove a selector from all our internal selector maps. * @param (com.ibm.rave.core.css.CSSStyleSheet) styleSheet StyleSheet to remove. * @return (boolean) true if this stylesheet was removed from the system. false if it did not exist. */ remove : function(styleSheet) { var result = false; for (var __i_enFor0 = 0, __exp_enFor0 = this.allMaps, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var map = __exp_enFor0[__i_enFor0]; for (var __i_enFor1 = 0, __exp_enFor1 = Object.keys(map), __len_enFor1 = __exp_enFor1.length; __i_enFor1 < __len_enFor1; ++__i_enFor1) { var key = __exp_enFor1[__i_enFor1]; var list = map[key]; for (var i = 0; i < list.length; ++i) { var rule = list[i]; if (rule.parentStyleSheet == styleSheet) { list.splice(i--, 1); result = true; } } if (list.length == 0) { delete map[key]; } } } return result; } }); /** * Split this individual selector up into tag, class and id pieces So, "img#id.foo" would be split into "tag" "#id" ".foo". Use a lookbehind regex so we keep the special chars * @param selectorText A selector string representing a single * @return (java.lang.String[]) Array of individual selector pieces that represent a single class/attribute/id of a node. */ com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes = function(selector) { return selector.replace(new RegExp(",","g"), " ").split(new RegExp("(?=[\\.\\#\\s])")); }; com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSpecificity = function(styleRule) { if (styleRule._specificity > 0) { return styleRule._specificity; } var specificity = 0; for (var __i_enFor0 = 0, __exp_enFor0 = com_ibm_rave_core_internal_css_CSSStyleSheetManager.splitSelectorTextByTypes(styleRule.selectorText), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var selector = __exp_enFor0[__i_enFor0]; switch (com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType(selector)) { case 3: specificity++; break; case 2: specificity += 0x100; break; case 1: specificity += 0x10; break; default: break; } } styleRule._specificity = specificity; return specificity; }; com_ibm_rave_core_internal_css_CSSStyleSheetManager.determineSelectorType = function(selectorText) { if (selectorText == null) { return -1; } var firstChar = selectorText.charCodeAt(0); if (firstChar == 35) { return 2; } else if (firstChar == 46 || firstChar == 58) { return 1; } return 3; }; com_ibm_rave_core_internal_css_CSSStyleSheetManager.CLASS = 1; com_ibm_rave_core_internal_css_CSSStyleSheetManager.ID = 2; com_ibm_rave_core_internal_css_CSSStyleSheetManager.TAG = 3; /** * Singleton instance of the style sheet manager. */ com_ibm_rave_core_internal_css_CSSStyleSheetManager.INSTANCE = new com_ibm_rave_core_internal_css_CSSStyleSheetManager(); com_ibm_rave_core_internal_css_CSSStyleSheetManager.UNKNOWN = -1; // $source: com/ibm/rave/core/geom/RaveRect /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * A class that describes a Rectangular shape in a non-native way. Immutable. Uses doubles as coordinates. * @author jim */ var com_ibm_rave_core_geom_RaveRect = rave_externs["RaveRect"] = com_ibm_rave_core_nativeImpl_Declare({ /** @expose */ x : 0, /** @expose */ y : 0, /** @expose */ width : 0, /** @expose */ height : 0, /** @expose */ constructor : function(x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; }, /** @expose */ getX : function() { return this.x; }, /** @expose */ getX2 : function() { return this.x + this.width; }, /** @expose */ getY : function() { return this.y; }, /** @expose */ getY2 : function() { return this.y + this.height; }, /** @expose */ getWidth : function() { return this.width; }, /** @expose */ getHeight : function() { return this.height; }, /** * Return true if the receiver the the rect intersect, false otherwise * @param (com.ibm.rave.core.geom.RectStruct) rect another rectangle to test for intersection * @return (boolean) true if the rectangles intersect, false otherwise */ /** @expose */ intersects : function(rect) { return this.x <= (rect.x + rect.width) && (this.x + this.width) >= rect.x && this.y <= (rect.y + rect.height) && (this.y + this.height) >= rect.y; }, /** * Checks whether or not this Rectangle contains the point at the specified location {@code (x,y)} . * @param (double) X the specified X coordinate * @param (double) Y the specified Y coordinate * @return (boolean) true if the point {@code (x,y)} is inside this Rectangle; false otherwise. */ /** @expose */ contains : function(X, Y) { if (this.width < 0 || this.height < 0) { return false; } return X >= this.x && Y >= this.y && X <= (this.x + this.width) && Y <= (this.y + this.height); } }); // $source: com/ibm/rave/render/internal/nodes/GeometricHelper /************************************************************************ ** 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/core/geom/PointStruct (runtime) // new //@import com/ibm/rave/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/path/Path2DUtil (runtime) // arcToBezier /** * A handful of geometric helper methods used by SceneNode hit testing * @author Ian Ballantyne */ var com_ibm_rave_render_internal_nodes_GeometricHelper = { }; /** * Determine if a rectangle intersects with a polygon * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection * @param (Array) points polygon for testing intersection * @return (boolean) true if intersect, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect = function(rect, points) { var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y); if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(topLeft, points)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) { return true; } else { var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y); var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height); var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height); var prevPoint = points[points.length - 1]; for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var curPoint = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } prevPoint = curPoint; } } return false; }; /** * Determine if a rectangle intersects with a polyline * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing intersection * @param (Array) points polyline for testing intersection * @return (boolean) true if intersect, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect = function(rect, points) { if (com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle(points[0], rect)) { return true; } else { var topLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y); var topRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y); var bottomRight = new com_ibm_rave_core_geom_PointStruct(rect.x + rect.width, rect.y + rect.height); var bottomLeft = new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y + rect.height); var prevPoint = points[points.length - 1]; for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var curPoint = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topLeft.x, topLeft.y, topRight.x, topRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(topRight.x, topRight.y, bottomRight.x, bottomRight.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } else if (com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect(bottomLeft.x, bottomLeft.y, topLeft.x, topLeft.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y)) { return true; } prevPoint = curPoint; } } return false; }; /** * Determine if a point is inside a polygon * @param (com.ibm.rave.core.geom.PointStruct) pt point to test * @param (Array) points polygon for testing * @return (boolean) true if point is inside polygon, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon = function(pt, points) { var isInside = false; var prevPoint = points[points.length - 1]; for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var curPoint = __exp_enFor0[__i_enFor0]; var curAbove = curPoint.y >= pt.y; var prevAbove = prevPoint.y >= pt.y; var stradle = curAbove != prevAbove; if (stradle) { var xIntersect = (prevPoint.x - curPoint.x) * (pt.y - curPoint.y) / (prevPoint.y - curPoint.y) + curPoint.x; var pointLeftOfIntersect = pt.x <= xIntersect; if (pointLeftOfIntersect) { isInside = !isInside; } } prevPoint = curPoint; } return isInside; }; /** * Determine if a point lies on a polyline * @param (com.ibm.rave.core.geom.PointStruct) pt point to test * @param (Array) points polyline for testing * @param (double) tolerance max distance point can be from polyline to be considered "on" * @return (boolean) true if point is on the polyline, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline = function(pt, points, tolerance) { var prevPoint; for (var __i_enFor0 = 0, __exp_enFor0 = points, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var curPoint = __exp_enFor0[__i_enFor0]; if (!prevPoint) { prevPoint = curPoint; } else { var d = com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance(pt.x, pt.y, prevPoint.x, prevPoint.y, curPoint.x, curPoint.y); if (d <= tolerance) { return true; } prevPoint = curPoint; } } return false; }; /** * Determine if a point is in a rectangle * @param (com.ibm.rave.core.geom.PointStruct) pt point to test * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing * @return (boolean) true if point is inside the rectangle, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.pointInRectangle = function(pt, rect) { return pt.x >= rect.x && pt.x < rect.x + rect.width && pt.y >= rect.y && pt.y < rect.y + rect.height; }; /** * Determine if a circle intersects with a rectangle * @param (double) xCtr center x of circle * @param (double) yCtr center y of circle * @param (double) radius radius of circle * @param (com.ibm.rave.core.geom.RectStruct) rect rectangle for testing * @return (boolean) true if intersect, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect = function(xCtr, yCtr, radius, rect) { var xClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(xCtr, rect.x, rect.x + rect.width); var yClosest = com_ibm_rave_render_internal_nodes_GeometricHelper.clamp(yCtr, rect.y, rect.y + rect.height); var dx = xCtr - xClosest; var dy = yCtr - yClosest; var distance_sq = dx * dx + dy * dy; return distance_sq < (radius * radius); }; com_ibm_rave_render_internal_nodes_GeometricHelper.clamp = function(value, minValue, maxValue) { if (value < minValue) { return minValue; } else if (value > maxValue) { return maxValue; } return value; }; /** * Calculate the distance of a point from a line segment * @param (double) x x value of point * @param (double) y y value of point * @param (double) x1 start x of line segment * @param (double) y1 start y of line segment * @param (double) x2 end x of line segment * @param (double) y2 end y of line segment * @return (double) distance */ com_ibm_rave_render_internal_nodes_GeometricHelper.calcDistance = function(x, y, x1, y1, x2, y2) { var dot = (x - x1) * (x2 - x1) + (y - y1) * (y2 - y1); var len_sq = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); var u = -1; if (len_sq != 0) { u = dot / len_sq; } var xSeg, ySeg; if (u < 0) { xSeg = x1; ySeg = y1; } else if (u > 1) { xSeg = x2; ySeg = y2; } else { xSeg = x1 + u * (x2 - x1); ySeg = y1 + u * (y2 - y1); } var dx = x - xSeg; var dy = y - ySeg; return Math.sqrt(dx * dx + dy * dy); }; /** * Determine if two line segments intersect * @param (double) x1 start x of first line segment * @param (double) y1 start y of first line segment * @param (double) x2 end x of first line segment * @param (double) y2 end y of first line segment * @param (double) x3 start x of second line segment * @param (double) y3 start y of second line segment * @param (double) x4 end x of second line segment * @param (double) y4 end y of second line segment * @return (boolean) true if line segments intersect, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.linesIntersect = function(x1, y1, x2, y2, x3, y3, x4, y4) { var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); if (denom <= 0.00001) { return false; } var uA = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; var uB = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom; return uA > 0 && uA < 1 && uB > 0 && uB < 1; }; /** * Determine if 2 rectangles intersect * @param (double) left1 left (x) of first rectangle * @param (double) top1 top (y) of first rectangle * @param (double) width1 width of first rectangle * @param (double) height1 height of first rectangle * @param (double) left2 left (x) of second rectangle * @param (double) top2 top (y) of second rectangle * @param (double) width2 width of second rectangle * @param (double) height2 heightof second rectangle * @return (boolean) true if intersect, false otherwise */ com_ibm_rave_render_internal_nodes_GeometricHelper.rectIntersects = function(left1, top1, width1, height1, left2, top2, width2, height2) { var right1 = left1 + width1; var bottom1 = top1 + height1; var right2 = left2 + width2; var bottom2 = top2 + height2; return !(left1 > right2 || right1 < left2 || top1 > bottom2 || bottom1 < top2); }; /** * A path can contain 0 or more "shapes" (either polylines or polygons), this object holds on to one of those shapes */ com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape = com_ibm_rave_core_nativeImpl_Declare({ //points : null, //bounds : null, isClosed : false, isCollinear : true, initialSlope : 0, initialVertical : false, constructor : function() { this.points = []; }, addPoint : function(point) { if (this.points.length != 0) { if (point.x == this.points[this.points.length - 1].x && point.y == this.points[this.points.length - 1].y) { return; } } this.points.push(point); if (!this.bounds) { this.bounds = []; this.bounds[0] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y); this.bounds[1] = new com_ibm_rave_core_geom_PointStruct(point.x, point.y); } else { if (point.x < this.bounds[0].x) { this.bounds[0].x = point.x; } else if (point.x > this.bounds[1].x) { this.bounds[1].x = point.x; } if (point.y < this.bounds[0].y) { this.bounds[0].y = point.y; } else if (point.y > this.bounds[1].y) { this.bounds[1].y = point.y; } } if (this.isCollinear && this.points.length >= 2) { var dx = this.points[this.points.length - 1].x - this.points[this.points.length - 2].x; var dy = this.points[this.points.length - 1].y - this.points[this.points.length - 2].y; var isVertical = Math.abs(dy) < 0.0001; var slope = isVertical ? 0 : dx / dy; if (this.points.length == 2) { this.initialVertical = isVertical; this.initialSlope = slope; } else { this.isCollinear = (isVertical == this.initialVertical && Math.abs(this.initialSlope - slope) < 0.0001); } } }, setClosed : function() { if (!this.isCollinear) { this.isClosed = true; } }, getBounds : function() { return this.bounds; }, intersect$0 : function(point) { if (this.isClosed) { return com_ibm_rave_render_internal_nodes_GeometricHelper.pointInPolygon(point, this.points); } else { return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(point, this.points, 5.0); } }, intersect$1 : function(rect) { if (rect.width <= 2 && rect.height <= 2) { return this.intersect$0(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y)); } if (rect.x > this.bounds[1].x || (rect.x + rect.width) < this.bounds[0].x || rect.y > this.bounds[1].y || (rect.y + rect.height) < this.bounds[0].y) { return false; } if (this.isClosed) { return com_ibm_rave_render_internal_nodes_GeometricHelper.polygonIntersect(rect, this.points); } else { return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, this.points); } }, intersect : function(a0) { var args = arguments; if (args.length == 1 && (a0 == null || com_ibm_rave_core_nativeImpl_Object.isInstanceOf(a0, com_ibm_rave_core_geom_PointStruct))) { return this.intersect$0(a0); } return this.intersect$1(a0); } }); /** * An implementation of Path2DHandler that is used to create an array of PathShape objects that represent the contents of a Path */ com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler = com_ibm_rave_core_nativeImpl_Declare({ //shapes : null, //currentPoint : null, currentShape : -1, constructor : function() { this.shapes = []; }, /** @expose */ fail : function(index) {}, /** @expose */ startPath : function() {}, /** @expose */ closePath : function() { this.shapes[this.currentShape].setClosed(); this.currentPoint = null; }, /** @expose */ moveTo : function(x, y) { this.currentShape++; this.shapes.push(new com_ibm_rave_render_internal_nodes_GeometricHelper.PathShape()); this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y); this.shapes[this.currentShape].addPoint(this.currentPoint); }, /** @expose */ lineTo : function(x, y) { this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y); this.shapes[this.currentShape].addPoint(this.currentPoint); }, /** @expose */ quadraticCurveTo : function(cpx, cpy, x, y) { var p0x = this.currentPoint.x; var p0y = this.currentPoint.y; var p1x = cpx; var p1y = cpy; var p2x = x; var p2y = y; var dx = p2x - p0x; var dy = p2y - p0y; var delta = Math.max(Math.abs(dx), Math.abs(dy)); var curvePointCount = ~~(delta / 2); if (curvePointCount > 1) { var dt = 1.0 / curvePointCount; var t = dt; for (var j = 0; j < curvePointCount; ++j) { var xp = (1 - t) * (1 - t) * p0x + 2 * (1 - t) * t * p1x + (t * t) * p2x; var yp = (1 - t) * (1 - t) * p0y + 2 * (1 - t) * t * p1y + (t * t) * p2y; this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp)); t += dt; } } this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y); this.shapes[this.currentShape].addPoint(this.currentPoint); }, /** @expose */ bezierCurveTo : function(cp1x, cp1y, cp2x, cp2y, x, y) { var p0x = this.currentPoint.x; var p0y = this.currentPoint.y; var p1x = cp1x; var p1y = cp1y; var p2x = cp2x; var p2y = cp2y; var p3x = x; var p3y = y; var dx = p3x - p0x; var dy = p3y - p0y; var delta = Math.max(Math.abs(dx), Math.abs(dy)); var curvePointCount = ~~(delta / 2); if (curvePointCount > 1) { var dt = 1.0 / curvePointCount; var t = dt; for (var j = 0; j < curvePointCount; ++j) { var xp = (1 - t) * (1 - t) * (1 - t) * p0x + 3 * (1 - t) * (1 - t) * t * p1x + 3 * (1 - t) * (t * t) * p2x + (t * t * t) * p3x; var yp = (1 - t) * (1 - t) * (1 - t) * p0y + 3 * (1 - t) * (1 - t) * t * p1y + 3 * (1 - t) * (t * t) * p2y + (t * t * t) * p3y; this.shapes[this.currentShape].addPoint(new com_ibm_rave_core_geom_PointStruct(xp, yp)); t += dt; } } this.currentPoint = new com_ibm_rave_core_geom_PointStruct(x, y); this.shapes[this.currentShape].addPoint(this.currentPoint); }, /** @expose */ arcTo : function(x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier(this, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y); }, getShapes : function() { return this.shapes; } }); // $source: com/ibm/rave/render/internal/nodes/path/Path2DUtil /************************************************************************ ** 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/core/transform/MatrixUtil (static) // identity, mapPoints var com_ibm_rave_render_internal_nodes_path_Path2DUtil = { //constructor : function() {} }; /** * Utility for converting an SVG arc to bezier curves. Useful for platforms that do not support the SVG arc in the same way. */ com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBezier = function(path, x0, y0, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y) { var angle = xAxisRotation % 360; var dx2 = (x0 - x) / 2.0; var dy2 = (y0 - y) / 2.0; var angleRad = angle / 180.0 * Math.PI; var cosAngle = Math.cos(angleRad); var sinAngle = Math.sin(angleRad); var x1 = (cosAngle * dx2 + sinAngle * dy2); var y1 = (-sinAngle * dx2 + cosAngle * dy2); var rxAbs = Math.abs(rx); var ryAbs = Math.abs(ry); var Prx = rxAbs * rxAbs; var Pry = ryAbs * ryAbs; var Px1 = x1 * x1; var Py1 = y1 * y1; var radiiCheck = Px1 / Prx + Py1 / Pry; if (radiiCheck > 1) { rxAbs = Math.sqrt(radiiCheck) * rxAbs; ryAbs = Math.sqrt(radiiCheck) * ryAbs; Prx = rxAbs * rxAbs; Pry = ryAbs * ryAbs; } var sign = (largeArcFlag == sweepFlag) ? -1 : 1; var sq = ((Prx * Pry) - (Prx * Py1) - (Pry * Px1)) / ((Prx * Py1) + (Pry * Px1)); sq = (sq < 0) ? 0 : sq; var coef = (sign * Math.sqrt(sq)); var cx1 = coef * ((rxAbs * y1) / ryAbs); var cy1 = coef * -((ryAbs * x1) / rxAbs); var sx2 = (x0 + x) / 2.0; var sy2 = (y0 + y) / 2.0; var cx = sx2 + (cosAngle * cx1 - sinAngle * cy1); var cy = sy2 + (sinAngle * cx1 + cosAngle * cy1); var ux = (x1 - cx1) / rxAbs; var uy = (y1 - cy1) / ryAbs; var vx = (-x1 - cx1) / rxAbs; var vy = (-y1 - cy1) / ryAbs; var p, n; n = Math.sqrt((ux * ux) + (uy * uy)); p = ux; sign = (uy < 0) ? -1 : 1; var angleStart = (sign * Math.acos(p / n)) * 180.0 / Math.PI; n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1 : 1; var angleExtent = (sign * Math.acos(p / n)) * 180.0 / Math.PI; if (!sweepFlag && angleExtent > 0) { angleExtent -= 360; } else if (sweepFlag && angleExtent < 0) { angleExtent += 360; } angleExtent %= 360; angleStart %= 360; var bezierPoints = com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers(angleStart, angleExtent); var m = com_ibm_rave_core_transform_MatrixUtil.identity(); com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.scaleNonUniform(rxAbs, ryAbs)); com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.rotate(angle)); com_ibm_rave_core_transform_MatrixUtil.mapPoints(bezierPoints, m.translate(cx, cy)); bezierPoints[bezierPoints.length - 2] = x; bezierPoints[bezierPoints.length - 1] = y; for (var i = 0; i < bezierPoints.length; i += 6) { path.bezierCurveTo(bezierPoints[i], bezierPoints[i + 1], bezierPoints[i + 2], bezierPoints[i + 3], bezierPoints[i + 4], bezierPoints[i + 5]); } }; com_ibm_rave_render_internal_nodes_path_Path2DUtil.arcToBeziers = function(angleStart, angleExtent) { var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0); var angleStartRad = angleStart / 180.0 * Math.PI; var angleExtentRad = angleExtent / 180.0 * Math.PI; var angleIncrement = (angleExtentRad / numSegments); var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0)); var coords = []; var pos = 0; for (var i = 0; i < numSegments; ++i) { var angle = angleStartRad + i * angleIncrement; var dx = Math.cos(angle); var dy = Math.sin(angle); coords[pos++] = (dx - controlLength * dy); coords[pos++] = (dy + controlLength * dx); angle += angleIncrement; dx = Math.cos(angle); dy = Math.sin(angle); coords[pos++] = (dx + controlLength * dy); coords[pos++] = (dy - controlLength * dx); coords[pos++] = dx; coords[pos++] = dy; } return coords; }; // $source: com/ibm/rave/render/internal/nodes/CircleSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // circleIntersect /** * Circle shape. */ var com_ibm_rave_render_internal_nodes_CircleSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { cx : 0, r : 0, cy : 0, calculateBBox : function() { return new com_ibm_rave_core_geom_RaveRect(this.cx - this.r, this.cy - this.r, this.r * 2, this.r * 2); }, /** @expose */ rave_getDrawType : function() { return 1002; }, /** @expose */ rave_getName : function() { return "circle"; }, getCx : function() { return this.cx; }, getCy : function() { return this.cy; }, getR : function() { return this.r; }, rave_intersects : function(rect) { return com_ibm_rave_render_internal_nodes_GeometricHelper.circleIntersect(this.cx, this.cy, this.r, rect) && this.intersectsClip(rect); }, paint : function(renderer) { renderer.setStrokeAndFill(this); renderer.drawCircle(this); }, doLayout : function() { this.cx = this.rave_getSizePx(this.getComputedCSSStyle(9).value); this.cy = this.rave_getSizePx(this.getComputedCSSStyle(10).value); this.r = this.rave_getSizePx(this.getComputedCSSStyle(6).value); } //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/nodes/LineSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/core/geom/PointStruct (runtime) // new //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // pointOnPolyline, polylineIntersect /** * Circle shape. */ var com_ibm_rave_render_internal_nodes_LineSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { x1 : 0, x2 : 0, y1 : 0, y2 : 0, calculateBBox : function() { var tmp; if (this.x1 > this.x2) { tmp = this.x1; this.x1 = this.x2; this.x2 = tmp; } if (this.y1 > this.y2) { tmp = this.y1; this.y1 = this.y2; this.y2 = tmp; } return new com_ibm_rave_core_geom_RaveRect(this.x1, this.y1, this.x2 - this.x1, this.y2 - this.y1); }, /** @expose */ rave_getDrawType : function() { return 1001; }, /** @expose */ rave_getName : function() { return "line"; }, getX1 : function() { return this.x1; }, getX2 : function() { return this.x2; }, getY1 : function() { return this.y1; }, getY2 : function() { return this.y2; }, rave_intersects : function(rect) { var line = []; line.push(new com_ibm_rave_core_geom_PointStruct(this.x1, this.y1)); line.push(new com_ibm_rave_core_geom_PointStruct(this.x2, this.y2)); if (rect.width <= 2 && rect.height <= 2) { return com_ibm_rave_render_internal_nodes_GeometricHelper.pointOnPolyline(new com_ibm_rave_core_geom_PointStruct(rect.x, rect.y), line, 5.0); } return com_ibm_rave_render_internal_nodes_GeometricHelper.polylineIntersect(rect, line) && this.intersectsClip(rect); }, paint : function(renderer) { renderer.setStrokeAndFill(this); renderer.drawLine(this); }, doLayout : function() { this.x1 = this.rave_getSizePx(this.getComputedCSSStyle(4).value); this.x2 = this.rave_getSizePx(this.getComputedCSSStyle(5).value); this.y1 = this.rave_getSizePx(this.getComputedCSSStyle(7).value); this.y2 = this.rave_getSizePx(this.getComputedCSSStyle(8).value); } //constructor : function(nsuri, context) {} }); com_ibm_rave_render_internal_nodes_LineSceneItem.LINE_TOUCH_DISTANCE = 5; // $source: com/ibm/rave/render/internal/nodes/TextSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RectStruct (runtime) // new //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new //@import com/ibm/rave/core/Rave (runtime) // Rave /** * Text shape. */ var com_ibm_rave_render_internal_nodes_TextSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { //styleCache : null, //ascent : null, //descent : null, //cachedBoundingClientRectBBox : null, x : 0, y : 0, width : 0, height : 0, nextX : 0, nextY : 0, /** @expose */ rave_getDrawType : function() { return 1003; }, /** @expose */ rave_getName : function() { return "text"; }, notifyAfterUpdate : function(type, subType, key, toValue, fromValue) { this.styleCache = null; com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue); }, invalidateLayout : function() { com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this); this.cachedBoundingClientRectBBox = null; }, calculateBBox : function() { var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height); if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; var childRect = (child).calculateBBox(); this.expandRect(childRect, clientRect); } } return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height); }, getBoundingClientRectBBox : function() { if (!this.cachedBoundingClientRectBBox) { if (this.invalidLayout) { this.layout(); } var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height); if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; var childRect = (child).getBoundingClientRectBBox(); this.expandRect(childRect, clientRect); } } this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height); } return this.cachedBoundingClientRectBBox; }, /** * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place. * @param (com.ibm.rave.core.geom.RaveRect) rect1 * @param (com.ibm.rave.core.geom.RectStruct) rect2 */ expandRect : function(rect1, rect2) { var currentX2 = rect2.x + rect2.width; var currentY2 = rect2.y + rect2.height; var childX2 = rect1.x + rect1.width; var childY2 = rect1.y + rect1.height; rect2.x = Math.min(rect1.x, rect2.x); rect2.y = Math.min(rect1.y, rect2.y); rect2.width = Math.max(currentX2, childX2) - rect2.x; rect2.height = Math.max(currentY2, childY2) - rect2.y; }, /** * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node. */ getFontStyle : function() { if (!this.styleCache) { this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this); } return this.styleCache; }, /** * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node. */ getShadow : function() { var result = this.getComputedStyleValue(46); if (!result) { result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow")); } result = (!result || "none" == result) ? null : result; return result; }, /** * Return the text content. * @return (String) text content */ getTextString : function() { return this.text; }, /** * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account. * @return (double) x position taking alignment into account. */ getX : function() { return this.x; }, /** * Returns the Y position where this item will start drawing from. This returns the text baseline * @return (double) y position */ getY : function() { return this.y; }, /** @expose */ rave_getSizePx : function(size) { var value = 0; if (size) { value = size.value; switch (size.unit.type) { case 1: return size.value * this.getFontStyle().getSize(); default: return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size); } } return value; }, paint : function(renderer) { if (this.text != null && this.text.length > 0) { renderer.setStrokeAndFill(this); renderer.drawText(this); } }, doLayout : function() { this.calculateDimensions(); this.nextX = this.x + this.width; this.nextY = this.y; this.invalidLayout = false; if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) { var achild = child; if (achild.invalidLayout) { achild.layout(); } this.nextX = achild.nextX; this.nextY = achild.nextY; } } } }, /** * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children. */ setDirty : function(dirty_, invalidateLayout) { if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) { (child).invalidateLayout(); } } } com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout); }, /** * Perform dimension (x,y,width,height,etc) calculations only. */ calculateDimensions : function() { this.computeStylesToRoot(); var metrics = this.calculateMetrics(); this.width = metrics["width"]; var fontSize = this.rave_getSizePx(this.getComputedCSSStyle(22).value); this.ascent = metrics["actualBoundingBoxAscent"]; this.descent = metrics["actualBoundingBoxDescent"]; if (undefined == this.ascent) { this.ascent = fontSize * .7 + fontSize * .1; } if (undefined == this.descent) { this.descent = fontSize * .3; } this.height = this.ascent + this.descent; this.width = this.calculateMetrics()["width"]; this.x = this.calculateX(); this.y = this.rave_getSizePx(this.getComputedCSSStyle(1).value) + this.rave_getSizePx(this.getComputedCSSStyle(16).value); }, calculateX : function() { var calculatedX = this.rave_getSizePx(this.getComputedStyleValue(0)); var anchor = this.getComputedStyleValue(27); if ("middle" == anchor) { calculatedX -= this.width / 2; } else if ("end" == anchor) { calculatedX -= this.width; } return calculatedX + this.rave_getSizePx(this.getComputedStyleValue(15)); }, calculateMetrics : function() { var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d"); context.font = this.getFontStyle().toString(); var tm = context.measureText(this.text); com_ibm_rave_core_Rave.canvas.disposeContext(context); return tm; } //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/style/GradientFillStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass /** * The abstract base class for color gradient used for filling shapes. Gradients are immutable. */ var com_ibm_rave_render_internal_style_GradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, { /** * A list to hold gradient color stops */ //stops : null, constructor : function() { this.stops = []; }, /** * Add a gradient color stop at a set index. * @param (com.ibm.rave.render.internal.style.GradientStop) stop {@link (com.ibm.rave.render.internal.style.GradientStop) GradientStop} * @return (com.ibm.rave.render.internal.style.GradientFillStyle) This gradient for easy chaining. */ addStop : function(stop) { this.stops.push(this.updateOffset(stop)); return this; }, /** * Return a list of all stop objects associated with this gradient. * @return (Array) list of all stop objects associated with this gradient. Returns an empty list if none defined. */ getStops : function() { return this.stops; }, getColor : function() { return null; }, calculateColorWithOpacity : function() { return null; }, /** * Update the stop's offset to match the rules of SVG for gradients. (http://www.w3.org/TR/SVG/pservers.html#StopElement) */ updateOffset : function(stop) { var maxStop; for (var __i_enFor0 = 0, __exp_enFor0 = this.stops, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var s = __exp_enFor0[__i_enFor0]; if (!maxStop || s.offset > maxStop.offset) { maxStop = s; } } if (maxStop) { var maxOffset = maxStop.offset; if (stop.offset <= maxOffset) { stop.setOffset(maxOffset); maxStop.setOffset(maxOffset - 1.0E-5); } } return stop; } }); /** * A small adjustment to differentiate between equal stop values. AWT renderer throws an exception when stops have the same value. Adjusting one of the values by this amount mimics SVG behavior for equal stop values. */ com_ibm_rave_render_internal_style_GradientFillStyle.EQUAL_DIFF = 0.00001; // $source: com/ibm/rave/render/internal/style/LinearGradientFillStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass var com_ibm_rave_render_internal_style_LinearGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, { /** * Starting X position. */ x1 : 0, /** * Starting Y position. */ y1 : 0, /** * Ending X position. */ x2 : 0, /** * Ending Y position. */ y2 : 0, /** * Create a linear gradient style. Has the following public properties defined:

x0

y0

x1

y1

stops

* @param (double) x1 The horizontal coordinate of the gradient start point. * @param (double) y1 The vertical coordinate of the gradient start point. * @param (double) x2 The horizontal coordinate of the gradient end point. * @param (double) y2 The vertical coordinate of the gradient end point. */ constructor : function(x1, y1, x2, y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; }, getType : function() { return 1001; } }); // $source: com/ibm/rave/render/internal/style/RadialGradientFillStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/GradientFillStyle (loadtime) // superclass var com_ibm_rave_render_internal_style_RadialGradientFillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_GradientFillStyle, { /** * The horizontal coordinate of the gradient start point. */ cx : 0, /** * The vertical coordinate of the gradient start point. */ cy : 0, /** * Radius of the starting circle. */ r : 0, /** * The horizontal coordinate of the gradient end point. */ fx : 0, /** * The vertical coordinate of the gradient end point. */ fy : 0, /** * Create a radial gradient style. Has the following public properties defined:

cx

cy

r

fx

fy

stops

* @param (double) cx The horizontal coordinate of the gradient center point. * @param (double) cy The vertical coordinate of the gradient center point. * @param (double) r Radius of the starting circle. * @param (double) fx The horizontal coordinate of the gradient focal point. * @param (double) fy The vertical coordinate of the gradient focal point. */ constructor : function(cx, cy, r, fx, fy) { this.cx = cx; this.cy = cy; this.r = r; this.fx = fx; this.fy = fy; }, getType : function() { return 1002; } }); // $source: com/ibm/rave/render/internal/style/FillStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass //@import com/ibm/rave/core/Rave (runtime) // rgb var com_ibm_rave_render_internal_style_FillStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, { //color : null, /** * A class representing a fill style for an arbitrary shape. If both a color and gradient are supplied, the renderer has the option to apply either. * @param (Object) color A color style to apply as a fill in a CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc). * @param (double) opacity The amount of opacity to apply from 0 (transparent) to 1 (opaque). * @see http://www.w3.org/TR/css3-color/ */ constructor : function(color, opacity) { this.setOpacity(opacity); this.color = com_ibm_rave_core_Rave.rgb(color); }, /** * Parses the value of getColor() as an RGB string and returns a new RGB object. * @return (com.ibm.rave.core.color.RGB) RGB object representing color. */ getColor : function() { return this.color; }, isVisible : function() { return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.color; }, getType : function() { return 1000; } }); // $source: com/ibm/rave/render/internal/style/GradientStop /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/Rave (runtime) // rgb /** * A class representing a stop for a gradient. Holds a stop offset and a color. */ var com_ibm_rave_render_internal_style_GradientStop = com_ibm_rave_core_nativeImpl_Declare({ /** * Gradient stop color. */ //color : null, /** * Gradient stop offset. */ offset : 0, /** * Gradient stop opacity */ opacity : 0, /** * Creates a new object representing a stop inside a gradient. * @param (double) offset Where this offset starts. A value between 0-1 representing a percentage of a bounding box. The bounding box is defined by the gradient type and properties. * @param (com.ibm.rave.core.color.RGB) color The color of this gradient stop. * @param (double) opacity The opacity level of this stop. */ constructor : function(offset, color, opacity) { this.offset = this.fix(offset); this.color = color; this.opacity = this.fix(opacity); }, /** * Return this stop as an RGBA color. Multiplies any existing rgba() fill color with stop-opacity to create the alpha value. * @return (com.ibm.rave.core.color.RGB) RGBA combining stop-opacity and stop color. */ calculateColor : function() { var opacity = this.color.a * this.opacity; return com_ibm_rave_core_Rave.rgb("rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + opacity + ")"); }, fix : function(number) { return Math.min(Math.max(number, 0), 1); }, /** * Return the stop offset from 0->1 * @return (double) The offset from 0-1> */ getOffset : function() { return this.offset; }, setOffset : function(offset) { this.offset = this.fix(offset); }, /** * Return the stop opacity from 0->1. Defaults to 1. * @return (double) The stop opacity from 0->1. */ getOpacity : function() { return this.opacity; } }); // $source: com/ibm/rave/render/internal/style/StrokeStyle /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/style/AbstractStyle (loadtime) // superclass //@import com/ibm/rave/core/Rave (runtime) // rgb var com_ibm_rave_render_internal_style_StrokeStyle = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_style_AbstractStyle, { //lineJoin : null, //lineCap : null, //dashArray : null, //strokeColor : null, width : 0, miterLimit : 0, dashOffset : 0, /** * A class that holds information about stroke styling. * @param (Object) strokeColor A string representation of a color in CSS style notation (ie - "#ffffff", "rgb(0,0,0)", etc) * @param (double) width the pixel stroke width * @param (double) opacity the opacity between 0 and 1 inclusive * @param (double) miterLimit the maxmimum miter length. Miter length is the distance between the inner corner and the outer corner where two lines meet. Only valid when lineJoin is 'miter'. * @param (String) lineJoin the type of corner created when two lines meet. Valid values: bevel, round, miter * @param (String) lineCap the style of end caps for a line. Valid values: butt, round, square * @param (float[]) dashArray the pattern of dashes and gaps (positive numbers) used to stroke paths * @param (double) dashOffset the distance into the dash pattern to start the dash */ constructor : function(strokeColor, width, opacity, miterLimit, lineJoin, lineCap, dashArray, dashOffset) { this.setOpacity(opacity); this.strokeColor = com_ibm_rave_core_Rave.rgb(strokeColor); this.width = width; this.miterLimit = miterLimit; this.lineJoin = lineJoin; this.lineCap = lineCap; this.dashArray = dashArray; this.dashOffset = dashOffset; }, isVisible : function() { return com_ibm_rave_render_internal_style_AbstractStyle.prototype.isVisible.call(this) && this.width > 0; }, /** * Return the stroke width. * @return (double) Stroke width. */ getWidth : function() { return this.width; }, /** * Return the line cap. Valid values are butt, round, square * @return (String) line cap */ getLineCap : function() { return this.lineCap; }, /** * Return the line join. Valid values are bevel, round, miter. * @return (String) line join */ getLineJoin : function() { return this.lineJoin; }, /** * Return the miter limit. * @return (double) the miter limit */ getMiterLimit : function() { return this.miterLimit; }, /** * Return the stroke color as RGB. May return null. * @return (com.ibm.rave.core.color.RGB) Set stroke color. Returns 'black' if the defined color is not valid. */ getColor : function() { return this.strokeColor; }, /** * Return the dash array. * @return (float[]) the dash array */ getDashArray : function() { return this.dashArray; }, /** * Return the dash offset. * @return (double) the dash offset */ getDashOffset : function() { return this.dashOffset; }, getType : function() { return 1003; } }); // $source: com/ibm/rave/render/internal/style/RenderStyleManager /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/core/internal/css/CSSUtil (runtime) // parseIdUrlLink //@import com/ibm/rave/render/internal/nodes/NodeUtil (runtime) // findSceneNode //@import com/ibm/rave/render/internal/style/LinearGradientFillStyle (static) // new //@import com/ibm/rave/render/internal/style/RadialGradientFillStyle (static) // new //@import com/ibm/rave/render/internal/style/FillStyle (static) // new //@import com/ibm/rave/render/internal/style/GradientStop (static) // new //@import com/ibm/rave/render/internal/style/StrokeStyle (static) // new //@import com/ibm/rave/render/internal/style/FontStyle (static) // new /** * An internal helper class that converts styles on a SceneNode to internal style classes (FillStyle, FontStyle, etc) used by the renderers. */ var com_ibm_rave_render_internal_style_RenderStyleManager = com_ibm_rave_core_nativeImpl_Declare({ }); /** * Return a FillStyle object based on style properties set on the node. Will return null if there is no fill style defined on the node or if the style would result in a completely transparent fill. * @return (com.ibm.rave.render.internal.style.AbstractStyle) FillStyle object representing styles set on the node. */ com_ibm_rave_render_internal_style_RenderStyleManager.getFill = function(node) { var fill = node.getComputedStyleValue(28); var style; if (fill != null && !("none" == fill)) { var id = com_ibm_rave_core_internal_css_CSSUtil.parseIdUrlLink(fill); if (id != null) { var gradientNode = com_ibm_rave_render_internal_nodes_NodeUtil.findSceneNode(node, id, [1011, 1012]); if (gradientNode) { switch (gradientNode.rave_getDrawType()) { case 1011: var linearGradient = gradientNode; style = new com_ibm_rave_render_internal_style_LinearGradientFillStyle(linearGradient.getX1(node), linearGradient.getY1(node), linearGradient.getX2(node), linearGradient.getY2(node)); com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, linearGradient); break; case 1012: var radialGradient = gradientNode; style = new com_ibm_rave_render_internal_style_RadialGradientFillStyle(radialGradient.getCX(node), radialGradient.getCY(node), radialGradient.getR(node), radialGradient.getFX(node), radialGradient.getFY(node)); com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops(style, radialGradient); break; } } } else { var oOpacity = node.getComputedStyleValue(30); var oFillOpacity = node.getComputedStyleValue(33); var opacity = (oOpacity != null) ? (oOpacity) : 1; var fillOpacity = (oFillOpacity != null) ? (oFillOpacity) : 1; opacity = opacity * fillOpacity; if (opacity > 0) { style = new com_ibm_rave_render_internal_style_FillStyle(fill, Math.min(opacity, 1)); } } } return style; }; com_ibm_rave_render_internal_style_RenderStyleManager.addGradientStops = function(gradientStyle, gradientNode) { for (var __i_enFor0 = 0, __exp_enFor0 = gradientNode.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (child.rave_getDrawType() == 1016) { var stopItem = child; gradientStyle.addStop(new com_ibm_rave_render_internal_style_GradientStop(stopItem.getOffset(), stopItem.getColor(), stopItem.getOpacity())); } } }; /** * Return a StrokeStyle object based on style properties set on the node. Will return null if there is no stroke styling defined on the node or if the style would result in a completely transparent stroke. * @return (com.ibm.rave.render.internal.style.StrokeStyle) FillStyle object representing styles set on the node. */ com_ibm_rave_render_internal_style_RenderStyleManager.getStroke = function(node) { var stroke = node.getComputedStyleValue(29); if (stroke == null || "none" == stroke) { return null; } var strokeWidth = node.getComputedSizePx(31); if (strokeWidth > 0) { var oOpacity = node.getComputedStyleValue(30); var oStrokeOpacity = node.getComputedStyleValue(32); var opacity = (oOpacity != null) ? (oOpacity) : 1; var strokeOpacity = (oStrokeOpacity != null) ? (oStrokeOpacity) : 1; opacity = opacity * strokeOpacity; if (opacity > 0) { var miterLimit = (node.getComputedStyleValue(38)); var lineJoin = node.getComputedStyleValue(37); var lineCap = node.getComputedStyleValue(36); var dashArray = node.getComputedStyleValue(34); var dashOffset = node.getComputedSizePx(35); return new com_ibm_rave_render_internal_style_StrokeStyle(stroke, strokeWidth, Math.min(opacity, 1), miterLimit, lineJoin, lineCap, dashArray, dashOffset); } } return null; }; /** * Gets font information from CSS-type styles set on a scene node. Currently supports these style attributes:

font-style

- Defaults to "normal".

font-family

- Defaults to "".

font-size

- Defaults size to FontStyle.DEFAULT_FONT_SIZE

- Defaults unit to FontUnitType.PX

font-weight

- Defaults to "normal".

* @param (com.ibm.rave.render.internal.nodes.AbstractSceneNode) node Scene node with styles set. * @return (com.ibm.rave.render.internal.style.FontStyle) FontStyle object that holds font information for drawing. */ com_ibm_rave_render_internal_style_RenderStyleManager.getFont = function(node) { var style = node.getComputedStyleValue(23); var family = node.getComputedStyleValue(21); var size = node.getComputedStyleValue(22); var weight = node.getComputedStyleValue(24); var lineHeight = ""+(node.getComputedStyleValue(14)); var variant = node.getComputedStyleValue(25); return new com_ibm_rave_render_internal_style_FontStyle(style, family, size, weight, lineHeight, variant); }; //com_ibm_rave_render_internal_style_RenderStyleManager.NONE = "none"; //com_ibm_rave_render_internal_style_RenderStyleManager.BUTT = "butt"; //com_ibm_rave_render_internal_style_RenderStyleManager.MITER = "miter"; // $source: com/ibm/rave/render/internal/nodes/TSpanSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/TextSceneItem (loadtime) // new, superclass //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (runtime) /** * A class that describes a text span. tspan nodes are treated like text nodes with the exception that they are positioned relative to their parent element (typically a text node) if no absolute positioning is provided. */ var com_ibm_rave_render_internal_nodes_TSpanSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_TextSceneItem, { /** @expose */ rave_getName : function() { return "tspan"; }, /** * Create a tspan scene node. * @param (String) nsuri * @param (com.ibm.rave.core.scene.SceneNode) context */ constructor : function(nsuri, context) { this.invalidLayout = true; }, doLayout : function() { var parent = this.rave_getParentNode(); if (parent && (parent).invalidLayout) { (parent).doLayout(); } else { com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.doLayout.call(this); } }, /** @expose */ getBoundingClientRect : function() { var parent = this.rave_getParentNode(); if (parent) { return (parent).getBoundingClientRect(); } return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBoundingClientRect.call(this); }, /** @expose */ getBBox : function() { var parent = this.rave_getParentNode(); if (parent) { return (parent).getBBox(); } return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.getBBox.call(this); }, getFontStyle : function() { var parent = this.rave_getParentNode(); if (parent && (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem))) { return (parent).getFontStyle(); } return com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.getFontStyle.call(this); }, calculateDimensions : function() { com_ibm_rave_render_internal_nodes_TextSceneItem.prototype.calculateDimensions.call(this); var parent = this.rave_getParentNode(); if (parent && com_ibm_rave_core_nativeImpl_Object.isInstanceOf(parent, com_ibm_rave_render_internal_nodes_TextSceneItem)) { var parentItem = parent; if (this.getAttribute("x") == null) { this.x += parentItem.nextX; } if (this.getAttribute("y") == null) { this.y += parentItem.nextY; } } } }); // $source: com/ibm/rave/render/internal/nodes/TextPathSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RectStruct (runtime) // new //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFont //@import com/ibm/rave/render/internal/style/ShadowStyle (runtime) // parse //@import com/ibm/rave/core/Rave (runtime) // selectAll, Rave //@import com/ibm/rave/render/internal/nodes/TSpanSceneItem (runtime) // new //@import com/ibm/rave/render/internal/nodes/TextSceneItem (runtime) // new /** * TextPath shape. */ var com_ibm_rave_render_internal_nodes_TextPathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { //styleCache : null, //ascent : null, //descent : null, //cachedBoundingClientRectBBox : null, x : 0, y : 0, width : 0, height : 0, nextX : 0, nextY : 0, /** @expose */ getDrawType : function() { return 1017; }, /** @expose */ getName : function() { return "textPath"; }, notifyAfterUpdate : function(type, subType, key, toValue, fromValue) { this.styleCache = null; com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.notifyAfterUpdate.call(this, type, subType, key, toValue, fromValue); }, invalidateLayout : function() { com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.invalidateLayout.call(this); this.cachedBoundingClientRectBBox = null; }, calculateBBox : function() { var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height); if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; var childRect = (child).calculateBBox(); this.expandRect(childRect, clientRect); } } return new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height); }, getBoundingClientRectBBox : function() { if (!this.cachedBoundingClientRectBBox) { if (this.invalidLayout) { this.layout(); } var clientRect = new com_ibm_rave_core_geom_RectStruct(this.x, this.y - this.ascent, this.width, this.height); if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; var childRect = (child).getBoundingClientRectBBox(); this.expandRect(childRect, clientRect); } } this.cachedBoundingClientRectBBox = new com_ibm_rave_core_geom_RaveRect(clientRect.x, clientRect.y, clientRect.width, clientRect.height); } return this.cachedBoundingClientRectBBox; }, /** * Expand bounding box of rect2 to include positions of rect1 that are outside rect2 bounds. Modifies rect2 in place. * @param (com.ibm.rave.core.geom.RaveRect) rect1 * @param (com.ibm.rave.core.geom.RectStruct) rect2 */ expandRect : function(rect1, rect2) { var currentX2 = rect2.x + rect2.width; var currentY2 = rect2.y + rect2.height; var childX2 = rect1.x + rect1.width; var childY2 = rect1.y + rect1.height; rect2.x = Math.min(rect1.x, rect2.x); rect2.y = Math.min(rect1.y, rect2.y); rect2.width = Math.max(currentX2, childX2) - rect2.x; rect2.height = Math.max(currentY2, childY2) - rect2.y; }, /** * @return (com.ibm.rave.render.internal.style.FontStyle) An object representing the styles of this text node. */ getFontStyle : function() { if (!this.styleCache) { this.styleCache = com_ibm_rave_render_internal_style_RenderStyleManager.getFont(this); } return this.styleCache; }, /** * @return (com.ibm.rave.render.internal.style.ShadowStyle) An object representing the styles of this text node. */ getShadow : function() { var result = this.getComputedStyleValue(46); if (!result) { result = com_ibm_rave_render_internal_style_ShadowStyle.parse(this.rave_getProperty("_rave_drop_shadow")); } result = (!result || "none" == result) ? null : result; return result; }, /** * Return the text content. * @return (String) text content */ getTextString : function() { return this.text; }, /** * Returns the X position where this item will start drawing from. TODO: Does not yet take text direction into account. * @return (double) x position taking alignment into account. */ getX : function() { return this.x; }, getXOffset : function() { return + (this.rave_getParentNode().getAttribute("x")) + + (this.rave_getParentNode().getAttribute("dx")); }, getYOffset : function() { return + (this.rave_getParentNode().getAttribute("y")) + + (this.rave_getParentNode().getAttribute("dy")); }, /** * Returns the Y position where this item will start drawing from. This returns the text baseline * @return (double) y position */ getY : function() { return this.y; }, /** @expose */ getSizePx : function(size) { var value = 0; if (size) { value = size.value; switch (size.unit.type) { case 1: return size.value * this.getFontStyle().getSize(); default: return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_getSizePx.call(this, size); } } return value; }, paint : function(renderer) { if (this.text != null && this.text.length > 0) { renderer.setStrokeAndFill(this); renderer.drawTextPath(this, this.getFilteredPath()); } }, /** * Will return a selector with all the path matching the provided id */ getFilteredPath : function() { var pathID = (this.getAttribute("http://www.w3.org/1999/xlink:href")); var finalPathID = pathID.substring(1); var filteredPaths = com_ibm_rave_core_Rave.selectAll("path").filter(function(data, index, groupIndex) { return finalPathID == (this).getAttribute("id") ? true : false; }); return filteredPaths; }, doLayout : function() { this.calculateDimensions(); this.nextX = this.x + this.width; this.nextY = this.y; this.invalidLayout = false; if (this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) { var achild = child; if (achild.invalidLayout) { achild.layout(); } this.nextX = achild.nextX; this.nextY = achild.nextY; } } } }, /** * When a textSceneItem is invalidated, if it has a tspanItem child, the child tspanItem needs to be invalidated too. This is necessary because tspan is generated internally, and the text style attribute is specified on text, not on its tspan children. */ setDirty : function(dirty_, invalidateLayout) { if (dirty_ && invalidateLayout && this.rave_hasChildNodes()) { for (var __i_enFor0 = 0, __exp_enFor0 = this.rave_getChildNodes(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(child, com_ibm_rave_render_internal_nodes_TSpanSceneItem)) { (child).invalidateLayout(); } } } com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.setDirty.call(this, dirty_, invalidateLayout); }, /** * Perform dimension (x,y,width,height,etc) calculations only. */ calculateDimensions : function() { this.computeStylesToRoot(); var metrics = this.calculateMetrics(); this.width = metrics["width"]; var fontSize = this.getSizePx(this.getComputedCSSStyle(22).value); this.ascent = metrics["actualBoundingBoxAscent"]; this.descent = metrics["actualBoundingBoxDescent"]; if (undefined == this.ascent) { this.ascent = fontSize * .7 + fontSize * .1; } if (undefined == this.descent) { this.descent = fontSize * .3; } this.height = this.ascent + this.descent; if (!(com_ibm_rave_core_nativeImpl_Object.isInstanceOf(this.rave_getParentNode(), com_ibm_rave_render_internal_nodes_TextSceneItem))) { this.x = 0; this.y = 0; } else { this.x = this.calculateX(); this.y = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(1)) + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(16)); } }, calculateX : function() { var parentCalculatedX = this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(0)); var anchor = this.getComputedStyleValue(27); if ("middle" == anchor) { parentCalculatedX -= this.width / 2; } else if ("end" == anchor) { parentCalculatedX -= this.width; } return parentCalculatedX + this.getSizePx((this.rave_getParentNode()).getComputedStyleValue(15)); }, calculateMetrics : function() { var context = com_ibm_rave_core_Rave.canvas.create(1, 1).getContext("2d"); context.font = this.getFontStyle().toString(); var tm = context.measureText(this.text); com_ibm_rave_core_Rave.canvas.disposeContext(context); return tm; } //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/nodes/GroupSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/transform/MatrixUtil (runtime) // transformBounds //@import com/ibm/rave/core/geom/RectStruct (runtime) // new //@import com/ibm/rave/core/geom/RaveRect (runtime) // new var com_ibm_rave_render_internal_nodes_GroupSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { isolated : false, /** @expose */ rave_getName : function() { return "g"; }, /** @expose */ rave_getDrawType : function() { return 1004; }, rave_intersects : function(rect) { if (this.rave_hasChildNodes()) { return com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_intersects.call(this, rect); } return false; }, calculateBBox : function() { var x1, y1, x2, y2, cx2, cy2; x1 = y1 = x2 = y2 = 0; if (this.rave_hasChildNodes()) { x1 = y1 = Infinity; x2 = y2 = -Infinity; for (var __i_enFor0 = 0, __exp_enFor0 = this.getChildrenArray(), __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var child = __exp_enFor0[__i_enFor0]; var bb = child.getBBox(); var x = bb.x; var y = bb.y; var w = bb.width; var h = bb.height; var t = (child).computeStyleValue(11); if (t) { var bstruct = com_ibm_rave_core_transform_MatrixUtil.transformBounds(new com_ibm_rave_core_geom_RectStruct(x, y, w, h), t); x = bstruct.x; y = bstruct.y; w = bstruct.width; h = bstruct.height; } cx2 = x + w; cy2 = y + h; if (x < x1) { x1 = x; } if (y < y1) { y1 = y; } if (cx2 > x2) { x2 = cx2; } if (cy2 > y2) { y2 = cy2; } } } return new com_ibm_rave_core_geom_RaveRect(x1, y1, x2 - x1, y2 - y1); }, paint : function(renderer) { this.isolated = this.isolate(); if (this.isolated) { renderer.push(); } }, postPaint : function(renderer) { if (this.isolated) { renderer.pop(this.getOpacity()); } }, doLayout : function() {}, /** * Determine if we need to isolate the painting of the group: if we have opacity, we need to isolate the group by drawing into a new context, applying opacity, then drawing that image into the previous context. */ isolate : function() { return this.getOpacity() < 1 ? true : false; }, /** * Return the opacity of this stop from 0->1. Defaults to 1 (fully opaque) * @return (double) opacity of this stop from 0->1 */ getOpacity : function() { var oOpacity = this.getComputedStyleValue(30); return (oOpacity != null) ? (oOpacity) : 1; } //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/nodes/PathSceneItem /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/AbstractSceneNode (loadtime) // superclass //@import com/ibm/rave/core/geom/RaveRect (runtime) // new //@import com/ibm/rave/render/internal/nodes/GeometricHelper (runtime) // new //@import com/ibm/rave/render/internal/style/RenderStyleManager (runtime) // getFill //@import com/ibm/rave/core/internal/nativeImpl/Lang (runtime) // isString //@import com/ibm/rave/render/internal/nodes/path/StringPathGenerator (runtime) // new //@import com/ibm/rave/core/internal/geo/PathActionPathGenerator (runtime) // new //@import com/ibm/rave/core/internal/geo/PathActionDrawingContext (runtime) // new /** * A translated implementation of an SVG path shape. */ var com_ibm_rave_render_internal_nodes_PathSceneItem = com_ibm_rave_core_nativeImpl_Declare(com_ibm_rave_render_internal_nodes_AbstractSceneNode, { //d : null, //pathString : null, calculateBBox : function() { if (!this.d) { return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0); } var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler(); this.d.draw(pathHandler); var shapes = pathHandler.getShapes(); if (shapes.length == 0) { return new com_ibm_rave_core_geom_RaveRect(0, 0, 0, 0); } var bounds = shapes[0].getBounds(); var xMin = bounds[0].x; var yMin = bounds[0].y; var xMax = bounds[1].x; var yMax = bounds[1].y; for (var i = 1; i < shapes.length; ++i) { bounds = shapes[i].getBounds(); if (bounds[0].x < xMin) { xMin = bounds[0].x; } if (bounds[1].x > xMax) { xMax = bounds[1].x; } if (bounds[0].y < yMin) { yMin = bounds[0].y; } if (bounds[1].y > yMax) { yMax = bounds[1].y; } } return new com_ibm_rave_core_geom_RaveRect(xMin, yMin, xMax - xMin, yMax - yMin); }, /** @expose */ rave_getDrawType : function() { return 1006; }, /** @expose */ rave_getName : function() { return "path"; }, rave_intersects : function(rect) { var intersection = false; if (this.d) { var pathHandler = new com_ibm_rave_render_internal_nodes_GeometricHelper.PathHandler(); this.d.draw(pathHandler); var shapes = pathHandler.getShapes(); if (shapes.length == 0) { return false; } var hasFill = com_ibm_rave_render_internal_style_RenderStyleManager.getFill(this); for (var __i_enFor0 = 0, __exp_enFor0 = shapes, __len_enFor0 = __exp_enFor0.length; __i_enFor0 < __len_enFor0; ++__i_enFor0) { var shape = __exp_enFor0[__i_enFor0]; if (hasFill) { shape.setClosed(); } if (shape.intersect$1(rect)) { if (this.intersectsClip(rect)) { intersection = !intersection; } } } } return intersection; }, paint : function(renderer) { if (this.getPath()) { renderer.setStrokeAndFill(this); renderer.drawPath(this); } }, /** * @return (com.ibm.rave.core.geo.PathGenerator) PathGenerator representing the current path. */ getPath : function() { return this.d; }, /** * If this path was populated via an SVG path as a string, this will return the original string. null if a PathDrawingContext was used to populate. * @return (String) String SVG path used to originally populate this path object. null otherwise. */ getPathString : function() { return this.pathString; }, /** @expose */ rave_initExtensions : function() { com_ibm_rave_render_internal_nodes_AbstractSceneNode.prototype.rave_initExtensions.call(this); var origSetAttr = this.setAttribute; var self = this; this.setAttribute = function(key, value) { origSetAttr.call(this, key, value); if (value != null && "d" == key) { var internalVal = self.attributes.getByIndex(16); self.pathString = null; if (com_ibm_rave_core_internal_nativeImpl_Lang.isString(internalVal)) { self.pathString = ""+(internalVal); self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString()); } else { self.d = new com_ibm_rave_core_internal_geo_PathActionPathGenerator(); if (com_ibm_rave_core_nativeImpl_Object.isInstanceOf(internalVal, com_ibm_rave_core_internal_geo_PathActionDrawingContext)) { self.d.context(internalVal); } } } else if (value != null && "points" == key) { var internalVal = self.attributes.getByIndex(17); self.pathString = ""+(internalVal); self.d = new com_ibm_rave_render_internal_nodes_path_StringPathGenerator(self.getPathString()); } }; }, doLayout : function() {} //constructor : function(nsuri, context) {} }); // $source: com/ibm/rave/render/internal/nodes/path/StringPathGenerator /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare //@import com/ibm/rave/render/internal/nodes/path/Path2DParser (runtime) // new /** * A PathGenerator that first parses an SVG path and then calls the Path commands on it. This is used in Path rendering to take an SVG path and create path shapes out of it. */ var com_ibm_rave_render_internal_nodes_path_StringPathGenerator = com_ibm_rave_core_nativeImpl_Declare({ //path : null, _$functionClassMethod : function() { var _$self = function(data, index, groupIndex) { return null; }; return _$self; }, /** * @param (String) path The SVG Path string to parse. */ constructor : function(path) { this.path = path; }, context$0 : function() { return null; }, context$1 : function(context) { return this; }, /** @expose */ draw : function(path2dHandler) { new com_ibm_rave_render_internal_nodes_path_Path2DParser(path2dHandler).parse(this.path); }, /** @expose */ context : function(a0) { var args = arguments; if (args.length == 0) { return this.context$0(); } return this.context$1(a0); } }); // $source: com/ibm/rave/render/internal/nodes/path/Path2DParser /************************************************************************ ** 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/core/nativeImpl/Declare (loadtime) // declare /** * SVG path parser. */ var com_ibm_rave_render_internal_nodes_path_Path2DParser = com_ibm_rave_core_nativeImpl_Declare({ //path : null, //d : null, currentX : 0, currentY : 0, xCenter : 0, yCenter : 0, idx : 0, dLength : 0, fail : false, currentChar : 0, currentCharIdx : -1, constructor : function(path) { this.path = path; }, parse : function(pathString) { if (pathString != null) { this.currentX = this.currentY = this.xCenter = this.yCenter = this.idx = 0; this.currentChar = 0; this.currentCharIdx = -1; this.d = pathString; this.dLength = pathString.length; this.path.startPath(); for (; this.idx < this.dLength;) { this.fail = false; this.skipWhitespace(); switch (this.getChar(this.idx++)) { case 109: this._moveTo(false); break; case 77: this._moveTo(true); break; case 108: this._lineTo(false, true, true); break; case 76: this._lineTo(true, true, true); break; case 99: this._bezierCurveTo(false, false); break; case 67: this._bezierCurveTo(true, false); break; case 115: this._bezierCurveTo(false, true); break; case 83: this._bezierCurveTo(true, true); break; case 113: this._quadraticCurveTo(false, false); break; case 81: this._quadraticCurveTo(true, false); break; case 116: this._quadraticCurveTo(false, true); break; case 84: this._quadraticCurveTo(true, true); break; case 104: this._lineTo(false, false, true); break; case 72: this._lineTo(true, false, true); break; case 118: this._lineTo(false, true, false); break; case 86: this._lineTo(true, true, false); break; case 97: this._arcTo(false); break; case 65: this._arcTo(true); break; case 122: case 90: this.path.closePath(); break; default: this.path.fail(this.idx - 1); return; } } } }, /** * Skips 4 different types of whitespace characters: