You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2019/11/15 20:32:48 UTC

[GitHub] [royale-asjs] nihavend opened a new issue #562: Tree component in Royale can not render with a kind of XML data, which is working with Flex

nihavend opened a new issue #562: Tree component in Royale can not render with a kind of XML data, which is working with Flex
URL: https://github.com/apache/royale-asjs/issues/562
 
 
   XML data below is not correctly handled by Tree component 
   
   ```
   <fx:XMLList id="PInaraData">
   	<list title="Grup Listesi" id="0">
   		<jobGroup title="Independents" id="-1">
   			<jobProperty title="SENSORDATA_HOURLY" id="1" statu="0" port="1"/>
   			<jobProperty title="SENSORDATA_DAILY" id="2" statu="0" port="1"/>
   			<jobProperty title="SENSORDATA_ALWAYSON" id="3" statu="0" port="1"/>
   			<jobProperty title="SENSORDATA_FIVE_MIN" id="4" statu="9" port="1"/>
   			<jobProperty title="PERSONAL_PROFILE_INFO" id="5" statu="9" port="1"/>
   			<jobProperty title="SENSORDATA_AVG_CONS" id="6" statu="9" port="1"/>
   		</jobGroup>
   	</list>
   </fx:XMLList>
   ```
   This is the test code for the case
   
   ```
   <?xml version="1.0" encoding="utf-8"?>
   <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   			   xmlns:s="library://ns.apache.org/royale/spark"
   			   xmlns:mx="library://ns.apache.org/royale/mx"
   			   paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
   			   height="100%" width="100%" 
   			   creationComplete="loadData()"
   			   >
   	
   	<fx:Metadata>
   	</fx:Metadata>
   	
   	<fx:Script>
   		<![CDATA[
   			
   			import mx.collections.XMLListCollection;
   			import mx.events.ListEvent;
   			
   			[Bindable]
   			public var selectedNode:XML;
   			
   			[Bindable] 
   			public static var liveTreeDP:XMLList;
   			
   			public function loadData():void {
   				liveTreeDP = treeData3Node; //<><node label="3 Node"></node></>; 
   			}
   			
   			public function Node3View():void {
   				
   				try {
   					liveTreeDP = treeData3Node;
   					myTree.validateNow();
   				} catch(err:Error) {
   					//Alert.show("HATA : " + errorString);
   					trace(err);
   				}
   				
   			}
   			
   			public function Node6View():void {
   				
   				try {
   					liveTreeDP = treeData6Node;
   					myTree.validateNow();
   				} catch(err:Error) {
   					//Alert.show("HATA : " + errorString);
   					trace(err);
   				}
   				
   			}
   			
   			public function original():void {
   				
   				try {
   					liveTreeDP = PInaraData;
   					myTree.validateNow();
   				} catch(err:Error) {
   					//Alert.show("HATA : " + errorString);
   					trace(err);
   				}
   				
   			}
   			
   			private function tlosTree_itemClickHandler(e:ListEvent):void {
   				
   			}
   			
   			protected function liveTree_itemDoubleClickHandler(event:ListEvent):void {
   				
   			}
   			
   			public function treeChanged(event:Event):void {
   				selectedNode=Tree(event.target).selectedItem as XML;
   			}
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>
   		<fx:XMLList id="treeData3Node">
   			<node label="3 Node">
   				<node label="Inbox">
   					<node label="Marketing"/>
   					<node label="Product Management"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Outbox">
   					<node label="Professional"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Spam"/>
   			</node>	
   		</fx:XMLList>
   		<fx:XMLList id="treeData6Node">
   			<node label="6 Node">
   				<node label="Inbox">
   					<node label="Marketing"/>
   					<node label="Product Management"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Outbox">
   					<node label="Professional"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Spam"/>
   				<node label="Sent"/>
   				<node label="Region">
   					<node label="First"/>
   					<node label="Second"/>
   				</node>
   				<node label="Division">
   					<node label="Up"/>
   					<node label="Down"/>
   				</node>
   			</node>	
   		</fx:XMLList>
   		
   		<fx:XMLList id="treeData">
   			<node label="Mail Box">
   				<node label="Inbox">
   					<node label="Marketing"/>
   					<node label="Product Management"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Outbox">
   					<node label="Professional"/>
   					<node label="Personal"/>
   				</node>
   				<node label="Spam"/>
   				<node label="Sent"/>
   			</node>	
   		</fx:XMLList>
   		
   		<fx:XMLList id="PInaraData">
   			<list title="Grup Listesi" id="0">
   				<jobGroup title="Independents" id="-1">
   					<jobProperty title="SENSORDATA_HOURLY" id="1" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_DAILY" id="2" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_ALWAYSON" id="3" statu="0" port="1"/>
   					<jobProperty title="SENSORDATA_FIVE_MIN" id="4" statu="9" port="1"/>
   					<jobProperty title="PERSONAL_PROFILE_INFO" id="5" statu="9" port="1"/>
   					<jobProperty title="SENSORDATA_AVG_CONS" id="6" statu="9" port="1"/>
   				</jobGroup>
   			</list>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   	
   	<s:Button id="TreeNode" click="Node3View()"  label="3 Node"/>
   	<s:Button id="SixNode" click="Node6View()"  label="6 Node"/>
   	<s:Button id="Original" click="original()"  label="Original"/>
   	
   	<mx:Panel title="Tree Control Example"
   			  paddingBottom="10" paddingTop="10" paddingLeft="10" paddingRight="10"
   			  height="50%" width="50%">
   		
   		<mx:Label width="100%" 
   				  text="Select a node in the Tree control."/>
   		
   		<mx:HDividedBox width="100%" height="100%">
   			<mx:Tree id="myTree" width="50%" height="100%" labelField="@label"
   					 showRoot="false" dataProvider="{liveTreeDP}" change="treeChanged(event)"/>
   			<mx:Tree id="myTreeStatic" width="50%" height="100%" labelField="@label"
   					 showRoot="false" dataProvider="{treeData}" change="treeChanged(event)"/>
   			<mx:TextArea height="100%" width="50%"
   						 text="Selected Item: {selectedNode.@label}"/>
   		</mx:HDividedBox>
   		
   	</mx:Panel>
   	
   </s:Application>
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services