Repository: flex-asjs Updated Branches: refs/heads/develop 32cd93b62 -> 95059a74f
Tuning the Javascript version of FlexJS charts. Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/95059a74 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/95059a74 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/95059a74 Branch: refs/heads/develop Commit: 95059a74fa5332e6ca3c8d88b05bdde70d62509a Parents: 32cd93b Author: Peter Ent <[email protected]> Authored: Wed Nov 19 16:32:16 2014 -0500 Committer: Peter Ent <[email protected]> Committed: Wed Nov 19 16:32:16 2014 -0500 ---------------------------------------------------------------------- .../org/apache/flex/charts/beads/ChartView.as | 6 +- .../flex/charts/beads/VerticalLinearAxisBead.as | 2 +- .../flex/charts/optimized/SVGChartAxisGroup.as | 2 +- .../flex/core/graphics/GraphicsContainer.as | 2 +- .../org/apache/flex/charts/core/ChartBase.js | 3 +- .../charts/supportClasses/ChartAxisGroup.js | 84 ++++++++++++++++++++ .../FlexJS/src/org/apache/flex/core/UIBase.js | 8 +- .../src/org/apache/flex/core/graphics/Circle.js | 2 + .../org/apache/flex/core/graphics/Ellipse.js | 2 + .../apache/flex/core/graphics/GraphicShape.js | 17 ++-- .../flex/core/graphics/GraphicsContainer.js | 39 +++++++-- .../src/org/apache/flex/core/graphics/Line.js | 2 + .../src/org/apache/flex/core/graphics/Path.js | 3 + .../src/org/apache/flex/core/graphics/Rect.js | 2 + .../src/org/apache/flex/core/graphics/Text.js | 5 +- .../src/org/apache/flex/html/beads/ListView.js | 12 +++ 16 files changed, 173 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as index 1b3c2d8..2d1708d 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/ChartView.as @@ -64,14 +64,16 @@ package org.apache.flex.charts.beads var haxis:IHorizontalAxisBead = _strand.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead; if (haxis && _horizontalAxisGroup == null) { - _horizontalAxisGroup = new (ValuesManager.valuesImpl.getValue(value, "iHorizontalAxisGroup")) as IAxisGroup; + var m1:Class = ValuesManager.valuesImpl.getValue(value, "iHorizontalAxisGroup"); + _horizontalAxisGroup = new m1(); haxis.axisGroup = _horizontalAxisGroup; IParent(_strand).addElement(_horizontalAxisGroup); } var vaxis:IVerticalAxisBead = _strand.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead; if (vaxis && _verticalAxisGroup == null) { - _verticalAxisGroup = new (ValuesManager.valuesImpl.getValue(value, "iVerticalAxisGroup")) as IAxisGroup; + var m2:Class = ValuesManager.valuesImpl.getValue(value, "iVerticalAxisGroup"); + _verticalAxisGroup = new m2(); vaxis.axisGroup = _verticalAxisGroup; IParent(_strand).addElement(_verticalAxisGroup); } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as index cd3ad95..4223743 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as @@ -201,7 +201,7 @@ package org.apache.flex.charts.beads var labelY:Number = UIBase(axisGroup).height + 8; for(i=0; i < numTicks+1; i++) - { + { addTickLabel(formatLabel(tickValue), 0, ypos, 0, tickSpacing); // add a tick mark, too. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as index 529de40..479d85f 100644 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as +++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as @@ -95,7 +95,7 @@ package org.apache.flex.charts.optimized public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number, tickFill:IFill ):void { fill = tickFill; - drawText(text, xpos, ypos-9); + drawText(text, xpos, ypos-boxHeight/4); } /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as index 08c5f43..32fd418 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as @@ -168,7 +168,7 @@ package org.apache.flex.core.graphics } textField.x = x; - textField.y = y; + textField.y = y + textField.textHeight/4; } } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/charts/core/ChartBase.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/charts/core/ChartBase.js b/frameworks/js/FlexJS/src/org/apache/flex/charts/core/ChartBase.js index 1845da3..2aaf7f2 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/charts/core/ChartBase.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/charts/core/ChartBase.js @@ -33,7 +33,7 @@ goog.require('org.apache.flex.html.List'); */ org.apache.flex.charts.core.ChartBase = function() { - goog.base(this); + org.apache.flex.charts.core.ChartBase.base(this); this.className = 'ChartBase'; }; goog.inherits( @@ -58,6 +58,7 @@ org.apache.flex.charts.core.ChartBase.prototype.createElement = function() { org.apache.flex.charts.core.ChartBase.base(this, 'createElement'); this.element.style.border = 'none'; this.element.style.overflow = 'visible'; + return this.element; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js index 20fecfd..1df1db2 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js @@ -16,6 +16,8 @@ goog.provide('org.apache.flex.charts.supportClasses.ChartAxisGroup'); goog.require('org.apache.flex.charts.core.IAxisGroup'); goog.require('org.apache.flex.core.UIBase'); +goog.require('org.apache.flex.core.graphics.Path'); +goog.require('org.apache.flex.html.Label'); @@ -60,6 +62,88 @@ org.apache.flex.charts.supportClasses.ChartAxisGroup. /** + * @expose + * @param {string} text The label to display. + * @param {number} xpos The x position of the label. + * @param {number} ypos The y position of the label. + * @param {number} boxWidth The size of the area for the label. + * @param {number} boxHeight The size of the area for the label. + * @param {org.apache.flex.core.graphics.IStroke} tickFill The color of the path. + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.drawHorizontalTickLabel = +function(text, xpos, ypos, boxWidth, boxHeight, tickFill) { + var label = new org.apache.flex.html.Label(); + this.addElement(label); + label.set_text(text); + label.set_x(xpos - label.get_width() / 2); + label.set_y(ypos); +}; + + +/** + * @expose + * @param {string} text The label to display. + * @param {number} xpos The x position of the label. + * @param {number} ypos The y position of the label. + * @param {number} boxWidth The size of the area for the label. + * @param {number} boxHeight The size of the area for the label. + * @param {org.apache.flex.core.graphics.IStroke} tickFill The color of the path. + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.drawVerticalTickLabel = +function(text, xpos, ypos, boxWidth, boxHeight, tickFill) { + var label = new org.apache.flex.html.Label(); + this.addElement(label); + label.set_text(text); + label.set_x(xpos); + label.set_y(ypos - label.get_height() / 2); +}; + + +/** + * @expose + * @param {number} originX The x position of the path. + * @param {number} originY The y position of the path. + * @param {number} width The size of the area for the path. + * @param {number} height The size of the area for the path. + * @param {string} marks The path to draw. + * @param {org.apache.flex.core.graphics.IStroke} tickStroke The color of the path. + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.drawTickMarks = +function(originX, originY, width, height, marks, tickStroke) { + var tickPath = new org.apache.flex.core.graphics.Path(); + tickPath.set_x(0); + tickPath.set_y(0); + tickPath.set_width(this.get_width()); + tickPath.set_height(this.get_height()); + this.addElement(tickPath); + tickPath.set_stroke(tickStroke); + tickPath.drawPath(0, 0, marks); +}; + + +/** + * @expose + * @param {number} originX The x position of the path. + * @param {number} originY The y position of the path. + * @param {number} width The size of the area for the path. + * @param {number} height The size of the area for the path. + * @param {org.apache.flex.core.graphics.IStroke} lineStroke The color of the path. + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.drawAxisLine = +function(originX, originY, width, height, lineStroke) { + var axisPath = new org.apache.flex.core.graphics.Path(); + axisPath.set_x(0); + axisPath.set_y(0); + axisPath.set_width(this.get_width()); + axisPath.set_height(this.get_height()); + this.addElement(axisPath); + axisPath.set_stroke(lineStroke); + var pathLine = 'M ' + String(originX) + ' ' + String(originY) + ' l ' + String(width) + ' ' + String(height); + axisPath.drawPath(0, 0, pathLine); +}; + + +/** * @return {void} */ org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.removeAllElements = http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js index 5aecfa8..23d7cc8 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/UIBase.js @@ -19,6 +19,8 @@ goog.require('org.apache.flex.core.IBeadController'); goog.require('org.apache.flex.core.IBeadLayout'); goog.require('org.apache.flex.core.IBeadModel'); goog.require('org.apache.flex.core.IBeadView'); +goog.require('org.apache.flex.core.ILayoutChild'); +goog.require('org.apache.flex.core.IParentIUIBase'); goog.require('org.apache.flex.core.IUIBase'); goog.require('org.apache.flex.core.ValuesManager'); @@ -27,6 +29,8 @@ goog.require('org.apache.flex.core.ValuesManager'); /** * @constructor * @implements {org.apache.flex.core.IUIBase} + * @implements {org.apache.flex.core.ILayoutChild} + * @implements {org.apache.flex.core.IParentIUIBase} * @extends {org.apache.flex.core.HTMLElementWrapper} */ org.apache.flex.core.UIBase = function() { @@ -52,7 +56,9 @@ goog.inherits(org.apache.flex.core.UIBase, org.apache.flex.core.UIBase.prototype.FLEXJS_CLASS_INFO = { names: [{ name: 'UIBase', qName: 'org.apache.flex.core.UIBase' }], - interfaces: [org.apache.flex.core.IUIBase] }; + interfaces: [org.apache.flex.core.IUIBase, + org.apache.flex.core.IParentIUIBase, + org.apache.flex.core.ILayoutChild] }; /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js index d63fc9f..c009bba 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Circle.js @@ -89,6 +89,8 @@ org.apache.flex.core.graphics.Circle.prototype.drawCircle = function(x, y, radiu circle.setAttribute('rx', String(radius)); circle.setAttribute('ry', String(radius)); this.element.appendChild(circle); + + this.resize(x, y, circle.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js index d249a15..3063064 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Ellipse.js @@ -66,6 +66,8 @@ org.apache.flex.core.graphics.Ellipse.prototype.drawEllipse = function(x, y, wid ellipse.setAttribute('rx', String(width / 2)); ellipse.setAttribute('ry', String(height / 2)); this.element.appendChild(ellipse); + + this.resize(x, y, ellipse.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js index 6e0f9de..740cf90 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicShape.js @@ -123,10 +123,13 @@ org.apache.flex.core.graphics.GraphicShape.prototype.set_stroke = function(value */ org.apache.flex.core.graphics.GraphicShape.prototype.addedToParent = function() { this.draw(); + this.element.style.overflow = 'visible'; + /* + * not sure this is valuable any longer var bbox = this.element.getBBox(); if (bbox.width === 0 && !isNaN(this.get_width())) bbox.width = this.get_width(); if (bbox.height === 0 && !isNaN(this.get_height())) bbox.height = this.get_height(); - this.resize(this.get_x(), this.get_y(), bbox); + this.resize(this.get_x(), this.get_y(), bbox);*/ }; @@ -175,10 +178,14 @@ org.apache.flex.core.graphics.GraphicShape.prototype.getStyleStr = function() { * @param {Object} bbox The bounding box of the svg element. */ org.apache.flex.core.graphics.GraphicShape.prototype.resize = function(x, y, bbox) { - this.element.setAttribute('width', String(bbox.width + bbox.x + this.xOffset_) + 'px'); - this.element.setAttribute('height', String(bbox.height + bbox.y + this.yOffset_) + 'px'); - this.element.setAttribute('style', 'overflow:visible; position:absolute; left:' + - String(x) + 'px; top:' + String(y) + 'px'); + var width = Math.max(this.get_width(), bbox.width); + var height = Math.max(this.get_height(), bbox.height); + + this.element.style.position = 'absolute'; + if (!isNaN(x)) this.element.style.top = String(x) + 'px'; + if (!isNaN(y)) this.element.style.left = String(y) + 'px'; + this.element.style.width = String(width) + 'px'; + this.element.style.height = String(height) + 'px'; }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js index c48012a..656568b 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/GraphicsContainer.js @@ -50,7 +50,11 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.get_numChildren = func /** * @expose */ -org.apache.flex.core.graphics.GraphicsContainer.prototype.removeChildren = function() { +org.apache.flex.core.graphics.GraphicsContainer.prototype.removeAllElements = function() { + var svg = this.element; + while (svg.lastChild) { + svg.removeChild(svg.lastChild); + } }; @@ -58,8 +62,9 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.removeChildren = funct * @override */ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_width = function(value) { - goog.base(this, 'set_width', value); + org.apache.flex.core.graphics.GraphicsContainer.base(this, 'set_width', value); this.element.setAttribute('width', String(value) + 'px'); + this.element.style.width = String(value) + 'px'; }; @@ -67,8 +72,31 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_width = function(v * @override */ org.apache.flex.core.graphics.GraphicsContainer.prototype.set_height = function(value) { - goog.base(this, 'set_height', value); + org.apache.flex.core.graphics.GraphicsContainer.base(this, 'set_height', value); this.element.setAttribute('height', String(value) + 'px'); + this.element.style.height = String(value) + 'px'; +}; + + +/** + * @override + */ +org.apache.flex.core.graphics.GraphicsContainer.prototype.set_x = function(value) { + org.apache.flex.core.graphics.GraphicsContainer.base(this, 'set_x', value); + this.element.setAttribute('x', String(value) + 'px'); + this.element.style.position = 'absolute'; + this.element.style.left = String(value) + 'px'; +}; + + +/** + * @override + */ +org.apache.flex.core.graphics.GraphicsContainer.prototype.set_y = function(value) { + org.apache.flex.core.graphics.GraphicsContainer.base(this, 'set_y', value); + this.element.setAttribute('y', String(value) + 'px'); + this.element.style.position = 'absolute'; + this.element.style.top = String(value) + 'px'; }; @@ -157,9 +185,10 @@ org.apache.flex.core.graphics.GraphicsContainer.prototype.drawText = function(va var style = this.getStyleStr(); var text = document.createElementNS('http://www.w3.org/2000/svg', 'text'); text.setAttribute('style', style); - text.innerHTML = value; text.setAttribute('x', String(x) + 'px'); - text.setAttribute('y', String(y) + 'px'); + text.setAttribute('y', String(y + 15) + 'px'); + var textNode = document.createTextNode(value); + text.appendChild(textNode); this.element.appendChild(text); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Line.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Line.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Line.js index 0a76a95..6fe9d4c 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Line.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Line.js @@ -57,6 +57,8 @@ org.apache.flex.core.graphics.Line.prototype.drawLine = function(x1, y1, x2, y2) line.setAttribute('y2', y2); this.setPosition(x1, y2, this.get_stroke().get_weight(), this.get_stroke().get_weight()); this.element.appendChild(line); + + this.resize(x, y, line.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js index dfaf1cc..ae37a59 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Path.js @@ -76,6 +76,7 @@ org.apache.flex.core.graphics.Path.prototype.get_data = function() { * If the segment command is lower-case, the parameters are relative values. */ org.apache.flex.core.graphics.Path.prototype.drawPath = function(x, y, data) { + if (data == null || data.length === 0) return; var style = this.getStyleStr(); var path = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path.setAttribute('style', style); @@ -89,6 +90,8 @@ org.apache.flex.core.graphics.Path.prototype.drawPath = function(x, y, data) { { this.setPosition(x, y, 0, 0); } + + this.resize(x, y, path.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js index c1bce41..2a2caaf 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Rect.js @@ -66,6 +66,8 @@ org.apache.flex.core.graphics.Rect.prototype.drawRect = function(x, y, width, he rect.setAttribute('width', String(width) + 'px'); rect.setAttribute('height', String(height) + 'px'); this.element.appendChild(rect); + + this.resize(x, y, rect.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Text.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Text.js b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Text.js index 106b77b..18137e1 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Text.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/core/graphics/Text.js @@ -50,11 +50,14 @@ org.apache.flex.core.graphics.Text.prototype.drawText = function(value, x, y) { var style = this.getStyleStr(); var text = document.createElementNS('http://www.w3.org/2000/svg', 'text'); text.setAttribute('style', style); - text.innerHTML = value; text.setAttribute('x', String(x) + 'px'); text.setAttribute('y', String(y) + 'px'); this.setPosition(x, y, 0, 0); + var textNode = document.createTextNode(value); + text.appendChild(textNode); this.element.appendChild(text); + + this.resize(x, y, text.getBBox()); }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/95059a74/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ListView.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ListView.js b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ListView.js index e3329c5..af01e93 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ListView.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/html/beads/ListView.js @@ -67,6 +67,8 @@ org.apache.flex.html.beads.ListView.prototype.set_strand = this.model = this.strand_.get_model(); this.model.addEventListener('selectedIndexChanged', goog.bind(this.selectionChangeHandler, this)); + this.model.addEventListener('dataProviderChanged', + goog.bind(this.dataProviderChangeHandler, this)); if (this.dataGroup_ == null) { var m2 = org.apache.flex.core.ValuesManager.valuesImpl. @@ -129,6 +131,16 @@ org.apache.flex.html.beads.ListView.prototype. /** * @expose + * @param {Object} value The event that triggeed the selection. + */ +org.apache.flex.html.beads.ListView.prototype. + dataProviderChangeHandler = function(value) { + // override in subclass +}; + + +/** + * @expose * @return {Object} The view that contains the layout objects. */ org.apache.flex.html.beads.ListView.prototype.get_contentView = function() {
