Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » container border not shown by default any more?
container border not shown by default any more? [message #162012] Thu, 22 November 2007 09:35 Go to next message
paolo russian is currently offline paolo russianFriend
Messages: 81
Registered: July 2009
Member
Hy, I edited a StackLayout in a container EditPart of mine, but since I
did it when I place this container to the stage gmf no longer shows me its
borders.
I can click'ndrag to select an area around the component and then the
borders are shown, so I can resize it, but where is the class, what is the
method name dealing with the border stuff?
Because I need it the border always to be shown (as it normally happens).

what I did is customizing this way:

figure.setLayoutManager(new StackLayout() {

public void layout(IFigure figure) {
Rectangle r = figure.getClientArea();

List children = figure.getChildren();
IFigure child;
Dimension d;

int mywidth=60;
int myheight=100;
d=figure.getPreferredSize(mywidth, myheight);
mywidth=mywidth;

for (int i = 1; i < children.size(); i++) {

child = (IFigure)children.get(i);

d = child.getPreferredSize(r.width, r.height);
d.width = Math.min(d.width, r.width);
d.height = Math.min(d.height, r.height);

Rectangle childRect = new Rectangle(
r.x+mywidth*i-mywidth,
r.y,
mywidth, r.height);

child.setBounds(childRect);
}
}
});

This customization make the container's children to be drawn not one ontop
the other (covering each other, as happens by default) but to an "x"
offset depending by their width. So, in other words, each of them is
visible like in a grid. It works very well, but the border of the
container (where this method above is implemented) has been killed :D
Re: container border not shown by default any more? [message #162028 is a reply to message #162012] Thu, 22 November 2007 10:34 Go to previous messageGo to next message
paolo russian is currently offline paolo russianFriend
Messages: 81
Registered: July 2009
Member
p.s.

this container class extends AbstractBorderedShapeEditPart

and always in this same XxxEditPart the addBorderItem generated method

/**
* @generated
*/
protected void addBorderItem(IFigure borderItemContainer,
IBorderItemEditPart borderItemEditPart) {


if (borderItemEditPart instanceof DataGridValueEditPart) {
System.out.println("la prima che hai detto");
BorderItemLocator locator = new
BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
locator.setBorderItemOffset(new Dimension(0, 0));
borderItemContainer.add(borderItemEditPart.getFigure(), locator);
} else {
System.out.println("la seconda che hai detto");
super.addBorderItem(borderItemContainer, borderItemEditPart);
}
}

I don't know if this can help tracking my issue with invisible element
border (unless you select it, then it reveals)
Re: container border not shown by default any more? [message #162441 is a reply to message #162028] Fri, 23 November 2007 18:33 Go to previous message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Paolo,

Exactly which figure did you change the layout manager of? The
AbstractBorderedShapeEditPart's getFigure() method returns the
BorderedNodeFigure which is a figure that contains the main figure of
the shape and another container figure to host the border items. I
think you probably wanted to change the layout manager on the main
figure -- AbstractBorderedShapeEditPart.getMainFigure().

I hope this helps and doesn't add to the confusion. :-)

- Cherie


Paolo Russian wrote:
> p.s.
> this container class extends AbstractBorderedShapeEditPart
> and always in this same XxxEditPart the addBorderItem generated method
>
> /**
> * @generated
> */
> protected void addBorderItem(IFigure borderItemContainer,
> IBorderItemEditPart borderItemEditPart) {
>
>
> if (borderItemEditPart instanceof DataGridValueEditPart) {
> System.out.println("la prima che hai detto");
> BorderItemLocator locator = new
> BorderItemLocator(getMainFigure(), PositionConstants.SOUTH);
> locator.setBorderItemOffset(new Dimension(0, 0));
> borderItemContainer.add(borderItemEditPart.getFigure(),
> locator);
> } else {
> System.out.println("la seconda che hai detto");
> super.addBorderItem(borderItemContainer, borderItemEditPart);
> }
> }
>
> I don't know if this can help tracking my issue with invisible element
> border (unless you select it, then it reveals)
>
Previous Topic:gmfmap
Next Topic:ecore_diagram: how to set operation params?
Goto Forum:
  


Current Time: Thu Apr 25 09:32:47 GMT 2024

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

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

Back to the top