Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » painting Figure
painting Figure [message #227813] Mon, 11 December 2006 09:53 Go to next message
Eclipse User
Originally posted by: Sferzah.yandex.ru

Simple figure extend RoundedRectangle
with LabelFigure on it (icon&text)

i want to dinamic calculate size this figure to react textsize changed..
where i have to do that? i mazed by validate, revalidate, paintFigure,
rePaint etc.
and where getPreferredSize() and getMinimumSize() are calling?

thx
Re: painting Figure [message #227844 is a reply to message #227813] Tue, 12 December 2006 08:26 Go to previous messageGo to next message
Eclipse User
Originally posted by: Sferzah.yandex.ru

so, for my purposes i write method

public void refreshVisuals() {
ActivityFigure fig = (ActivityFigure) getFigure();
ActivityModel model = getActivityModel();
fig.setText( model.getName() );
model.setSize(fig.getBestSize());

super.refreshVisuals();
}

if i want to resize parent when children changed - i can't override some
"validate" method in Figure class and have to use editpart??
Re: painting Figure [message #228153 is a reply to message #227844] Sat, 16 December 2006 16:33 Go to previous messageGo to next message
Eclipse User
Originally posted by: none.unknown.com

You're doing it the other way around. You should be updating the model with
the new size and then the figure should be updated accordingly. If you want
the parent to be sized so as all its children are visible, use -1, -1 as the
parent's size in the model (that way, it doesn't change when children are
added/removed/resized). Then your figure should use an automatic layout
that would size it based on its children. XYLayout already does that.

"Alexey" <Sferzah@yandex.ru> wrote in message
news:3a57e21141d58508af2d546a6267a959$1@www.eclipse.org...
> so, for my purposes i write method
> public void refreshVisuals() {
> ActivityFigure fig = (ActivityFigure) getFigure();
> ActivityModel model = getActivityModel(); fig.setText( model.getName() );
> model.setSize(fig.getBestSize());
>
> super.refreshVisuals();
> }
>
> if i want to resize parent when children changed - i can't override some
> "validate" method in Figure class and have to use editpart??
>
Re: painting Figure [message #228206 is a reply to message #228153] Mon, 18 December 2006 02:51 Go to previous messageGo to next message
Eclipse User
Originally posted by: Sferzah.yandex.ru

my container figure use XYLayout
i add contentpane there as -1,-1 size :
add(container_pane, new Rectangle( CORNER_X, CORNER_Y, -1, -1 ));
contentpane use ToolbarLayout

i try to debug "child added" and see that size calculating perfectly in
ToolbarLayout.calculatePreferredSize()

then, in parent (root) XYLayot i see in layout(IFigure parent)
f.setBounds(bounds); - bounds correctly.

so, contentpane size is calculating right, but owner figure size is not
calculating anywhere and don't resized visually..
Re: painting Figure [message #228215 is a reply to message #228206] Mon, 18 December 2006 03:09 Go to previous message
Eclipse User
Originally posted by: Sferzah.yandex.ru

> then, in parent (root) XYLayot i see in layout(IFigure parent)
> f.setBounds(bounds); - bounds correctly.

sorry, not root, just parent figure (contentpane owner)

so if this figure size (-1,-1) too thwn it works!

thx!
Previous Topic:restore diagram problem
Next Topic:Problem sizing the LayeredPane
Goto Forum:
  


Current Time: Mon Jul 28 12:40:15 EDT 2014

Powered by FUDForum. Page generated in 0.07310 seconds