RE: [flexcoders] Re: Tree custom renderer
In your treeRendererFilter class, override the updateDisplayList method. In there, set the position of your customerReportingFilter based on the label property. Be careful since the label property, in the base class, is made to be the entire lenght of the item renderer minus the icons. So, you want to calculate the size of your customerReportingFilter component, in the measure function, and in the updateDisplayList function, you do something like: override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); label.width -= filter.width; filter.x = label.x + label.width; } where filter is you customerReportingFilter. Yves From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 7:17 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Actually it adds it behind the label. I have spent some time trying to tweak it with no success. Anybody, any idea? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , markgoldin_2000 markgoldin_2...@... wrote: Yes, that was a problem to show an additional component. Now when I see it, I realize that it's going to be added in a front of a node text, while I want it to be after. How to do that? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tracy@ wrote: One thing to watch for is that manual instantiation does not always set a default height and width. Explicitly set these to see if the child controls display Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 3:54 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Thanks, Tracy, I have looked into your example. Here is what I got so far. It compiles fine, but when it runs I dont see anything except regular nodes with a text. package { import mx.controls.treeClasses.*; public class treeRendererFilter extends TreeItemRenderer { private var _oTreeListData:TreeListData; public function treeRendererFilter() { super(); } override public function set data(value:Object):void { super.data = value; _oTreeListData = TreeListData(super.listData); } override protected function createChildren():void { super.createChildren(); var filter:customerReportingFilter = new customerReportingFilter(); addChild(filter); validateDisplayList(); } } } //customerReportingFilter ?xml version=1.0 encoding=utf-8? mx:FormItem xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml com/2006/mxml height=22 direction=horizontal visible=true mx:HBox mx:RadioButtonGroup id=reportfilter/ mx:RadioButton label=Button 1 groupName=reportfilter/ mx:RadioButton label=Button 2 groupName=reportfilter/ /mx:HBox /mx:FormItem // tree definition mx:Tree id=customerServiceTree fontSize=11 width=100% height=99% labelField=@name textAlign=left itemRenderer=treeRendererFilter creationComplete=userNavigation(Number(category4.name), customerServiceTree) itemClick=itemClickEvt(event); showRoot=false borderStyle=solid borderThickness=1 /mx:Tree --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Tracy Spratt tracy@ wrote: I have an example on www.cflex.net http://www.cflex. http://www.cflex.net/ http://www.cflex.net/ net/ that extends TreeItemRenderer and adds the tree sibling lines. It might be a good starting point. Tracy Spratt, Lariat Services, development services available _ From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 2:42 PM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] Tree custom renderer I am looking for design ideas to extend an item renderer for a tree control. Specifically, I want to have a node that would show a regular label for its name plus a radiogroup with 3-4 radio buttons shown horizontally with a node. So, the user can specify some filters for an upcoming interface when he selects a node. Any clue? Thanks
RE: [flexcoders] Re: Tree custom renderer
Works fine for me. You probably have another issue in there. This is what I had for item renderer. The other classes were not touched. package { import mx.controls.treeClasses.*; public class treeRendererFilter extends TreeItemRenderer { private var _oTreeListData:TreeListData; public var filter:customerReportingFilter = null; public function treeRendererFilter() { super(); } override public function set data(value:Object):void { super.data = value; _oTreeListData = TreeListData(super.listData); } override protected function createChildren():void { super.createChildren(); filter = new customerReportingFilter(); filter.width = 200; addChild(filter); validateDisplayList(); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); label.width -= filter.width; filter.x = label.x + label.width; } } } From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Wednesday, April 29, 2009 9:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Not so fast :) My item renderer with additional objects is shown properly. But the whole tree is not working they way it should. First, open/close symbol for the top folder node is shown now on a far right side, while it should be on a left. Second, when I open and close it, my special item renderer gets messed up. Any idea? Thanks --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , markgoldin_2000 markgoldin_2...@... wrote: Yep, that was it, thanks! --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Yves Riel riel@ wrote: In your treeRendererFilter class, override the updateDisplayList method. In there, set the position of your customerReportingFilter based on the label property. Be careful since the label property, in the base class, is made to be the entire lenght of the item renderer minus the icons. So, you want to calculate the size of your customerReportingFilter component, in the measure function, and in the updateDisplayList function, you do something like: override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { super.updateDisplayList(unscaledWidth, unscaledHeight); label.width -= filter.width; filter.x = label.x + label.width; } where filter is you customerReportingFilter. Yves From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 7:17 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Actually it adds it behind the label. I have spent some time trying to tweak it with no success. Anybody, any idea? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , markgoldin_2000 markgoldin_2000@ wrote: Yes, that was a problem to show an additional component. Now when I see it, I realize that it's going to be added in a front of a node text, while I want it to be after. How to do that? --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt tracy@ wrote: One thing to watch for is that manual instantiation does not always set a default height and width. Explicitly set these to see if the child controls display Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 3:54 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Thanks, Tracy, I have looked into your example. Here is what I got so far. It compiles fine, but when it runs I dont see anything except regular nodes with a text. package { import mx.controls.treeClasses.*; public class treeRendererFilter extends TreeItemRenderer { private var _oTreeListData:TreeListData; public function treeRendererFilter() { super(); } override public function set data(value:Object):void { super.data = value; _oTreeListData = TreeListData(super.listData); } override protected function createChildren():void {
RE: [flexcoders] Re: Tree custom renderer
One thing to watch for is that manual instantiation does not always set a default height and width. Explicitly set these to see if the child controls display Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 3:54 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Tree custom renderer Thanks, Tracy, I have looked into your example. Here is what I got so far. It compiles fine, but when it runs I dont see anything except regular nodes with a text. package { import mx.controls.treeClasses.*; public class treeRendererFilter extends TreeItemRenderer { private var _oTreeListData:TreeListData; public function treeRendererFilter() { super(); } override public function set data(value:Object):void { super.data = value; _oTreeListData = TreeListData(super.listData); } override protected function createChildren():void { super.createChildren(); var filter:customerReportingFilter = new customerReportingFilter(); addChild(filter); validateDisplayList(); } } } //customerReportingFilter ?xml version=1.0 encoding=utf-8? mx:FormItem xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml height=22 direction=horizontal visible=true mx:HBox mx:RadioButtonGroup id=reportfilter/ mx:RadioButton label=Button 1 groupName=reportfilter/ mx:RadioButton label=Button 2 groupName=reportfilter/ /mx:HBox /mx:FormItem // tree definition mx:Tree id=customerServiceTree fontSize=11 width=100% height=99% labelField=@name textAlign=left itemRenderer=treeRendererFilter creationComplete=userNavigation(Number(category4.name), customerServiceTree) itemClick=itemClickEvt(event); showRoot=false borderStyle=solid borderThickness=1 /mx:Tree --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Tracy Spratt tr...@... wrote: I have an example on www.cflex.net http://www.cflex. http://www.cflex.net/ net/ that extends TreeItemRenderer and adds the tree sibling lines. It might be a good starting point. Tracy Spratt, Lariat Services, development services available _ From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of markgoldin_2000 Sent: Tuesday, April 28, 2009 2:42 PM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] Tree custom renderer I am looking for design ideas to extend an item renderer for a tree control. Specifically, I want to have a node that would show a regular label for its name plus a radiogroup with 3-4 radio buttons shown horizontally with a node. So, the user can specify some filters for an upcoming interface when he selects a node. Any clue? Thanks