Repository: flex-radii8 Updated Branches: refs/heads/master [created] f370bfcf4
http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/modules/InspectorContainer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/modules/InspectorContainer.mxml b/Radii8Remote/src/modules/InspectorContainer.mxml new file mode 100644 index 0000000..7cd3deb --- /dev/null +++ b/Radii8Remote/src/modules/InspectorContainer.mxml @@ -0,0 +1,724 @@ +<?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. + +--> +<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + width="400" height="100%" + minHeight="250" + styleName="shadow" + creationComplete="init(event)" + stateChangeComplete="module1_stateChangeCompleteHandler(event)" + > + + <fx:Style> + @namespace s "library://ns.adobe.com/flex/spark"; + @namespace mx "library://ns.adobe.com/flex/mx"; + .shadow { + textShadowColor:red; + } + </fx:Style> + <fx:Script> + <![CDATA[ + import flash.utils.flash_proxy; + + import mx.collections.ArrayList; + import mx.events.FlexEvent; + import mx.events.MenuEvent; + + import data.Perspective; + + import managers.RemoteManager; + + import renderers.OnlineViewRenderer;OnlineViewRenderer; + import renderers.PerspectivesViewRenderer;PerspectivesViewRenderer; + import renderers.ViewRenderer; + + import spark.events.IndexChangeEvent; + + ///////////////////////////////////////////////////////// + /// CONSTANTS + ///////////////////////////////////////////////////////// + public const HOME_STATE:String = "home"; + public const ONLINE_STATE:String = "online"; + public const VIEWS_STATE:String = "views"; + public const SETTINGS_STATE:String = "settings"; + public const PERSPECTIVES_STATE:String = "perspectives"; + public const LOADING_STATE:String = "loading"; + + public const SHARED_OBJECT_NAME:String = "save"; + public const ITEMS_UPDATED:String = "itemsUpdated"; + public const ITEMS_UPDATE_FAULT:String = "itemsUpdateFault"; + public const SETTINGS_CHANGE:String = "settingChange"; + + ///////////////////////////////////////////////////////// + /// Variables + ///////////////////////////////////////////////////////// + + /** + * + * */ + [Bindable] + public var itemRenderer:ClassFactory = new ClassFactory(ViewRenderer); + + + ///////////////////////////////////////////////////////// + /// Methods + ///////////////////////////////////////////////////////// + + /** + * + * */ + public var clearSharedObject:Boolean = true; + + /** + * + * */ + public var remoteManager:RemoteManager = RemoteManager.getInstance(); + + + /** + * Register classes for saving settings + * */ + protected function init(event:FlexEvent):void { + RemoteManager.init(clearSharedObject); + + // listen to changes to settings and save + remoteManager.addEventListener(SETTINGS_CHANGE, settingChangeHandler); + } + + /** + * Saves changes to settings when dispatched from modules + * */ + public static function settingChangeHandler(event:Event):void { + RemoteManager.saveSettings(); + } + + + /** + * Handle when view menu item is selected + * */ + private function menuHandler(event:MenuEvent):void { + var name:String = String(event.item.@label); + var stateName:String = String(event.item.@stateName); + var menuItem:Object = event.item; + + if (menuItem.@groupName=="perspectives") { + var perspective:Perspective = remoteManager.findPerspectiveByName(menuItem.@label); + RemoteManager.selectedPerspective = perspective; + RemoteManager.remoteItemsList.refresh(); + changeStates(VIEWS_STATE); + + } + // Donât open the Alert for a menu bar item that + // opens a popup submenu. + else if (menuItem.@data != "top") { + + //Alert.show("Label: " + event.item.@label + "\n" + "Data: " + event.item.@data, "Clicked menu item"); + var item:Object = focusManager.getFocus(); + if (item is MenuBar) { + trace("is checkbox"); + } + + //event.preventDefault(); + + //FlexGlobals.topLevelApplication.setFocus();//setFocus(); + //onlineList.setStyle("verticalScrollPolicy", "off"); + //setTimeout(changeStates, 1000, stateName); + changeStates(stateName); + } + } + + /** + * Update title when state changes + * */ + protected function module1_stateChangeCompleteHandler(event:FlexEvent):void { + updateTitleLabel(); + } + + /** + * Update title of general view + * */ + private function updateTitleLabel():void { + + if (currentState==HOME_STATE) { + titleLabel.text = "Home"; + } + else if (currentState==SETTINGS_STATE) { + titleLabel.text = "Settings"; + } + else if (currentState==ONLINE_STATE) { + titleLabel.text = "Available Views"; + } + else if (currentState==VIEWS_STATE) { + titleLabel.text = "Views"; + } + else if (currentState==PERSPECTIVES_STATE) { + titleLabel.text = "Perspectives"; + } + else if (currentState==LOADING_STATE) { + titleLabel.text = "Loading"; + } + } + + /** + * Changes state + * */ + private function changeStates(name:String):void { + + if (name==HOME_STATE) { + currentState = HOME_STATE; + } + else if (name==SETTINGS_STATE) { + currentState = SETTINGS_STATE; + } + else if (name==ONLINE_STATE) { + if (!RemoteManager.remoteItemsList.length) { + remoteManager.getRemoteItems(); + } + currentState = ONLINE_STATE; + } + else if (name==VIEWS_STATE) { + currentState = VIEWS_STATE; + } + else if (name==PERSPECTIVES_STATE) { + currentState = PERSPECTIVES_STATE; + } + else if (name==LOADING_STATE) { + currentState = LOADING_STATE; + } + + } + + /** + * Sets the label of the mini right arrow menu item. Hides the root menu item from showing a value + * */ + private function menuLabelFunction(item:Object):String { + + if (item.@menuRoot==true) { + //return " "; + } + + return String(item.@label); + } + + /** + * Goes to online state + * */ + protected function showOnlineViewHandler(event:MouseEvent):void { + changeStates(ONLINE_STATE); + } + + /** + * Goes to views state + * */ + protected function showViewsHandler(event:MouseEvent):void { + changeStates(VIEWS_STATE); + } + + + /** + * Add perspective + * */ + protected function addPerspectives_clickHandler(event:Event):void { + var name:String = newPerspectiveNameInput.text; + var perspective:Perspective = remoteManager.createPerspective(newPerspectiveNameInput.text); + RemoteManager.saveSettings(); + perspectivesCollection.refresh(); + var list:XMLList = menuItemsXMLList.(@label=="Perspectives").item; + var item = '<item label="'+perspective.name+'" groupName="perspectives" type="radio" toggled="true"/>'; + //list.prependChild(); + var newXML:XML = new XML("<menu>"+item + list.toXMLString()+"</menu>"); + var nList:XMLList = menuItemsXMLList.(@label=="Perspectives").item; + //var nList = menuItemsXMLList.(@label=="Perspectives").item; + for ( var i:int = list.length() - 1; i >= 0; i-- ) { + delete list[i]; + } + + var nList2:XML = menuItemsXMLList.(@label=="Perspectives")[0]; + nList2.menu = newXML.item; + //nList.children = undefined; + //delete nList[0][0]; + newPerspectiveNameInput.text = ""; + menuCollection.refresh(); + } + + + /** + * Updates the default perspective items + * */ + public function updateDefaultItems():void { + // + } + + /** + * Load list of remote items + * */ + protected function loadRemoteViews(event:MouseEvent):void { + changeStates(LOADING_STATE); + + remoteManager.getRemoteItems(); + } + + /** + * Filters out items not in the selected perspective + * */ + public function filterItemsFunction(item:Object):Boolean { + var types:Array = RemoteManager.selectedPerspective.types; + var count:int = types ? types.length : 0; + + for (var i:int;i<count;i++) { + if (types[i]==item.type) { + return true; + } + } + + return false; + } + + protected function continueOnlineViewsSelection_clickHandler(event:MouseEvent):void { + selectedItems.refresh(); + RemoteManager.saveSettings(); + changeStates(VIEWS_STATE); + } + + protected function selectedItemsRefresh_clickHandler(event:MouseEvent):void { + + selectedItems.refresh(); + } + + protected function perspectivesDropDownList_changeHandler(event:IndexChangeEvent):void { + + if (event.newIndex>-1) { + var p:Object = perspectivesCollection.getItemAt(event.newIndex); + RemoteManager.selectedPerspective = perspectivesCollection.getItemAt(event.newIndex) as Perspective; + RemoteManager.remoteItemsList.refresh(); + } + } + + protected function perspectivesList_changeHandler(event:IndexChangeEvent):void { + + if (event.newIndex>-1) { + var p:Object = perspectivesCollection.getItemAt(event.newIndex); + RemoteManager.selectedPerspective = perspectivesCollection.getItemAt(event.newIndex) as Perspective; + RemoteManager.remoteItemsList.refresh(); + } + } + + ]]> + </fx:Script> + + <fx:Declarations> + <!-- Place non-visual elements (e.g., services, value objects) here --> + <fx:Model id="menuBarModel"> + <root> + <menu label="File..."> + <item label="New" /> + <item label="Open" /> + <item label="Save" /> + <item label="Save As" /> + <fake type="separator" /> + <item label="Exit" /> + </menu> + <menu label="Edit..."> + <item label="Cut" /> + <item label="Copy" /> + <item label="Paste" /> + <fake type="separator" /> + <item label="Undo" /> + <item label="Redo" /> + <fake type="separator" /> + <item label="radio button" type="radio" toggled="true" /> + <item label="check box" type="check" toggled="true" /> + </menu> + <menu label="Help" /> + </root> + </fx:Model> + + <fx:XMLList id="viewsXMLList" xmlns=""> + <item label="Home" stateName="home" type="radio" groupName="view" toggled="true" /> + <item label="Views" stateName="views" type="radio" groupName="view" toggled="false" /> + <item label="Perspectives" stateName="perspectives" type="radio" groupName="view" toggled="false" /> + <item label="Settings" stateName="settings" type="radio" groupName="view" toggled="false" /> + <item label="Online" stateName="online" type="radio" groupName="view" toggled="false" /> + </fx:XMLList> + + + <fx:XMLList id="perspectivesXMLList" xmlns=""> + <item label="Default" toggled="false" groupName="perspectives" /> + <fake type="separator" /> + <item label="Settings" stateName="settings" type="radio" groupName="perspectives" /> + </fx:XMLList> + + <fx:XMLList id="menuItemsXMLList" xmlns=""> + <menu label="Perspectives"> + <item label="Default" groupName="perspectives" type="radio" toggled="true" /> + <item type="separator" /> + <item label="Settings" stateName="settings" groupName="perspectives" /> + </menu> + <menu label="Screens" menuRoot="true"> + <item label="Home" stateName="home" type="radio" groupName="view" toggled="true" /> + <item label="Views" stateName="views" type="radio" groupName="view" toggled="false" /> + <item label="Perspectives" stateName="perspectives" type="radio" groupName="view" toggled="false" /> + <item label="Online" stateName="online" type="radio" groupName="view" toggled="false" /> + <item label="Settings" stateName="settings" type="radio" groupName="view" toggled="false" /> + </menu> + </fx:XMLList> + + <s:ArrayCollection id="perspectivesCollection" source="{RemoteManager.perspectives}"/> + <s:ArrayCollection id="selectedPerspectiveItemsCollection" source="{RemoteManager.preferences.selectedPerspective.items}"/> + + <s:ArrayCollection id="selectedItems" + source="{RemoteManager.remoteItemsList.source}" + filterFunction="filterItemsFunction"/> + + </fx:Declarations> + + <s:transitions> + <s:Transition fromState="home" interruptionBehavior="stop" toState="settings"> + <s:Parallel target="{menuBar2}"> + <s:Animate duration="500"> + <s:SimpleMotionPath property="x" valueBy="-250"/> + <s:SimpleMotionPath property="y" valueBy="0"/> + </s:Animate> + <s:Fade duration="250" startDelay="250"/> + </s:Parallel> + </s:Transition> + </s:transitions> + + + <s:states> + <s:State name="home"/> + <s:State name="loading"/> + <s:State name="settings"/> + <s:State name="online"/> + <s:State name="views"/> + <s:State name="perspectives"/> + </s:states> + + + <s:VGroup width="100%" height="100%" + top="30" + clipAndEnableScrolling="true"> + + <!-- HOME --> + <s:Group width="100%" height="100%" includeIn="home"> + <s:VGroup width="100%" verticalCenter="0" horizontalAlign="center"> + <s:Label text="Welcome
Push the start button to get views from the server" + textAlign="center"/> + <s:Spacer height="10"/> + <s:Button label="Start" click="loadRemoteViews(event)"/> + </s:VGroup> + </s:Group> + + + <!-- LOADING --> + <s:Group width="100%" height="100%" includeIn="loading"> + <s:VGroup horizontalCenter="0" verticalCenter="00"> + <s:Label text="Loading remote items"/> + <s:Label id="loadingStatusText" + text="{RemoteManager.loadingStatusText}" + /> + <mx:ProgressBar visible="{RemoteManager.retrievingData}" + hideEffect="Fade" + label="" + height="10" + indeterminate="true"/> + <s:HGroup width="100%"> + <s:Button label="Reload" + click="loadRemoteViews(event)"/> + <s:Button label="Continue" + enabled="{RemoteManager.itemsReceived}" + click="showOnlineViewHandler(event)"/> + </s:HGroup> + </s:VGroup> + </s:Group> + + + + <!-- ALL VIEWS AVAILABLE ONLINE --> + <s:VGroup width="100%" + height="100%" + paddingBottom="2" paddingLeft="2" + paddingRight="2" paddingTop="2" + includeIn="online" > + + <s:Spacer height="10"/> + + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:Label text="Select the views to show in the perspective selected and click continue"/> + <s:Spacer width="100%" height="10"/> + </s:HGroup> + + <s:HGroup gap="1" width="100%"> + <!--<s:Label text="Enabled"/> + <s:Label text="Panel"/>--> + <s:Line width="100%"> + <s:stroke> + <s:SolidColorStroke weight="2" /> + </s:stroke> + </s:Line> + </s:HGroup> + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:DropDownList id="perspectivesDropDownList" + width="100%" + dataProvider="{perspectivesCollection}" + labelField="name" + selectedItem="{RemoteManager.selectedPerspective}" + change="perspectivesDropDownList_changeHandler(event)"/> + <s:Spacer width="100%" height="10"/> + <s:Label text="Enabled"/> + </s:HGroup> + + <s:HGroup gap="1" width="100%"> + <!--<s:Label text="Enabled"/> + <s:Label text="Panel"/>--> + <s:Line width="100%"> + <s:stroke> + <s:SolidColorStroke weight="2" /> + </s:stroke> + </s:Line> + </s:HGroup> + + <s:List id="onlineList" + dataProvider="{RemoteManager.remoteItemsList}" + itemRenderer="{new ClassFactory(OnlineViewRenderer)}" + width="100%" + borderVisible="false" + height="100%" + horizontalScrollPolicy="off" + > + + </s:List> + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:TextInput id="searchInput" + prompt="Search" + borderAlpha=".5"/> + <s:Spacer width="100%" height="10"/> + <s:Button label="Continue" click="continueOnlineViewsSelection_clickHandler(event)"/> + </s:HGroup> + </s:VGroup> + + + <!-- VIEWS --> + <s:VGroup width="100%" + height="100%" + paddingBottom="2" paddingLeft="2" + paddingRight="2" paddingTop="2" + includeIn="views"> + + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:Label text="Views in the current perspective" width="100%"/> + <s:Spacer width="100%" height="10"/> + <s:TextInput id="searchViewsInput" focusAlpha="0" prompt="filter"/> + </s:HGroup> + + <s:HGroup gap="1" width="100%"> + <s:Line width="100%"> + <s:stroke> + <s:SolidColorStroke weight="1" /> + </s:stroke> + </s:Line> + </s:HGroup> + + + <s:HGroup gap="1" width="100%"> + <s:ModuleLoader url="modules/Tools.swf" width="100%"/> + </s:HGroup> + + <s:HGroup gap="1" width="100%"> + <s:Line width="100%"> + <s:stroke> + <s:SolidColorStroke weight="1" /> + </s:stroke> + </s:Line> + </s:HGroup> + + <!-- EXAMPLE RADIATE CONTAINER --> + <s:Scroller id="radiateScroller" + width="100%" + height="100%" + left="0" + right="0" + top="0" + bottom="0"> + + <s:DataGroup id="panels" width="100%" height="100%" + clipAndEnableScrolling="true" + itemRenderer="renderers.ModuleItemRenderer" + dataProvider="{selectedItems}" + > + + <s:layout> + <s:VerticalLayout horizontalAlign="justify" + useVirtualLayout="false" + variableRowHeight="true" + paddingRight="10" paddingLeft="10"/> + </s:layout> + + </s:DataGroup> + + </s:Scroller> + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:Spacer width="100%" height="10"/> + <s:Button label="Refresh" click="selectedItemsRefresh_clickHandler(event)"/> + </s:HGroup> + + </s:VGroup> + + + <!-- SETTINGS --> + <s:VGroup width="100%" + paddingBottom="2" paddingLeft="2" + paddingRight="2" paddingTop="2" + includeIn="settings"> + + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:Label text="Panel width:" /> + <s:TextInput id="panelWidth" widthInChars="3"/> + <s:Spacer width="100%" height="10"/> + </s:HGroup> + + <s:Label id="settingsLabel" + text="Show views for {RemoteManager.preferences.selectedPerspective.name}" + width="100%" backgroundColor="#cccccc"/> + + + <s:List dataProvider="{selectedItems}" + itemRenderer="{itemRenderer}" + width="100%" + dropEnabled="true" + dragEnabled="true" + dragMoveEnabled="true" + borderVisible="false" + > + <s:layout> + <s:VerticalLayout horizontalAlign="contentJustify" verticalAlign="middle" + /> + </s:layout> + + </s:List> + + <s:Label text="Tools" width="100%" backgroundColor="#cccccc"/> + + <!--<s:Button id="showHomeButton" + label="Home" + click="showHomeButton_clickHandler(event)"/>--> + + <!--<s:HGroup gap="1"> + <s:Label text="..." toolTip="Enabled"/> + <s:Label text="Panel"/> + </s:HGroup>--> + + <s:List dataProvider="{selectedPerspectiveItemsCollection}" + itemRenderer="{itemRenderer}" + width="100%" + dropEnabled="true" + dragEnabled="true" + dragMoveEnabled="true" + borderVisible="false" + > + <s:layout> + <s:VerticalLayout horizontalAlign="contentJustify" verticalAlign="middle" + /> + </s:layout> + + </s:List> + </s:VGroup> + + + <!-- PERSPECTIVES --> + <s:VGroup width="100%" + paddingBottom="2" paddingLeft="2" + paddingRight="2" paddingTop="2" + includeIn="perspectives"> + + + <s:Label text="Select the perspective" width="100%"/> + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:TextInput id="searchPerspectivesInput" prompt="Search" /> + <s:Spacer width="100%" height="10"/> + <!--<s:Button label="Home" + click="showHomeButton_clickHandler(event)"/>--> + <!--<s:Label text="ONLINE"/>--> + </s:HGroup> + + <s:HGroup gap="1" width="100%"> + <!--<s:Label text="Enabled"/> + <s:Label text="Panel"/>--> + <s:Line width="100%"> + <s:stroke> + <s:SolidColorStroke weight="1" /> + </s:stroke> + </s:Line> + </s:HGroup> + + <s:List id="perspectivesList" + dataProvider="{perspectivesCollection}" + itemRenderer="{new ClassFactory(PerspectivesViewRenderer)}" + change="perspectivesList_changeHandler(event)" + width="100%" + borderVisible="false" + > + + </s:List> + + <s:HGroup width="100%" gap="1" verticalAlign="middle"> + <s:TextInput id="newPerspectiveNameInput" width="100%" /> + <s:Button label="Add" + click="addPerspectives_clickHandler(event)"/> + </s:HGroup> + </s:VGroup> + + </s:VGroup> + + <!-- CURRENT STATE LABEL--> + <s:Label id="titleLabel" right="26" top="4" visible="false"/> + + <!-- MORE ICON --> + <s:Image source="@Embed('assets/icons/more.png')" + top="2" right="2" + width="22" height="20" + visible="false"/> + + <mx:MenuBar id="menuBar2" + focusEnabled="false" + hasFocusableChildren="false" + labelField="@label" + itemClick="menuHandler(event)" + labelFunction="menuLabelFunction" + backgroundSkin="{null}" + cornerRadius="0" + top="0" left="-20" + height="28" + useHandCursor="true" + buttonMode="true" + > + <mx:dataProvider> + <s:XMLListCollection id="menuCollection">{menuItemsXMLList}</s:XMLListCollection> + </mx:dataProvider> + </mx:MenuBar> +</s:Group> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/modules/Layers.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/modules/Layers.mxml b/Radii8Remote/src/modules/Layers.mxml new file mode 100644 index 0000000..2752b24 --- /dev/null +++ b/Radii8Remote/src/modules/Layers.mxml @@ -0,0 +1,44 @@ +<?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. + +--> +<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + xmlns:views="com.flexcapacitor.views.*" + width="100%" height="100%" + minHeight="300" + minWidth="200"> + + + <s:Rect width="100%" height="100%"> + <s:fill> + <s:SolidColor color="#0000ff" alpha=".05"/> + </s:fill> + <s:stroke> + <s:SolidColorStroke color="#000000" weight="1" alpha=".1"/> + </s:stroke> + </s:Rect> + + + <views:DisplayList width="100%" height="100%" + bottom="0" top="0" + contentBackgroundAlpha="0" + /> + +</s:Module> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/modules/PropertiesExample.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/modules/PropertiesExample.mxml b/Radii8Remote/src/modules/PropertiesExample.mxml new file mode 100644 index 0000000..8dea3b2 --- /dev/null +++ b/Radii8Remote/src/modules/PropertiesExample.mxml @@ -0,0 +1,54 @@ +<?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. + +--> +<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"> + + <fx:Script> + <![CDATA[ + protected function button1_clickHandler(event:MouseEvent):void { + + if (height == 100) { + height = 300; + } + else { + height = 100; + } + + } + ]]> + </fx:Script> + + <fx:Declarations> + <!-- Place non-visual elements (e.g., services, value objects) here --> + </fx:Declarations> + + <s:Rect width="100%" height="100%"> + <s:stroke> + <s:SolidColorStroke color="#ff0000"/> + </s:stroke> + </s:Rect> + + <s:Label horizontalCenter="0" verticalCenter="0" + text="Properties Example"/> + + <s:Button label="change size" click="button1_clickHandler(event)"/> + +</s:Module> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/modules/Tools.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/modules/Tools.mxml b/Radii8Remote/src/modules/Tools.mxml new file mode 100644 index 0000000..c64b1bb --- /dev/null +++ b/Radii8Remote/src/modules/Tools.mxml @@ -0,0 +1,295 @@ +<?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. + +--> +<s:Module xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + xmlns:controls="com.flexcapacitor.controls.*" + width="100%" height="100%" + > + + <fx:Script> + <![CDATA[ + import com.flexcapacitor.controller.Radiate; + import com.flexcapacitor.events.DragDropEvent; + import com.flexcapacitor.utils.DisplayObjectUtils; + import com.flexcapacitor.utils.DragManagerUtil; + import com.flexcapacitor.utils.supportClasses.ComponentDescription; + + import mx.core.EventPriority; + import mx.core.FlexGlobals; + import mx.core.IUIComponent; + import mx.events.FlexMouseEvent; + import mx.managers.SystemManager; + + import spark.components.Application; + import spark.components.List; + + public var radiate:Radiate = Radiate.instance; + public var toggleMode:Boolean = true; + + private var targetApplication:Object; + private var dragManagerInstance:DragManagerUtil; + private var selectionToolEnabled:Boolean; + private var possibleTarget:Object; + + public function set targets(values:Array):void { + + for (var i:int;values.length;i++) { + trace("tool = " + values[i]); + } + } + + /* + mouseUp="imagebutton1_mouseUpHandler(event)" + mouseOut="imagebutton1_mouseUpHandler(event)" + mouseDownOutside="imagebutton1_mouseDownOutsideHandler(event)" + */ + protected function image1_clickHandler(event:MouseEvent):void { + //Radiate.getInstance().setTarget(event.currentTarget); + + if (!selectionToolEnabled) { + selectionToolEnabled = true; + enableSelectionTool(); + } + else { + deselectSelectionTool(); + } + } + + /** + * Click handler added to stage + * We only check the target if the alt key is down + * If the shift key is down also then we enter the debugger + * Press step into to bring the debugger to the check target method + * In that method you can check details in the target property + * */ + protected function handleClick(event:MouseEvent):void { + + event.stopImmediatePropagation(); + /* + if (enabled) { + if (event.ctrlKey) { + // we are intercepting this event so we can inspect the target + // stop the event propagation + event.stopImmediatePropagation(); + checkTarget(event); + } + } */ + } + + /** + * Gets the current target and traces it to the console + * */ + private function checkTarget(event:MouseEvent):void { + /* var rootComponent:ComponentItem = document ? getComponentDisplayList(document) : getComponentDisplayList(FlexGlobals.topLevelApplication); + var componentItem:ComponentItem= getComponentFromDisplayObject(DisplayObject(event.target), rootComponent); + var target:DisplayObject = event.target as DisplayObject; + + + if (showDisplayObjectInformation) { + if (event.altKey) { + message = getComponentDetails(componentItem.accessPath, true); + } + else { + message = getComponentDetails(componentItem, false); + } + } + else { + // NOT SUPPORTED YET + //message = getDisplayObjectDetails(event.target); + } + + + trace(message); + + + // The purpose of this is to check the properties on the target + if (event.shiftKey) { + + // the debugger doesn't take you here until you press step into or step over + trace("\n// Click your heels three times and step in..."); + + // the target object contains the item you clicked on + enterDebugger(); + } */ + } + protected function image2_clickHandler(event:MouseEvent):void { + Radiate.setDocuments(FlexGlobals.topLevelApplication); + } + + protected function stageClick_Handler(event:MouseEvent):void { + var componentTree:ComponentDescription; + var description:ComponentDescription; + var target:Object = event.target; + + /* if (target == stage) { + return; + } */ + + + if (toggleMode) { + deselectSelectionTool(); + } + + possibleTarget = target; + + + event.stopImmediatePropagation(); + event.stopPropagation(); + event.preventDefault(); + + radiate.setTarget(target); + /* + if (target) { + // select target on mouse up or drag drop whichever comes first + target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true, EventPriority.BINDING, true); + target.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, false, EventPriority.BINDING, true); + + + // drag support + if (false) {//target!=targetApplication) { + + // listen for drag + if (!dragManagerInstance) { + dragManagerInstance = new DragManagerUtil(); + } + + //target.visible = false; + dragManagerInstance.listenForDragBehavior(target as IUIComponent, radiate.document as Application, event); + dragManagerInstance.addEventListener(DragDropEvent.DRAG_DROP, handleDragDrop); + } + } */ + + + + return; + + var point:Point = new Point(event.stageX, event.stageY); + var targetsUnderPoint:Array = radiate.getNonNullDocument().getObjectsUnderPoint(point); + targetApplication = Radiate.getInstance().getNonNullDocument(); + + // clicked outside of this container. is there a way to prevent hearing + // events from everywhere? stage sandboxroot? + if (!targetApplication || !Object(targetApplication).contains(target)) { + //trace("does not contain"); + return; + } + + // clicked on background area + if (target==targetApplication || target==this) { + radiate.setTarget(targetApplication, true); + return; + } + + } + + protected function handleDragDrop(event:DragDropEvent):void { + // select target + //radiate.target = event.draggedItem; + } + + protected function mouseUpHandler(event:MouseEvent):void { + var target:Object = event.currentTarget; + + if (target is List) { + target.dragEnabled = true; // restore drag and drop if it was enabled + } + + target.visible = true; // because we were dragging + + // select target + if (radiate.target!=target) { + radiate.setTarget(target); + } + + event.stopPropagation(); + event.stopImmediatePropagation(); + event.preventDefault(); + + // clean up + target.removeEventListener(MouseEvent.MOUSE_UP, arguments.callee); + + if (toggleMode) { + deselectSelectionTool(); + } + + } + + protected function imagebutton1_mouseUpHandler(event:MouseEvent):void { + + //stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); + //stage.addEventListener("mouseDownOutside", mouseDownOutsideHandler); + //stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + } + + protected function imagebutton1_mouseDownOutsideHandler(event:FlexMouseEvent):void { + //enableSelectionTool = false; + } + + protected function mouseMoveHandler(event:MouseEvent):void { + trace("MOUSE MOVE"); + } + + protected function mouseDownOutsideHandler(event:Event):void { + trace("MOUSE DOWN OUTSIDE"); + } + + /** + * Remove stage listeners + * */ + private function deselectSelectionTool():void { + selectionToolEnabled = false; + //stage.removeEventListener(MouseEvent.MOUSE_DOWN, stageClick_Handler); + //stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); + stage.removeEventListener(MouseEvent.CLICK, stageClick_Handler, true); + selectionButton.setStyle("backgroundAlpha", 0); + } + + /** + * Listen to the stage for click events + * */ + private function enableSelectionTool():void { + systemManager.stage.addEventListener(MouseEvent.CLICK, stageClick_Handler, true, EventPriority.BINDING, true); + selectionButton.setStyle("backgroundAlpha", .1); + } + + ]]> + </fx:Script> + + <fx:Declarations> + <!-- Place non-visual elements (e.g., services, value objects) here --> + </fx:Declarations> + + <s:HGroup width="100%"> + <controls:ImageButton source="{Radii8LibraryAssets.applicationIcon}" + useButtonUpStyle="true" + click="image2_clickHandler(event)" + /> + <controls:ImageButton id="selectionButton" + useButtonUpStyle="true" + backgroundColor="#0" + backgroundAlpha="0" + width="20" + source="{Radii8LibraryAssets.arrow}" + click="image1_clickHandler(event)" + /> + </s:HGroup> + +</s:Module> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/preferences.xml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/preferences.xml b/Radii8Remote/src/preferences.xml new file mode 100644 index 0000000..aa084e6 --- /dev/null +++ b/Radii8Remote/src/preferences.xml @@ -0,0 +1,47 @@ +<?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. + +--> +<root> + <items> + <item name="Properties" url="panel.swf" default="true" type="com.radii8.views.properties"> + <content>Shows the properties of the selected target</content> + </item> + <item name="Properties Example" url="modules/PropertiesExample.swf" type="com.radii8.views.propertiesexample"> + <content>Example that shows the properties of the selected target</content> + </item> + <item name="Outline Example" url="modules/Layers.swf" type="com.radii8.views.layer" default="true"> + <content>Shows the component tree of the selected target</content> + </item> + <item name="Styles" url="panel2.swf" type="com.radii8.views.styles"> + <content>Shows available styles of the selected target</content> + </item> + <item name="Constraints" url="panel2.swf" type="com.radii8.views.constraints"> + <content>Shows the constraint properties of top, bottom, left, right, vertical center and horizontal center</content> + </item> + <item name="History" url="panel2.swf" type="com.radii8.views.history"> + <content>Shows a list of the history of changes with undo and redo support</content> + </item> + <item name="Outline" url="panel2.swf" type="com.radii8.views.outline"> + <content>Shows an tree outline of components. Allows you to select components and set their visibility. This is the component tree not the display list</content> + </item> + <item name="Selector" url="panel2.swf" type="com.radii8.tools.selector" default="true"> + <content>Selects an item</content> + </item> + </items> +</root> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/renderers/ModuleItemRenderer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/renderers/ModuleItemRenderer.mxml b/Radii8Remote/src/renderers/ModuleItemRenderer.mxml new file mode 100644 index 0000000..f6a8ee5 --- /dev/null +++ b/Radii8Remote/src/renderers/ModuleItemRenderer.mxml @@ -0,0 +1,68 @@ +<?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. + +--> +<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + minHeight="50" + autoDrawBackground="false"> + + <fx:Script> + <![CDATA[ + import data.Item; + + import mx.core.mx_internal; + + use namespace mx_internal; + + public var item:Item; + + override public function set data(value:Object):void { + super.data = value; + + item = value as Item; + + if (value) { + module.url = item.url; + nameLabel.text = item.name; + } + else { + nameLabel.text = "item is null"; + } + } + + ]]> + </fx:Script> + + <s:layout> + <s:VerticalLayout /> + </s:layout> + + <s:Label id="nameLabel" + backgroundColor="#F6f6F6" + fontSize="12" + fontWeight="bold" + typographicCase="uppercase" + paddingLeft="8" paddingTop="8" paddingBottom="4" + width="100%"/> + + <s:ModuleLoader id="module" width="100%" height="100%"> + + </s:ModuleLoader> +</s:ItemRenderer> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/renderers/OnlineViewRenderer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/renderers/OnlineViewRenderer.mxml b/Radii8Remote/src/renderers/OnlineViewRenderer.mxml new file mode 100644 index 0000000..6865735 --- /dev/null +++ b/Radii8Remote/src/renderers/OnlineViewRenderer.mxml @@ -0,0 +1,118 @@ +<?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. + +--> +<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + autoDrawBackground="true" + width="100%" + implements="mx.managers.IFocusManagerContainer"> + + <fx:Script> + <![CDATA[ + import data.Item; + import data.Perspective; + + import managers.RemoteManager; + + import mx.core.IFlexDisplayObject; + import mx.managers.ISystemManager; + + public var item:Item; + public var perspective:Perspective; + + override public function set data(value:Object):void { + super.data = value; + + item = value as Item; + + if (!value) { + enabledCheckbox.selected = false; + } + else { + perspective = RemoteManager.selectedPerspective; + + if (perspective.types.indexOf(item.type)!=-1) { + enabledCheckbox.selected = true; + } + else { + enabledCheckbox.selected = false; + } + + /* enabledCheckbox.selected = item.enabled; */ + nameLabel.text = item.name; + descriptionLabel.text = item.description + "\n" + item.type; + } + + } + + protected function enabledCheckbox_changeHandler(event:Event):void { + perspective = RemoteManager.selectedPerspective; + RemoteManager.updatePerspectiveItem(perspective, item, enabledCheckbox.selected); + + //dispatchEvent(new Event(RemoteManager.SETTINGS_CHANGE, true)); + } + + public function get defaultButton():IFlexDisplayObject { + return null; + } + + public function set defaultButton(value:IFlexDisplayObject):void { + // do nothing + } + + override public function get systemManager():ISystemManager { + return null; + } + ]]> + </fx:Script> + + + + <s:VGroup width="100%" right="22" + gap="0" + paddingTop="2" paddingBottom="2"> + <s:Label id="nameLabel" + paddingTop="2" width="100%" + fontWeight="bold" + typographicCase="uppercase" + /> + + <s:Label id="descriptionLabel" + paddingTop="2" + width="100%" + /> + + <s:Label id="typeLabel" + paddingTop="2" + width="100%" + fontStyle="italic" + alpha=".75" + /> + + </s:VGroup> + + + + <s:CheckBox id="enabledCheckbox" + change="enabledCheckbox_changeHandler(event)" + verticalCenter="0" + right="4"/> + +</s:ItemRenderer> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/renderers/PerspectivesViewRenderer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/renderers/PerspectivesViewRenderer.mxml b/Radii8Remote/src/renderers/PerspectivesViewRenderer.mxml new file mode 100644 index 0000000..a62a234 --- /dev/null +++ b/Radii8Remote/src/renderers/PerspectivesViewRenderer.mxml @@ -0,0 +1,91 @@ +<?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. + +--> +<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + autoDrawBackground="true" + width="100%"> + + <fx:Script> + <![CDATA[ + import data.Item; + import data.Perspective; + + public var item:Perspective; + + override public function set data(value:Object):void { + super.data = value; + + item = value as Perspective; + + if (!value) { + enabledCheckbox.selected = false; + } + else { + enabledCheckbox.selected = item.enabled; + nameLabel.text = item.name; + //descriptionLabel.text = item.description; + } + + } + + protected function loadButton_clickHandler(event:MouseEvent):void { + dispatchEvent(new Event("loadView", true)); + } + + protected function enabledCheckbox_changeHandler(event:Event):void { + item.enabled = enabledCheckbox.selected; + dispatchEvent(new Event("settingChange", true)); + } + + ]]> + </fx:Script> + + + <!--<s:layout> + <s:HorizontalLayout verticalAlign="middle" + + paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="2"/> + </s:layout> + --> + + <s:VGroup width="100%" right="22" + gap="0" + paddingTop="2" paddingBottom="2"> + <s:Label id="nameLabel" paddingTop="2" width="100%" + fontWeight="bold" + /> + + <s:Label id="descriptionLabel" + paddingTop="2" + width="100%" + /> + + </s:VGroup> + + + <!--<s:Spacer width="100%" />--> + + <s:CheckBox id="enabledCheckbox" change="enabledCheckbox_changeHandler(event)" + verticalCenter="0" + right="4"/> + <!--<s:Button id="loadButton" label="Load" click="loadButton_clickHandler(event)"/>--> + +</s:ItemRenderer> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/renderers/ViewRenderer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/renderers/ViewRenderer.mxml b/Radii8Remote/src/renderers/ViewRenderer.mxml new file mode 100644 index 0000000..039a4c5 --- /dev/null +++ b/Radii8Remote/src/renderers/ViewRenderer.mxml @@ -0,0 +1,86 @@ +<?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. + +--> +<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" + autoDrawBackground="false"> + + <fx:Script> + <![CDATA[ + import data.Item; + + import mx.core.IFlexDisplayObject; + import mx.managers.ISystemManager; + + public var item:Item; + + override public function set data(value:Object):void { + super.data = value; + + item = value as Item; + + if (!value) { + enabledCheckbox.selected = false; + } + else { + enabledCheckbox.selected = item.enabled; + nameLabel.text = item.name; + } + + } + + protected function loadButton_clickHandler(event:MouseEvent):void { + dispatchEvent(new Event("loadView", true)); + } + + protected function enabledCheckbox_changeHandler(event:Event):void { + item.enabled = enabledCheckbox.selected; + dispatchEvent(new Event("settingChange", true)); + } + + public function get defaultButton():IFlexDisplayObject { + return null; + } + + public function set defaultButton(value:IFlexDisplayObject):void { + } + + override public function get systemManager():ISystemManager { + return null; + } + ]]> + </fx:Script> + + + <s:layout> + <s:HorizontalLayout verticalAlign="middle" + paddingBottom="2" paddingLeft="2" paddingRight="2" paddingTop="2"/> + </s:layout> + + + <s:CheckBox id="enabledCheckbox" change="enabledCheckbox_changeHandler(event)"/> + + <s:Label id="nameLabel" paddingTop="2"/> + + <s:Spacer width="100%" /> + + <s:Button id="loadButton" label="Load" click="loadButton_clickHandler(event)"/> + +</s:ItemRenderer> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/spark/components/MyScroller.as ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/spark/components/MyScroller.as b/Radii8Remote/src/spark/components/MyScroller.as new file mode 100644 index 0000000..0c39b39 --- /dev/null +++ b/Radii8Remote/src/spark/components/MyScroller.as @@ -0,0 +1,47 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 components +{ + import flash.events.FocusEvent; + + import mx.managers.FocusManager; + + import spark.components.Scroller; + + /** + * Gets rid of focusmanager scroller bug + * https://bugs.adobe.com/jira/browse/SDK-29522 + * */ + public class MyScroller extends MyScroller + { + public function MyScroller() + { + super(); + } + + override protected function focusInHandler(event:FocusEvent):void + { + if(FocusManager != null) { + super.focusInHandler(event); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/spark/components/TitleContainer.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/spark/components/TitleContainer.mxml b/Radii8Remote/src/spark/components/TitleContainer.mxml new file mode 100644 index 0000000..5657102 --- /dev/null +++ b/Radii8Remote/src/spark/components/TitleContainer.mxml @@ -0,0 +1,348 @@ +<?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. + +--> +<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:s="library://ns.adobe.com/flex/spark" + xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"> + + <!-- + TODO: + + - Add Add new perspective + - Add switch perspective + - Add delete perspective + - Add start docked + - Add Mini Inspector cmd click + - Add selector + + --> + + + <fx:Script> + <![CDATA[ + import spark.primitives.Rect; + import spark.events.TitleWindowBoundsEvent; + + import mx.core.FlexGlobals; + import mx.events.CloseEvent; + import mx.graphics.SolidColorStroke; + import mx.managers.PopUpManager; + + import modules.InspectorContainer;PopUpManager; + + + public static const FLOATING_TEXT:String = "Floating"; + public static const DOCKED_TEXT:String = "Docked"; + + public var popup:Group; + public var titleWindow:TitleWindow; + public var dropRectangle:Group; + + /** + * Previous height of window before docked + * */ + public var previousHeight:int; + + /** + * Previous width of window before docked + * */ + public var previousWidth:int; + + /** + * Indicates if window is docked + * */ + public var docked:Boolean; + + /** + * Minimum distance to the edge of the screen to show the drop indicator rectangle + * */ + public var minEdgeDistance:int = 20; + + /** + * Display the inspector + * */ + public function showInspector():void { + + // create drop rectangle to be ready to use + // or remove if already visible + if (!dropRectangle) { + var rect:Rect = new Rect(); + rect.bottom = 0; + rect.left = 0; + rect.top = 0; + rect.right = 0; + rect.percentWidth = 100; + rect.percentHeight = 100; + + var stroke:SolidColorStroke = new SolidColorStroke(); + stroke.weight = 4; + stroke.alpha = .5; + stroke.color = 0x0000ff; + stroke.joints = JointStyle.MITER; + rect.stroke = stroke; + + dropRectangle = new Group(); + dropRectangle.addElement(rect); + dropRectangle.width = 100; + dropRectangle.height = 100; + } + else { + PopUpManager.removePopUp(dropRectangle); + } + + // remove title window if already visible + // may want to reuse or something + if (!titleWindow) { + //PopUpManager.removePopUp(titleWindow); + } + + // create new inspector container + if (!popup) { + popup = new InspectorContainer(); + } + + if (!titleWindow) { + titleWindow = this; // new TitleWindow(); + titleWindow.addElement(popup); + } + + titleWindow.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVE_START, windowMoveStartHandler, false, 0, true); + titleWindow.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVING, windowMovingHandler, false, 0, true); + titleWindow.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVE, windowMoveHandler, false, 0, true); + titleWindow.addEventListener(TitleWindowBoundsEvent.WINDOW_MOVE_END, windowMoveEndHandler, false, 0, true); + titleWindow.addEventListener(Event.CLOSE, windowCloseHandler, false, 0, true); + + + // display pop up title window + PopUpManager.addPopUp(titleWindow, FlexGlobals.topLevelApplication as DisplayObject, false); + PopUpManager.centerPopUp(titleWindow); + + + } + + /** + * Handles when moving title window + * */ + protected function windowMoveHandler(event:TitleWindowBoundsEvent):void { + var xBound:int = event.afterBounds.x; + var visibleHeight:int = systemManager.topLevelSystemManager.getVisibleApplicationRect().height; + + if (event) { + positionLabel.text = "X:"+ event.afterBounds.x + " Y:" + event.afterBounds.y; + sizeLabel.text = "w:"+ event.afterBounds.width + " h:" + visibleHeight; + } + + // if less than minimum edge distance (checking mouse position) + // show drop indicator rectangle + if (xBound<minEdgeDistance) { + dropRectangle.visible = true; + dropRectangle.x = 0; + dropRectangle.y = 0; + dropRectangle.height = visibleHeight; + dropRectangle.width = titleWindow.width; + + titleWindow.title = "near edge"; + + } + else { + + // hide drop indicator rectangle + dropRectangle.visible = false; + + // if docked and title window is not near the edge + // then undock and resize + if (docked) { + + // resize + if (titleWindow.height!=previousHeight) { + titleWindow.height = previousHeight; + } + + // undock + docked = false; + + + if (titleWindow.getStyle("dropShadowVisible")!=true) { + titleWindow.setStyle("dropShadowVisible", true); + } + + titleWindow.title = FLOATING_TEXT; + } + else if (!docked) { + + titleWindow.title = FLOATING_TEXT; + + } + } + } + + /** + * Handles end of move of title window + * */ + protected function windowMoveEndHandler(event:TitleWindowBoundsEvent):void { + var yBound:int = event.afterBounds.y; + var xBound:int = event.afterBounds.x; + var appHeight:int = systemManager.topLevelSystemManager.getVisibleApplicationRect().height; + + // if off the screen then snap top to 0. bug when mouse leaves browser - using firefox fp 11.4 osx + if (yBound<0) { + titleWindow.y = 0; + } + + if (event) { + positionLabel.text = "x:"+ event.beforeBounds.x + " y:" + event.beforeBounds.y; + sizeLabel.text = "w:"+ event.afterBounds.width + " h:" + appHeight; + } + + // if near the edge then dock + if (xBound<20) { + setDocked(true); + } + else { + setDocked(false); + } + + removeDropRectangle(); + + } + + /** + * Checks if near edges of screen and keeps the + * title window in bounds + * */ + protected function windowMovingHandler(event:TitleWindowBoundsEvent):void { + + // These are the new bounds when the window is moved. + // You can modify them to alter the result of when the TitleWindow moves. + var endBounds:Rectangle = event.afterBounds; + + // check if near the left edge of the stage + if (endBounds.x < 0) { + endBounds.x = 0; + } + + // near right edge of the stage + if ((endBounds.x + endBounds.width) > parentApplication.width) { + endBounds.x = parentApplication.width - endBounds.width; + } + + // near top edge of the stage + if (endBounds.y < 0) { + endBounds.y = 0; + } + + // near bottom edge of the stage + if ((endBounds.y + titleWindow.moveArea.height) > parentApplication.height) { + endBounds.y = parentApplication.height - titleWindow.moveArea.height; + } + } + + /** + * Handles when user presses the close button on the title window + * */ + protected function windowCloseHandler(event:CloseEvent):void { + PopUpManager.removePopUp(titleWindow); + + if (docked) { + if (FlexGlobals.topLevelApplication.x!=0) { + FlexGlobals.topLevelApplication.x = 0; + } + docked = false; + } + + titleWindow.removeEventListener(TitleWindowBoundsEvent.WINDOW_MOVE_START, windowMoveStartHandler); + titleWindow.removeEventListener(TitleWindowBoundsEvent.WINDOW_MOVING, windowMovingHandler); + titleWindow.removeEventListener(TitleWindowBoundsEvent.WINDOW_MOVE, windowMoveHandler); + titleWindow.removeEventListener(TitleWindowBoundsEvent.WINDOW_MOVE_END, windowMoveEndHandler); + + } + + /** + * Adds drop indicator to the stage when window starts to move + * but not visible + * */ + protected function windowMoveStartHandler(event:TitleWindowBoundsEvent):void { + + addDropRectangle(); + + } + + /** + * Removes the drop indicator rectangle + * */ + public function removeDropRectangle():void { + if (dropRectangle.isPopUp) { + PopUpManager.removePopUp(dropRectangle); + } + } + + /** + * Adds the drop indicator rectangle + * */ + public function addDropRectangle():void { + if (!dropRectangle.isPopUp) { + PopUpManager.addPopUp(dropRectangle, this); + } + } + + /** + * + * */ + private function systemManagerResizeHandler(event:Event):void { + var appHeight:int = systemManager.topLevelSystemManager.getVisibleApplicationRect().height; + + titleWindow.move(0, 0); + titleWindow.setActualSize(titleWindow.width, appHeight); // this doesn't work :P + titleWindow.invalidateProperties(); + titleWindow.invalidateDisplayList(); + titleWindow.height = appHeight; + } + + /** + * Docks the window + * */ + public function setDocked(value:Boolean):void { + var appHeight:int = systemManager.topLevelSystemManager.getVisibleApplicationRect().height; + + if (value) { + previousHeight = Math.min(titleWindow.height, appHeight/2); + titleWindow.move(0, 0); + titleWindow.setActualSize(titleWindow.width, appHeight); + titleWindow.height = appHeight; + titleWindow.setStyle("dropShadowVisible", false); + FlexGlobals.topLevelApplication.x = titleWindow.width; + docked = true; + titleWindow.title = DOCKED_TEXT; + systemManager.topLevelSystemManager.addEventListener(Event.RESIZE, systemManagerResizeHandler); + } + else { + + if (FlexGlobals.topLevelApplication.x!=0) { + FlexGlobals.topLevelApplication.x = 0; + } + docked = false; + titleWindow.title = FLOATING_TEXT; + systemManager.topLevelSystemManager.removeEventListener(Event.RESIZE, systemManagerResizeHandler); + } + } + ]]> + </fx:Script> + <s:Label id="positionLabel" horizontalCenter="0" top="20" /> + <s:Label id="sizeLabel" horizontalCenter="0" top="35" /> +</s:TitleWindow> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/build.xml ---------------------------------------------------------------------- diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..5b43875 --- /dev/null +++ b/build.xml @@ -0,0 +1,153 @@ +<?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. + +--> + +<project name="radii8" default="main" basedir="."> + + <property name="RADII8_HOME" location="${basedir}"/> + + <!-- Required for OSX 10.6 / Snow Leopard Performance. --> + <!-- Java 7 on Mac requires OSX 10.7.3 or higher and is 64-bit only --> + <!-- local.d32 is set/used in build.properties so this needs to be done first. --> + <condition property="local.d32" value="-d32"> + <and> + <os family="windows"/> + <equals arg1="${sun.arch.data.model}" arg2="64"/> + <equals arg1="${os.arch}" arg2="x86_64"/> + <equals arg1="${ant.java.version}" arg2="1.6"/> + </and> + </condition> + + <property file="${RADII8_HOME}/env.properties"/> + <property environment="env"/> + <property file="${RADII8_HOME}/local.properties"/> + <property file="${RADII8_HOME}/build.properties"/> + + <property name="debug" value="true"/> + <property name="strict" value="true"/> + <property name="javac.src" value="1.5"/> + + <property name="kit.prefix" value="apache-flex-radii8-${release.version}"/> + <property name="source.kit" value="${kit.prefix}-src"/> + <property name="binary.kit" value="${kit.prefix}-bin"/> + + <!-- + Optional jars but should be in place for a real release build. + + For <grep> put antelopetasks*.jar in this path. + See version-update. + + For <rat> apache-rat-0.8.jar and apache-rat-tasks-0.8.jar should be in classpath. + See rat-check. + --> + <path id="anttask.classpath"> + <fileset dir="${env.ANT_HOME}/lib"> + <include name="**/antelopetasks*.jar"/> + <include name="**/apache-rat*.jar"/> + </fileset> + <fileset dir="${user.home}"> + <include name=".ant/lib/**/antelopetasks*.jar"/> + <include name=".ant/lib/**/apache-rat*.jar"/> + </fileset> + </path> + + <!-- + Notes: If you're running the main target, then there is no need to call clean first. + Each of the main targets for the modules will call clean themselves before proceeding. + --> + + <target name="main" depends="rat-check" description="Just run Rat for now"> + </target> + + <target name="rat-taskdef" description="Rat taskdef"> + <available property="have.rattasks" + resource="org/apache/rat/anttasks/antlib.xml" + classpathref="anttask.classpath"/> + + <antcall target="have-rattasks"/> + <antcall target="no-rattasks"/> + </target> + + <target name="have-rattasks" if="have.rattasks"> + <typedef resource="org/apache/rat/anttasks/antlib.xml" + uri="antlib:org.apache.rat.anttasks" + classpathref="anttask.classpath"/> + </target> + + <target name="no-rattasks" unless="have.rattasks"> + <echo message="Rat report not generated."/> + <echo message="rat jars (apache-rat-*.jar, apache-rat-tasks-*.jar)"/> + <echo message="not found in anttask.classpath"/> + </target> + + <!-- + Run the Apache Rat audit tool against the source in the source kit. + The report is written to rat.report. + + To check a subset of files run with -Drat.dir=<dir>. + + You need to place apache-rat-tasks-0.8.jar and apache-rat-0.8.jar in the + anttask.classpath in order to do this. If the jar isn't found, the report + will not be generated. + --> + <target name="rat-check" depends="rat-taskdef" if="have.rattasks" + description="Report on licenses in source kit."> + + <property name="rat.dir" value="${basedir}"/> + + <mkdir dir="${basedir}/rat" /> + + <property name="rat.report" value="${basedir}/rat/rat.report"/> + <echo message="Checking files at ${rat.dir}, report is rat/${rat.report}"/> + + <rat:report xmlns:rat="antlib:org.apache.rat.anttasks" reportFile="${rat.report}"> + <fileset dir="${rat.dir}"> + <!-- Start of binary files --> + <!-- exclude media (png, gif, jpg, mp3, flv) --> + <exclude name="**/*.png"/> + <exclude name="**/*.gif"/> + <exclude name="**/*.jpg"/> + <exclude name="**/*.mp3"/> + <exclude name="**/*.flv"/> + <!-- exclude psd files --> + <exclude name="**/*.psd"/> + <!-- End of binary files --> + <!-- exclude the report --> + <exclude name="rat/**"/> + <!-- exclude Base64 (MIT License) --> + <exclude name="Radii8Library/src/com/flexcapacitor/utils/Base64.as"/> + <!-- exclude EventListeners.mxml (MIT License) --> + <exclude name="Radii8Library/src/com/flexcapacitor/views/panels/EventListeners.mxml"/> + <!-- exclude normalize.css (MIT License) --> + <exclude name="Radii8Designer/src/css/normalize/2.1.2/normalize.css"/> + <!-- exclude swfobject.js (MIT License) --> + <exclude name="**/swfobject.js"/> + <!-- exclude syntax highlighter (Apache License) --> + <exclude name="Radii8Library/src/com/flexcapacitor/utils/SyntaxHighlighter.as"/> + <!-- exclude Flash Builder data files (no creativity) --> + <exclude name="**/org.eclipse.core.resources.prefs"/> + <!-- exclude some other files (no creativity) --> + <exclude name="Radii8Designer/src/blankpage.html"/> + <exclude name="Radii8Designer/build.number"/> + <exclude name="Radii8Designer/todo.txt"/> + </fileset> + </rat:report> + </target> + +</project>
