Skip to main content



      Home
Home » Eclipse Projects » GEF » get initial figure size
get initial figure size [message #121775] Thu, 11 March 2004 04:14 Go to next message
Eclipse UserFriend
Originally posted by: kylee.cecid.hku.hk

Hi all,

When I create a "container" editpart, I will create a Figure object that
allows user to add objects into it. However the default bounds for Figure is
0, 0, 64, 36. Is it possible to determine the "viewer's" actual size on
start up, such that the bounds of the Figure could be overridden?

Thanks!!
Re: get initial figure size [message #121937 is a reply to message #121775] Thu, 11 March 2004 17:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

If by "viewer" you mean scrolling graphical viewer, It has a viewport
figure which will stretch its contents to be the entire size of the viewer.
If you have figures nested inside, using stacklayout will pass on this
behavior. You'd have to post your exact figure structure for more advice.

"Simon Lee" <kylee@cecid.hku.hk> wrote in message
news:c2padh$acn$1@eclipse.org...
> Hi all,
>
> When I create a "container" editpart, I will create a Figure object that
> allows user to add objects into it. However the default bounds for Figure
is
> 0, 0, 64, 36. Is it possible to determine the "viewer's" actual size on
> start up, such that the bounds of the Figure could be overridden?
>
> Thanks!!
>
>
Re: get initial figure size [message #121949 is a reply to message #121937] Thu, 11 March 2004 21:30 Go to previous message
Eclipse UserFriend
Originally posted by: kylee.cecid.hku.hk

Hi Randy,

Thanks for your help. Below is the "createFigure" code fragment in the
"container" editpart

protected IFigure createFigure() {
Figure f = new Figure() {
public void setBounds(Rectangle rect) {
int x = bounds.x, y = bounds.y;

boolean resize =
(rect.width != bounds.width)
|| (rect.height != bounds.height);
if (isVisible() && (resize)) {
erase();
}
bounds.width = rect.width;
bounds.height = rect.height;
if (resize) {
fireMoved();
repaint();
}
}
};

f.setLayoutManager(new XYLayout());
return f;
}

and the viewer i am using is ScrollingGraphicalViewer with
ScalableRootEditPart. For the "child" editpart (i.e. the figure added to the
container), the following is the code fragment for refreshVisuals()

protected void refreshVisuals() {
ChildUIModel childUIModel =
(ChildUIModel ) getModel();
Rectangle r =
new Rectangle(
childUIModel .getX(),
childUIModel .getY(),
-1,
-1);
((GraphicalEditPart) getParent()).setLayoutConstraint(
this,
getFigure(),
r);
}

What I want is that when childUIModel.getX() or childUIModel.getY()
returns -1, those values will be set such that the newly added child UI
figure will reside in the middle of the "container" figure. Is there any way
to do that? Or am I going on the wrong track? Thanks!!


"Randy Hudson" <none@us.ibm.com> wrote in message
news:c2qouh$a0j$1@eclipse.org...
> If by "viewer" you mean scrolling graphical viewer, It has a viewport
> figure which will stretch its contents to be the entire size of the
viewer.
> If you have figures nested inside, using stacklayout will pass on this
> behavior. You'd have to post your exact figure structure for more advice.
>
> "Simon Lee" <kylee@cecid.hku.hk> wrote in message
> news:c2padh$acn$1@eclipse.org...
> > Hi all,
> >
> > When I create a "container" editpart, I will create a Figure object that
> > allows user to add objects into it. However the default bounds for
Figure
> is
> > 0, 0, 64, 36. Is it possible to determine the "viewer's" actual size on
> > start up, such that the bounds of the Figure could be overridden?
> >
> > Thanks!!
> >
> >
>
>
Previous Topic:Text displayed using Label Figure do not get aligned correctly.
Next Topic:Getting Logic example to work in Eclipse 2.1.2
Goto Forum:
  


Current Time: Mon May 12 09:40:11 EDT 2025

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

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

Back to the top