You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Federico Jakimowicz <po...@outlook.com> on 2012/11/14 15:40:56 UTC

TLF2 Background manager

Hi,
I have been trying for quite a while to setup a custom BackgroundManager by specifiying a customFlowComposerClass that extends StandardFlowComposer and provides me with a custom BackgroundManager.I expected that when the textflow invokes :
TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{	if (!_backgroundManager && (flowComposer is StandardFlowComposer))		_backgroundManager = (flowComposer as StandardFlowComposer).createBackgroundManager()	return _backgroundManager;}
it retrieves my custom backgroundmanager from my custom flowcomposer.
However when rendering the text the TextFlowTextLineFactory seems to get it's own FlowComposer which in turn has it's own configuration and backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
I'm really having a nightmare with this. I know I can draw in the background directly and without using the BackgroundManager however since the framework seems to allow the developer to customize it's configuration I really believe that using the configuration is the real way to go. I think TLF should be easy to customize and that it was done with that in mind.Does someone has a way to go through this?
Another alternative could be downloading the source of TLF and creating my own version of the library in one hand that would be an overkill and in the other hand I don't know how to build the TLF library project (if someone could provide some tutorial on how to do it would be cool too).
thanks in advance,
Polaco.




 		 	   		  

Re: TLF2 Background manager

Posted by Alex Harui <ah...@adobe.com>.
I think TLF handles all of that in BaseCompose.as.  It looks pretty complex and will depend on how complex your text is.


On 11/20/12 10:50 AM, "Federico Jakimowicz" <po...@outlook.com> wrote:

Well, I have managed to make my custom background to be invoked by the framework,
However I'm having a tough time calculating the height of the background to cover all the space between two lines.
Specially when lines have different sizes and using lineHeight in the style.

How can I get the space between two textlines? I mean the line totalHeight + any other space TLF or Flex adds between the lines.
Background alignment starts geting uggly when I add styles like:
{
lineHeight:"120%";
leadingModel:box;
dominantBaseline:auto;
baselineShift:-4;
alignmentBaseline:useDominantBaseline;
}
maybe my styles are wrong

> From: polacofede@outlook.com
> To: flex-dev@incubator.apache.org
> Subject: RE: TLF2 Background manager
> Date: Thu, 15 Nov 2012 10:39:51 -0300
>
> I will take a look at it and let you know.
> thanks Alex!
>
> > From: aharui@adobe.com
> > To: flex-dev@incubator.apache.org
> > Date: Wed, 14 Nov 2012 07:57:00 -0800
> > Subject: Re: TLF2 Background manager
> >
> > Well, once you see "tlf_internal" (or mx_internal, for that matter), that
> > implies that there isn't official support.
> >
> > I'm not the expert in this code, but in a quick grep of it, it looks like
> > you can assign a backgroundManager to the textFlow.  IIRC, there is logic
> > that chooses which Factory to use for textlines and maybe you want to figure
> > out how to control that so it doesn't use TextFlowTextLineFactory and one of
> > the other ones that might honor the textFlow's backgroundManager, or maybe
> > it is just a bug and the factory should be checking for and using the
> > textflow's backgroundManager.
> >
> >
> > On 11/14/12 6:40 AM, "Federico Jakimowicz" <po...@outlook.com> wrote:
> >
> > > Hi,
> > > I have been trying for quite a while to setup a custom BackgroundManager by
> > > specifiying a customFlowComposerClass that extends StandardFlowComposer and
> > > provides me with a custom BackgroundManager.I expected that when the textflow
> > > invokes :
> > > TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{ if
> > > (!_backgroundManager && (flowComposer is
> > > StandardFlowComposer))  _backgroundManager = (flowComposer as
> > > StandardFlowComposer).createBackgroundManager() return _backgroundManager;}
> > > it retrieves my custom backgroundmanager from my custom flowcomposer.
> > > However when rendering the text the TextFlowTextLineFactory seems to get it's
> > > own FlowComposer which in turn has it's own configuration and
> > > backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
> > > I'm really having a nightmare with this. I know I can draw in the background
> > > directly and without using the BackgroundManager however since the framework
> > > seems to allow the developer to customize it's configuration I really believe
> > > that using the configuration is the real way to go. I think TLF should be easy
> > > to customize and that it was done with that in mind.Does someone has a way to
> > > go through this?
> > > Another alternative could be downloading the source of TLF and creating my own
> > > version of the library in one hand that would be an overkill and in the other
> > > hand I don't know how to build the TLF library project (if someone could
> > > provide some tutorial on how to do it would be cool too).
> > > thanks in advance,
> > > Polaco.
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > Alex Harui
> > Flex SDK Team
> > Adobe Systems, Inc.
> > http://blogs.adobe.com/aharui
> >
>



--
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui

Re: TLF2 Background manager

Posted by Carol Frampton <cf...@adobe.com>.
I'm not sure what you are trying to do but you might want to look at drawBackgroundAndSetScrollRect() in RichEditableTextContainerManager.  This draws a background.  You can use the backgroundColor and backgroundAlpha styles to control the color of the background.

Carol

On 11/20/12 1 :50PM, "Federico Jakimowicz" <po...@outlook.com>> wrote:

Well, I have managed to make my custom background to be invoked by the framework,
However I'm having a tough time calculating the height of the background to cover all the space between two lines.
Specially when lines have different sizes and using lineHeight in the style.

How can I get the space between two textlines? I mean the line totalHeight + any other space TLF or Flex adds between the lines.
Background alignment starts geting uggly when I add styles like:
{
lineHeight:"120%";
leadingModel:box;
dominantBaseline:auto;
baselineShift:-4;
alignmentBaseline:useDominantBaseline;
}
maybe my styles are wrong

> From: polacofede@outlook.com<ma...@outlook.com>
> To: flex-dev@incubator.apache.org<ma...@incubator.apache.org>
> Subject: RE: TLF2 Background manager
> Date: Thu, 15 Nov 2012 10:39:51 -0300
>
> I will take a look at it and let you know.
> thanks Alex!
>
> > From: aharui@adobe.com<ma...@adobe.com>
> > To: flex-dev@incubator.apache.org<ma...@incubator.apache.org>
> > Date: Wed, 14 Nov 2012 07:57:00 -0800
> > Subject: Re: TLF2 Background manager
> >
> > Well, once you see "tlf_internal" (or mx_internal, for that matter), that
> > implies that there isn't official support.
> >
> > I'm not the expert in this code, but in a quick grep of it, it looks like
> > you can assign a backgroundManager to the textFlow. IIRC, there is logic
> > that chooses which Factory to use for textlines and maybe you want to figure
> > out how to control that so it doesn't use TextFlowTextLineFactory and one of
> > the other ones that might honor the textFlow's backgroundManager, or maybe
> > it is just a bug and the factory should be checking for and using the
> > textflow's backgroundManager.
> >
> >
> > On 11/14/12 6:40 AM, "Federico Jakimowicz" <po...@outlook.com>> wrote:
> >
> > > Hi,
> > > I have been trying for quite a while to setup a custom BackgroundManager by
> > > specifiying a customFlowComposerClass that extends StandardFlowComposer and
> > > provides me with a custom BackgroundManager.I expected that when the textflow
> > > invokes :
> > > TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{ if
> > > (!_backgroundManager && (flowComposer is
> > > StandardFlowComposer)) _backgroundManager = (flowComposer as
> > > StandardFlowComposer).createBackgroundManager() return _backgroundManager;}
> > > it retrieves my custom backgroundmanager from my custom flowcomposer.
> > > However when rendering the text the TextFlowTextLineFactory seems to get it's
> > > own FlowComposer which in turn has it's own configuration and
> > > backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
> > > I'm really having a nightmare with this. I know I can draw in the background
> > > directly and without using the BackgroundManager however since the framework
> > > seems to allow the developer to customize it's configuration I really believe
> > > that using the configuration is the real way to go. I think TLF should be easy
> > > to customize and that it was done with that in mind.Does someone has a way to
> > > go through this?
> > > Another alternative could be downloading the source of TLF and creating my own
> > > version of the library in one hand that would be an overkill and in the other
> > > hand I don't know how to build the TLF library project (if someone could
> > > provide some tutorial on how to do it would be cool too).
> > > thanks in advance,
> > > Polaco.
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > Alex Harui
> > Flex SDK Team
> > Adobe Systems, Inc.
> > http://blogs.adobe.com/aharui
> >
>

RE: TLF2 Background manager

Posted by Federico Jakimowicz <po...@outlook.com>.
Well, I have managed to make my custom background to be invoked by the framework,However I'm having a tough time calculating the height of the background to cover all the space between two lines.Specially when lines have different sizes and using lineHeight in the style.
How can I get the space between two textlines? I mean the line totalHeight + any other space TLF or Flex adds between the lines.Background alignment starts geting uggly when I add styles like:{lineHeight:"120%";leadingModel:box;dominantBaseline:auto;baselineShift:-4;alignmentBaseline:useDominantBaseline;}maybe my styles are wrong

> From: polacofede@outlook.com
> To: flex-dev@incubator.apache.org
> Subject: RE: TLF2 Background manager
> Date: Thu, 15 Nov 2012 10:39:51 -0300
> 
> I will take a look at it and let you know.
> thanks Alex!
> 
> > From: aharui@adobe.com
> > To: flex-dev@incubator.apache.org
> > Date: Wed, 14 Nov 2012 07:57:00 -0800
> > Subject: Re: TLF2 Background manager
> > 
> > Well, once you see "tlf_internal" (or mx_internal, for that matter), that
> > implies that there isn't official support.
> > 
> > I'm not the expert in this code, but in a quick grep of it, it looks like
> > you can assign a backgroundManager to the textFlow.  IIRC, there is logic
> > that chooses which Factory to use for textlines and maybe you want to figure
> > out how to control that so it doesn't use TextFlowTextLineFactory and one of
> > the other ones that might honor the textFlow's backgroundManager, or maybe
> > it is just a bug and the factory should be checking for and using the
> > textflow's backgroundManager.
> > 
> > 
> > On 11/14/12 6:40 AM, "Federico Jakimowicz" <po...@outlook.com> wrote:
> > 
> > > Hi,
> > > I have been trying for quite a while to setup a custom BackgroundManager by
> > > specifiying a customFlowComposerClass that extends StandardFlowComposer and
> > > provides me with a custom BackgroundManager.I expected that when the textflow
> > > invokes :
> > > TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{ if
> > > (!_backgroundManager && (flowComposer is
> > > StandardFlowComposer))  _backgroundManager = (flowComposer as
> > > StandardFlowComposer).createBackgroundManager() return _backgroundManager;}
> > > it retrieves my custom backgroundmanager from my custom flowcomposer.
> > > However when rendering the text the TextFlowTextLineFactory seems to get it's
> > > own FlowComposer which in turn has it's own configuration and
> > > backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
> > > I'm really having a nightmare with this. I know I can draw in the background
> > > directly and without using the BackgroundManager however since the framework
> > > seems to allow the developer to customize it's configuration I really believe
> > > that using the configuration is the real way to go. I think TLF should be easy
> > > to customize and that it was done with that in mind.Does someone has a way to
> > > go through this?
> > > Another alternative could be downloading the source of TLF and creating my own
> > > version of the library in one hand that would be an overkill and in the other
> > > hand I don't know how to build the TLF library project (if someone could
> > > provide some tutorial on how to do it would be cool too).
> > > thanks in advance,
> > > Polaco.
> > > 
> > > 
> > > 
> > > 
> > >  
> > 
> > -- 
> > Alex Harui
> > Flex SDK Team
> > Adobe Systems, Inc.
> > http://blogs.adobe.com/aharui
> > 
>  		 	   		  
 		 	   		  

RE: TLF2 Background manager

Posted by Federico Jakimowicz <po...@outlook.com>.
I will take a look at it and let you know.
thanks Alex!

> From: aharui@adobe.com
> To: flex-dev@incubator.apache.org
> Date: Wed, 14 Nov 2012 07:57:00 -0800
> Subject: Re: TLF2 Background manager
> 
> Well, once you see "tlf_internal" (or mx_internal, for that matter), that
> implies that there isn't official support.
> 
> I'm not the expert in this code, but in a quick grep of it, it looks like
> you can assign a backgroundManager to the textFlow.  IIRC, there is logic
> that chooses which Factory to use for textlines and maybe you want to figure
> out how to control that so it doesn't use TextFlowTextLineFactory and one of
> the other ones that might honor the textFlow's backgroundManager, or maybe
> it is just a bug and the factory should be checking for and using the
> textflow's backgroundManager.
> 
> 
> On 11/14/12 6:40 AM, "Federico Jakimowicz" <po...@outlook.com> wrote:
> 
> > Hi,
> > I have been trying for quite a while to setup a custom BackgroundManager by
> > specifiying a customFlowComposerClass that extends StandardFlowComposer and
> > provides me with a custom BackgroundManager.I expected that when the textflow
> > invokes :
> > TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{ if
> > (!_backgroundManager && (flowComposer is
> > StandardFlowComposer))  _backgroundManager = (flowComposer as
> > StandardFlowComposer).createBackgroundManager() return _backgroundManager;}
> > it retrieves my custom backgroundmanager from my custom flowcomposer.
> > However when rendering the text the TextFlowTextLineFactory seems to get it's
> > own FlowComposer which in turn has it's own configuration and
> > backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
> > I'm really having a nightmare with this. I know I can draw in the background
> > directly and without using the BackgroundManager however since the framework
> > seems to allow the developer to customize it's configuration I really believe
> > that using the configuration is the real way to go. I think TLF should be easy
> > to customize and that it was done with that in mind.Does someone has a way to
> > go through this?
> > Another alternative could be downloading the source of TLF and creating my own
> > version of the library in one hand that would be an overkill and in the other
> > hand I don't know how to build the TLF library project (if someone could
> > provide some tutorial on how to do it would be cool too).
> > thanks in advance,
> > Polaco.
> > 
> > 
> > 
> > 
> >  
> 
> -- 
> Alex Harui
> Flex SDK Team
> Adobe Systems, Inc.
> http://blogs.adobe.com/aharui
> 
 		 	   		  

Re: TLF2 Background manager

Posted by Alex Harui <ah...@adobe.com>.
Well, once you see "tlf_internal" (or mx_internal, for that matter), that
implies that there isn't official support.

I'm not the expert in this code, but in a quick grep of it, it looks like
you can assign a backgroundManager to the textFlow.  IIRC, there is logic
that chooses which Factory to use for textlines and maybe you want to figure
out how to control that so it doesn't use TextFlowTextLineFactory and one of
the other ones that might honor the textFlow's backgroundManager, or maybe
it is just a bug and the factory should be checking for and using the
textflow's backgroundManager.


On 11/14/12 6:40 AM, "Federico Jakimowicz" <po...@outlook.com> wrote:

> Hi,
> I have been trying for quite a while to setup a custom BackgroundManager by
> specifiying a customFlowComposerClass that extends StandardFlowComposer and
> provides me with a custom BackgroundManager.I expected that when the textflow
> invokes :
> TextFlow#tlf_internal function getBackgroundManager():BackgroundManager{ if
> (!_backgroundManager && (flowComposer is
> StandardFlowComposer))  _backgroundManager = (flowComposer as
> StandardFlowComposer).createBackgroundManager() return _backgroundManager;}
> it retrieves my custom backgroundmanager from my custom flowcomposer.
> However when rendering the text the TextFlowTextLineFactory seems to get it's
> own FlowComposer which in turn has it's own configuration and
> backgroundmanager. ( Check TextFlowTextLineFactory#createTextLinesInternal )
> I'm really having a nightmare with this. I know I can draw in the background
> directly and without using the BackgroundManager however since the framework
> seems to allow the developer to customize it's configuration I really believe
> that using the configuration is the real way to go. I think TLF should be easy
> to customize and that it was done with that in mind.Does someone has a way to
> go through this?
> Another alternative could be downloading the source of TLF and creating my own
> version of the library in one hand that would be an overkill and in the other
> hand I don't know how to build the TLF library project (if someone could
> provide some tutorial on how to do it would be cool too).
> thanks in advance,
> Polaco.
> 
> 
> 
> 
>  

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui