Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » What apart from the "ratio" value affects division of space within a perspective?(I understand how "ratio" works but it doesn't seem to be the whole story)
What apart from the "ratio" value affects division of space within a perspective? [message #656778] Mon, 28 February 2011 14:59 Go to next message
Alan Chambers is currently offline Alan ChambersFriend
Messages: 6
Registered: February 2011
Junior Member
I'm working on a RAP app in which we have an editor area and three other views - editor area at bottom right, a horizontal split with two views dividing the area above the split and one more to the left of the editor area below the split.

If I recreate this layout using a simple example (based on one of the RAP samples), the proportions set by the various "ratio" values all work as I understand they are supposed to.

E.g. in the following code...

public void createInitialLayout(IPageLayout layout) {
		String editorArea = layout.getEditorArea();
		layout.setEditorAreaVisible(true);
		layout.setFixed(true);

		layout.addStandaloneView(View.ID, false, IPageLayout.TOP, .4f, editorArea);
		layout.addStandaloneView(View2.ID, false, IPageLayout.RIGHT, .4f, View.ID);
		layout.addStandaloneView(View3.ID, false, IPageLayout.LEFT, .7f, editorArea);
	}


...the top two views occupy 40% of the vertical space. Of these the left one has 40% of the horizontal space, and the right one has 60%. Below them, the bottom left view has 70% of the horizontal space, and the editor area has 30%.

However in our application, the ratios don't seem to work so predictably. With identical code (apart from the view IDs being different), the proportions are completely different. Experimenting with the ratios, if I add the first view above the editor area with a ratio of 0.9, it actually gets only about 40% of the area. Set it to 0.5 and it gets only about a quarter of the vertical space. I have a similar problem when I add a view to the left of the editor area - again, setting a ratio of 0.9 gives the view less than 50% of the space formerly occupied by the editor area.

Clearly, other factors are influencing the layout but I can't think what. It feels like the editor area thinks it needs more space than I'm allocating it and is grabbing what it wants anyway.

Where should I be looking to solve this?

I'm fairly new to RAP, so apols if this is a noobie question; I have searched the forums without finding an answer so far.
Re: What apart from the "ratio" value affects division of space within a perspective? [message #656897 is a reply to message #656778] Mon, 28 February 2011 22:22 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

from my experience try-and-error is a better approach than reasoning when
layouting a perspective ;-) You can also try it with a simple RCP
application, because what works in RCP will work alike in RAP.

Since this is an RCP question, you may get more insightful answers on an
RCP list.

Please remember that if you resize views in your perspective, these
settings will be saved in the setting store. You may want to clear your
cookies to be sure that no saved layouts influence your experiments.

Best regards, Ralf

--
Ralf Sternberg

Twitter: @ralfstx
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: What apart from the "ratio" value affects division of space within a perspective? [message #656908 is a reply to message #656778] Mon, 28 February 2011 23:01 Go to previous messageGo to next message
Paul Bilnoski is currently offline Paul BilnoskiFriend
Messages: 28
Registered: August 2010
Junior Member
It sounds like your unpredictable proportion results are due to adding multiple views in sequence in the same direction.

If you add the editor area in, then add a view above it at 40%, it will indeed take 40% space and the editor area 60%. If however you then add another view above the first view at 50%, it will only take up 50% of the 40% the first view already has, resulting in 20-20-60 distribution. This is consistent with what you said that it takes up about a quarter of the vertical space.

Also note the javadoc for addStandaloneView: "a ratio specifying how to divide the space currently occupied by the reference part, in the range 0.05f to 0.95f.", which means the percentage will only be applied between the referenced part and the new part, but not the total horizontal or vertical area.

There could potentially be a bug in RAP related to fixed layouts and standalone views.

Hope that is helpful,
--Paul Bilnoski
Re: What apart from the "ratio" value affects division of space within a perspective? [message #656987 is a reply to message #656897] Tue, 01 March 2011 09:44 Go to previous messageGo to next message
Alan Chambers is currently offline Alan ChambersFriend
Messages: 6
Registered: February 2011
Junior Member
Hi Ralf.

Ralf Sternberg wrote on Mon, 28 February 2011 17:22

Please remember that if you resize views in your perspective, these
settings will be saved in the setting store. You may want to clear your
cookies to be sure that no saved layouts influence your experiments.



I wasn't aware of that - certainly something for me to check and could explain some of the strange behaviour I'm seeing. I'll do some more tests, taking care to clear the cookies each time, and see what happens.

Many thanks for your thoughts on this,

Alan
Re: What apart from the "ratio" value affects division of space within a perspective? [message #656991 is a reply to message #656908] Tue, 01 March 2011 09:55 Go to previous message
Alan Chambers is currently offline Alan ChambersFriend
Messages: 6
Registered: February 2011
Junior Member
Paul Bilnoski wrote on Mon, 28 February 2011 18:01

If you add the editor area in, then add a view above it at 40%, it will indeed take 40% space and the editor area 60%. If however you then add another view above the first view at 50%, it will only take up 50% of the 40% the first view already has, resulting in 20-20-60 distribution. This is consistent with what you said that it takes up about a quarter of the vertical space.


Paul - your thoughts are appreciated but I think I may not have been very clear in describing what I'm trying to achieve. My first view is added above the editor area, but the next one is added to the right of that, and the third one added to the left of the editor area, so I'm not adding multiple views in the same direction. What is strange to me is that in my simple test case (code provided above) the ratios work exactly as you describe but in the almost identical application code I'm working on, it behaves differently, suggesting that something else is influencing the layout other than these ratios.

Many thanks,

Alan

[Updated on: Tue, 01 March 2011 09:57]

Report message to a moderator

Previous Topic:Data from my widget don't appear in other widget
Next Topic:Server Side Requirements
Goto Forum:
  


Current Time: Wed Oct 27 01:53:28 GMT 2021

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

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

Back to the top