Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 23: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 10: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 10:48 Go to previous messageGo to next message
Richard Gronback is currently offline Richard GronbackFriend
Messages: 605
Registered: July 2009
Senior Member
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 21:23 Go to previous messageGo to next message
Lazar Codrut-Lucian is currently offline Lazar Codrut-LucianFriend
Messages: 91
Registered: July 2009
Member
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] Wed, 28 May 2008 00: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: Wed Apr 24 17:09:23 GMT 2024

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

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

Back to the top