Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Centering the text within a label?
Centering the text within a label? [message #188366] Wed, 21 May 2008 19:03 Go to next message
Eclipse UserFriend
Hi All!

Is it possible to center the text within a label? And especially is it
possible to define this behaviour within the models (gmfgraph or gmfgen)?

So I'm not searching a possibility to center a label within a node, I want
to center the text within a single label.

I'm lopking forward to your replies... really tried everythin and didn't
succeeded.

Thanks in advance!

Yours,
Markus
Re: Centering the text within a label? [message #188656 is a reply to message #188366] Thu, 22 May 2008 06:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ste-re.gmx.de

Hi Markus,

I'm not sure, but isn't the text inside a label always centered? I
think only the position of the label can be different.
For exmaple, if you want to center der name (label) of a node, you
have to center the whole label. to do this, a realy simple code
change have to be done.
Search for XXX.diagram.edit.parts.YYYEditPart (YYY = YourElement),
in this package the function public YYYFigure() and change the
following line from
layoutThis.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT);
to
layoutThis.setMinorAlignment(FlowLayout.ALIGN_CENTER);

Actually I don't know an other way

Stefan

Markus Gieser wrote:
> Hi All!
>
> Is it possible to center the text within a label? And especially is it
> possible to define this behaviour within the models (gmfgraph or gmfgen)?
>
> So I'm not searching a possibility to center a label within a node, I want
> to center the text within a single label.
>
> I'm lopking forward to your replies... really tried everythin and didn't
> succeeded.
>
> Thanks in advance!
>
> Yours,
> Markus
>
>
Re: Centering the text within a label? [message #188673 is a reply to message #188656] Thu, 22 May 2008 06:48 Go to previous messageGo to next message
Eclipse UserFriend
Did you try label.setAlignment(PositionConstants.CENTER)?

- Rich


On 5/22/08 6:51 AM, in article g13in4$jv9$1@build.eclipse.org, "Stefan"
<ste-re@gmx.de> wrote:

> Hi Markus,
>
> I'm not sure, but isn't the text inside a label always centered? I
> think only the position of the label can be different.
> For exmaple, if you want to center der name (label) of a node, you
> have to center the whole label. to do this, a realy simple code
> change have to be done.
> Search for XXX.diagram.edit.parts.YYYEditPart (YYY = YourElement),
> in this package the function public YYYFigure() and change the
> following line from
> layoutThis.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT);
> to
> layoutThis.setMinorAlignment(FlowLayout.ALIGN_CENTER);
>
> Actually I don't know an other way
>
> Stefan
>
> Markus Gieser wrote:
>> Hi All!
>>
>> Is it possible to center the text within a label? And especially is it
>> possible to define this behaviour within the models (gmfgraph or gmfgen)?
>>
>> So I'm not searching a possibility to center a label within a node, I want
>> to center the text within a single label.
>>
>> I'm lopking forward to your replies... really tried everythin and didn't
>> succeeded.
>>
>> Thanks in advance!
>>
>> Yours,
>> Markus
>>
>>
Re: Centering the text within a label? [message #189295 is a reply to message #188656] Sat, 24 May 2008 17:23 Go to previous messageGo to next message
Eclipse UserFriend
As Stefan wrote, the label could be smaller than you think (try to change
its background or add a border to see it as it really is), and you need to
change it to fill the space horizontally, or to be centered. You can do
that from gmfmap by using layout data added to your figure that corresponds
to the layout of the compartment.

Lucian
Re: Centering the text within a label? [message #189609 is a reply to message #188656] Tue, 27 May 2008 20:10 Go to previous message
Eclipse UserFriend
Thanks for your help! I solved my problem... :-)

Greetings,
Markus

"Stefan" <ste-re@gmx.de> schrieb im Newsbeitrag
news:g13in4$jv9$1@build.eclipse.org...
> Hi Markus,
>
> I'm not sure, but isn't the text inside a label always centered? I think
> only the position of the label can be different.
> For exmaple, if you want to center der name (label) of a node, you have to
> center the whole label. to do this, a realy simple code change have to be
> done.
> Search for XXX.diagram.edit.parts.YYYEditPart (YYY = YourElement), in
> this package the function public YYYFigure() and change the following line
> from layoutThis.setMinorAlignment(FlowLayout.ALIGN_TOPLEFT);
> to
> layoutThis.setMinorAlignment(FlowLayout.ALIGN_CENTER);
>
> Actually I don't know an other way
>
> Stefan
>
> Markus Gieser wrote:
>> Hi All!
>>
>> Is it possible to center the text within a label? And especially is it
>> possible to define this behaviour within the models (gmfgraph or gmfgen)?
>>
>> So I'm not searching a possibility to center a label within a node, I
>> want to center the text within a single label.
>>
>> I'm lopking forward to your replies... really tried everythin and didn't
>> succeeded.
>>
>> Thanks in advance!
>>
>> Yours,
>> Markus
Previous Topic:Set default (initialization) color for a figure
Next Topic:Connection not deleting..between figures.
Goto Forum:
  


Current Time: Sat Jul 05 09:15:20 EDT 2025

Powered by FUDForum. Page generated in 0.29358 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top