Return-Path: X-Original-To: apmail-flex-commits-archive@www.apache.org Delivered-To: apmail-flex-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6644610F25 for ; Mon, 18 Nov 2013 21:02:59 +0000 (UTC) Received: (qmail 29415 invoked by uid 500); 18 Nov 2013 21:02:57 -0000 Delivered-To: apmail-flex-commits-archive@flex.apache.org Received: (qmail 29330 invoked by uid 500); 18 Nov 2013 21:02:57 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 29029 invoked by uid 99); 18 Nov 2013 21:02:56 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Nov 2013 21:02:56 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 7BC4935DE4; Mon, 18 Nov 2013 21:02:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Mon, 18 Nov 2013 21:03:06 -0000 Message-Id: <7a486d1a30434d60b15bb7289aedc199@git.apache.org> In-Reply-To: <8ac04100b51c448eb9e3ca087eb86c82@git.apache.org> References: <8ac04100b51c448eb9e3ca087eb86c82@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/21] move AS code into a projects/FlexJSUI http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as new file mode 100644 index 0000000..5936387 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/supportClasses/UIItemRendererBase.as @@ -0,0 +1,123 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html.staticControls.supportClasses +{ + import org.apache.flex.core.IItemRenderer; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + + public class UIItemRendererBase extends UIBase implements IItemRenderer + { + public function UIItemRendererBase() + { + } + + override public function addedToParent():void + { + super.addedToParent(); + + // very common for item renderers to be resized by their containers, + addEventListener("widthChanged", sizeChangeHandler); + addEventListener("heightChanged", sizeChangeHandler); + } + + public var backgroundColor:uint = 0xFFFFFF; + public var highlightColor:uint = 0xCEDBEF; + public var selectedColor:uint = 0xA8C6EE; + public var downColor:uint = 0x808080; + + private var _data:Object; + + public function get data():Object + { + return _data; + } + public function set data(value:Object):void + { + _data = value; + } + + private var _index:int; + + public function get index():int + { + return _index; + } + public function set index(value:int):void + { + _index = value; + } + + private var _hovered:Boolean; + + public function get hovered():Boolean + { + return _hovered; + } + public function set hovered(value:Boolean):void + { + _hovered = value; + updateRenderer(); + } + + private var _selected:Boolean; + + public function get selected():Boolean + { + return _selected; + } + public function set selected(value:Boolean):void + { + _selected = value; + updateRenderer(); + } + + private var _down:Boolean; + + public function get down():Boolean + { + return _down; + } + public function set down(value:Boolean):void + { + _down = value; + updateRenderer(); + } + + public function updateRenderer():void + { + if (down) + backgroundColor = downColor; + else if (hovered) + backgroundColor = highlightColor; + else if (selected) + backgroundColor = selectedColor; + } + + private function sizeChangeHandler(event:Event):void + { + adjustSize(); + } + + public function adjustSize():void + { + // handle in subclass + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Button.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Button.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Button.as new file mode 100644 index 0000000..4b7731d --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Button.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.Button; + + public class Button extends org.apache.flex.html.staticControls.Button + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/CheckBox.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/CheckBox.as new file mode 100644 index 0000000..ec92d72 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/CheckBox.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.CheckBox; + + public class CheckBox extends org.apache.flex.html.staticControls.CheckBox + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/ComboBox.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/ComboBox.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/ComboBox.as new file mode 100644 index 0000000..ebeea35 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/ComboBox.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.ComboBox; + + public class ComboBox extends org.apache.flex.html.staticControls.ComboBox + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/DropDownList.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/DropDownList.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/DropDownList.as new file mode 100644 index 0000000..14aa0fe --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/DropDownList.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.DropDownList; + + public class DropDownList extends org.apache.flex.html.staticControls.DropDownList + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Label.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Label.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Label.as new file mode 100644 index 0000000..8a8ad99 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/Label.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 org.apache.flex.html5.staticControls +{ + import org.apache.flex.html.staticControls.Label; + + /** + * Label probably should extend TextField directly, + * but the player's APIs for TextLine do not allow + * direct instantiation, and we might want to allow + * Labels to be declared and have their actual + * view be swapped out. + */ + public class Label extends org.apache.flex.html.staticControls.Label + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/List.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/List.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/List.as new file mode 100644 index 0000000..86e8ef8 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/List.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 org.apache.flex.html5.staticControls +{ + import org.apache.flex.html.staticControls.List; + + /** + * Label probably should extend TextField directly, + * but the player's APIs for TextLine do not allow + * direct instantiation, and we might want to allow + * Labels to be declared and have their actual + * view be swapped out. + */ + public class List extends org.apache.flex.html.staticControls.List + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/RadioButton.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/RadioButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/RadioButton.as new file mode 100644 index 0000000..78f117b --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/RadioButton.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.RadioButton; + + public class RadioButton extends org.apache.flex.html.staticControls.RadioButton + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextArea.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextArea.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextArea.as new file mode 100644 index 0000000..a2c4f0b --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextArea.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.TextArea; + + public class TextArea extends org.apache.flex.html.staticControls.TextArea + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextButton.as new file mode 100644 index 0000000..6c87ea4 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextButton.as @@ -0,0 +1,32 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html5.staticControls +{ + import flash.display.DisplayObject; + + import org.apache.flex.html.staticControls.TextButton; + + public class TextButton extends org.apache.flex.html.staticControls.TextButton + { + public function TextButton(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null) + { + super(upState, overState, downState, hitTestState); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextInput.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextInput.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextInput.as new file mode 100644 index 0000000..adb723f --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html5/staticControls/TextInput.as @@ -0,0 +1,25 @@ +// +// 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.html5.staticControls +{ + import org.apache.flex.html.staticControls.TextInput; + + public class TextInput extends org.apache.flex.html.staticControls.TextInput + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/Application.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/Application.as new file mode 100644 index 0000000..e2a3113 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/Application.as @@ -0,0 +1,31 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.jquery +{ + import org.apache.flex.core.Application; + import org.apache.flex.core.IFlexInfo; + + public class Application extends org.apache.flex.core.Application implements IFlexInfo + { + public function Application() + { + super(); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/CheckBox.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/CheckBox.as new file mode 100644 index 0000000..a2f3a01 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/CheckBox.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.jquery.staticControls +{ + import org.apache.flex.html.staticControls.CheckBox; + + public class CheckBox extends org.apache.flex.html.staticControls.CheckBox + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/RadioButton.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/RadioButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/RadioButton.as new file mode 100644 index 0000000..a94739a --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/RadioButton.as @@ -0,0 +1,26 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.jquery.staticControls +{ + import org.apache.flex.html.staticControls.RadioButton; + + public class RadioButton extends org.apache.flex.html.staticControls.RadioButton + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/TextButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/TextButton.as new file mode 100644 index 0000000..c2632f3 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/jquery/staticControls/TextButton.as @@ -0,0 +1,32 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.jquery.staticControls +{ + import flash.display.DisplayObject; + + import org.apache.flex.html.staticControls.TextButton; + + public class TextButton extends org.apache.flex.html.staticControls.TextButton + { + public function TextButton(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null) + { + super(upState, overState, downState, hitTestState); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/BinaryUploader.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/BinaryUploader.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/BinaryUploader.as new file mode 100644 index 0000000..e806518 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/BinaryUploader.as @@ -0,0 +1,305 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + import flash.events.HTTPStatusEvent; + import flash.events.IOErrorEvent; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.URLRequestHeader; + import flash.net.URLRequestMethod; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.utils.BinaryData; + + [Event(name="complete", type="org.apache.flex.events.Event")] + + [Event(name="ioError", type="org.apache.flex.events.Event")] + + [Event(name="httpStatus", type="org.apache.flex.events.Event")] + + [Event(name="httpResponseStatus", type="org.apache.flex.events.Event")] + + [DefaultProperty("beads")] + + public class BinaryUploader extends EventDispatcher implements IStrand, IBead + { + public static const HTTP_METHOD_GET:String = URLRequestMethod.GET; + public static const HTTP_METHOD_POST:String = URLRequestMethod.POST; + public static const HTTP_METHOD_PUT:String = URLRequestMethod.PUT; + public static const HTTP_METHOD_DELETE:String = URLRequestMethod.DELETE; + + public function BinaryUploader() + { + super(); + } + + private var _contentType:String = "application/octet-stream"; + public function get contentType():String + { + return _contentType; + } + public function set contentType(value:String):void + { + if (_contentType != value) + { + _contentType = value; + dispatchEvent(new Event("contentTypeChanged")); + } + } + + private var _binaryData:BinaryData; + public function get binaryData():BinaryData + { + return _binaryData; + } + public function set binaryData(value:BinaryData):void + { + if (_binaryData != value) + { + _binaryData = value; + dispatchEvent(new Event("binaryDataChanged")); + } + } + + private var _headers:Array; + public function get headers():Array + { + if (_headers == null) + _headers = []; + return _headers; + } + public function set headers(value:Array):void + { + if (_headers != value) + { + _headers = value; + dispatchEvent(new Event("headersChanged")); + } + } + + private var _method:String = HTTP_METHOD_POST; + public function get method():String + { + return _method; + } + public function set method(value:String):void + { + if (_method != value) + { + _method = value; + dispatchEvent(new Event("methodChanged")); + } + } + + private var _responseHeaders:Array; + public function get responseHeaders():Array + { + if (_responseHeaders && _responseHeaders.length > 0) + { + if (_responseHeaders[0] is URLRequestHeader) + { + var n:int = _responseHeaders.length; + for (var i:int = 0; i < n; i++) + { + var old:URLRequestHeader = _responseHeaders[i]; + var nu:HTTPHeader = new HTTPHeader(old.name, old.value); + _responseHeaders[i] = nu; + } + } + } + return _responseHeaders; + } + + private var _responseURL:String; + public function get responseURL():String + { + return _responseURL; + } + + private var _status:int; + public function get status():int + { + return _status; + } + + private var _url:String; + public function get url():String + { + return _url; + } + public function set url(value:String):void + { + if (_url != value) + { + _url = value; + dispatchEvent(new Event("urlChanged")); + } + } + + private var _timeout:Number = 0; + public function get timeout():Number + { + return _timeout; + } + public function set timeout(value:Number):void + { + if (_timeout != value) + { + _timeout = value; + dispatchEvent(new Event("timeoutChanged")); + } + } + + 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")); + } + } + + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + } + + // beads declared in MXML are added to the strand. + // from AS, just call addBead() + public var beads:Array; + + private var _beads:Vector.; + public function addBead(bead:IBead):void + { + if (!_beads) + _beads = new Vector.; + _beads.push(bead); + bead.strand = this; + } + + public function getBeadByType(classOrInterface:Class):IBead + { + for each (var bead:IBead in _beads) + { + if (bead is classOrInterface) + return bead; + } + return null; + } + + 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; + } + + private var urlLoader:URLLoader; + + public function send():void + { + if (!urlLoader) + urlLoader = new URLLoader(); + var request:URLRequest = new URLRequest(url); + request.method = method; + if ("idleTimeout" in request) + { + request["idleTimeout"] = timeout; + } + var sawContentType:Boolean; + if (headers) + { + for each (var header:HTTPHeader in headers) + { + var urlHeader:URLRequestHeader = new URLRequestHeader(header.name, header.value); + request.requestHeaders.push(urlHeader); + if (header.name == HTTPHeader.CONTENT_TYPE) + sawContentType = true; + } + } + if (method != HTTP_METHOD_GET && !sawContentType) + { + urlHeader = new URLRequestHeader(HTTPHeader.CONTENT_TYPE, contentType); + request.requestHeaders.push(urlHeader); + } + if (binaryData) + { + if (method == HTTP_METHOD_GET) + { + if (url.indexOf("?") != -1) + url += binaryData.data.toString(); + else + url += "?" + binaryData.data.toString(); + } + else + request.data = binaryData.data; + } + urlLoader.addEventListener(flash.events.Event.COMPLETE, completeHandler); + urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + if (HTTPStatusEvent.HTTP_RESPONSE_STATUS) // only on AIR + urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, statusHandler); + urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, statusHandler); + urlLoader.load(request); + } + + protected function statusHandler(event:HTTPStatusEvent):void + { + _status = event.status; + if ("responseHeaders" in event) + _responseHeaders = event.responseHeaders; + if ("responseURL" in event) + _responseURL = event.responseURL; + dispatchEvent(new Event(event.type)); + } + + protected function ioErrorHandler(event:IOErrorEvent):void + { + dispatchEvent(new Event(event.type)); + } + + protected function completeHandler(event:flash.events.Event):void + { + dispatchEvent(new Event(event.type)); + } + + public function get data():* + { + return urlLoader.data; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPHeader.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPHeader.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPHeader.as new file mode 100644 index 0000000..4585530 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPHeader.as @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + public class HTTPHeader + { + public static const CONTENT_TYPE:String = "Content-type"; + + public function HTTPHeader(name:String = null, value:String = null) + { + super(); + this.name = name; + this.value = value; + } + + public var name:String; + public var value:String; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPService.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPService.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPService.as new file mode 100644 index 0000000..225ff08 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/HTTPService.as @@ -0,0 +1,304 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + import flash.events.HTTPStatusEvent; + import flash.events.IOErrorEvent; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.URLRequestHeader; + import flash.net.URLRequestMethod; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.events.Event; + import org.apache.flex.events.EventDispatcher; + + [Event(name="complete", type="org.apache.flex.events.Event")] + + [Event(name="ioError", type="org.apache.flex.events.Event")] + + [Event(name="httpStatus", type="org.apache.flex.events.Event")] + + [Event(name="httpResponseStatus", type="org.apache.flex.events.Event")] + + [DefaultProperty("beads")] + + public class HTTPService extends EventDispatcher implements IStrand, IBead + { + public static const HTTP_METHOD_GET:String = URLRequestMethod.GET; + public static const HTTP_METHOD_POST:String = URLRequestMethod.POST; + public static const HTTP_METHOD_PUT:String = URLRequestMethod.PUT; + public static const HTTP_METHOD_DELETE:String = URLRequestMethod.DELETE; + + public function HTTPService() + { + super(); + } + + private var _contentType:String = "application/x-www-form-urlencoded"; + public function get contentType():String + { + return _contentType; + } + public function set contentType(value:String):void + { + if (_contentType != value) + { + _contentType = value; + dispatchEvent(new Event("contentTypeChanged")); + } + } + + private var _contentData:String; + public function get contentData():String + { + return _contentData; + } + public function set contentData(value:String):void + { + if (_contentData != value) + { + _contentData = value; + dispatchEvent(new Event("contentDataChanged")); + } + } + + private var _headers:Array; + public function get headers():Array + { + if (_headers == null) + _headers = []; + return _headers; + } + public function set headers(value:Array):void + { + if (_headers != value) + { + _headers = value; + dispatchEvent(new Event("headersChanged")); + } + } + + private var _method:String = HTTP_METHOD_GET; + public function get method():String + { + return _method; + } + public function set method(value:String):void + { + if (_method != value) + { + _method = value; + dispatchEvent(new Event("methodChanged")); + } + } + + private var _responseHeaders:Array; + public function get responseHeaders():Array + { + if (_responseHeaders && _responseHeaders.length > 0) + { + if (_responseHeaders[0] is URLRequestHeader) + { + var n:int = _responseHeaders.length; + for (var i:int = 0; i < n; i++) + { + var old:URLRequestHeader = _responseHeaders[i]; + var nu:HTTPHeader = new HTTPHeader(old.name, old.value); + _responseHeaders[i] = nu; + } + } + } + return _responseHeaders; + } + + private var _responseURL:String; + public function get responseURL():String + { + return _responseURL; + } + + private var _status:int; + public function get status():int + { + return _status; + } + + private var _url:String; + public function get url():String + { + return _url; + } + public function set url(value:String):void + { + if (_url != value) + { + _url = value; + dispatchEvent(new Event("urlChanged")); + } + } + + private var _timeout:Number = 0; + public function get timeout():Number + { + return _timeout; + } + public function set timeout(value:Number):void + { + if (_timeout != value) + { + _timeout = value; + dispatchEvent(new Event("timeoutChanged")); + } + } + + 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")); + } + } + + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + } + + // beads declared in MXML are added to the strand. + // from AS, just call addBead() + public var beads:Array; + + private var _beads:Vector.; + public function addBead(bead:IBead):void + { + if (!_beads) + _beads = new Vector.; + _beads.push(bead); + bead.strand = this; + } + + public function getBeadByType(classOrInterface:Class):IBead + { + for each (var bead:IBead in _beads) + { + if (bead is classOrInterface) + return bead; + } + return null; + } + + 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; + } + + private var urlLoader:URLLoader; + + public function send():void + { + if (!urlLoader) + urlLoader = new URLLoader(); + var request:URLRequest = new URLRequest(url); + request.method = method; + if ("idleTimeout" in request) + { + request["idleTimeout"] = timeout; + } + var sawContentType:Boolean; + if (headers) + { + for each (var header:HTTPHeader in headers) + { + var urlHeader:URLRequestHeader = new URLRequestHeader(header.name, header.value); + request.requestHeaders.push(urlHeader); + if (header.name == HTTPHeader.CONTENT_TYPE) + sawContentType = true; + } + } + if (method != HTTP_METHOD_GET && !sawContentType && contentData != null) + { + urlHeader = new URLRequestHeader(HTTPHeader.CONTENT_TYPE, contentType); + request.requestHeaders.push(urlHeader); + } + if (contentData) + { + if (method == HTTP_METHOD_GET) + { + if (url.indexOf("?") != -1) + url += contentData; + else + url += "?" + contentData; + } + else + request.data = contentData; + } + urlLoader.addEventListener(flash.events.Event.COMPLETE, completeHandler); + urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + if (HTTPStatusEvent.HTTP_RESPONSE_STATUS) // only on AIR + urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, statusHandler); + urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, statusHandler); + urlLoader.load(request); + } + + protected function statusHandler(event:HTTPStatusEvent):void + { + _status = event.status; + if ("responseHeaders" in event) + _responseHeaders = event.responseHeaders; + if ("responseURL" in event) + _responseURL = event.responseURL; + dispatchEvent(new Event(event.type)); + } + + protected function ioErrorHandler(event:IOErrorEvent):void + { + dispatchEvent(new Event(event.type)); + } + + protected function completeHandler(event:flash.events.Event):void + { + dispatchEvent(new Event(event.type)); + } + + public function get data():* + { + return urlLoader.data; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IInputParser.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IInputParser.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IInputParser.as new file mode 100644 index 0000000..55e0d99 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IInputParser.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + public interface IInputParser + { + function parseItems(s:String):Array; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IItemConverter.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IItemConverter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IItemConverter.as new file mode 100644 index 0000000..f736ce5 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/IItemConverter.as @@ -0,0 +1,25 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + public interface IItemConverter + { + function convertItem(data:String):Object + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONInputParser.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONInputParser.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONInputParser.as new file mode 100644 index 0000000..4abbbde --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONInputParser.as @@ -0,0 +1,28 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + public class JSONInputParser implements IInputParser + { + public function parseItems(s:String):Array + { + return s.split("},"); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as new file mode 100644 index 0000000..0042e5b --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/JSONItemConverter.as @@ -0,0 +1,30 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net +{ + import org.apache.flex.net.IItemConverter; + + public class JSONItemConverter implements IItemConverter + { + public function convertItem(data:String):Object + { + return JSON.parse(data); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as new file mode 100644 index 0000000..7b1be41 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/net/dataConverters/LazyCollection.as @@ -0,0 +1,106 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.net.dataConverters +{ + import flash.events.Event; + import flash.events.IEventDispatcher; + + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.data.ICollection; + import org.apache.flex.events.EventDispatcher; + import org.apache.flex.net.IInputParser; + import org.apache.flex.net.IItemConverter; + + public class LazyCollection extends EventDispatcher implements IBead, ICollection + { + public function LazyCollection() + { + super(); + } + + private var _inputParser:IInputParser; + public function get inputParser():IInputParser + { + return _inputParser; + } + public function set inputParser(value:IInputParser):void + { + if (_inputParser != value) + { + _inputParser = value; + dispatchEvent(new Event("inputParserChanged")); + } + } + + private var _itemConverter:IItemConverter; + public function get itemConverter():IItemConverter + { + return _itemConverter; + } + public function set itemConverter(value:IItemConverter):void + { + if (_itemConverter != value) + { + _itemConverter = value; + dispatchEvent(new Event("itemConverterChanged")); + } + } + + 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")); + } + } + + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(_strand).addEventListener(Event.COMPLETE, completeHandler); + } + + private var rawData:Array; + private var data:Array; + + private function completeHandler(event:Event):void + { + rawData = inputParser.parseItems(_strand["data"]); + data = new Array(rawData.length); + } + + public function getItemAt(index:int):Object + { + if (data[index] == undefined) + { + data[index] = itemConverter.convertItem(rawData[index]); + } + return data[index]; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/svg/staticControls/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/svg/staticControls/TextButton.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/svg/staticControls/TextButton.as new file mode 100644 index 0000000..a493e31 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/svg/staticControls/TextButton.as @@ -0,0 +1,32 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.staticControls +{ + import flash.display.DisplayObject; + + import org.apache.flex.html.staticControls.TextButton; + + public class TextButton extends org.apache.flex.html.staticControls.TextButton + { + public function TextButton(upState:DisplayObject=null, overState:DisplayObject=null, downState:DisplayObject=null, hitTestState:DisplayObject=null) + { + super(upState, overState, downState, hitTestState); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BeadMetrics.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BeadMetrics.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BeadMetrics.as new file mode 100644 index 0000000..3ec3827 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BeadMetrics.as @@ -0,0 +1,79 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIMetrics; + import org.apache.flex.core.ValuesManager; + +public class BeadMetrics +{ + + public static function getMetrics(strand:IStrand) : UIMetrics + { + var borderThickness:Object = ValuesManager.valuesImpl.getValue(strand,"border-thickness"); + var borderOffset:Number; + if( borderThickness == null ) { + borderOffset = 0; + } + else { + borderOffset = Number(borderThickness); + if( isNaN(borderOffset) ) borderOffset = 0; + } + + var paddingLeft:Object; + var paddingTop:Object; + var padding:Object = ValuesManager.valuesImpl.getValue(strand, "padding"); + if (padding is Array) + { + if (padding.length == 1) + paddingLeft = paddingTop = padding[0]; + else if (padding.length <= 3) + { + paddingLeft = padding[1]; + paddingTop = padding[0]; + } + else if (padding.length == 4) + { + paddingLeft = padding[3]; + paddingTop = padding[0]; + } + } + else if (padding == null) + { + paddingLeft = ValuesManager.valuesImpl.getValue(strand, "padding-left"); + paddingTop = ValuesManager.valuesImpl.getValue(strand, "padding-top"); + } + else + { + paddingLeft = paddingTop = padding; + } + var pl:Number = Number(paddingLeft); + var pt:Number = Number(paddingTop); + + var result:UIMetrics = new UIMetrics(); + result.top = borderOffset + pt; + result.left = borderOffset + pl; + result.bottom = borderOffset + pt; + result.right = borderOffset + pl; + + return result; + } +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BinaryData.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BinaryData.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BinaryData.as new file mode 100644 index 0000000..48cfd00 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/BinaryData.as @@ -0,0 +1,106 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ + import flash.utils.ByteArray; + +public class BinaryData +{ + public function BinaryData() + { + + } + + private var ba:ByteArray = new ByteArray(); + + /** + * Get the platform-specific data for sending. + * Generally only used by the network services. + */ + public function get data():Object + { + return ba; + } + + public function writeByte(byte:int):void + { + ba.writeByte(byte); + } + + public function writeShort(byte:int):void + { + ba.writeShort(byte); + } + + public function writeUnsignedInt(byte:uint):void + { + ba.writeUnsignedInt(byte); + } + + public function writeInt(byte:uint):void + { + ba.writeInt(byte); + } + + public function readByte():int + { + return ba.readByte(); + } + + public function readShort():int + { + return ba.readShort(); + } + + public function readUnsignedInt():uint + { + return ba.readUnsignedInt(); + } + + public function readInt():int + { + return ba.readInt(); + } + + public function get length():int + { + return ba.length; + } + + public function get bytesAvailable():int + { + return ba.bytesAvailable; + } + + public function get position():int + { + return ba.position; + } + + public function set position(value:int):void + { + ba.position = value; + } + + public function growBuffer(extra:int):void + { + // no need to do anything in AS + } +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as new file mode 100644 index 0000000..3538e51 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/MXMLDataInterpreter.as @@ -0,0 +1,321 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ + +import org.apache.flex.core.IStrand; +import org.apache.flex.core.IBead; +import org.apache.flex.core.IDocument; +import org.apache.flex.core.IParent; +import org.apache.flex.core.IContainer; + +public class MXMLDataInterpreter +{ + public function MXMLDataInterpreter() + { + super(); + } + + + public static function generateMXMLObject(document:Object, data:Array):Object + { + var i:int = 0; + var cls:Class = data[i++]; + var comp:Object = new cls(); + + var m:int; + var j:int; + var name:String; + var simple:*; + var value:Object; + var id:String; + + m = data[i++]; // num props + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, null, value as Array); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + if (name == "id") + { + document[value] = comp; + id = value as String; + } + else if (name == "_id") + { + document[value] = comp; + id = value as String; + continue; // skip assignment to comp + } + comp[name] = value; + } + if (comp is IDocument) + comp.setDocument(document, id); + return comp; + } + + public static function generateMXMLArray(document:Object, parent:IParent, data:Array, recursive:Boolean = true):Array + { + var comps:Array = []; + + var n:int = data.length; + var i:int = 0; + while (i < n) + { + var cls:Class = data[i++]; + var comp:Object = new cls(); + + var m:int; + var j:int; + var name:String; + var simple:*; + var value:Object; + var id:String = null; + + m = data[i++]; // num props + if (m > 0 && data[0] == "model") + { + m--; + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, parent, value as Array, recursive); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + comp[name] = value; + if (value is IBead && comp is IStrand) + IStrand(comp).addBead(value as IBead); + } + var beadOffset:int = i + (m - 1) * 3; + if (beadOffset >= -1) + trace(beadOffset, data[beadOffset]); + if (m > 0 && data[beadOffset] == "beads") + { + m--; + } + else + beadOffset = -1; + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, null, value as Array, recursive); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + if (name == "id") + id = value as String; + if (name == "document" && !comp.document) + comp.document = document; + else if (name == "_id") + id = value as String; // and don't assign to comp + else + comp[name] = value; + } + if (beadOffset > -1) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, null, value as Array, recursive); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + else + comp[name] = value; + var beads:Array = value as Array; + var l:int = beads.length; + for (var k:int = 0; k < l; k++) + { + var bead:IBead = beads[k] as IBead; + IStrand(comp).addBead(bead); + } + } + m = data[i++]; // num styles + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, null, value as Array, recursive); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + comp.setStyle(name, value); + } + + m = data[i++]; // num effects + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(document, null, value as Array, recursive); + else if (simple == false) + value = generateMXMLObject(document, value as Array); + comp.setStyle(name, value); + } + + m = data[i++]; // num events + for (j = 0; j < m; j++) + { + name = data[i++]; + value = data[i++]; + comp.addEventListener(name, value); + } + + if (parent) + { + parent.addElement(comp); + } + + var children:Array = data[i++]; + if (children) + { + if (recursive) + { + generateMXMLInstances(document, comp as IParent, children, recursive); + if (comp is IContainer) + { + IContainer(comp).childrenAdded(); + } + } + else + comp.setMXMLDescriptor(children); + } + + if (id) + document[id] = comp; + + if (comp is IDocument) + comp.setDocument(document, id); + comps.push(comp); + } + return comps; + } + + public static function generateMXMLInstances(document:Object, parent:IParent, data:Array, recursive:Boolean = true):void + { + if (!data) return; + + generateMXMLArray(document, parent, data, recursive); + } + + public static function generateMXMLProperties(host:Object, data:Array):void + { + if (!data) return; + + var i:int = 0; + var m:int; + var j:int; + var name:String; + var simple:*; + var value:Object; + var id:String = null; + + m = data[i++]; // num props + var beadOffset:int = i + (m - 1) * 3; + if (beadOffset >= -1) + trace(beadOffset, data[beadOffset]); + if (m > 0 && data[beadOffset] == "beads") + { + m--; + } + else + beadOffset = -1; + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(host, null, value as Array, true); + else if (simple == false) + value = generateMXMLObject(host, value as Array); + if (name == "id") + id = value as String; + if (name == "_id") + id = value as String; // and don't assign + else + host[name] = value; + } + if (beadOffset > -1) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(host, null, value as Array, true); + else if (simple == false) + value = generateMXMLObject(host, value as Array); + else + host[name] = value; + var beads:Array = value as Array; + var l:int = beads.length; + for (var k:int = 0; k < l; k++) + { + var bead:IBead = beads[k] as IBead; + IStrand(host).addBead(bead); + bead.strand = host as IStrand; + } + } + m = data[i++]; // num styles + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(host, null, value as Array, true); + else if (simple == false) + value = generateMXMLObject(host, value as Array); + host[name] = value; + } + + m = data[i++]; // num effects + for (j = 0; j < m; j++) + { + name = data[i++]; + simple = data[i++]; + value = data[i++]; + if (simple == null) + value = generateMXMLArray(host, null, value as Array, true); + else if (simple == false) + value = generateMXMLObject(host, value as Array); + host[name] = value; + } + + m = data[i++]; // num events + for (j = 0; j < m; j++) + { + name = data[i++]; + value = data[i++]; + host.addEventListener(name, value as Function); + } + } + +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/SolidBorderUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/SolidBorderUtil.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/SolidBorderUtil.as new file mode 100644 index 0000000..cb43da1 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/SolidBorderUtil.as @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ + import flash.display.Graphics; + +public class SolidBorderUtil +{ + public static function drawBorder(g:Graphics, x:Number, y:Number, + width:Number, height:Number, + color:uint, backgroundColor:Object = null, + thickness:int = 1, alpha:Number = 1.0):void + { + g.lineStyle(thickness, color, alpha); + if (backgroundColor != null) + g.beginFill(uint(backgroundColor)); + + g.drawRect(x, y, width, height); + if (backgroundColor != null) + g.endFill(); + } +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/Timer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/Timer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/Timer.as new file mode 100644 index 0000000..541ddfd --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/Timer.as @@ -0,0 +1,45 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ +import flash.events.TimerEvent; +import flash.utils.Timer; + +import org.apache.flex.events.Event; + +[Event(name="timer", type="org.apache.flex.events.Event")] + +public class Timer extends flash.utils.Timer +{ + public function Timer(delay:Number, repeatCount:int = 0) + { + super(delay, repeatCount); + addEventListener("timer", interceptor, false, 9999); + } + + private function interceptor(event:flash.events.Event):void + { + if (event is TimerEvent) + { + event.stopImmediatePropagation(); + dispatchEvent(new Event("timer")); + } + } +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/ViewSourceContextMenuOption.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/ViewSourceContextMenuOption.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/ViewSourceContextMenuOption.as new file mode 100644 index 0000000..e119377 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/utils/ViewSourceContextMenuOption.as @@ -0,0 +1,63 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.utils +{ + +import flash.display.InteractiveObject; +import flash.events.ContextMenuEvent; +import flash.net.URLRequest; +import flash.net.navigateToURL; +import flash.ui.ContextMenu; +import flash.ui.ContextMenuItem; + +import org.apache.flex.core.IBead; +import org.apache.flex.core.IStrand; + +public class ViewSourceContextMenuOption implements IBead +{ + public function ViewSourceContextMenuOption() + { + } + + private var _strand:IStrand; + + public function set strand(value:IStrand):void + { + _strand = value; + + var menuHost:InteractiveObject = InteractiveObject(value); + var cm:ContextMenu = menuHost.contextMenu; + if (!cm) + { + cm = new ContextMenu(); + menuHost.contextMenu = cm; + } + var cmi:ContextMenuItem = new ContextMenuItem("View Source..."); + cm.hideBuiltInItems(); + cm.customItems.push(cmi); + cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, viewSource); + } + + private function viewSource(e:ContextMenuEvent):void + { + var urlRequest:URLRequest = new URLRequest("srcview/index.html"); + navigateToURL(urlRequest, "_blank"); + } +} +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/66246d8a/frameworks/as/projects/FlexJSUI/svg-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/svg-manifest.xml b/frameworks/as/projects/FlexJSUI/svg-manifest.xml new file mode 100644 index 0000000..89d7728 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/svg-manifest.xml @@ -0,0 +1,26 @@ + + + + + + + + +