Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » justify items inside a compartment,
justify items inside a compartment, [message #637752] Mon, 08 November 2010 17:07 Go to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi guys,

How can I left justify items inside a compartment, i tried the affixed parent side but its not working inside a compartment,

any ideas?
thanks
Re: justify items inside a compartment, [message #637839 is a reply to message #637752] Tue, 09 November 2010 06:38 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

What kind of a compartment are you using? AFAIR list compartments by default layout their items left justified (what kind of items btw?), you can customize the compartment layout within the XXXCompartmentEditPart like below:

/**
 * @generated NOT
 */
public IFigure createFigure() {
	ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();		
	result.setTitleVisibility(false);
	
	ConstrainedToolbarLayout layout = (ConstrainedToolbarLayout) result.getContentPane().getLayoutManager(); // Works only with list compartments.
	// Configure layout.
	
	return result;
}

Now if your compartment is a shape compartment (free form), I don't think you should be trying to left justify items in it. Also note that "affixed parent side" is used for a completely different purpose.

Hope this helps.

- Asiri
Re: justify items inside a compartment, [message #637840 is a reply to message #637752] Tue, 09 November 2010 06:40 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
[deleted duplicated message]

[Updated on: Tue, 09 November 2010 07:00]

Report message to a moderator

Re: justify items inside a compartment, [message #637919 is a reply to message #637840] Tue, 09 November 2010 11:10 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi Asiri,

thanks for the reply, ure right i was using shapecompartment Rolling Eyes , i have changed to a list compartment and all my elments are as expected on the left side, however i have figures with different size, and when i add a figure it change it size to have the same size as the biggest one on the list and some figures arent entirely displayed.
how can i fix this issue,

thanks a lot
Re: justify items inside a compartment, [message #637924 is a reply to message #637752] Tue, 09 November 2010 11:20 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

ConstrainedToolbarLayout has several options like setStretchMajorAxis(), setStretchMinorAxis() and setIgnoreInvisibleChildren() did you fiddle with them to see if you can achieve your goal with them? Sometimes I just set / unset these flags and observe the effect they make, and most of the time some combination works out Wink

- Asiri

[Updated on: Tue, 09 November 2010 11:21]

Report message to a moderator

Re: justify items inside a compartment, [message #637930 is a reply to message #637924] Tue, 09 November 2010 11:47 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi , Crying or Very Sad


i ve tried this but if the figure is longer than a certain size it display just a part of it (left side in my case)
Quote:


public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
.createFigure();
ConstrainedToolbarLayout layout = (ConstrainedToolbarLayout) result.getContentPane().getLayoutManager();
layout.setStretchMinorAxis(true);
layout.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
layout.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
layout.setSpacing(20);
result.setLayoutManager(layout);
result.setTitleVisibility(false);
return result;
}



Re: justify items inside a compartment, [message #637939 is a reply to message #637752] Tue, 09 November 2010 12:16 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

public IFigure createFigure() {
	ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
	ConstrainedToolbarLayout layout = (ConstrainedToolbarLayout) 	result.getContentPane().getLayoutManager();
	layout.setStretchMinorAxis(true);
	layout.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
	layout.setMinorAlignment(FlowLayout.ALIGN_LEFTTOP);
	layout.setSpacing(20);
	result.setLayoutManager(layout); // This is wrong.
	result.setTitleVisibility(false);
	return result;
}

I think you are trying to override the layout manager of the ResizableCompartmentFigure; we are only adjusting the content pane's layout manager so setting the layout manager of ResizableCompartmentFigure is wrong. May be try removing that line? Smile

- Asiri
Re: justify items inside a compartment, [message #638006 is a reply to message #637939] Tue, 09 November 2010 15:52 Go to previous message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi Shocked,

Giving a good result, thanks a lot Asiri.
Previous Topic:View Factories are not generated any more
Next Topic:Observe .ecore changes made via ecorediag (ecoretools editor)
Goto Forum:
  


Current Time: Thu Apr 25 16:17:42 GMT 2024

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

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

Back to the top