new folders for CreateJS
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/f992c05d Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/f992c05d Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/f992c05d Branch: refs/heads/mavenfolders Commit: f992c05d79828063cbf1efb2b2d75f63284bbb0a Parents: 86bd389 Author: Alex Harui <aha...@apache.org> Authored: Tue Feb 2 16:33:37 2016 -0800 Committer: Alex Harui <aha...@apache.org> Committed: Tue Feb 2 16:33:37 2016 -0800 ---------------------------------------------------------------------- frameworks/projects/CreateJS/as/defaults.css | 36 -- .../projects/CreateJS/as/src/CreateJSClasses.as | 33 -- .../src/org/apache/flex/createjs/Application.as | 120 ----- .../as/src/org/apache/flex/createjs/CheckBox.as | 124 ----- .../as/src/org/apache/flex/createjs/Label.as | 81 ---- .../src/org/apache/flex/createjs/TextButton.as | 118 ----- .../src/org/apache/flex/createjs/core/UIBase.as | 449 ------------------- .../org/apache/flex/createjs/core/ViewBase.as | 206 --------- .../projects/CreateJS/compile-asjs-config.xml | 83 ---- frameworks/projects/CreateJS/compile-config.xml | 83 ---- .../projects/CreateJS/createjs-manifest.xml | 31 -- frameworks/projects/CreateJS/src/defaults.css | 36 ++ .../CreateJS/src/main/flex/CreateJSClasses.as | 33 ++ .../org/apache/flex/createjs/Application.as | 120 +++++ .../flex/org/apache/flex/createjs/CheckBox.as | 124 +++++ .../main/flex/org/apache/flex/createjs/Label.as | 81 ++++ .../flex/org/apache/flex/createjs/TextButton.as | 118 +++++ .../org/apache/flex/createjs/core/UIBase.as | 449 +++++++++++++++++++ .../org/apache/flex/createjs/core/ViewBase.as | 206 +++++++++ .../src/main/resources/compile-asjs-config.xml | 83 ++++ .../src/main/resources/compile-config.xml | 83 ++++ .../src/main/resources/createjs-manifest.xml | 31 ++ 22 files changed, 1364 insertions(+), 1364 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/defaults.css b/frameworks/projects/CreateJS/as/defaults.css deleted file mode 100644 index 55fa336..0000000 --- a/frameworks/projects/CreateJS/as/defaults.css +++ /dev/null @@ -1,36 +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. - * - */ - -@namespace createjs "library://ns.apache.org/flexjs/createjs"; - -@media -flex-flash -{ - -createjs|TextButton -{ - IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel"); - IBeadView: ClassReference("org.apache.flex.html.beads.TextButtonView"); -} - -createjs|CheckBox -{ - IBeadView: ClassReference("org.apache.flex.html.beads.CheckBoxView"); -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/CreateJSClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/CreateJSClasses.as b/frameworks/projects/CreateJS/as/src/CreateJSClasses.as deleted file mode 100644 index eeafa52..0000000 --- a/frameworks/projects/CreateJS/as/src/CreateJSClasses.as +++ /dev/null @@ -1,33 +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 -{ - -/** - * @private - * This class is used to link additional classes into rpc.swc - * beyond those that are found by dependecy analysis starting - * from the classes specified in manifest.xml. - */ -internal class CreateJSClasses -{ -} - -} - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as deleted file mode 100644 index 06ae1fb..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Application.as +++ /dev/null @@ -1,120 +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.createjs -{ - import org.apache.flex.core.ApplicationBase; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IFlexInfo; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IUIBase; - import org.apache.flex.core.IValuesImpl; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.createjs.core.ViewBase; - import org.apache.flex.events.Event; - import org.apache.flex.utils.MXMLDataInterpreter; - - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - import createjs.DisplayObject; - import createjs.Stage; - } - - //-------------------------------------- - // Events - //-------------------------------------- - - /** - * Dispatched at startup. - */ - [Event(name="initialize", type="org.apache.flex.events.Event")] - - /** - * CreateJS Application - */ - public class Application extends org.apache.flex.core.Application implements IStrand, IFlexInfo - { - /** - * FalconJX will inject html into the index.html file. Surround with - * "inject_html" tag as follows: - * - * <inject_html> - * <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script> - * </inject_html> - */ - public function Application() - { - super(); - } - - COMPILE::JS - private var stage:Stage; - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion HTMLBodyElement - * @flexjsignorecoercion HTMLCanvasElement - */ - COMPILE::JS - override public function start():void - { - var body:HTMLBodyElement; - var canvas:HTMLCanvasElement; - - // For createjs, the application is the same as the canvas - // and it provides convenient access to the stage. - - element = document.createElement('canvas') as WrappedHTMLElement; - element.flexjs_wrapper = this; - canvas = element as HTMLCanvasElement; - canvas.id = 'flexjsCanvas'; - canvas.width = 700; - canvas.height = 500; - - body = document.getElementsByTagName('body')[0] as HTMLBodyElement; - body.appendChild(this.element); - - stage = new createjs.Stage('flexjsCanvas'); - - /* AJH is this needed - MXMLDataInterpreter.generateMXMLProperties(this, - MXMLProperties); - */ - - dispatchEvent('initialize'); - - initialView.applicationModel = this.model; - addElement(initialView); - - dispatchEvent('viewChanged'); - - stage.update(); - } - - /** - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - override public function addElement(c:Object, dispatchEvent:Boolean = true):void - { - stage.addChild(c.element as DisplayObject); - c.addedToParent(); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as deleted file mode 100644 index 3ce2d50..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/CheckBox.as +++ /dev/null @@ -1,124 +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.createjs -{ - COMPILE::AS3 - { - import org.apache.flex.html.CheckBox; - } - COMPILE::JS - { - import createjs.Container; - import createjs.Shape; - import createjs.Stage; - import createjs.Text; - - import org.apache.flex.createjs.core.UIBase; - import org.apache.flex.core.WrappedHTMLElement; - import org.apache.flex.events.Event; - } - - COMPILE::AS3 - public class CheckBox extends org.apache.flex.html.CheckBox - { - } - - COMPILE::JS - public class CheckBox extends UIBase - { - private var checkMark:Shape; - private var checkMarkBackground:Shape; - private var checkBoxLabel:Text; - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - override public function createElement():WrappedHTMLElement - { - checkMarkBackground = new createjs.Shape(null); - checkMarkBackground.name = 'checkmarkbackground'; - checkMarkBackground.graphics.beginFill('red'). - drawRoundRect(0, 0, 40, 40, 8); - - checkMark = new createjs.Shape(null); - checkMark.name = 'checkmark'; - checkMark.graphics.beginFill('white').drawRoundRect(0, 0, 32, 32, 6); - checkMark.x = 4; - checkMark.y = 4; - checkMark.visible = false; - - checkBoxLabel = new createjs.Text('checkbox', '20px Arial', '#ff7700'); - checkBoxLabel.name = 'label'; - checkBoxLabel.textAlign = 'left'; - checkBoxLabel.textBaseline = 'middle'; - checkBoxLabel.x = 45; - checkBoxLabel.y = 40 / 2; - - var container:createjs.Container = new createjs.Container(); - element = container as WrappedHTMLElement; - container.name = 'checkbox'; - container.addChild(this.checkMarkBackground); - container.addChild(this.checkBoxLabel); - container.addChild(this.checkMark); - container.onClick = clickHandler; - - this.positioner = this.element; - - return this.element; - } - - public function get text():String - { - return checkBoxLabel.text; - } - - public function set text(value:String):void - { - checkBoxLabel.text = value; - } - - public function get selected():Boolean - { - return checkMark.visible; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - public function set selected(value:Boolean):void - { - checkMark.visible = value; - var stage:Stage = (element as Container).getStage(); - if (stage) - stage.update(); - } - - - /** - * @param event The event. - */ - private function clickHandler(event:Event):void - { - selected = !selected; - } - - - } - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as deleted file mode 100644 index 3540599..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/Label.as +++ /dev/null @@ -1,81 +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.createjs -{ - COMPILE::AS3 - { - import org.apache.flex.html.Label; - } - - COMPILE::JS - { - import createjs.Text; - import createjs.Stage; - - import org.apache.flex.createjs.core.UIBase; - import org.apache.flex.core.WrappedHTMLElement; - } - - COMPILE::AS3 - public class Label extends org.apache.flex.html.Label - { - - } - - COMPILE::JS - public class Label extends UIBase - { - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - override public function createElement():WrappedHTMLElement - { - var text:Text = new Text('default text', '20px Arial', '#ff7700'); - text.x = 0; - text.y = 20; - text.textBaseline = 'alphabetic'; - - positioner = element = text as WrappedHTMLElement; - return element; - } - - - /** - * @flexjsignorecoercion createjs.Text - */ - public function get text():String - { - return (element as Text).text; - } - - /** - * @flexjsignorecoercion createjs.Text - */ - public function set text(value:String):void - { - var text:Text = element as Text; - text.text = value; - var stage:Stage = text.getStage(); - if (stage) - stage.update(); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as deleted file mode 100644 index f7a31f9..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/TextButton.as +++ /dev/null @@ -1,118 +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.createjs -{ - COMPILE::AS3 - { - import org.apache.flex.core.ITextModel; - import org.apache.flex.html.Button; - } - COMPILE::JS - { - import createjs.Container; - import createjs.Text; - import createjs.Shape; - import createjs.Stage; - - import org.apache.flex.createjs.core.UIBase; - import org.apache.flex.core.WrappedHTMLElement; - } - - COMPILE::AS3 - public class TextButton extends Button - { - public function TextButton() - { - super(); - } - - public function get text():String - { - return ITextModel(model).text; - } - public function set text(value:String):void - { - ITextModel(model).text = value; - } - - public function get html():String - { - return ITextModel(model).html; - } - public function set html(value:String):void - { - ITextModel(model).html = value; - } - - } - - COMPILE::JS - public class TextButton extends UIBase - { - private var buttonBackground:Shape; - private var buttonLabel:Text; - private var button:Container; - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - override public function createElement():WrappedHTMLElement - { - buttonBackground = new createjs.Shape(null); - buttonBackground.name = 'background'; - buttonBackground.graphics.beginFill('red'). - drawRoundRect(0, 0, 200, 60, 10); - - buttonLabel = new createjs.Text('button', 'bold 24px Arial', - '#FFFFFF'); - buttonLabel.name = 'label'; - buttonLabel.textAlign = 'center'; - buttonLabel.textBaseline = 'middle'; - buttonLabel.x = 200 / 2; - buttonLabel.y = 60 / 2; - - button = new createjs.Container(); - button.name = 'button'; - button.x = 50; - button.y = 25; - button.addChild(buttonBackground); - button.addChild(buttonLabel); - - positioner = element = button as WrappedHTMLElement; - element.flexjs_wrapper = this; - return element; - } - - - /** - * @flexjsignorecoercion createjs.Text - */ - public function get text():String - { - return buttonLabel.text; - } - - /** - * @flexjsignorecoercion createjs.Text - */ - public function set text(value:String):void - { - buttonLabel.text = value; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as deleted file mode 100644 index 10f18ab..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/UIBase.as +++ /dev/null @@ -1,449 +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.createjs.core -{ - import org.apache.flex.core.HTMLElementWrapper; - import org.apache.flex.core.IStrand; - import org.apache.flex.core.IBeadModel; - import org.apache.flex.core.IBead; - import org.apache.flex.core.IFlexJSElement; - import org.apache.flex.core.IUIBase; - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - - COMPILE::JS - { - import createjs.Container; - import createjs.DisplayObject; - import createjs.Stage; - import org.apache.flex.core.WrappedHTMLElement; - } - - public class UIBase extends HTMLElementWrapper implements IStrand, IEventDispatcher, IUIBase, IFlexJSElement - { - public function UIBase() - { - super(); - COMPILE::JS - { - createElement(); - } - } - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function addElement(c:Object, dispatchEvent:Boolean = true):void - { - (element as Container).addChild(c.element as DisplayObject); - } - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void - { - (element as Container).addChildAt(c.element as DisplayObject, index); - } - - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function getElementIndex(c:Object):int - { - return (element as Container).getChildIndex(c.element as DisplayObject); - } - - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function removeElement(c:Object, dispatchEvent:Boolean = true):void - { - (element as Container).removeChild(c.element as DisplayObject); - } - - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function getElementAt(index:int):Object - { - return (element as Container).getChildAt(index); - } - - - /** - * @flexjsignorecoercion createjs.Container - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function get numElements():int - { - return (element as Container).numChildren; - } - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - COMPILE::JS - public function createElement():WrappedHTMLElement - { - element = new Container() as WrappedHTMLElement; - - positioner = this.element; - return element; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function get x():Number - { - return (positioner as Container).x; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function set x(value:Number):void - { - var container:Container = positioner as Container; - container.x = value; - var stage:Stage = container.getStage(); - if (stage) - stage.update(); - } - - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function get y():Number - { - return (positioner as Container).y; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function set y(value:Number):void - { - var container:Container = positioner as Container; - container.y = value; - var stage:Stage = container.getStage(); - if (stage) - stage.update(); - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function get width():Number - { - return (positioner as Container).width; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function set width(value:Number):void - { - var container:Container = positioner as Container; - container.width = value; - var stage:Stage = container.getStage(); - if (stage) - stage.update(); - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function get height():Number - { - return (positioner as Container).height; - } - - /** - * @flexjsignorecoercion createjs.Container - */ - COMPILE::JS - public function set height(value:Number):void - { - var container:Container = positioner as Container; - container.height = value; - var stage:Stage = container.getStage(); - if (stage) - stage.update(); - } - - COMPILE::AS3 - private var _width:Number = 0; - COMPILE::AS3 - override public function get width():Number - { - return _width; - } - - COMPILE::AS3 - override public function set width(value:Number):void - { - if (_width != value) - { - _width = value; - dispatchEvent(new Event("widthChanged")); - } - } - COMPILE::AS3 - protected function get $width():Number - { - return super.width; - } - - COMPILE::AS3 - private var _height:Number = 0; - COMPILE::AS3 - override public function get height():Number - { - return _height; - } - COMPILE::AS3 - override public function set height(value:Number):void - { - if (_height != value) - { - _height = value; - dispatchEvent(new Event("heightChanged")); - } - } - COMPILE::AS3 - protected function get $height():Number - { - return super.height; - } - - COMPILE::AS3 - private var _model:IBeadModel; - COMPILE::AS3 - public function get model():IBeadModel - { - return _model; - } - COMPILE::AS3 - public function set model(value:IBeadModel):void - { - if (_model != value) - { - addBead(value as IBead); - dispatchEvent(new Event("modelChanged")); - } - } - - private var _id:String; - public function get id():String - { - return _id; - } - public function set id(value:String):void - { - if (_id != value) - { - _id = value; - dispatchEvent(new Event("idChanged")); - } - } - - // beads declared in MXML are added to the strand. - // from AS, just call addBead() - COMPILE::AS3 - public var beads:Array; - - COMPILE::AS3 - private var _beads:Vector.<IBead>; - COMPILE::AS3 - override public function addBead(bead:IBead):void - { - if (!_beads) - _beads = new Vector.<IBead>; - _beads.push(bead); - if (bead is IBeadModel) - _model = bead as IBeadModel; - bead.strand = this; - } - - COMPILE::AS3 - public function getBeadByType(classOrInterface:Class):IBead - { - for each (var bead:IBead in _beads) - { - if (bead is classOrInterface) - return bead; - } - return null; - } - - COMPILE::AS3 - public function removeBead(value:IBead):IBead - { - var n:int = _beads.length; - for (var i:int = 0; i < n; i++) - { - var bead:IBead = _beads[i]; - if (bead == value) - { - _beads.splice(i, 1); - return bead; - } - } - return null; - } - - /** - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function get visible():Boolean - { - return (positioner as DisplayObject).visible; - } - - /** - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function set visible(value:Boolean):void - { - var oldValue:Boolean = (positioner as DisplayObject).visible; - if (value !== oldValue) - { - if (!value) - { - (positioner as DisplayObject).visible = value; - dispatchEvent(new Event('hide')); - } - else - { - (positioner as DisplayObject).visible = value; - dispatchEvent(new Event('show')); - } - dispatchEvent(new Event('visibleChanged')); - } - } - - /** - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function get alpha():Number - { - return (positioner as DisplayObject).alpha; - } - - /** - * @flexjsignorecoercion createjs.DisplayObject - */ - COMPILE::JS - public function set alpha(value:Number):void - { - (positioner as DisplayObject).alpha = value; - } - - COMPILE::JS - private var _positioner:WrappedHTMLElement; - - /** - * The HTMLElement used to position the component. - */ - COMPILE::JS - public function get positioner():WrappedHTMLElement - { - return _positioner; - } - - /** - * @private - */ - COMPILE::JS - public function set positioner(value:WrappedHTMLElement):void - { - _positioner = value; - } - - /** - * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher - */ - public function get topMostEventDispatcher():IEventDispatcher - { - COMPILE::AS3 - { - return null; - } - COMPILE::JS - { - var e:WrappedHTMLElement = document.body as WrappedHTMLElement; - return e.flexjs_wrapper as IEventDispatcher; - } - } - - public function addedToParent():void - { - - } - - /** - * @copy org.apache.flex.core.IUIBase#element - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::AS3 - public function get element():IFlexJSElement - { - return this; - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as deleted file mode 100644 index 9fb19e8..0000000 --- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as +++ /dev/null @@ -1,206 +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.createjs.core -{ - COMPILE::AS3 - { - import flash.display.DisplayObject; - import org.apache.flex.core.ViewBase; - } - - import org.apache.flex.core.IApplicationView; - import org.apache.flex.core.IParent; - import org.apache.flex.core.IUIBase; - import org.apache.flex.events.Event; - import org.apache.flex.utils.MXMLDataInterpreter; - - COMPILE::JS - { - import org.apache.flex.core.IBead; - import org.apache.flex.core.IStatesImpl; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.states.State; - } - - COMPILE::AS3 - public class ViewBase extends org.apache.flex.core.ViewBase - { - - } - - [DefaultProperty("mxmlContent")] - COMPILE::JS - public class ViewBase extends UIBase implements IParent, IApplicationView - { - public function ViewBase() - { - super(); - } - - override public function addedToParent():void - { - /* AJH needed? - MXMLDataInterpreter.generateMXMLProperties(this, MXMLProperties); - */ - MXMLDataInterpreter.generateMXMLInstances(this, this, MXMLDescriptor); - } - - public function get MXMLDescriptor():Array - { - return null; - } - - /* - public function get MXMLProperties():Array - { - return null; - } - */ - - public var mxmlContent:Array; - - private var _applicationModel:Object; - - [Bindable("modelChanged")] - public function get applicationModel():Object - { - return _applicationModel; - } - - public function set applicationModel(value:Object):void - { - _applicationModel = value; - dispatchEvent(new Event("modelChanged")); - } - - private var _states:Array; - - /** - * The array of view states. These should - * be instances of org.apache.flex.states.State. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get states():Array - { - return _states; - } - - /** - * @private - * @flexjsignorecoercion Class - * @flexjsignorecoercion org.apache.flex.core.IBead - */ - public function set states(value:Array):void - { - _states = value; - _currentState = _states[0].name; - - try{ - if (getBeadByType(IStatesImpl) == null) - { - var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class; - var b:Object = new c(); - addBead(b as IBead); - } - } - //TODO: Need to handle this case more gracefully - catch(e:Error) - { - } - - } - - /** - * <code>true</code> if the array of states - * contains a state with this name. - * - * @param state The state namem. - * @return True if state in state array - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function hasState(state:String):Boolean - { - for each (var s:State in _states) - { - if (s.name == state) - return true; - } - return false; - } - - private var _currentState:String; - - [Bindable("currentStateChange")] - /** - * The name of the current state. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get currentState():String - { - return _currentState; - } - - /** - * @private - */ - public function set currentState(value:String):void - { - var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value) - _currentState = value; - dispatchEvent(event); - } - - private var _transitions:Array; - - /** - * The array of transitions. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get transitions():Array - { - return _transitions; - } - - /** - * @private - */ - public function set transitions(value:Array):void - { - _transitions = value; - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/compile-asjs-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/compile-asjs-config.xml b/frameworks/projects/CreateJS/compile-asjs-config.xml deleted file mode 100644 index 35c65b3..0000000 --- a/frameworks/projects/CreateJS/compile-asjs-config.xml +++ /dev/null @@ -1,83 +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. - ---> -<flex-config> - - <compiler> - <accessible>false</accessible> - - <external-library-path> - </external-library-path> - - <mxml> - <children-as-data>true</children-as-data> - </mxml> - <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> - <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> - <binding-value-change-event-type>valueChange</binding-value-change-event-type> - - <keep-as3-metadata> - <name>Bindable</name> - <name>Managed</name> - <name>ChangeEvent</name> - <name>NonCommittingChangeEvent</name> - <name>Transient</name> - </keep-as3-metadata> - - <locale/> - - <library-path> - </library-path> - - <namespaces> - <namespace> - <uri>library://ns.apache.org/flexjs/createjs</uri> - <manifest>createjs-manifest.xml</manifest> - </namespace> - </namespaces> - - <source-path> - <path-element>as/src</path-element> - </source-path> - - <library-path> - <path-element>../../externs/Core.swc</path-element> - <path-element>../../externs/HTML.swc</path-element> - </library-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-file> - </include-file> - - <include-sources> - </include-sources> - - <include-classes> - <class>CreateJSClasses</class> - </include-classes> - - <include-namespaces> - <uri>library://ns.apache.org/flexjs/createjs</uri> - </include-namespaces> - - <!--<target-player>${playerglobal.version}</target-player>--> - - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/compile-config.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/compile-config.xml b/frameworks/projects/CreateJS/compile-config.xml deleted file mode 100644 index 3aecfb2..0000000 --- a/frameworks/projects/CreateJS/compile-config.xml +++ /dev/null @@ -1,83 +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. - ---> -<flex-config> - - <compiler> - <accessible>false</accessible> - - <external-library-path> - <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element> - <path-element>../../libs/Core.swc</path-element> - <path-element>../../libs/HTML.swc</path-element> - </external-library-path> - - <mxml> - <children-as-data>true</children-as-data> - </mxml> - <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event> - <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind> - <binding-value-change-event-type>valueChange</binding-value-change-event-type> - - <keep-as3-metadata> - <name>Bindable</name> - <name>Managed</name> - <name>ChangeEvent</name> - <name>NonCommittingChangeEvent</name> - <name>Transient</name> - </keep-as3-metadata> - - <locale/> - - <library-path/> - - <namespaces> - <namespace> - <uri>library://ns.apache.org/flexjs/createjs</uri> - <manifest>createjs-manifest.xml</manifest> - </namespace> - </namespaces> - - <source-path> - <path-element>as/src</path-element> - </source-path> - - <warn-no-constructor>false</warn-no-constructor> - </compiler> - - <include-file> - <name>defaults.css</name> - <path>as/defaults.css</path> - </include-file> - <include-file> - <name>js/out/*</name> - <path>js/out/*</path> - </include-file> - - <include-classes> - <class>CreateJSClasses</class> - </include-classes> - - <include-namespaces> - <uri>library://ns.apache.org/flexjs/createjs</uri> - </include-namespaces> - - <target-player>${playerglobal.version}</target-player> - - -</flex-config> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/createjs-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/createjs-manifest.xml b/frameworks/projects/CreateJS/createjs-manifest.xml deleted file mode 100644 index 1c5a5ed..0000000 --- a/frameworks/projects/CreateJS/createjs-manifest.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.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. - ---> - - -<componentPackage> - - <component id="Application" class="org.apache.flex.createjs.Application"/> - <component id="UIBase" class="org.apache.flex.createjs.core.UIBase"/> - <component id="ViewBase" class="org.apache.flex.createjs.core.ViewBase"/> - <component id="Label" class="org.apache.flex.createjs.Label"/> - <component id="TextButton" class="org.apache.flex.createjs.TextButton"/> - <component id="CheckBox" class="org.apache.flex.createjs.CheckBox"/> - -</componentPackage> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/defaults.css b/frameworks/projects/CreateJS/src/defaults.css new file mode 100644 index 0000000..55fa336 --- /dev/null +++ b/frameworks/projects/CreateJS/src/defaults.css @@ -0,0 +1,36 @@ +/* + * + * 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. + * + */ + +@namespace createjs "library://ns.apache.org/flexjs/createjs"; + +@media -flex-flash +{ + +createjs|TextButton +{ + IBeadModel: ClassReference("org.apache.flex.html.beads.models.TextModel"); + IBeadView: ClassReference("org.apache.flex.html.beads.TextButtonView"); +} + +createjs|CheckBox +{ + IBeadView: ClassReference("org.apache.flex.html.beads.CheckBoxView"); +} + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as b/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as new file mode 100644 index 0000000..eeafa52 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as @@ -0,0 +1,33 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + +/** + * @private + * This class is used to link additional classes into rpc.swc + * beyond those that are found by dependecy analysis starting + * from the classes specified in manifest.xml. + */ +internal class CreateJSClasses +{ +} + +} + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as new file mode 100644 index 0000000..06ae1fb --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as @@ -0,0 +1,120 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.createjs +{ + import org.apache.flex.core.ApplicationBase; + import org.apache.flex.core.IBead; + import org.apache.flex.core.IFlexInfo; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IUIBase; + import org.apache.flex.core.IValuesImpl; + import org.apache.flex.core.ValuesManager; + import org.apache.flex.createjs.core.ViewBase; + import org.apache.flex.events.Event; + import org.apache.flex.utils.MXMLDataInterpreter; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + import createjs.DisplayObject; + import createjs.Stage; + } + + //-------------------------------------- + // Events + //-------------------------------------- + + /** + * Dispatched at startup. + */ + [Event(name="initialize", type="org.apache.flex.events.Event")] + + /** + * CreateJS Application + */ + public class Application extends org.apache.flex.core.Application implements IStrand, IFlexInfo + { + /** + * FalconJX will inject html into the index.html file. Surround with + * "inject_html" tag as follows: + * + * <inject_html> + * <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script> + * </inject_html> + */ + public function Application() + { + super(); + } + + COMPILE::JS + private var stage:Stage; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLBodyElement + * @flexjsignorecoercion HTMLCanvasElement + */ + COMPILE::JS + override public function start():void + { + var body:HTMLBodyElement; + var canvas:HTMLCanvasElement; + + // For createjs, the application is the same as the canvas + // and it provides convenient access to the stage. + + element = document.createElement('canvas') as WrappedHTMLElement; + element.flexjs_wrapper = this; + canvas = element as HTMLCanvasElement; + canvas.id = 'flexjsCanvas'; + canvas.width = 700; + canvas.height = 500; + + body = document.getElementsByTagName('body')[0] as HTMLBodyElement; + body.appendChild(this.element); + + stage = new createjs.Stage('flexjsCanvas'); + + /* AJH is this needed + MXMLDataInterpreter.generateMXMLProperties(this, + MXMLProperties); + */ + + dispatchEvent('initialize'); + + initialView.applicationModel = this.model; + addElement(initialView); + + dispatchEvent('viewChanged'); + + stage.update(); + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + override public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + stage.addChild(c.element as DisplayObject); + c.addedToParent(); + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/CheckBox.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/CheckBox.as new file mode 100644 index 0000000..3ce2d50 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/CheckBox.as @@ -0,0 +1,124 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.createjs +{ + COMPILE::AS3 + { + import org.apache.flex.html.CheckBox; + } + COMPILE::JS + { + import createjs.Container; + import createjs.Shape; + import createjs.Stage; + import createjs.Text; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + import org.apache.flex.events.Event; + } + + COMPILE::AS3 + public class CheckBox extends org.apache.flex.html.CheckBox + { + } + + COMPILE::JS + public class CheckBox extends UIBase + { + private var checkMark:Shape; + private var checkMarkBackground:Shape; + private var checkBoxLabel:Text; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override public function createElement():WrappedHTMLElement + { + checkMarkBackground = new createjs.Shape(null); + checkMarkBackground.name = 'checkmarkbackground'; + checkMarkBackground.graphics.beginFill('red'). + drawRoundRect(0, 0, 40, 40, 8); + + checkMark = new createjs.Shape(null); + checkMark.name = 'checkmark'; + checkMark.graphics.beginFill('white').drawRoundRect(0, 0, 32, 32, 6); + checkMark.x = 4; + checkMark.y = 4; + checkMark.visible = false; + + checkBoxLabel = new createjs.Text('checkbox', '20px Arial', '#ff7700'); + checkBoxLabel.name = 'label'; + checkBoxLabel.textAlign = 'left'; + checkBoxLabel.textBaseline = 'middle'; + checkBoxLabel.x = 45; + checkBoxLabel.y = 40 / 2; + + var container:createjs.Container = new createjs.Container(); + element = container as WrappedHTMLElement; + container.name = 'checkbox'; + container.addChild(this.checkMarkBackground); + container.addChild(this.checkBoxLabel); + container.addChild(this.checkMark); + container.onClick = clickHandler; + + this.positioner = this.element; + + return this.element; + } + + public function get text():String + { + return checkBoxLabel.text; + } + + public function set text(value:String):void + { + checkBoxLabel.text = value; + } + + public function get selected():Boolean + { + return checkMark.visible; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + public function set selected(value:Boolean):void + { + checkMark.visible = value; + var stage:Stage = (element as Container).getStage(); + if (stage) + stage.update(); + } + + + /** + * @param event The event. + */ + private function clickHandler(event:Event):void + { + selected = !selected; + } + + + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Label.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Label.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Label.as new file mode 100644 index 0000000..3540599 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Label.as @@ -0,0 +1,81 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.createjs +{ + COMPILE::AS3 + { + import org.apache.flex.html.Label; + } + + COMPILE::JS + { + import createjs.Text; + import createjs.Stage; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + COMPILE::AS3 + public class Label extends org.apache.flex.html.Label + { + + } + + COMPILE::JS + public class Label extends UIBase + { + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override public function createElement():WrappedHTMLElement + { + var text:Text = new Text('default text', '20px Arial', '#ff7700'); + text.x = 0; + text.y = 20; + text.textBaseline = 'alphabetic'; + + positioner = element = text as WrappedHTMLElement; + return element; + } + + + /** + * @flexjsignorecoercion createjs.Text + */ + public function get text():String + { + return (element as Text).text; + } + + /** + * @flexjsignorecoercion createjs.Text + */ + public function set text(value:String):void + { + var text:Text = element as Text; + text.text = value; + var stage:Stage = text.getStage(); + if (stage) + stage.update(); + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/TextButton.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/TextButton.as new file mode 100644 index 0000000..f7a31f9 --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/TextButton.as @@ -0,0 +1,118 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.createjs +{ + COMPILE::AS3 + { + import org.apache.flex.core.ITextModel; + import org.apache.flex.html.Button; + } + COMPILE::JS + { + import createjs.Container; + import createjs.Text; + import createjs.Shape; + import createjs.Stage; + + import org.apache.flex.createjs.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + + COMPILE::AS3 + public class TextButton extends Button + { + public function TextButton() + { + super(); + } + + public function get text():String + { + return ITextModel(model).text; + } + public function set text(value:String):void + { + ITextModel(model).text = value; + } + + public function get html():String + { + return ITextModel(model).html; + } + public function set html(value:String):void + { + ITextModel(model).html = value; + } + + } + + COMPILE::JS + public class TextButton extends UIBase + { + private var buttonBackground:Shape; + private var buttonLabel:Text; + private var button:Container; + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override public function createElement():WrappedHTMLElement + { + buttonBackground = new createjs.Shape(null); + buttonBackground.name = 'background'; + buttonBackground.graphics.beginFill('red'). + drawRoundRect(0, 0, 200, 60, 10); + + buttonLabel = new createjs.Text('button', 'bold 24px Arial', + '#FFFFFF'); + buttonLabel.name = 'label'; + buttonLabel.textAlign = 'center'; + buttonLabel.textBaseline = 'middle'; + buttonLabel.x = 200 / 2; + buttonLabel.y = 60 / 2; + + button = new createjs.Container(); + button.name = 'button'; + button.x = 50; + button.y = 25; + button.addChild(buttonBackground); + button.addChild(buttonLabel); + + positioner = element = button as WrappedHTMLElement; + element.flexjs_wrapper = this; + return element; + } + + + /** + * @flexjsignorecoercion createjs.Text + */ + public function get text():String + { + return buttonLabel.text; + } + + /** + * @flexjsignorecoercion createjs.Text + */ + public function set text(value:String):void + { + buttonLabel.text = value; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/f992c05d/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/UIBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/UIBase.as b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/UIBase.as new file mode 100644 index 0000000..10f18ab --- /dev/null +++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/UIBase.as @@ -0,0 +1,449 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.createjs.core +{ + import org.apache.flex.core.HTMLElementWrapper; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IBeadModel; + import org.apache.flex.core.IBead; + import org.apache.flex.core.IFlexJSElement; + import org.apache.flex.core.IUIBase; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + COMPILE::JS + { + import createjs.Container; + import createjs.DisplayObject; + import createjs.Stage; + import org.apache.flex.core.WrappedHTMLElement; + } + + public class UIBase extends HTMLElementWrapper implements IStrand, IEventDispatcher, IUIBase, IFlexJSElement + { + public function UIBase() + { + super(); + COMPILE::JS + { + createElement(); + } + } + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function addElement(c:Object, dispatchEvent:Boolean = true):void + { + (element as Container).addChild(c.element as DisplayObject); + } + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function addElementAt(c:Object, index:int, dispatchEvent:Boolean = true):void + { + (element as Container).addChildAt(c.element as DisplayObject, index); + } + + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function getElementIndex(c:Object):int + { + return (element as Container).getChildIndex(c.element as DisplayObject); + } + + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function removeElement(c:Object, dispatchEvent:Boolean = true):void + { + (element as Container).removeChild(c.element as DisplayObject); + } + + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function getElementAt(index:int):Object + { + return (element as Container).getChildAt(index); + } + + + /** + * @flexjsignorecoercion createjs.Container + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function get numElements():int + { + return (element as Container).numChildren; + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + public function createElement():WrappedHTMLElement + { + element = new Container() as WrappedHTMLElement; + + positioner = this.element; + return element; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function get x():Number + { + return (positioner as Container).x; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function set x(value:Number):void + { + var container:Container = positioner as Container; + container.x = value; + var stage:Stage = container.getStage(); + if (stage) + stage.update(); + } + + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function get y():Number + { + return (positioner as Container).y; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function set y(value:Number):void + { + var container:Container = positioner as Container; + container.y = value; + var stage:Stage = container.getStage(); + if (stage) + stage.update(); + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function get width():Number + { + return (positioner as Container).width; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function set width(value:Number):void + { + var container:Container = positioner as Container; + container.width = value; + var stage:Stage = container.getStage(); + if (stage) + stage.update(); + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function get height():Number + { + return (positioner as Container).height; + } + + /** + * @flexjsignorecoercion createjs.Container + */ + COMPILE::JS + public function set height(value:Number):void + { + var container:Container = positioner as Container; + container.height = value; + var stage:Stage = container.getStage(); + if (stage) + stage.update(); + } + + COMPILE::AS3 + private var _width:Number = 0; + COMPILE::AS3 + override public function get width():Number + { + return _width; + } + + COMPILE::AS3 + override public function set width(value:Number):void + { + if (_width != value) + { + _width = value; + dispatchEvent(new Event("widthChanged")); + } + } + COMPILE::AS3 + protected function get $width():Number + { + return super.width; + } + + COMPILE::AS3 + private var _height:Number = 0; + COMPILE::AS3 + override public function get height():Number + { + return _height; + } + COMPILE::AS3 + override public function set height(value:Number):void + { + if (_height != value) + { + _height = value; + dispatchEvent(new Event("heightChanged")); + } + } + COMPILE::AS3 + protected function get $height():Number + { + return super.height; + } + + COMPILE::AS3 + private var _model:IBeadModel; + COMPILE::AS3 + public function get model():IBeadModel + { + return _model; + } + COMPILE::AS3 + public function set model(value:IBeadModel):void + { + if (_model != value) + { + addBead(value as IBead); + dispatchEvent(new Event("modelChanged")); + } + } + + private var _id:String; + public function get id():String + { + return _id; + } + public function set id(value:String):void + { + if (_id != value) + { + _id = value; + dispatchEvent(new Event("idChanged")); + } + } + + // beads declared in MXML are added to the strand. + // from AS, just call addBead() + COMPILE::AS3 + public var beads:Array; + + COMPILE::AS3 + private var _beads:Vector.<IBead>; + COMPILE::AS3 + override public function addBead(bead:IBead):void + { + if (!_beads) + _beads = new Vector.<IBead>; + _beads.push(bead); + if (bead is IBeadModel) + _model = bead as IBeadModel; + bead.strand = this; + } + + COMPILE::AS3 + public function getBeadByType(classOrInterface:Class):IBead + { + for each (var bead:IBead in _beads) + { + if (bead is classOrInterface) + return bead; + } + return null; + } + + COMPILE::AS3 + public function removeBead(value:IBead):IBead + { + var n:int = _beads.length; + for (var i:int = 0; i < n; i++) + { + var bead:IBead = _beads[i]; + if (bead == value) + { + _beads.splice(i, 1); + return bead; + } + } + return null; + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function get visible():Boolean + { + return (positioner as DisplayObject).visible; + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function set visible(value:Boolean):void + { + var oldValue:Boolean = (positioner as DisplayObject).visible; + if (value !== oldValue) + { + if (!value) + { + (positioner as DisplayObject).visible = value; + dispatchEvent(new Event('hide')); + } + else + { + (positioner as DisplayObject).visible = value; + dispatchEvent(new Event('show')); + } + dispatchEvent(new Event('visibleChanged')); + } + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function get alpha():Number + { + return (positioner as DisplayObject).alpha; + } + + /** + * @flexjsignorecoercion createjs.DisplayObject + */ + COMPILE::JS + public function set alpha(value:Number):void + { + (positioner as DisplayObject).alpha = value; + } + + COMPILE::JS + private var _positioner:WrappedHTMLElement; + + /** + * The HTMLElement used to position the component. + */ + COMPILE::JS + public function get positioner():WrappedHTMLElement + { + return _positioner; + } + + /** + * @private + */ + COMPILE::JS + public function set positioner(value:WrappedHTMLElement):void + { + _positioner = value; + } + + /** + * @copy org.apache.flex.core.IUIBase#topMostEventDispatcher + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion org.apache.flex.events.IEventDispatcher + */ + public function get topMostEventDispatcher():IEventDispatcher + { + COMPILE::AS3 + { + return null; + } + COMPILE::JS + { + var e:WrappedHTMLElement = document.body as WrappedHTMLElement; + return e.flexjs_wrapper as IEventDispatcher; + } + } + + public function addedToParent():void + { + + } + + /** + * @copy org.apache.flex.core.IUIBase#element + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::AS3 + public function get element():IFlexJSElement + { + return this; + } + + } +}