RE: [flexcoders] Flex 2 Tree Behaviour override

2006-03-20 Thread Jason Hawryluk





if you just want to concat the label then replace text=[EMAIL PROTECTED]with the 2 attributes

example in your cellrenderer

?xml 
version="1.0" encoding="utf-8"?mx:HBox xmlns:mx="http://www.macromedia.com/2005/mxml" 
implements="mx.controls.listclasses.IDropInListItemRenderer"xmlns="*" 
mx:Label id="Name" text="[EMAIL PROTECTED] + ' '+ 
[EMAIL PROTECTED]"//mx:HBox
however that said your tree renderer needs to implement the 
IDropInListItemRenderer as above. This is 
untested and may not work... in anycase have a look at 
the

Interface IDropInListItemRenderer in the 
help

Or even better you could do something in an as class like (again not 
tested):

packageSampleTreeRenderer {import 
mx.controls.treeclasses.TreeCellRenderer;/** * 
this class allows us to set specific properties on a tree 
node**/public class Tree_Item 
extends mx.controls.treeclasses.TreeCellRenderer 
{public function 
Vision_Tree_Item(){super();}override protected function 
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
{super.updateDisplayList(unscaledWidth,unscaledHeight);//do 
all speacial drawing 
here}override 
public function set dataObject(value:Object):void 
{super.dataObject=value;
//do your concat here or what 
everif (value !=null){
[EMAIL PROTECTED] + ' ' + [EMAIL PROTECTED];}
}
}}


then on your tree you do a 
listItemRenderer="Tree_Item"

hope this helps..

jason


  -Message d'origine-De: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part 
  de yair_inyEnvoyé: lundi 20 mars 2006 
  12:51À: flexcoders@yahoogroups.comObjet: 
  [flexcoders] Flex 2 Tree Behaviour 
  overrideHi,I am evaluating Flex 2 Beta in 
  comparison with Laszlo, in order to make a choice on an RIA framework for 
  our company.As part of this evaluation I am trying to modify the Tree 
  control behaviour, to allow me to display structured text from more than 
  one XML attribute in my data source. I have tried doing this using 
  ListItemRenderer but it stops displaying all of the standard tree 
  behaviour as soon as I override it.Does anyone know how to do 
  this? Are there any examples of the tree bahaviour being 
  overriden?Below are the sources for the two MXML 
  files.Thanks,Yair Iny?xml version="1.0" 
  encoding="utf-8"?mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" 
  xmlns="*" layout="vertical" 
  mx:XML id="TreeXML" 
   folder name="Inbox" 
  num="100"  
   item name="Item1" 
  num="50"/  
   folder name="Junk" 
  num="20"  
item 
  name="Item2" num="25"/ 

  /folder 
   
  /folder 
  /mx:XML mx:Panel width="638" 
  height="425" layout="absolute" title="Problem View 
  Mockup"  
  mx:Tree dataProvider="{TreeXML}" rootVisible="false" width="598" 
  height="373" 
  listItemRenderer="MyTreeRenderer" 
   
  /mx:Tree 
  /mx:Panel/mx:Application?xml version="1.0" 
  encoding="utf-8"?mx:HBox xmlns:mx="http://www.macromedia.com/2005/mxml" 
  xmlns="*" mx:Label id="Name" 
  text="[EMAIL PROTECTED]"/ mx:Label 
  id="Count" 
  text="[EMAIL PROTECTED]"//mx:HBox





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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  









RE: [flexcoders] Flex 2 Tree Behaviour override

2006-03-20 Thread Joan Tan










If you are still using just text for each
node in your tree, then, you dont need to do a custom itemRenderer.
Instead, you can just use a labelFunction. So, on your Tree tag, just add
something like labelFunction=returnLabel. Then, you will have a
returnLabel function that looks something like this:



private function returnLabel(item:Object)
: String

{

 var str:String [EMAIL PROTECTED] + 
 + [EMAIL PROTECTED];

 return str;

}



Joan











From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of yair_iny
Sent: Monday, March 20, 2006 3:51
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex 2 Tree
Behaviour override





Hi,

I am evaluating Flex 2 Beta in comparison with
Laszlo, in order to 
make a choice on an RIA framework for our company.

As part of this evaluation I am trying to modify
the Tree control 
behaviour, to allow me to display structured text
from more than one 
XML attribute in my data source. I have
tried doing this using 
ListItemRenderer but it stops displaying all of
the standard tree 
behaviour as soon as I override it.

Does anyone know how to do this? Are there
any examples of the tree 
bahaviour being overriden?

Below are the sources for the two MXML files.

Thanks,
Yair Iny

?xml version=1.0
encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2005/mxml

xmlns=*
layout=vertical

 mx:XML
id=TreeXML

 folder name=Inbox num=100

  item
name=Item1 num=50/

  folder
name=Junk num=20

 
 item name=Item2
num=25/

  /folder

 /folder
 /mx:XML

 mx:Panel
width=638 height=425 layout=absolute 
title=Problem View Mockup

 mx:Tree dataProvider={TreeXML}
rootVisible=false 
width=598 height=373
listItemRenderer=MyTreeRenderer

 /mx:Tree
 /mx:Panel
/mx:Application


?xml version=1.0
encoding=utf-8?
mx:HBox xmlns:mx=http://www.macromedia.com/2005/mxml
xmlns=*
 mx:Label
id=Name text=[EMAIL PROTECTED]/
 mx:Label
id=Count text=[EMAIL PROTECTED]/
/mx:HBox















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

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  











RE: [flexcoders] Flex 2 Tree Behaviour override

2006-03-20 Thread Jason Hawryluk





true, 
however i was not assuming each node had the seconde attribute, come to think of 
it it would not matter. So; yes this is better then a custome 
renderer..

:)

Jason

  -Message d'origine-De: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]De la part 
  de Joan TanEnvoy: lundi 20 mars 2006 
  18:17: flexcoders@yahoogroups.comObjet: RE: 
  [flexcoders] Flex 2 Tree Behaviour override
  
  If you are still 
  using just text for each node in your tree, then, you dont need to do a 
  custom itemRenderer. Instead, you can just use a labelFunction. So, on your 
  Tree tag, just add something like labelFunction=returnLabel. Then, you will 
  have a returnLabel function that looks something like 
  this:
  
  private function 
  returnLabel(item:Object) : String
  {
   
  var str:String [EMAIL PROTECTED] + " " + [EMAIL PROTECTED];
   
  return str;
  }
  
  Joan
  
  
  
  
  
  From: 
  flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of yair_inySent: Monday, March 20, 2006 3:51 
  AMTo: 
  flexcoders@yahoogroups.comSubject: [flexcoders] Flex 2 Tree 
  Behaviour override
  
  Hi,I am evaluating Flex 2 Beta in comparison with Laszlo, in 
  order to make a choice on an RIA 
  framework for our company.As 
  part of this evaluation I am trying to modify the Tree control 
  behaviour, to allow me to display 
  structured text from more than one XML attribute in my data source. I have tried doing 
  this using ListItemRenderer but 
  it stops displaying all of the standard tree behaviour as soon as I override 
  it.Does anyone know how to do 
  this? Are there any examples of the tree bahaviour being overriden?Below are the sources for the two MXML 
  files.Thanks,Yair 
  Iny?xml version="1.0" 
  encoding="utf-8"?mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" 
  xmlns="*" 
  layout="vertical" mx:XML 
  id="TreeXML" 
   folder name="Inbox" 
  num="100" 
item 
  name="Item1" num="50"/ 
folder 
  name="Junk" num="20" 

   item name="Item2" 
  num="25"/ 

  /folder 
   /folder 
  /mx:XML mx:Panel width="638" 
  height="425" layout="absolute" title="Problem View Mockup" 
   mx:Tree dataProvider="{TreeXML}" 
  rootVisible="false" width="598" 
  height="373" listItemRenderer="MyTreeRenderer" 
   /mx:Tree 
  /mx:Panel/mx:Application?xml version="1.0" 
  encoding="utf-8"?mx:HBox 
  xmlns:mx="http://www.macromedia.com/2005/mxml" 
  xmlns="*" mx:Label id="Name" 
  text="[EMAIL PROTECTED]"/ mx:Label id="Count" 
  text="[EMAIL PROTECTED]"//mx:HBox





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



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.