Updates to get TodoListSample to work correctly.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b98da070 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b98da070 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b98da070 Branch: refs/heads/dual Commit: b98da07034f246b4abe3f9ca98449f4a16415353 Parents: fa9e044 Author: Peter Ent <[email protected]> Authored: Mon Apr 10 16:54:12 2017 -0400 Committer: Peter Ent <[email protected]> Committed: Mon Apr 10 16:54:12 2017 -0400 ---------------------------------------------------------------------- .../sample/todo/renderers/TodoItemRenderer.as | 91 -------------------- .../sample/todo/renderers/TodoItemRenderer.mxml | 58 +++++++++++++ .../flex/sample/todo/views/TodoListView.mxml | 68 ++++++++------- .../flex/html/beads/PanelWithControlBarView.as | 2 + 4 files changed, 95 insertions(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b98da070/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.as b/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.as deleted file mode 100644 index f13c054..0000000 --- a/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.as +++ /dev/null @@ -1,91 +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 sample.todo.renderers { - - import org.apache.flex.core.SimpleCSSStyles; - import org.apache.flex.events.Event; - import org.apache.flex.events.MouseEvent; - import org.apache.flex.html.Button; - import org.apache.flex.html.CheckBox; - import org.apache.flex.html.Group; - import org.apache.flex.html.Label; - import org.apache.flex.html.beads.layouts.HorizontalFlexLayout; - import org.apache.flex.html.supportClasses.DataItemRenderer; - - [Event("checkChanged","org.apache.flex.events.Event")] - [Event("removeRequest","org.apache.flex.events.Event")] - - public class TodoItemRenderer extends DataItemRenderer { - - public function TodoItemRenderer() { - super(); - className = "TodoItemRenderer"; - } - - private var group:Group; - - private var checkbox:CheckBox; - private var title:Label; - private var removeButton:Button; - - override public function addedToParent():void { - super.addedToParent(); - - group = new Group(); - group.percentWidth = 100; - group.percentHeight = 100; - group.addBead(new HorizontalFlexLayout()); - addElement(group); - - checkbox = new CheckBox(); - group.addElement(checkbox); - checkbox.addEventListener("change", checkBoxChange); - - title = new Label(); - title.className = "RendererText"; - group.addElement(title); - - removeButton = new Button(); - removeButton.className = "RemoveButton"; - group.addElement(removeButton); - removeButton.addEventListener("click", removeClick); - } - - override public function set data(value:Object):void { - super.data = value; - - checkbox.selected = data.selected; - title.text = data.title; - } - - override public function adjustSize():void { - updateRenderer(); - } - - private function checkBoxChange(event:Event):void - { - dispatchEvent(new Event("checkChanged")); - } - - private function removeClick(event:MouseEvent):void - { - dispatchEvent(new Event("removeRequest")); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b98da070/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.mxml b/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.mxml new file mode 100644 index 0000000..2d51c56 --- /dev/null +++ b/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/renderers/TodoItemRenderer.mxml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +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. + +--> +<js:MXMLItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:svg="library://ns.apache.org/flexjs/svg" + width="100%" height="40" + className="TodoItemRenderer2"> + + <fx:Script> + <![CDATA[ + + import org.apache.flex.events.Event; + import org.apache.flex.events.MouseEvent; + + private function checkBoxChange():void + { + dispatchEvent(new org.apache.flex.events.Event("checkChanged")); + } + + private function removeClick():void + { + dispatchEvent(new org.apache.flex.events.Event("removeRequest")); + } + ]]> + </fx:Script> + + <js:beads> + <js:HorizontalFlexLayout /> + <js:ItemRendererDataBinding /> + </js:beads> + + <js:CheckBox text="{data.title}" + selected="{data.selected}" + className="RendererText" + change="checkBoxChange()" /> + + <js:Button className="RemoveButton" + click="removeClick()" /> + +</js:MXMLItemRenderer> + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b98da070/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/views/TodoListView.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/views/TodoListView.mxml b/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/views/TodoListView.mxml index 967fd32..563d1f0 100644 --- a/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/views/TodoListView.mxml +++ b/examples/flexjs/TodoListSampleApp/src/main/flex/sample/todo/views/TodoListView.mxml @@ -23,6 +23,32 @@ limitations under the License. initComplete="setup()" xmlns:renderers="sample.todo.renderers.*"> + <fx:Style> + @namespace basic "library://ns.apache.org/flexjs/basic"; + @namespace renderers "sample.todo.renderers.*"; + + renderers|TodoItemRenderer2 { + backgroundColor: #FFFF; + height: 40px; + padding: 4px; + IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController"); + } + + .RendererText { + flex-grow: 1; + } + + .RemoveButton { + width: 16px; + height: 16px; + border: solid 1px red; + } + + .StatusText { + flex-grow: 1; + } + </fx:Style> + <fx:Script> <