[flexcoders] Re: Tree component
I tried this, but i cant expand and collapse nodes. There are no possibility to do this. I have extended Box and implements IDropInListItemRenderer. I tried also to extend TreeItemRenderer and add some child on set data depending the depth of the node, but no child appear, only folder icon and label. I want to say that dataProvider for the Tree is an array of objects, objects that have a property children array of other objects. Mihai --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: It would probably be easier to have a single renderer that can display differently. If it implements IDropInListItemRenderer you can access listData.depth to know the depth of the node. Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Mihai C Sent: Thursday, October 08, 2009 8:08 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Tree component Hi! Is there a way to create different ItemRenderers for each level from a Tree? Mihai
[flexcoders] Re: Tree Component openItems and refresh dataProvider issue
I am looking for a solution to the same issue. As far as I understand it the problem is that the new dataProvider elements are assigned different UIDs from the UIDs stored in your openItems array. The UIDs assigned to the old dataProvier are different than the UIDs assigned to the new dataProvider. I read a solution somewhere that you can create a new ArrayCollection class that implements the IUID interface and use that for your dataProvider but that doesn't solve my problem as I am using XML for my dataProvider. I'll keep you posted if I find a solution. --- In flexcoders@yahoogroups.com, flashalisious [EMAIL PROTECTED] wrote: Ok I have working with the Tree to display a list of files for to users. There are two branches. Each labeled with the user name. Any files they have uploaded are listed under there branch. I will have an upload file button as part of the view. When the users uploads a file I fire off an AMFPHP call to get the new file list data so that I can update the tree with the new files name. Here is the issue that I am running into. I am storing the Tree's openItems property into an Array because after the user uploads the file and the dataProvider gets updated the branches close. I would like the user to be presented with the branches they had open before they uploaded the file. Ever time a branch is open I say myArray = mytree.openItems; If I put a button all the stage and on the click I say mytree.openItems = myArray; The tree opens the branches stored in the Array. If I make an AMF Call and the dataProvider changes the same function for setting the openItems proporty does not work. I even tried using mytree.validateNow() before I set the openItems propory. Anyone have thoughts on how to make this work. Seams like a bug to me but I am not sure. -Matthew
[flexcoders] Re: Tree Component openItems and refresh dataProvider issue
Are you resetting the data provider or just updating it? I find that if I just update the data provider by inserting/removing elements the Tree reflects the change appropriately. One bug I've hit, which might be what you are experiencing, is that if I remove the Tree from the stage and add it later then all branches will appear collapsed even tho the property openItems correctly lists the open nodes. The workaround is similar to what you describe: https://bugs.adobe.com/jira/browse/SDK-14892
Re: [flexcoders] Re: Tree Component openItems and refresh dataProvider issue
override the set dataProvider; then store the openitems, selecteditems, etc... call super.dataProvider = provider; openItems=storedOpenItems; validateNow(); selectedItems=storedSelectedItems; validateNow(); as for amf calls, I have a method which gets the instance from the dataprovider and adds it to an array. then i set the value in the tree. Ryan Gravener http://twitter.com/ryangravener On Thu, Sep 25, 2008 at 1:41 PM, Ivo [EMAIL PROTECTED] wrote: Are you resetting the data provider or just updating it? I find that if I just update the data provider by inserting/removing elements the Tree reflects the change appropriately. One bug I've hit, which might be what you are experiencing, is that if I remove the Tree from the stage and add it later then all branches will appear collapsed even tho the property openItems correctly lists the open nodes. The workaround is similar to what you describe: https://bugs.adobe.com/jira/browse/SDK-14892
RE: [flexcoders] Re: Tree Component openItems and refresh dataProvider issue
I didn't quite follow Ryan's suggestion. The problem in general is that the selectdItems array has to contain references to items in the dataProvider. This will not be the case if your replace the DataProvider. Using the API to update changed items is an ideal solution if possible in your case. Another solution would be to keep a list of ids of the open nodes. You only need to keep the end child in the list. Then, when the dataProvider is refreshed, recursively process the dataProvider looking for ids in the list. When found, climb the ancestor chain opening nodes as you go until you reach an open node or root. Really ugly, but pretty fast if your data is not huge. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Gravener Sent: Thursday, September 25, 2008 1:59 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Tree Component openItems and refresh dataProvider issue override the set dataProvider; then store the openitems, selecteditems, etc... call super.dataProvider = provider; openItems=storedOpenItems; validateNow(); selectedItems=storedSelectedItems; validateNow(); as for amf calls, I have a method which gets the instance from the dataprovider and adds it to an array. then i set the value in the tree. Ryan Gravener http://twitter.com/ryangravener http://twitter.com/ryangravener On Thu, Sep 25, 2008 at 1:41 PM, Ivo [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Are you resetting the data provider or just updating it? I find that if I just update the data provider by inserting/removing elements the Tree reflects the change appropriately. One bug I've hit, which might be what you are experiencing, is that if I remove the Tree from the stage and add it later then all branches will appear collapsed even tho the property openItems correctly lists the open nodes. The workaround is similar to what you describe: https://bugs.adobe.com/jira/browse/SDK-14892 https://bugs.adobe.com/jira/browse/SDK-14892
[flexcoders] Re: tree component and null itemRenderer
If I open all the nodes in the tree, i.e. make them visible though and then try to get a handle to one of the custom item renderers I'm getting that it is null, i.e. itemRenderer in code below is always null. for each (var model:String in _carModels) { for each (var item:XML in dp..node) { if ([EMAIL PROTECTED] == model) { trace(model=+model); trace([EMAIL PROTECTED][EMAIL PROTECTED]); var itemRenderer:CheckTreeRenderer = tree.itemToItemRenderer (item) as CheckTreeRenderer; trace(itemRenderer=+itemRenderer); itemRenderer.select(); } } } --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: It sounds like you may not understand that item renderers are recycled, and do not even exist when non-visible. What exactly do you mean by initialize the item renderer? They are components, and live the normal component lifecycle, including initialize and creationComplete events. initialization that is not dependent on the item node data can be done in handlers for those events. Any properties or behaviors that are dependent on the item node data must be manipulated through the set data, commitProperties, updateDisplayList and invalidation mechanisms. My bet is a customer checkbox IS dependent on the underlying data. It must get its value from the data and user interaction must be persisted in the data. If you already know all this sorry, I may be misunderstanding your question, otherwise I suggest that you find an existing item renderer to use as an example. There will be many available. Google Alex Harui itemRenderer. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of paulbohnenkamp Sent: Tuesday, September 09, 2008 12:31 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] tree component and null itemRenderer I've got a tree component with an customer checkbox itemRenderer and on init of the outer component I need all the itemRenderers to be initialized so I can call a method on the itemRenderer to select them based on the result of a web service call. Is there a way to do this? Somehow loop through the items in the tree dataprovider and select them all so the itemRenderers are all initialized? I tried tree.openItems and looping through and doing tree.expandItem (item, true) but that doesn't seem to init the itemRenderers.
RE: [flexcoders] Re: tree component and null itemRenderer
I have not used that method and can't sugggest why it might not be working. I won't say what you are doing is wrong, but it is very rare that itemRenderers should be manipulated directly. What you are doing will die if someone closes a branch. I really suggest that you re-examine your approach. The normal way to do what your are attempting would be to have a selected attribute on your nodes, and have the renderer use that to set its selected state. To set all the checkboxes to selected, loop over your data as you are doing, set the selected attribute as you wish. The tree will automatically display the results. One nice thing about XML is that you can add attributes on the fly. So even if your source xml does not have a @selected attribute, you loop can add one. I do that in this example, which is for a DataGrid: http://www.cflex.net/showFileDetails.cfm?ObjectID=559 Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of paulbohnenkamp Sent: Tuesday, September 09, 2008 12:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: tree component and null itemRenderer If I open all the nodes in the tree, i.e. make them visible though and then try to get a handle to one of the custom item renderers I'm getting that it is null, i.e. itemRenderer in code below is always null. for each (var model:String in _carModels) { for each (var item:XML in dp..node) { if ([EMAIL PROTECTED] == model) { trace(model=+model); trace([EMAIL PROTECTED][EMAIL PROTECTED]); var itemRenderer:CheckTreeRenderer = tree.itemToItemRenderer (item) as CheckTreeRenderer; trace(itemRenderer=+itemRenderer); itemRenderer.select(); } } } --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt [EMAIL PROTECTED] wrote: It sounds like you may not understand that item renderers are recycled, and do not even exist when non-visible. What exactly do you mean by initialize the item renderer? They are components, and live the normal component lifecycle, including initialize and creationComplete events. initialization that is not dependent on the item node data can be done in handlers for those events. Any properties or behaviors that are dependent on the item node data must be manipulated through the set data, commitProperties, updateDisplayList and invalidation mechanisms. My bet is a customer checkbox IS dependent on the underlying data. It must get its value from the data and user interaction must be persisted in the data. If you already know all this sorry, I may be misunderstanding your question, otherwise I suggest that you find an existing item renderer to use as an example. There will be many available. Google Alex Harui itemRenderer. Tracy From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of paulbohnenkamp Sent: Tuesday, September 09, 2008 12:31 AM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] tree component and null itemRenderer I've got a tree component with an customer checkbox itemRenderer and on init of the outer component I need all the itemRenderers to be initialized so I can call a method on the itemRenderer to select them based on the result of a web service call. Is there a way to do this? Somehow loop through the items in the tree dataprovider and select them all so the itemRenderers are all initialized? I tried tree.openItems and looping through and doing tree.expandItem (item, true) but that doesn't seem to init the itemRenderers.
Re: [flexcoders] Re: Tree component that doesn't display all nodes?
Hi, You could also write a custom dataDescriptor that subclasses DefaultDataDescriptor. In that class override the getChildren() method and only return the children you want based on the nodes you want filtered. Peace, Mike On 12 Apr 2007 22:22:04 -0700, dorkie dork from dorktown [EMAIL PROTECTED] wrote: i see. what i would do is use a lazy loading mechanism. so you only display the top level branches. when the user opens a branch then you lazy load the child nodes. when the user opens the branch then you can get the node they opened and filter the node they opened of all the noshow nodes. // in the open node event var filteredNode:XML = myTree.selectedNode.myFilter; myTree.selectedNode = filteredNode; actually, i think there is a way to apply a filter on xmllist collection non destructively. i think maybe you could put your selected node into an xml list collection and then filter it. if this was AS2 i'd be able to help you more. On 12 Apr 2007 18:40:43 -0700, hosey hosey [EMAIL PROTECTED] wrote: Thanks, I dont believe that can work. If the data is xml cb title=hello noshow notitle=dontshowanything/ cb title=there/ /cb /xml and I set the datasource=data.cb then the tree appears with hello and all of the following tags. if I set the datasource =data..cb then I get an XMLlist of all of the tags I need , but the first of which expands revealing the no show tag if I set the datasource=data.cb.(nodeName!=noShow).. the first of which expands revealing the no show tag Anyways I am looking into creating a filter function, but I think a better way is to extned a renderer...but I dont know yet Thanks Hosey -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.
Re: [flexcoders] Re: Tree component that doesn't display all nodes?
Excellent, works great. Thank you. Hosey On 13 Apr 2007 05:38:14 -0700, Michael Schmalle [EMAIL PROTECTED] wrote: Hi, You could also write a custom dataDescriptor that subclasses DefaultDataDescriptor. In that class override the getChildren() method and only return the children you want based on the nodes you want filtered. Peace, Mike On 12 Apr 2007 22:22:04 -0700, dorkie dork from dorktown [EMAIL PROTECTED] wrote: i see. what i would do is use a lazy loading mechanism. so you only display the top level branches. when the user opens a branch then you lazy load the child nodes. when the user opens the branch then you can get the node they opened and filter the node they opened of all the noshow nodes. // in the open node event var filteredNode:XML = myTree.selectedNode.myFilter; myTree.selectedNode = filteredNode; actually, i think there is a way to apply a filter on xmllist collection non destructively. i think maybe you could put your selected node into an xml list collection and then filter it. if this was AS2 i'd be able to help you more. On 12 Apr 2007 18:40:43 -0700, hosey hosey [EMAIL PROTECTED] wrote: Thanks, I dont believe that can work. If the data is xml cb title=hello noshow notitle=dontshowanything/ cb title=there/ /cb /xml and I set the datasource=data.cb then the tree appears with hello and all of the following tags. if I set the datasource =data..cb then I get an XMLlist of all of the tags I need , but the first of which expands revealing the no show tag if I set the datasource=data.cb.(nodeName!=noShow).. the first of which expands revealing the no show tag Anyways I am looking into creating a filter function, but I think a better way is to extned a renderer...but I dont know yet Thanks Hosey -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.
[flexcoders] Re: Tree component that doesn't display all nodes?
The main issue being I want live data changes; such that if the xml changes a label the tree changes its label (this works on default tree component). There will be 400 nodes with 40 unwanted to be displayed nodes. On 4/12/07, hosey hosey [EMAIL PROTECTED] wrote: The datasource is cb title=hello noshow title=dontshowanything/ cb title=there/ /cb I would like the tree to display -hello -there not -hello - -there Any ideas? Thanks Hosey
Re: [flexcoders] Re: Tree component that doesn't display all nodes?
if you use e4x format and regexp with your xml object then you can filter to show whatever data you want. i am not familiar with them enough to give you an example. note, you can also use regexp with xml. On 12 Apr 2007 15:30:51 -0700, hosey hosey [EMAIL PROTECTED] wrote: The main issue being I want live data changes; such that if the xml changes a label the tree changes its label (this works on default tree component). There will be 400 nodes with 40 unwanted to be displayed nodes. On 4/12/07, hosey hosey [EMAIL PROTECTED] wrote: The datasource is cb title=hello noshow title=dontshowanything/ cb title=there/ /cb I would like the tree to display -hello -there not -hello - -there Any ideas? Thanks Hosey
Re: [flexcoders] Re: Tree component that doesn't display all nodes?
Thanks, I dont believe that can work. If the data is xml cb title=hello noshow notitle=dontshowanything/ cb title=there/ /cb /xml and I set the datasource=data.cb then the tree appears with hello and all of the following tags. if I set the datasource =data..cb then I get an XMLlist of all of the tags I need , but the first of which expands revealing the no show tag if I set the datasource=data.cb.(nodeName!=noShow)..the first of which expands revealing the no show tag Anyways I am looking into creating a filter function, but I think a better way is to extned a renderer...but I dont know yet Thanks Hosey
Re: [flexcoders] Re: Tree component that doesn't display all nodes?
i see. what i would do is use a lazy loading mechanism. so you only display the top level branches. when the user opens a branch then you lazy load the child nodes. when the user opens the branch then you can get the node they opened and filter the node they opened of all the noshow nodes. // in the open node event var filteredNode:XML = myTree.selectedNode.myFilter; myTree.selectedNode = filteredNode; actually, i think there is a way to apply a filter on xmllist collection non destructively. i think maybe you could put your selected node into an xml list collection and then filter it. if this was AS2 i'd be able to help you more. On 12 Apr 2007 18:40:43 -0700, hosey hosey [EMAIL PROTECTED] wrote: Thanks, I dont believe that can work. If the data is xml cb title=hello noshow notitle=dontshowanything/ cb title=there/ /cb /xml and I set the datasource=data.cb then the tree appears with hello and all of the following tags. if I set the datasource =data..cb then I get an XMLlist of all of the tags I need , but the first of which expands revealing the no show tag if I set the datasource=data.cb.(nodeName!=noShow).. the first of which expands revealing the no show tag Anyways I am looking into creating a filter function, but I think a better way is to extned a renderer...but I dont know yet Thanks Hosey
[flexcoders] Re: Tree Component closing and opening item
Thanks barry and Mike! I have tried all the permutations and combinations it works fine without animation but when we set the animation true.It does not. I agree with Mike,We really have to do some major changes on the Tree component to achive this. Anyway,I wanted to achieve somthing like this.This is a AS2 Component: http://www.sephiroth.it/tutorials/flashPHP/custom_tree/index.php regards, --- In flexcoders@yahoogroups.com, Michael Schmalle [EMAIL PROTECTED] wrote: Hi, Actually, 'I think'... Having looked at the Tree code quite extensively, it is NOT possible. The reason being is the way the tween logic works in the Tree. When a tween is currently running, there cannot be any other tween going because there is only 1 instance of the tween in the whole tree. It would just theoretically reset the tween. Have a look a the method expanItem() and you will see a large block of logic that calculates opening rows etc. When thinking about it logically, it is impossible without major logic and really the way this Tree is made, I don't think it would ever be possible. The Tree is not like an Accordion that has 'specific' sectors. The tree is always dynamically created based on openItems. Peace, Mike On 9/18/06, barry.beattie [EMAIL PROTECTED] wrote: no takers, Mick? this was one thing I wanted to look into before being sidetracked with some datagrids. at first I was thinking of keeping a register of what was opened so I knew what to close. then I was thinking of closing all before opening the selected one. these are just some rough thoughts in absence of anything better. it *must* be possible: the panels do it. cheers barry.b -- What goes up, does come down. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Tree Component closing and opening item
no takers, Mick? this was one thing I wanted to look into before being sidetracked with some datagrids. at first I was thinking of keeping a register of what was opened so I knew what to close. then I was thinking of closing all before opening the selected one. these are just some rough thoughts in absence of anything better. it *must* be possible: the panels do it. cheers barry.b -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Tree Component closing and opening item
this can be done. at first I was thinking of keeping a register of what was opened so I knew what to close. you dont have to. mx:tree has a property called openItems ..this has a reference to all the opened items. all you have to do is check whether anything is opened during a Tree.itemOpen event eg mx:Tree id=tree1 itemOpen=treeOpened(event) public function treeOpened(event:TreeEvent):void { if(tree1.openItems.length 1) { tree1.expandItem(tree1.openItems[0], false); } something like this --- In flexcoders@yahoogroups.com, barry.beattie [EMAIL PROTECTED] wrote: no takers, Mick? this was one thing I wanted to look into before being sidetracked with some datagrids. at first I was thinking of keeping a register of what was opened so I knew what to close. then I was thinking of closing all before opening the selected one. these are just some rough thoughts in absence of anything better. it *must* be possible: the panels do it. cheers barry.b -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Re: Tree Component closing and opening item
Hi,Actually, 'I think'... Having looked at the Tree code quite extensively, it is NOT possible.The reason being is the way the tween logic works in the Tree. When a tween is currently running, there cannot be any other tween going because there is only 1 instance of the tween in the whole tree. It would just theoretically reset the tween. Have a look a the method expanItem() and you will see a large block of logic that calculates opening rows etc. When thinking about it logically, it is impossible without major logic and really the way this Tree is made, I don't think it would ever be possible. The Tree is not like an Accordion that has 'specific' sectors. The tree is always dynamically created based on openItems.Peace, MikeOn 9/18/06, barry.beattie [EMAIL PROTECTED] wrote: no takers, Mick? this was one thing I wanted to look into before being sidetracked with some datagrids. at first I was thinking of keeping a register of what was opened so I knew what to close. then I was thinking of closing all before opening the selected one. these are just some rough thoughts in absence of anything better. it *must* be possible: the panels do it. cheers barry.b -- What goes up, does come down. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Software development tool Software development Software development services Home design software Software development company Your email settings: Individual Email|Traditional Change settings via the Web (Yahoo! ID required) Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe __,_._,___
[flexcoders] Re: Tree Component expandItem Animation true problem.
Hi, Thanks Deepa for ur solution.I have tried to use custom ItemRenderer.Tweening is working fine.But how I do I change the row backgroud color when user selects a row? is there any handler to chage the selected color. I have used the following code in my ItemRenderer: Inside the updateDisplayList: if(TreeListData(super.listData).hasChildren) { graphics.clear(); graphics.beginFill(0xF4C403,1.0); graphics.lineStyle(1, 0xF4C403, 1.0); graphics.drawRect(0, 0, unscaledWidth, unscaledHeight); graphics.endFill() } Thanks again for your reply. regards, Mick --- In flexcoders@yahoogroups.com, Deepa Subramaniam [EMAIL PROTECTED] wrote: This is because of the way the depthColors are drawn. They are only drawn in drawRowBackgrounds() which gets called in updateDisplayList() so the row background colors are not tweened during the animation. I've added an enhancement request to allow for tweening of background row colors during the animation. Possible workarounds include overriding onTweenUpdate() and manually tweening the backgroundColor of each row yourself. You might be able to get away with writing your own TreeItemRenderer where each UITextField was encompassed in an HBox with backgroundColor set. However I think since renderers are re-used, you'd have to write some code to make sure that as each renderer is re-used its backgroundColor is changed to maintain the color ordering prescribed by that row's depth. If you find the shifting of colors too ugly, you can change your openDuration to 0 so that there is no animation and the items just open with the correct background row color. HTH, -deepa From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mick Robin Sent: Tuesday, September 05, 2006 7:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Tree Component expandItem Animation true problem. Hi, I got a problem with the Tree Component. I have set the following properties for theTree componenet in my application: labelField=@label width=100% height=100% defaultLeafIcon= undefined folderOpenIcon=undefined folderClosedIcon=undefined disclosureClosedIcon=undefined disclosureOpenIcon=undefined fontSize=10 depthColors= [0xF4C406,0xff,0xF4C403] borderStyle= none useRollOver=false selectionDuration=0 selectionColor= 0x99 Now when I am trying to call Tree.expandItem(event.currentTarget.selectedItem,true,true) method.It opens the child items .Only thing the animation for the parent node does not work.Only the labels get animated but the color behind the label doesnot animate it suddely changes it position.I want the label and color to move at the same time.Any help?? Thanks in advance Mick Do you Yahoo!? Get on board. You're invited http://us.rd.yahoo.com/evt=40791/*http:/advision.webevents.yahoo.com /ma ilbeta to try the new Yahoo! Mail. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Tree component help - please
Hi, Maybe try something like this: mx:Tree nodeOpen=getNodes(event.node) / you might want to store a reference to this node rather than using contentMgmtTree.selectedItem. So you script block might look like this: public function getNodes( treeNode ) { treeSelectedNode = treeNode; EventBroadcaster.getInstance().broadcastEvent( getTheNodez, treeNode.getData().oid ); } //and for adding the nodes public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) { var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode ); //or break it down even further with this //var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode.label, treeNode ); if( treeNode.hasChildren == true ) { tempNode.setProperty( 'isBranch', true, true ); } else { tempNode.setProperty( 'isBranch', false, true ); } } The only real difference is that I store a reference to the selected node from the nodeOpen event using event.node. This is then what I would use to add the child nodes to. See how that goes. Andrew Spaulding www.flexdaddy.info --- In flexcoders@yahoogroups.com, pat_ryan_99 [EMAIL PROTECTED] wrote: Hi Everyone, I have looked through old messages in this group and did not see anything that addresses my question - or at least it was not clear that it did. Here is what I am trying to do. Using the Cairngorm framework, I am making a remote call to my server to retrieve something I wrote called a TreeNodeVO ( which has a public label property ). My ViewHelper adds the Root node like this (which works ): public function addRootTreeNode(treeNode:TreeNodeVO) : Void { view.contentMgmtTree.removeAll(); var node:Object = view.contentMgmtTree.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } when I open the tree node, I make another remote call to get the children as an Array of TreeNodeVO objects. The ViewHelper method to add the other nodes under the opened node looks like: public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) : Void { trace(treeNode: + treeNode.toString()); var node:Object = view.contentMgmtTree.selectedItem.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } what I see happening is the root node renders correctly as a folder with the right label. When I open the folder the server is returning the correct array of TreeNodeVO objects but what is rendered under the root node is a document icon ( which is correct ) but with the label [type Function],[type Function],... Can someone please point me in the right direction on the correct way to add nodes that DO NOT use the XML model? Any help is greatly appreciated. Thanks Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hsihsdg/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124126261/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: Tree component help - please
Thank you for the response, but that produced the same results. Other thoughts? I assume that since my TreeNodeVO has a label attribute, that is all that is really required? Is it having trouble understanding this VO? Thanks again Pat --- In flexcoders@yahoogroups.com, Andrew Spaulding [EMAIL PROTECTED] wrote: Hi, Maybe try something like this: mx:Tree nodeOpen=getNodes(event.node) / you might want to store a reference to this node rather than using contentMgmtTree.selectedItem. So you script block might look like this: public function getNodes( treeNode ) { treeSelectedNode = treeNode; EventBroadcaster.getInstance().broadcastEvent( getTheNodez, treeNode.getData().oid ); } //and for adding the nodes public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) { var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode ); //or break it down even further with this //var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode.label, treeNode ); if( treeNode.hasChildren == true ) { tempNode.setProperty( 'isBranch', true, true ); } else { tempNode.setProperty( 'isBranch', false, true ); } } The only real difference is that I store a reference to the selected node from the nodeOpen event using event.node. This is then what I would use to add the child nodes to. See how that goes. Andrew Spaulding www.flexdaddy.info --- In flexcoders@yahoogroups.com, pat_ryan_99 [EMAIL PROTECTED] wrote: Hi Everyone, I have looked through old messages in this group and did not see anything that addresses my question - or at least it was not clear that it did. Here is what I am trying to do. Using the Cairngorm framework, I am making a remote call to my server to retrieve something I wrote called a TreeNodeVO ( which has a public label property ). My ViewHelper adds the Root node like this (which works ): public function addRootTreeNode(treeNode:TreeNodeVO) : Void { view.contentMgmtTree.removeAll(); var node:Object = view.contentMgmtTree.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } when I open the tree node, I make another remote call to get the children as an Array of TreeNodeVO objects. The ViewHelper method to add the other nodes under the opened node looks like: public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) : Void { trace(treeNode: + treeNode.toString()); var node:Object = view.contentMgmtTree.selectedItem.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } what I see happening is the root node renders correctly as a folder with the right label. When I open the folder the server is returning the correct array of TreeNodeVO objects but what is rendered under the root node is a document icon ( which is correct ) but with the label [type Function],[type Function],... Can someone please point me in the right direction on the correct way to add nodes that DO NOT use the XML model? Any help is greatly appreciated. Thanks Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hh0lo59/M=362131.6882499.7825260.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124129694/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life - brought to you by One Economy/a./font ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
RE: [flexcoders] Re: Tree component help - please
I think the label property need to be at the top level of the treeNode. So your example: var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode.label, treeNode ); Should work. Remember when accessing the treeNode, use the TreeDataProvider API, like getProperty(label), and getData() Tracy -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pat_ryan_99 Sent: Monday, August 15, 2005 12:02 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree component help - please Thank you for the response, but that produced the same results. Other thoughts? I assume that since my TreeNodeVO has a label attribute, that is all that is really required? Is it having trouble understanding this VO? Thanks again Pat --- In flexcoders@yahoogroups.com, Andrew Spaulding [EMAIL PROTECTED] wrote: Hi, Maybe try something like this: mx:Tree nodeOpen=getNodes(event.node) / you might want to store a reference to this node rather than using contentMgmtTree.selectedItem. So you script block might look like this: public function getNodes( treeNode ) { treeSelectedNode = treeNode; EventBroadcaster.getInstance().broadcastEvent( getTheNodez, treeNode.getData().oid ); } //and for adding the nodes public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) { var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode ); //or break it down even further with this //var tempNode:TreeNode = treeSelectedNode.addTreeNode( treeNode.label, treeNode ); if( treeNode.hasChildren == true ) { tempNode.setProperty( 'isBranch', true, true ); } else { tempNode.setProperty( 'isBranch', false, true ); } } The only real difference is that I store a reference to the selected node from the nodeOpen event using event.node. This is then what I would use to add the child nodes to. See how that goes. Andrew Spaulding www.flexdaddy.info --- In flexcoders@yahoogroups.com, pat_ryan_99 [EMAIL PROTECTED] wrote: Hi Everyone, I have looked through old messages in this group and did not see anything that addresses my question - or at least it was not clear that it did. Here is what I am trying to do. Using the Cairngorm framework, I am making a remote call to my server to retrieve something I wrote called a TreeNodeVO ( which has a public label property ). My ViewHelper adds the Root node like this (which works ): public function addRootTreeNode(treeNode:TreeNodeVO) : Void { view.contentMgmtTree.removeAll(); var node:Object = view.contentMgmtTree.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } when I open the tree node, I make another remote call to get the children as an Array of TreeNodeVO objects. The ViewHelper method to add the other nodes under the opened node looks like: public function addTreeNodeUnderSelected(treeNode:TreeNodeVO) : Void { trace(treeNode: + treeNode.toString()); var node:Object = view.contentMgmtTree.selectedItem.addTreeNode(treeNode); if( treeNode.hasChildren == true ) { view.contentMgmtTree.setIsBranch(node,true); } } what I see happening is the root node renders correctly as a folder with the right label. When I open the folder the server is returning the correct array of TreeNodeVO objects but what is rendered under the root node is a document icon ( which is correct ) but with the label [type Function],[type Function],... Can someone please point me in the right direction on the correct way to add nodes that DO NOT use the XML model? Any help is greatly appreciated. Thanks -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links Yahoo! Groups Sponsor ~-- font face=arial size=-1a href=http://us.ard.yahoo.com/SIG=12hohv8e7/M=362335.6886445.7839731.1510227/D=groups/S=1705007207:TM/Y=YAHOO/EXP=1124133933/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOOcmpgn=GRPRTP=http://groups.yahoo.com/;In low income neighborhoods, 84% do not own computers. At Network for Good, help bridge the Digital Divide!/a./font ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups
RE: [flexcoders] RE: Tree component confusion
Here is an example posted on the MM forum some time ago: Tariq, if you are listening, maybe this should go in your examples. Tracy There is an unexpected behavior with the dropLocation: Sometimes it does not return the correct integer. For example, expand all the nodes and try to drag node Four into the first(0) position in branch one. GetDropLocation() returns a 1 not a 0 as I would expect. If anyone has any insights I would like to hear, as I am fighting with this situation in my own application. Attach Code ?xml version=1.0 encoding=utf-8?mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml mx:Script ![CDATA[ import mx.managers.DragManager; function doDragEnter(event) { event.handled = true; } function doDragExit(event) { event.target.hideDropFeedback(); } function doDragOver(event) { event.target.showDropFeedback(); } function doDragDrop(event) { doDragExit(event); var dragNodes = event.dragSource.dataForFormat(source).selectedItems; var toNode = event.target.getDropParent(); var idex = event.target.getDropLocation(); event.target.clearSelected(); var imax = dragNodes.length; for( var i=0; i imax; i++ ) { taStatus.text = taStatus.text + \n + Adding node at index: + idex; toNode.addTreeNodeAt( idex, dragNodes[i] ); } } function doDragComplete(event) { var dragNodes = event.dragSource.dataForFormat(source).selectedItems; var imax = dragNodes.length; for( var i=0; i imax; i++ ) { var node = dragNodes; node.removeTreeNode(); } } ]]/mx:Script mx:Tree id=navigator editable=true heightFlex=1 dragEnabled=true dragEnter=doDragEnter(event) dragExit=doDragExit(event) dragOver=doDragOver(event) dragDrop=doDragDrop(event) dragComplete=doDragComplete(event) mx:dataProvider mx:XML node label=A node label=One node label=abc/ node label=def/ /node node label=Two / /node node label=B node label=Three / node label=Four / /node /mx:XML /mx:dataProvider /mx:Tree mx:TextArea id=taStatus width=300 height=100 //mx:Application From: Pilby [mailto:[EMAIL PROTECTED] Sent: Thursday, March 10, 2005 11:34 AM To: Flex Coders Subject: [flexcoders] RE: Tree component confusion My objective is to allow the user to drag a tree node and drop it on another node, and then reflect visually the changes he/she has made. I since learned this is a lot more complicated than meets the eye because the index of the drop location seems to change. From what I have seen, the moment a branch opens, its index becomes 0, and when it's closed, it's index becomes relative to its parent node. So if Node A is the topmost node, and Node B is its child node, while Node B is closed, it's index is 1, but the moment I open Node B, it's index becomes 0. This is a problem because the only method I see that I can use for my purpose is the addTreeNodeAt(index). And if there were multiple branches open in the entire tree, we end up having multiple nodes with the SAME index! Can anyone give me an example of a drag-n-drop operation entirely within a tree? The examples I have found deal with dragging datagrid items on a tree, or dragging items from a tree to a list box. What about an example that drags a tree item and drops on another tree item within the same tree?