When to assign TextFlow font? [message #220409] |
Mon, 31 July 2006 12:41 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
I have a Figure which extends RectangleFigure and contains a TextFlow.
The TextFlow is added to its parent in the figure's constructor.
I tried to set the Font for the TextFlow at that time, but it seems that
the parent figure's font is not yet initialized (null).
When is the proper time to assign a new Font to the TextFlow? I have
tried paintFigure(Graphics) and layout() but neither of these have an
effect.
Thanks,
Ben
|
|
|
Re: When to assign TextFlow font? [message #220479 is a reply to message #220409] |
Mon, 31 July 2006 19:36 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
You don't have to set its font: it will inherit one. If you're getting an
NPE for the font that means the TextFlow is in a broken figure hierarchy.
That is, someone's inquiring for its font before it (or one of its
ancestors) has been parented properly. BTW, I assume you're using a
FlowPage and don't have the TextFlow directly parented by a RectangleFigure.
"Ben Vitale" <ben.vitale@precipia.com> wrote in message
news:eaktob$i4e$1@utils.eclipse.org...
>I have a Figure which extends RectangleFigure and contains a TextFlow. The
>TextFlow is added to its parent in the figure's constructor.
>
> I tried to set the Font for the TextFlow at that time, but it seems that
> the parent figure's font is not yet initialized (null).
>
> When is the proper time to assign a new Font to the TextFlow? I have
> tried paintFigure(Graphics) and layout() but neither of these have an
> effect.
>
> Thanks,
> Ben
>
|
|
|
Re: When to assign TextFlow font? [message #220596 is a reply to message #220479] |
Wed, 02 August 2006 16:09 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
I want to assign a *different* font size than the default. I believe
this requires getting the current Font and its FontData, and updating
its height.
What I have is below. Should I do the font operations in the constructor?
public class ScenarioNodeFigure
extends RectangleFigure
public ScenarioNodeFigure()
{
setBorder(new MarginBorder(1));
Image image = new Image(...)
ImageFigure imageFigure = new ImageFigure(image);
add(imageFigure);
FlowPage flowPage = new FlowPage();
TextFlow textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
textFlow.setOpaque(false);
flowPage.add(textFlow);
setLayoutManager(new StackLayout());
add(flowPage);
}
Pratik Shah wrote:
> You don't have to set its font: it will inherit one. If you're getting an
> NPE for the font that means the TextFlow is in a broken figure hierarchy.
> That is, someone's inquiring for its font before it (or one of its
> ancestors) has been parented properly. BTW, I assume you're using a
> FlowPage and don't have the TextFlow directly parented by a RectangleFigure.
>
> "Ben Vitale" <ben.vitale@precipia.com> wrote in message
> news:eaktob$i4e$1@utils.eclipse.org...
>> I have a Figure which extends RectangleFigure and contains a TextFlow. The
>> TextFlow is added to its parent in the figure's constructor.
>>
>> I tried to set the Font for the TextFlow at that time, but it seems that
>> the parent figure's font is not yet initialized (null).
>>
>> When is the proper time to assign a new Font to the TextFlow? I have
>> tried paintFigure(Graphics) and layout() but neither of these have an
>> effect.
>>
>> Thanks,
>> Ben
>>
>
>
|
|
|
Re: When to assign TextFlow font? [message #220629 is a reply to message #220596] |
Wed, 02 August 2006 17:43 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
You can't do the font operations in the constructor, because when the
figure's being constructed, it doesn't have a parent yet. So, it doesn't
have an inherited font.
"Ben Vitale" <ben.vitale@precipia.com> wrote in message
news:eaqim6$gr1$1@utils.eclipse.org...
>I want to assign a *different* font size than the default. I believe this
>requires getting the current Font and its FontData, and updating its
>height.
>
> What I have is below. Should I do the font operations in the constructor?
>
> public class ScenarioNodeFigure
> extends RectangleFigure
>
> public ScenarioNodeFigure()
> {
> setBorder(new MarginBorder(1));
> Image image = new Image(...)
> ImageFigure imageFigure = new ImageFigure(image);
> add(imageFigure);
>
> FlowPage flowPage = new FlowPage();
> TextFlow textFlow = new TextFlow();
> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
> ParagraphTextLayout.WORD_WRAP_SOFT));
> textFlow.setOpaque(false);
> flowPage.add(textFlow);
>
> setLayoutManager(new StackLayout());
> add(flowPage);
> }
>
> Pratik Shah wrote:
>> You don't have to set its font: it will inherit one. If you're getting
>> an NPE for the font that means the TextFlow is in a broken figure
>> hierarchy. That is, someone's inquiring for its font before it (or one of
>> its ancestors) has been parented properly. BTW, I assume you're using a
>> FlowPage and don't have the TextFlow directly parented by a
>> RectangleFigure.
>>
>> "Ben Vitale" <ben.vitale@precipia.com> wrote in message
>> news:eaktob$i4e$1@utils.eclipse.org...
>>> I have a Figure which extends RectangleFigure and contains a TextFlow.
>>> The TextFlow is added to its parent in the figure's constructor.
>>>
>>> I tried to set the Font for the TextFlow at that time, but it seems that
>>> the parent figure's font is not yet initialized (null).
>>>
>>> When is the proper time to assign a new Font to the TextFlow? I have
>>> tried paintFigure(Graphics) and layout() but neither of these have an
>>> effect.
>>>
>>> Thanks,
>>> Ben
>>>
>>
|
|
|
Re: When to assign TextFlow font? [message #220674 is a reply to message #220479] |
Thu, 03 August 2006 12:09 |
Eclipse User |
|
|
|
Originally posted by: senthil.periasamy.flextronicssoftware.com
Hi
Are you from india. Please let me know if you have any contact
email id or contact number i am very novice to GMF EMF and GEF and i am
currently started to learn about the different framework
regards
senthil
|
|
|
Re: When to assign TextFlow font? [message #220862 is a reply to message #220629] |
Mon, 07 August 2006 11:46 |
Eclipse User |
|
|
|
Originally posted by: ben.vitale.precipia.com
Do you have a recommendation on when I *can* do font operations? That
was my original question. I have already tried in layout() and
paintFigure().
Thanks,
Ben
Pratik Shah wrote:
> You can't do the font operations in the constructor, because when the
> figure's being constructed, it doesn't have a parent yet. So, it doesn't
> have an inherited font.
>
> "Ben Vitale" <ben.vitale@precipia.com> wrote in message
> news:eaqim6$gr1$1@utils.eclipse.org...
>> I want to assign a *different* font size than the default. I believe this
>> requires getting the current Font and its FontData, and updating its
>> height.
>>
>> What I have is below. Should I do the font operations in the constructor?
>>
>> public class ScenarioNodeFigure
>> extends RectangleFigure
>>
>> public ScenarioNodeFigure()
>> {
>> setBorder(new MarginBorder(1));
>> Image image = new Image(...)
>> ImageFigure imageFigure = new ImageFigure(image);
>> add(imageFigure);
>>
>> FlowPage flowPage = new FlowPage();
>> TextFlow textFlow = new TextFlow();
>> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
>> ParagraphTextLayout.WORD_WRAP_SOFT));
>> textFlow.setOpaque(false);
>> flowPage.add(textFlow);
>>
>> setLayoutManager(new StackLayout());
>> add(flowPage);
>> }
>>
>> Pratik Shah wrote:
>>> You don't have to set its font: it will inherit one. If you're getting
>>> an NPE for the font that means the TextFlow is in a broken figure
>>> hierarchy. That is, someone's inquiring for its font before it (or one of
>>> its ancestors) has been parented properly. BTW, I assume you're using a
>>> FlowPage and don't have the TextFlow directly parented by a
>>> RectangleFigure.
>>>
>>> "Ben Vitale" <ben.vitale@precipia.com> wrote in message
>>> news:eaktob$i4e$1@utils.eclipse.org...
>>>> I have a Figure which extends RectangleFigure and contains a TextFlow.
>>>> The TextFlow is added to its parent in the figure's constructor.
>>>>
>>>> I tried to set the Font for the TextFlow at that time, but it seems that
>>>> the parent figure's font is not yet initialized (null).
>>>>
>>>> When is the proper time to assign a new Font to the TextFlow? I have
>>>> tried paintFigure(Graphics) and layout() but neither of these have an
>>>> effect.
>>>>
>>>> Thanks,
>>>> Ben
>>>>
>
|
|
|
Re: When to assign TextFlow font? [message #220995 is a reply to message #220862] |
Tue, 08 August 2006 21:42 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
What you are suggesting is along the lines of style support. I know of a
client that has added this to their application, but it is not easy to do
efficiently. We have deprecated many fields that would eventually move into
a style object, but I don't know of any plans to implement style support
soon.
Otherwise, the editpart should manage the font, or you could hook into
validate() if you really get desperate.
"Ben Vitale" <ben.vitale@precipia.com> wrote in message
news:eb794t$e5f$1@utils.eclipse.org...
> Do you have a recommendation on when I *can* do font operations? That was
> my original question. I have already tried in layout() and paintFigure().
>
> Thanks,
> Ben
>
|
|
|
Powered by
FUDForum. Page generated in 0.04506 seconds