Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Text filing
Text filing [message #151902] Fri, 24 September 2004 08:00 Go to next message
Antony is currently offline AntonyFriend
Messages: 34
Registered: July 2009
Member
I'm going mad with this.
Hi guys, if you can solve this I really love you!
The blocks in my diagram are labelled with their name. I used the same
kind of objects of the Logic Labels for this purpose, but the text is not
centered.

Then I created a method in BlockFigure named refreshMarginBorder(), called
by paintFigure(...). This method tries to center the text like this (not
exactly like this, but I make it simple for the sake of understandability):

int left = textFlow.x,
top = textFlow.y,
right = textFlow.width,
bottom = textFlow.height;

return new MarginBorder(left, top, right, bottom);

Of course this method is not correct 'cause it gives a lot of problems.
Then I tried to put some of the variables to a constant value (for
instance, new MarginBorder(left, top, 10, 10)). The result is that the
text is perfectly centered, but direct edit is horrible!
I don't know what else I can do, I even tried to attach a FocusListener to
the TextFlow or the TextPage, but they doesn't seem to notice it.

Ok now, see what can you do with that. Thank you,

Antony
Re: Text filing [message #151912 is a reply to message #151902] Fri, 24 September 2004 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ellinas_anogia.hotmail.com

First case:

If the problem is that the textFlow isn't centered inside his parent
you must put the follow code when you define the layout for the parent

layout.setMinorAlignment(FlowLayout.ALIGN_CENTER); where layout is
your layout and instead of FlowLayout put your layout type

Second Case:

If the problem is that the text inside the textFlow isn't centered then set
a layout manager to your textFlow ( yourTextFlow.setLayoutmanager(
layout) ) and follow the case 1












"Antony" <antonymist@hotmail.com> wrote in message
news:cj0k6j$f8a$1@eclipse.org...
> I'm going mad with this.
> Hi guys, if you can solve this I really love you!
> The blocks in my diagram are labelled with their name. I used the same
> kind of objects of the Logic Labels for this purpose, but the text is not
> centered.
>
> Then I created a method in BlockFigure named refreshMarginBorder(), called
> by paintFigure(...). This method tries to center the text like this (not
> exactly like this, but I make it simple for the sake of
understandability):
>
> int left = textFlow.x,
> top = textFlow.y,
> right = textFlow.width,
> bottom = textFlow.height;
>
> return new MarginBorder(left, top, right, bottom);
>
> Of course this method is not correct 'cause it gives a lot of problems.
> Then I tried to put some of the variables to a constant value (for
> instance, new MarginBorder(left, top, 10, 10)). The result is that the
> text is perfectly centered, but direct edit is horrible!
> I don't know what else I can do, I even tried to attach a FocusListener to
> the TextFlow or the TextPage, but they doesn't seem to notice it.
>
> Ok now, see what can you do with that. Thank you,
>
> Antony
>
Re: Text filing [message #151955 is a reply to message #151912] Fri, 24 September 2004 16:01 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Actually, the flow page support centered alignment just call
page.setHorizontalAligment(CENTER)

"Dakanalis" <ellinas_anogia@hotmail.com> wrote in message
news:cj0v4e$568$1@eclipse.org...
> First case:
>
> If the problem is that the textFlow isn't centered inside his parent
> you must put the follow code when you define the layout for the parent
>
> layout.setMinorAlignment(FlowLayout.ALIGN_CENTER); where layout is
> your layout and instead of FlowLayout put your layout type
>
> Second Case:
>
> If the problem is that the text inside the textFlow isn't centered then
set
> a layout manager to your textFlow ( yourTextFlow.setLayoutmanager(
> layout) ) and follow the case 1
>
>
>
>
>
>
>
>
>
>
>
>
> "Antony" <antonymist@hotmail.com> wrote in message
> news:cj0k6j$f8a$1@eclipse.org...
> > I'm going mad with this.
> > Hi guys, if you can solve this I really love you!
> > The blocks in my diagram are labelled with their name. I used the same
> > kind of objects of the Logic Labels for this purpose, but the text is
not
> > centered.
> >
> > Then I created a method in BlockFigure named refreshMarginBorder(),
called
> > by paintFigure(...). This method tries to center the text like this (not
> > exactly like this, but I make it simple for the sake of
> understandability):
> >
> > int left = textFlow.x,
> > top = textFlow.y,
> > right = textFlow.width,
> > bottom = textFlow.height;
> >
> > return new MarginBorder(left, top, right, bottom);
> >
> > Of course this method is not correct 'cause it gives a lot of problems.
> > Then I tried to put some of the variables to a constant value (for
> > instance, new MarginBorder(left, top, 10, 10)). The result is that the
> > text is perfectly centered, but direct edit is horrible!
> > I don't know what else I can do, I even tried to attach a FocusListener
to
> > the TextFlow or the TextPage, but they doesn't seem to notice it.
> >
> > Ok now, see what can you do with that. Thank you,
> >
> > Antony
> >
>
>
Previous Topic:Dificulties using scroll bar
Next Topic:Copy/paste
Goto Forum:
  


Current Time: Tue Apr 16 13:55:15 GMT 2024

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

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

Back to the top