You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2017/02/09 05:45:26 UTC
[34/50] [abbrv] git commit: [flex-asjs] [refs/heads/dual] - remove
wrapped components from HTML to make sure we are relying on Basic
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
deleted file mode 100644
index cd0729f..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Image.as
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.core.ImageBase;
-
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
- public class Image extends ImageBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Image()
- {
- super();
- }
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- override protected function createElement():WrappedHTMLElement
- {
- element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') as WrappedHTMLElement;
- element.flexjs_wrapper = this;
- element.setAttribute('x', 0);
- element.setAttribute('y', 0);
- //element.offsetParent = null;
- positioner = element;
- positioner.style.position = 'relative';
- addImageElement();
- return element;
- }
-
- COMPILE::JS
- protected var _image:WrappedHTMLElement;
-
- /**
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- COMPILE::JS
- protected function addImageElement():void
- {
- if (_image == null) {
- _image = document.createElementNS('http://www.w3.org/2000/svg', 'image') as WrappedHTMLElement;
- _image.setAttribute("width", "100%");
- _image.setAttribute("height", "100%");
- _image.flexjs_wrapper = this;
- element.appendChild(_image);
- }
- }
-
- COMPILE::JS
- override public function get imageElement():Element
- {
- return _image;
- }
-
- COMPILE::JS
- override public function get transformElement():WrappedHTMLElement
- {
- return _image;
- }
-
- COMPILE::JS
- override public function applyImageData(binaryDataAsString:String):void
- {
- (_image as SVGImageElement).setAttributeNS('http://www.w3.org/1999/xlink','href', binaryDataAsString);
- }
- COMPILE::JS
- override public function setWidth(value:Number, noEvent:Boolean=false):void
- {
- super.setWidth(value, noEvent);
- positioner.setAttribute("width", value);
- }
-
- COMPILE::JS
- override public function setHeight(value:Number, noEvent:Boolean=false):void
- {
- super.setHeight(value, noEvent);
- positioner.setAttribute("height", value);
- }
-
- COMPILE::JS
- override public function setX(value:Number):void
- {
- super.setX(value);
- positioner.setAttribute("x", value);
-
- }
- COMPILE::JS
- override public function setY(value:Number):void
- {
- super.setY(value);
- positioner.setAttribute("y", value);
-
- }
-
- COMPILE::JS
- override public function set x(value:Number):void
- {
- super.x = value;
- positioner.setAttribute("x", value);
- }
-
- COMPILE::JS
- override public function set y(value:Number):void
- {
- super.y = value;
- positioner.setAttribute("y", value);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
deleted file mode 100644
index 3369e47..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Path.as
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IPath;
- import org.apache.flex.graphics.PathBuilder;
-
- COMPILE::SWF
- {
- import flash.display.GraphicsPath;
- import flash.geom.Point;
- import flash.geom.Rectangle;
- import org.apache.flex.graphics.utils.PathHelper;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
-
- public class Path extends GraphicShape implements IPath
- {
-
- private var _data:String;
-
- public function get data():String
- {
- return _data;
- }
-
- public function set data(value:String):void
- {
- _data = value;
- _pathCommands = null;
- }
-
- private var _pathCommands:PathBuilder;
-
- public function get pathCommands():PathBuilder
- {
- return _pathCommands;
- }
-
- public function set pathCommands(value:PathBuilder):void
- {
- _pathCommands = value;
- _data = _pathCommands.getPathString();
- }
-
-
- COMPILE::JS
- private var _path:WrappedHTMLElement;
-
- /**
- * Draw the path.
- * @param data A PathBuilder object containing a vector of drawing commands.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawPathCommands(xp:Number,yp:Number,data:PathBuilder):void
- {
- drawStringPath(xp,yp,data.getPathString());
- }
-
- /**
- * Draw the path.
- * @param data A string containing a compact represention of the path segments.
- * The value is a space-delimited string describing each path segment. Each
- * segment entry has a single character which denotes the segment type and
- * two or more segment parameters.
- *
- * If the segment command is upper-case, the parameters are absolute values.
- * If the segment command is lower-case, the parameters are relative values.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawStringPath(xp:Number,yp:Number,data:String):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- var bounds:Rectangle = PathHelper.getBounds(data);
- this.width = bounds.width;
- this.height = bounds.height;
- beginFill(bounds,new Point(bounds.left + xp, bounds.top + yp) );
- var graphicsPath:GraphicsPath = PathHelper.getSegments(data,xp,yp);
- $sprite.graphics.drawPath(graphicsPath.commands, graphicsPath.data);
- endFill();
- }
- COMPILE::JS
- {
- if (data == null || data.length === 0) return;
- var style:String = getStyleStr();
- if (_path == null) {
- _path = document.createElementNS('http://www.w3.org/2000/svg', 'path') as WrappedHTMLElement;
- _path.flexjs_wrapper = this;
- element.appendChild(_path);
- }
- _path.setAttribute('style', style);
- _path.setAttribute('d', data);
-
- resize(x, y, _path['getBBox']());
-
- }
- }
-
- override protected function draw():void
- {
- drawStringPath(0, 0, data);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
deleted file mode 100644
index b1a57a3..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Rect.as
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IRect;
-
- COMPILE::SWF
- {
- import flash.geom.Point;
- import flash.geom.Rectangle;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- public class Rect extends GraphicShape implements IRect
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function Rect(x:Number=0, y:Number=0, width:Number=0, height:Number=0,rx:Number=NaN,ry:Number=NaN)
- {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
- this.rx = rx;
- this.ry = ry;
- }
-
- COMPILE::JS
- private var _rect:WrappedHTMLElement;
-
- private var _rx:Number;
-
- /**
- * The x axis radius for rounded corners
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- */
- public function get rx():Number
- {
- return _rx;
- }
-
- public function set rx(value:Number):void
- {
- _rx = value;
- }
-
- private var _ry:Number;
-
- /**
- * The y axis radius for rounded corners
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.7
- *
- */
- public function get ry():Number
- {
- return _ry;
- }
-
- public function set ry(value:Number):void
- {
- _ry = value;
- }
-
- /**
- * Draw the rectangle.
- * @param xp The x position of the top-left corner of the rectangle.
- * @param yp The y position of the top-left corner.
- * @param width The width of the rectangle.
- * @param height The height of the rectangle.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- */
- public function drawRect(xp:Number, yp:Number, width:Number, height:Number):void
- {
- COMPILE::SWF
- {
- $sprite.graphics.clear();
- applyStroke();
- beginFill(new Rectangle(xp, yp, width, height), new Point(xp,yp));
- if(isNaN(rx))
- $sprite.graphics.drawRect(0, 0, width, height);
- else
- {
- var dx:Number = rx*2;
- var dy:Number = isNaN(ry) ? ry : ry*2;
- $sprite.graphics.drawRoundRect(0, 0, width, height,dx ,dy);
- }
- endFill();
- }
- COMPILE::JS
- {
- var style:String = this.getStyleStr();
-
- if (_rect == null) {
- _rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect') as WrappedHTMLElement;
- _rect.flexjs_wrapper = this;
- element.appendChild(_rect);
- }
- _rect.setAttribute('style', style);
- if (stroke)
- {
- _rect.setAttribute('x', stroke.weight / 2);
- _rect.setAttribute('y', stroke.weight / 2);
- }
- else
- {
- _rect.setAttribute('x', 0);
- _rect.setAttribute('y', 0);
- }
- _rect.setAttribute('width', width);
- _rect.setAttribute('height', height);
-
- resize(x, y, _rect['getBBox']());
- }
- }
-
- COMPILE::JS
- override public function get transformElement():WrappedHTMLElement
- {
- return _rect;
- }
-
- override protected function draw():void
- {
- drawRect(0,0,width,height);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
deleted file mode 100644
index 51b8135..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/Text.as
+++ /dev/null
@@ -1,150 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg
-{
- import org.apache.flex.graphics.IText;
- import org.apache.flex.graphics.SolidColor;
-
- COMPILE::SWF
- {
- import flash.text.TextFieldType;
- import org.apache.flex.core.CSSTextField;
- }
- COMPILE::JS
- {
- import org.apache.flex.core.WrappedHTMLElement;
- }
-
- /**
- * Draws a string of characters at a specific location using the stroke
- * value of color and alpha.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * // TODO (aharui) ignore imports of external linkage interfaces?
- * @flexjsignoreimport SVGLocatable
- */
- public class Text extends GraphicShape implements IText
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function Text()
- {
- super();
-
- COMPILE::SWF
- {
- _textField = new CSSTextField();
- $sprite.addChild(_textField);
- }
- }
-
-
- COMPILE::SWF
- private var _textField:CSSTextField;
-
- COMPILE::JS
- private var _text:WrappedHTMLElement;
-
- /**
- * @copy org.apache.flex.core.ITextModel#textField
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- COMPILE::SWF
- public function get textField() : CSSTextField
- {
- return _textField;
- }
-
- /**
- * Draws text at the given point.
- * @param value The string to draw.
- * @param xt The x position of the top-left corner of the rectangle.
- * @param yt The y position of the top-left corner.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
- * @flexjsignorecoercion Text
- * @flexjsignorecoercion Node
- * @flexjsignorecoercion SVGLocatable
- */
- public function drawText(value:String, xt:Number, yt:Number):void
- {
- COMPILE::SWF
- {
- textField.selectable = false;
- textField.type = TextFieldType.DYNAMIC;
- textField.mouseEnabled = false;
- textField.autoSize = "left";
- textField.text = value;
-
- var color:SolidColor = fill as SolidColor;
- if (color) {
- textField.textColor = color.color;
- textField.alpha = color.alpha;
- }
-
- textField.x = xt;
- textField.y = yt;
- }
- COMPILE::JS
- {
- var style:String = this.getStyleStr();
- if (_text == null) {
- _text = document.createElementNS('http://www.w3.org/2000/svg', 'text') as WrappedHTMLElement;
- _text.flexjs_wrapper = this;
- element.appendChild(_text);
- }
- else {
- _text.removeChild(_text.childNodes[0]);
- }
- _text.setAttribute('style', style);
- _text.setAttribute('x', xt);
- _text.setAttribute('y', yt);
- var textNode:Text = document.createTextNode(value) as Text;
- _text.appendChild(textNode as Node);
-
- resize(x, y, (_text as SVGLocatable).getBBox());
-
- }
- }
-
- COMPILE::JS
- override protected function draw():void
- {
-
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/TextButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/TextButton.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/TextButton.as
deleted file mode 100644
index 83a2821..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/TextButton.as
+++ /dev/null
@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg
-{
- import org.apache.flex.html.TextButton;
-
- public class TextButton extends org.apache.flex.html.TextButton
- {
- public function TextButton()
- {
- super();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d89659f5/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
deleted file mode 100644
index 8cbd789..0000000
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/svg/beads/ImageView.as
+++ /dev/null
@@ -1,87 +0,0 @@
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// Licensed to the Apache Software Foundation (ASF) under one or more
-// contributor license agreements. See the NOTICE file distributed with
-// this work for additional information regarding copyright ownership.
-// The ASF licenses this file to You under the Apache License, Version 2.0
-// (the "License"); you may not use this file except in compliance with
-// the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-////////////////////////////////////////////////////////////////////////////////
-package org.apache.flex.svg.beads
-{
- import org.apache.flex.core.ImageViewBase;
- COMPILE::JS
- {
- import org.apache.flex.core.UIBase;
- import org.apache.flex.core.ValuesManager;
- }
-
- /**
- * The ImageView class creates the visual elements of the org.apache.flex.svg.Image component.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public class ImageView extends ImageViewBase
- {
- /**
- * constructor.
- *
- * @langversion 3.0
- * @playerversion Flash 10.2
- * @playerversion AIR 2.6
- * @productversion FlexJS 0.0
- */
- public function ImageView()
- {
- }
-
- COMPILE::JS
- override protected function sizeChangedHandler(event:Object):void
- {
- super.sizeChangedHandler(event);
- var host:UIBase = _strand as UIBase;
-
- var left:* = ValuesManager.valuesImpl.getValue(host, "left");
- var right:* = ValuesManager.valuesImpl.getValue(host, "right");
- var l:Number = isNaN(left) ? NaN : left;
- var r:Number = isNaN(right) ? NaN : right;
-
- var top:* = ValuesManager.valuesImpl.getValue(host, "top");
- var bottom:* = ValuesManager.valuesImpl.getValue(host, "bottom");
- var t:Number = isNaN(top) ? NaN : top;
- var b:Number = isNaN(bottom) ? NaN : bottom;
-
- var p:Object = host.positioner;
-
- if (!isNaN(l) &&
- !isNaN(r)) {
- // if just using size constraints and image will not shrink or grow
- var computedWidth:Number = (host.positioner.offsetParent as HTMLElement).offsetWidth -
- l - r;
- p.setAttribute("width", computedWidth);
-
- }
- if (!isNaN(t) &&
- !isNaN(b)) {
- // if just using size constraints and image will not shrink or grow
- var computedHeight:Number = (host.positioner.offsetParent as HTMLElement).offsetHeight -
- t - b;
- p.setAttribute("height", computedHeight);
- }
- }
-
- }
-}