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 2020/05/07 12:23:31 UTC

[GitHub] [royale-asjs] nihavend opened a new issue #824: Can not change locale for menubar constructed via XMLList within declarations

nihavend opened a new issue #824:
URL: https://github.com/apache/royale-asjs/issues/824


   Changing local for menubar has no affect whicih content is defined in XMLList including resources.
   It behaves different from flex.
   
   related with #545 
   
   When you click the button the locale is going to change.
   
   You have to define resource file and add the tokens 
   
   > en : switchLocale = Switch Locale
   > tr : switchLocale = Dili Değiştir
   
   Test Case Source code : 
   
   ```
   <?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"
   			   creationComplete="init()"
   			   height="100%" width="100%" 
   			   >
   	
   	<fx:Metadata>
   		[ResourceBundle("messages")]
   	</fx:Metadata>
   	
   	<fx:Script>
   		<![CDATA[
   			
   			import mx.resources.ResourceManager;
   			import mx.collections.XMLListCollection;
   			import mx.events.FlexEvent;
   			import mx.events.MenuEvent;
   			
   			
   			[Bindable]
   			public var menuBarData2:XMLListCollection = new XMLListCollection();
   				
   			protected function creationCompleteHandler2(event:FlexEvent):void
   			{
   
   				var roleInfo:String = "ADMIN";
   				
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData2.source = menuDataXMLList;
   				
   				menuBarData2.refresh();
   
   			}
   			
   			protected function itemClickHandler(event:MenuEvent):void {
   			}
   			
   			private function init():void {
   				resourceManager.localeChain = ["en_US"];
   			}
   			
   			private function changeLocale():void {
   				var locale:String = resourceManager.localeChain[0];
   				if(resourceManager.localeChain[0] != "en_US") {
   					resourceManager.localeChain = ["en_US"];
   				} else {
   					resourceManager.localeChain = ["tr_TR"];
   				}
   			}
   			
   			
   			private function dummyMethod(event:MouseEvent):void {
   			}
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>
   		<fx:XMLList id="menuDataXMLList">
   			<menuitem label="label-1">			
   				<menuitem label="label-1-1"/>			
   				<menuitem label="label-1-2"/>			
   			</menuitem>
   			<menuitem label="{resourceManager.getString('messages', 'switchLocale')}" id="admin" >			
   				<menuitem label="label-2-1"/>			
   				<menuitem label="label-2-2"/>			
   				<menuitem label="{resourceManager.getString('messages', 'switchLocale')}" id="admin" />
   			</menuitem>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   
   	<s:Button label="{resourceManager.getString('messages', 'switchLocale')}" click="changeLocale()"/>
   	
   	<mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuBarData2}" horizontalCenter="0"
   				itemClick="itemClickHandler(event)" 
   				labelField="@label" 
   				creationComplete="creationCompleteHandler2(event)"/>
   </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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629590159


   So in the simplified test case I posted, I just replaced the XMLListCollection in `changeLocale`.  I think that's the simplest workaround for you.  I think you could modify your `applyFilter` to assign an XMLListCollection, but maybe there is something I'm missing.  Other approaches will take more time to implement.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend edited a comment on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend edited a comment on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629600671


   I am really having difficulties while trying to understand you @aharui  but not because of the spoken language 
   
   > - I would not choose remote debugging unless I could not reproduce the problem locally. I think most people want the simplest test case possible that can run locally when debugging. 
   
    I prepared the live demo of the simplest test case. Not the real application. Because you told me that the cases I provided are not working. Is it possible you did think that I wanted you to debug real application ?
   
   > - In fact, I would prefer that your test cases do not use resources unless it truly is a bug in 
   the ResourceManager. I think the ResourceManager is now working and using resources just adds complexity to the test case. I have to take time to simplify the test case as I do not have the resource bundle handy. It is often simple enough to test just by replacing strings at runtime.
   
   The bug is related with resources alex. My problem is not changing value of xml in a function. Resources must do exist in test case. If I remove resources and "simplify" the case as you in the source, this is a different bug not mine.
   
   > - So in the simplified test case I posted, I just replaced the XMLListCollection in changeLocale. I think that's the simplest workaround for you. I think you could modify your applyFilter to assign an XMLListCollection, but maybe there is something I'm missing. Other approaches will take more time to implement.
   
   As I said before, putting xml manipulation in to the "changelocale" is thing I will never want to see in my design.  You do not have any idea about the real application architecture. There are lots of components related which each other and classes. Change locale is somewhere in one component and the menu is another component somewhere in hierarchy.
   
   I think there is a misunderstanding here. This issue is not related with changing XML and refreshing the component according to the new xml. If there is bug with XML modification it should be discussed under different topic.
   
   My issue is related with the locale change.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629744758


   This test case indicates to me that locale changes do in fact update the XML.
   
   ```
   <?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"
   			   creationComplete="init()"
   			   height="100%" width="100%" 
   			   >
   	<fx:Metadata>
   		[ResourceBundle("containers")]
   	</fx:Metadata>
   	
   	<fx:Script>
   		<![CDATA[
   			
   			import mx.resources.ResourceManager;
   			import mx.collections.XMLListCollection;
   			import mx.events.FlexEvent;
   			import mx.events.MenuEvent;
   			
   			
   			[Bindable]
   			public var menuBarData2:XMLListCollection = new XMLListCollection();
   				
   			protected function creationCompleteHandler2(event:FlexEvent):void
   			{
   
   				var roleInfo:String = "ADMIN";
   				
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData2.source = menuDataXMLList;
   				
   				menuBarData2.refresh();
   
   			}
   			
   			protected function itemClickHandler(event:MenuEvent):void {
   			}
   			
   			private function init():void {
   				resourceManager.localeChain = ["en_US"];
   			}
   			
   			[Bindable]public var switchLocale:String = "Switch Locale";
   			
   			private function changeLocale():void {
   				var locale:String = resourceManager.localeChain[0];
   				if(resourceManager.localeChain[0] != "en_US") {
   					resourceManager.localeChain = ["en_US"];
   				} else {
   					resourceManager.localeChain = ["es_ES"];
   				}
   
   				trace(menuDataXMLList.toXMLString());
   				
   				/*				
   				var newDP:XMLListCollection = new XMLListCollection(menuDataXMLList);
   				menuBarData2 = newDP;*/
   				
   			}
   			
   			
   			private function dummyMethod(event:MouseEvent):void {
   			}
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>
   		<fx:XMLList id="menuDataXMLList">
   			<menuitem label="label-1">			
   				<menuitem label="label-1-1"/>			
   				<menuitem label="label-1-2"/>			
   			</menuitem>
   			<menuitem label="{resourceManager.getString('containers', 'noColumnsFound')}" id="admin" >			
   				<menuitem label="label-2-1"/>			
   				<menuitem label="label-2-2"/>			
   				<menuitem label="{resourceManager.getString('containers', 'noRowsFound')}" id="admin" />
   			</menuitem>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   
   	<s:Button label="{resourceManager.getString('containers', 'noRowsFound')}" click="changeLocale()"/>
   	
   </s:Application>
   ```
   
   Does this not output the changed strings for you?
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629600671


   I am really having difficulties while trying to understand you @aharui  but not because of the spoken language 
   
   > - I would not choose remote debugging unless I could not reproduce the problem locally. I think most people want the simplest test case possible that can run locally when debugging. 
   
    I prepared the live demo of the simplest test case. Not the real application. Because you told me that the cases I provided are not working. Is it possible you did think that I wanted you to debug real application ?
   
   > - In fact, I would prefer that your test cases do not use resources unless it truly is a bug in 
   the ResourceManager. I think the ResourceManager is now working and using resources just adds complexity to the test case. I have to take time to simplify the test case as I do not have the resource bundle handy. It is often simple enough to test just by replacing strings at runtime.
   
   The bug is related with resources alex. My problem is not changing value of xml in a function. Resources must do exist in test case. If I remove resources and "simplify" the case I did in the source, this is a different bug not mine.
   
   > - So in the simplified test case I posted, I just replaced the XMLListCollection in changeLocale. I think that's the simplest workaround for you. I think you could modify your applyFilter to assign an XMLListCollection, but maybe there is something I'm missing. Other approaches will take more time to implement.
   
   As I said before, putting xml manipulation in to the "changelocale" is thing I will never want to see in my design.  You do not have any idea about the real application architecture. There are lots of components related which each other and classes. Change locale is somewhere in one component ant the menu is another component somewhere in hierarchy.
   
   I think there is a misunderstanding here. This issue is not related with changing XML and refreshing the component according to the new xml. If there is bug with XML modification it should be discussed under different topic.
   
   My issue is related with the locale change.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] greg-dove commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
greg-dove commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629591144


   fwiw I did think of something I might explore at some point as a potential solution for the XML notifier issue, that could have zero weight (which is what we want for regular XML use, I don't think we should be checking in each area the changes things by default whether we need to notify) unless it was needed.
   I wondered about the function notifier function doing some funky non-actionscript stuff to wrap the current instance methods like the way Language closure does, or (possibly better) to apply an upgraded prototype (which wraps the original prototype methods) to the current instance before it returns the notifier function. It might be possible to emulate it and still have it work for type checks etc, but I need to investigate it.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] greg-dove edited a comment on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
greg-dove edited a comment on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629591144


   fwiw I did think of something I might explore at some point as a potential solution for the XML notifier issue, that could have zero weight (which is what we want for regular XML use, I don't think we should be checking in each area that changes things by default whether we need to notify) unless it was needed.
   I wondered about the function notifier function doing some funky non-actionscript stuff to wrap the current instance methods like the way Language closure does, or (possibly better) to apply an upgraded prototype (which wraps the original prototype methods) to the current instance before it returns the notifier function. It might be possible to emulate it and still have it work for type checks etc, but I need to investigate it.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629346705


   The Flash runtime had a way of detecting changes to XML nodes.  The browser runtimes do not and I'm not really sure we want to emulate that in Royale.  Two other options are:
   1) make sure setting XMLListCollection.source triggers a CollectionEventKind.RESET and that the emulation classes respond to it
   2) Create an XMLBinding class that watches some object for an event and performs some action on another object.
   
   However, I am not able to understand if there is something important about the way your code runs that would cause those strategies to not work.  For example, if you must work on copies of the XMLList then listening to the original XMLList won't help.  Or if you must change the XMLListCollection source instead of swapping in an entirely new XMLListCollection.
   
   On the other hand, if you already have a change event and/or code running via the change event, it might be quicker for you to just modify that code.  For example, I assume your code knows when the locale changes, and it can fetch the XMLList, apply filters and put the result in a new XMLLIstCollection and replace the old one.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend edited a comment on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend edited a comment on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629106335


   You are right for asking because it does not have meaning here. And it also is not related with the bug.
   
   This is the original if you are interested in, I did not worked on converting because not necessary. 
   
   > Here is the reference[Line 350] : [MenuBar.mxml](https://github.com/likyateknoloji/pinaraui-royale/blob/master/src/com/likya/pinara/comps/MenuBar.mxml)
   
   ```
   			public function applyFilters():void {
   
   				var roleInfo:String = ModelLocator.getInstance().currentUser.roleinfo;
   				
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				tmpXmlList = RoleFilters.deleteRoledMenuItems(tmpXmlList, roleInfo);
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData.source = menuDataXMLList;
   				
   				// trace("Refreshing menubar...");
   				menuBarData.refresh();
   				
   			}
   ```
   
   Does it have an affect on the bug @aharui ?


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629570304


   @aharui I wonder if you had time to look to the running case ? Or am I spending time for preparing live case for nothing ?
   
   If so tell me so it may save really pretty much of my time. 
   
   For your comments, putting an xml logic into language change function is not a correct approach regarding the coding logic so not an option. 
   
   I am going to work on the 1 and 2 to understand and see what can i do and let you know. 
   
   Thanks.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend edited a comment on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend edited a comment on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629600671


   I am really having difficulties while trying to understand you @aharui  but not because of the spoken language 
   
   > - I would not choose remote debugging unless I could not reproduce the problem locally. I think most people want the simplest test case possible that can run locally when debugging. 
   
    I prepared the live demo of the simplest test case. Not the real application. Because you told me that the cases I provided are not working. Is it possible you did think that I wanted you to debug real application ?
   
   > - In fact, I would prefer that your test cases do not use resources unless it truly is a bug in 
   the ResourceManager. I think the ResourceManager is now working and using resources just adds complexity to the test case. I have to take time to simplify the test case as I do not have the resource bundle handy. It is often simple enough to test just by replacing strings at runtime.
   
   The bug is related with resources alex. My problem is not changing value of xml in a function. Resources must do exist in test case. If I remove resources and "simplify" the case I did in the source, this is a different bug not mine.
   
   > - So in the simplified test case I posted, I just replaced the XMLListCollection in changeLocale. I think that's the simplest workaround for you. I think you could modify your applyFilter to assign an XMLListCollection, but maybe there is something I'm missing. Other approaches will take more time to implement.
   
   As I said before, putting xml manipulation in to the "changelocale" is thing I will never want to see in my design.  You do not have any idea about the real application architecture. There are lots of components related which each other and classes. Change locale is somewhere in one component and the menu is another component somewhere in hierarchy.
   
   I think there is a misunderstanding here. This issue is not related with changing XML and refreshing the component according to the new xml. If there is bug with XML modification it should be discussed under different topic.
   
   My issue is related with the locale change.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629106335


   You are right for asking because it does not have meaning here. And it also is not related with the bug.
   
   This is the original if you are interested in, I did not worked on converting because not necessary. 
   
   ```
   			public function applyFilters():void {
   
   				var roleInfo:String = ModelLocator.getInstance().currentUser.roleinfo;
   				
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				tmpXmlList = RoleFilters.deleteRoledMenuItems(tmpXmlList, roleInfo);
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData.source = menuDataXMLList;
   				
   				// trace("Refreshing menubar...");
   				menuBarData.refresh();
   				
   			}
   ```
   
   Does it have an affect on the bug @aharui ?


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-630176044


   I checked the sample case and can confirm that after adding the fake event handler locale change refreshes menu with the new locale but this time tree crashes.
   
   ![image](https://user-images.githubusercontent.com/5983818/82217279-e0f03d80-9922-11ea-95bc-a5426303b8ad.png)
   
   You can use #562 as sample case
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629577948


   I set   the dataprovider of the menubar to directly xml variable menuDataXMLList without manipulating it in any creation function to see if it will refresh after language change and I can say no. Am I missing something ?
   
   ```
   <mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuDataXMLList}" horizontalCenter="0"
   				itemClick="itemClickHandler(event)" 
   				labelField="@label" 
   				/>
   ```


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629589724


   The attempt you made to use `dataProvider="{menuBarData2}"` would not work because, as I mentioned above, XML in the browser does not have change notification.  IOW, changing nodes in the XML does not dispatch events that the binding system can listen for.  Changing locales should (if it doesn't that would be worth fixing).  So the goal is to run your `applyFilter` method when the locale changes, which could be as simple as calling `applyFilter` from the `changeLocale` method.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629595617


   If by zero-weight you mean that we wouldn't modify the XML and XMLList source code, that is certainly possible in JS.  IMO, the level of difficulty might change depending on whether you want a general purpose solution or just to handle the common scenario of "a bunch of XML nodes changed, now update a list".  
   
   The reason I'm suggesting a workaround for now is that I think the workaround is likely to be simpler yet just as effective as a fancier solution.  Even though a few nodes changed, it could be less code to just replace the entire XMLListCollection rather than propagate change nodes from each changing node.
   
   While I'm thinking of it, in case it helps if you do work on it, there are a few places where it would be most tempting to try to add XML change notification.  Inside XMLListCollection is an XMLListAdapter which I think manages XML notification in Flash as well.  It could actually replace the setAttribute and setChild methods with wrappers and dispatch some sort of notification.
   
   The other place is in Binding.  We don't currently have an XMLWatcher, but we could put one together that replaces setAttribute and setChild on a node.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629589422


   I would not choose remote debugging unless I could not reproduce the problem locally.  I think most people want the simplest test case possible that can run locally when debugging.  In fact, I would prefer that your test cases do not use resources unless it truly is a bug in the ResourceManager.  I think the ResourceManager is now working and using resources just adds complexity to the test case.  I have to take time to simplify the test case as I do not have the resource bundle handy.  It is often simple enough to test just by replacing strings at runtime.  Here is the simplified test case I used:
   
   ```
   <?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"
   			   creationComplete="init()"
   			   height="100%" width="100%" 
   			   >
   	
   	<fx:Script>
   		<![CDATA[
   			
   			import mx.resources.ResourceManager;
   			import mx.collections.XMLListCollection;
   			import mx.events.FlexEvent;
   			import mx.events.MenuEvent;
   			
   			
   			[Bindable]
   			public var menuBarData2:XMLListCollection = new XMLListCollection();
   				
   			protected function creationCompleteHandler2(event:FlexEvent):void
   			{
   
   				var roleInfo:String = "ADMIN";
   				
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData2.source = menuDataXMLList;
   				
   				menuBarData2.refresh();
   
   			}
   			
   			protected function itemClickHandler(event:MenuEvent):void {
   			}
   			
   			private function init():void {
   			/*
   				resourceManager.localeChain = ["en_US"];
   				*/
   			}
   			
   			[Bindable]public var switchLocale:String = "Switch Locale";
   			
   			private function changeLocale():void {
   			/*
   				var locale:String = resourceManager.localeChain[0];
   				if(resourceManager.localeChain[0] != "en_US") {
   					resourceManager.localeChain = ["en_US"];
   				} else {
   					resourceManager.localeChain = ["tr_TR"];
   				}*/
   				switchLocale = "Locale Switched";
   				
   				var newDP:XMLListCollection = new XMLListCollection(menuDataXMLList);
   				menuBarData2 = newDP;
   				
   			}
   			
   			
   			private function dummyMethod(event:MouseEvent):void {
   			}
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>
   		<fx:XMLList id="menuDataXMLList">
   			<menuitem label="label-1">			
   				<menuitem label="label-1-1"/>			
   				<menuitem label="label-1-2"/>			
   			</menuitem>
   			<menuitem label="{switchLocale}" id="admin" >			
   				<menuitem label="label-2-1"/>			
   				<menuitem label="label-2-2"/>			
   				<menuitem label="{switchLocale}" id="admin" />
   			</menuitem>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   
   	<s:Button label="{switchLocale}" click="changeLocale()"/>
   	
   	<mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuBarData2}" horizontalCenter="0"
   				itemClick="itemClickHandler(event)" 
   				labelField="@label" 
   				creationComplete="creationCompleteHandler2(event)"/>
   </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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629096856


   It isn't obvious to me why the code in creationCompleteHandler2 doesn't just set the XMLList in the single XMLListCollection in menuBarData2.  What is the purpose of these lines?
   
   ```
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData2.source = menuDataXMLList;
   				
   				menuBarData2.refresh();
   ```
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] nihavend edited a comment on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
nihavend edited a comment on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629570304


   @aharui I wonder if you had time to look to the running case ? Or am I spending time for preparing live case for nothing ?
   
   If so tell me than it may save really pretty much of my time. 
   
   For your comments, putting an xml logic into language change function is not a correct approach regarding the coding logic and etc.  and not an option. 
   
   I am going to work on the 1 and 2 to understand and see what can i do and let you know. 
   
   Thanks.
   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui closed issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui closed issue #824:
URL: https://github.com/apache/royale-asjs/issues/824


   


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629667547


   If you have an issue with locale change, then create a test case I can run locally that uses a bundle I have (like one from Flex) that exposes the issue.  If it is notifications, it should not be necessary to involve MenuBar or XML.  Maybe a string in a Label.
   
   Almost all of the past examples you've sent that involve resources have been simplified by using string substitution.  So that's what I did to this example, and sure enough, the MenuBar did not update, so I proposed a workaround.
   
   I don't recall asking you to host live examples of these scenarios.  I would only look at live examples if I could not reproduce a problem locally because locally I have all of the source so I know there aren't any side-effects from other modules and can re-compile with a change if needed.
   
   For your TitleWindow issue, I just looked at the call stack and could see that it was another case of s:TextArea.   I'm not going to first try remote debugging.  It just isn't efficient for me.  I'm sorry you don't like the way I work.  You are welcome to tell me not to help you anymore and get someone else to help you.


----------------------------------------------------------------
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



[GitHub] [royale-asjs] aharui commented on issue #824: Can not change locale for menubar constructed via XMLList within declarations

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #824:
URL: https://github.com/apache/royale-asjs/issues/824#issuecomment-629754994


   I pushed some changes to that changing XMLListCollection.source will update the MenuBar.  I'm not clear on what your restrictions are in terms of updating the XMLListCollection, but updating the source in this example works.
   
   ```
   <?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"
   			   creationComplete="init()"
   			   height="100%" width="100%" 
   			   >
   	<fx:Metadata>
   		[ResourceBundle("containers")]
   	</fx:Metadata>
   	<fx:Declarations>
   			<mx:XMLListCollection id="menuBarData2" source="{menuDataXMLList}"/>	
   	</fx:Declarations>
   	
   	<fx:Script>
   		<![CDATA[
   			
   			import org.apache.royale.events.ValueChangeEvent;
   			import mx.resources.ResourceManager;
   			import mx.collections.XMLListCollection;
   			import mx.events.FlexEvent;
   			import mx.events.MenuEvent;
   			
   			
   				
   			protected function creationCompleteHandler2(event:FlexEvent):void
   			{
   
   				var roleInfo:String = "ADMIN";
   				
   				/*
   				var tmpXmlList:XMLListCollection = new XMLListCollection();
   				tmpXmlList.source = menuDataXMLList;
   				
   				menuDataXMLList = tmpXmlList.source.copy();
   				
   				menuBarData2.source = menuDataXMLList;
   				
   				menuBarData2.refresh();
   				*/
   
   			}
   			
   			protected function itemClickHandler(event:MenuEvent):void {
   			}
   			
   			private function init():void {
   				resourceManager.localeChain = ["en_US"];
   				resourceManager.addEventListener("change", xmlbinding);
   			}
   			
   			private function xmlbinding(event:Event):void
   			{
   				dispatchEvent(ValueChangeEvent.createUpdateEvent(this, "menuDataXMLList", null, menuDataXMLList));
   			}
   			
   			[Bindable]public var switchLocale:String = "Switch Locale";
   			
   			private function changeLocale():void {
   				var locale:String = resourceManager.localeChain[0];
   				if(resourceManager.localeChain[0] != "en_US") {
   					resourceManager.localeChain = ["en_US"];
   				} else {
   					resourceManager.localeChain = ["es_ES"];
   				}
   
   				trace(menuDataXMLList.toXMLString());
   				
   			}
   			
   			
   			private function dummyMethod(event:MouseEvent):void {
   			}
   			
   		]]>
   	</fx:Script>
   	
   	<fx:Declarations>
   		<fx:XMLList id="menuDataXMLList">
   			<menuitem label="label-1">			
   				<menuitem label="label-1-1"/>			
   				<menuitem label="label-1-2"/>			
   			</menuitem>
   			<menuitem label="{resourceManager.getString('containers', 'noColumnsFound')}" id="admin" >			
   				<menuitem label="label-2-1"/>			
   				<menuitem label="label-2-2"/>			
   				<menuitem label="{resourceManager.getString('containers', 'noRowsFound')}" id="admin" />
   			</menuitem>
   		</fx:XMLList>
   	</fx:Declarations>	
   	
   	<s:layout>
   		<s:VerticalLayout gap="10" paddingRight="10" paddingLeft="10" paddingTop="10" paddingBottom="20" />
   	</s:layout>
   
   	<s:Button label="{resourceManager.getString('containers', 'noRowsFound')}" click="changeLocale()"/>
   	
   	<mx:MenuBar id="menuBar_fx_Declarations" width="100%" dataProvider="{menuBarData2}" horizontalCenter="0"
   				itemClick="itemClickHandler(event)" 
   				labelField="@label" 
   				creationComplete="creationCompleteHandler2(event)"/>	
   </s:Application>
   ```
   
   In the example, I use a custom event listener to listen for the locale change and fake an update event on the XMLList, but the way the XMLList is set in the MenuBar is much simpler than what I think you are doing.  This example was written to prove that the updating source would work, and not to work in your usage. So now you should have the option of replacing the XMLListCollection or updating the XMLListCollection.source.


----------------------------------------------------------------
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