Measuring text is expensive if you do it a lot.  It should be rare to
need to call regenerateStyleCache.  Typically you make one instance of a
renderer, add it to the DG and use it to measure.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of markgoldin_2000
Sent: Wednesday, April 23, 2008 4:26 AM
To: [email protected]
Subject: [flexcoders] Re: Question about commitProperties

 

I do use measureText(dgc.headerText).width alone with 
regenerateStyleCache(false) because measureText fails without it.
I use this to calculate newly added column's width. Is that critical 
for performance?

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> commitProperties, measure or updateDisplayList being called over 
and
> over again.
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of markgoldin_2000
> Sent: Tuesday, April 22, 2008 8:16 PM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Question about commitProperties
> 
> 
> 
> Saying "invalidation problem " what would have been the nature of 
> this problem? What should I look for in my code?
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > I would normally expect that the model is the dataProvider for a
> > top-level datagrid, or the model is a singleton and doesn't 
require
> > pushing down.
> > 
> > 
> > 
> > If callLater solved your timeout problem it makes me think that 
> there's
> > some invalidation problem and you might now be hitting a slow
> > performance problem. That might be worth diagnosing and resolving 
> in
> > the more "standard" way so you have fewer problems down the road.
> > 
> > 
> > 
> > Often, when I run into issues like this, it makes me re-think my 
> design.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> 
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> ] On
> > Behalf Of markgoldin_2000
> > Sent: Tuesday, April 22, 2008 6:05 PM
> > To: [email protected] <mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%
40yahoogroups.com> 
> > Subject: [flexcoders] Re: Question about commitProperties
> > 
> > 
> > 
> > I am using callLater only because I was getting 15 secs. error. I 
> am 
> > changing xmlModelData down the road.
> > 
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > , "Alex Harui" <aharui@> wrote:
> > >
> > > There's not enough context here to know for sure, but it's 
> probably 
> > a
> > > bad sign to be using callLater in any validation method as the 
> > point is
> > > to validate synchronously. I'm also concerned about how you are 
> > using
> > > your properties bag on the ClassFactory. I hope you're not 
> > changing the
> > > values assigned.
> > > 
> > > 
> > > 
> > > Everything should be data-driven (pulling data from data 
> objects). 
> > If
> > > feels like you're pushing stuff down, instead of pulling.
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > 
> > [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> <mailto:flexcoders%
> 40yahoogroups.com>
> > ] On
> > > Behalf Of markgoldin_2000
> > > Sent: Tuesday, April 22, 2008 3:29 PM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> <mailto:flexcoders%
> 40yahoogroups.com> 
> > > Subject: [flexcoders] Question about commitProperties
> > > 
> > > 
> > > 
> > > I have a custom renderer based on canvas that has the following 
> > > setters:
> > > public function set trainId(value:String):void
> > > {
> > > _trainId = value;
> > > }
> > > public function get trainId():String
> > > {
> > > return _trainId;
> > > } 
> > > public function set highlightCurrentHour(value:String):void
> > > {
> > > _backgroundColor = value;
> > > } 
> > > public function get highlightCurrentHour():String
> > > {
> > > return _backgroundColor;
> > > }
> > > public function set xmlModelData(value:XML):void
> > > {
> > > _xmlModelData = value;
> > > } 
> > > public function get xmlModelData():XML
> > > {
> > > return _xmlModelData;
> > > }
> > > 
> > > then I have:
> > > override protected function commitProperties():void 
> > > {
> > > super.commitProperties();
> > > assignBlocks(xmlModelData, trainId, highlightCurrentHour);
> > > } 
> > > and
> > > public function assignBlocks(xmlModelData:XML, trainId:String, 
> > > highlightCurrentHour:String):void
> > > { 
> > > callLater(trainDepartGrid.assignBlocks, [trainId, 
> > > xmlModelData, highlightCurrentHour]); 
> > > trainDepartGrid.width = xmlModelData.trainshours.(train_id == 
> > > trainId).setwidth;
> > > callLater(trainReceivingGrid.assignCars, [trainId, 
> > > xmlModelData, highlightCurrentHour]);
> > > trainReceivingGrid.width = xmlModelData.trainshours.(train_id 
> > > == trainId).setwidth;
> > > }
> > > 
> > > I am setting these properties on this renderer like this:
> > > ClassFactory(codeDestinationRenderer).properties =
> > > {trainId:prop.train_id, highlightCurrentHour:bBackgroundColor, 
> > > xmlModelData:xmlModelData};
> > > 
> > > My question is:
> > > Is commitProperties is a right place to call assignBlocks?
> > > Before I changed my code to this version the program worked 
much 
> > > better though.
> > > 
> > > Please help.
> > > 
> > > Thanks
> > >
> >
>

 

Reply via email to