Home » Eclipse Projects » Remote Application Platform (RAP) » How to Resize FillLayout in 2.0?(Converting 1.4 app to 2.0. Browser resize not working.)
How to Resize FillLayout in 2.0? [message #1060166] |
Thu, 23 May 2013 07:39  |
Eclipse User |
|
|
|
Hi,
While converting a 1.4 app to 2.0 I noticed that the browser resize doesn't work anymore on a FillLayout. I checked the 1.5 and the 2.0 migration guides, but didn't see anything specific about this.
Is there a solution for that in 2.0, or do I have to wait for the display resize event in 2.1?
Kind Regards,
Erwin
|
|
| |
Re: How to Resize FillLayout in 2.0? [message #1060217 is a reply to message #1060189] |
Thu, 23 May 2013 10:46   |
Eclipse User |
|
|
|
Ivan,
Thanks for the reply. It is a bit difficult to post an complete example here because there are quite a few classes involved.
When looking for code to show here I noticed that it is likely not related to the FillLayout, but to the FormLayout. The code below, which is a shameless copy of the sample code, creates a header, a sidebar and a mainArea.
The form shows up correctly, but it won't resize.
Tested with FF-20.0 and Safari, both on Mac.
Any help is highly appreciated.
Kind Regards,
Erwin
private void createContent(Shell shell) {
FormLayout layout = new FormLayout();
shell.setLayout(layout);
Control header = createHeader(shell);
header.setLayoutData(createHeaderFormData());
sidebar = createSidebar(shell, someData);
sidebar.setLayoutData(createSidebarFormData());
mainArea = createMainArea(shell);
mainArea.setLayoutData(createMainAreaFormData());
statusArea = createStatusArea(shell);
statusArea.setLayoutData(createStatusAreaFormData());
}
private FormData createMainAreaFormData() {
FormData data = new FormData();
data.top = new FormAttachment(0, HEADER_HEIGHT + 20);
data.left = new FormAttachment(0, 230 + 10);
data.right = new FormAttachment(100, -20);
data.bottom = new FormAttachment(100, -30);
return data;
}
|
|
|
Re: How to Resize FillLayout in 2.0? [message #1060222 is a reply to message #1060217] |
Thu, 23 May 2013 11:11   |
Eclipse User |
|
|
|
Hi Erwin,
the following code works for me in both RAP 2.0 and 2.1RC1:
public class SimpleEntryPoint extends AbstractEntryPoint {
@Override
public void createContents( Composite parent ) {
parent.setLayout( new FormLayout() );
Composite composite = new Composite( parent, SWT.NONE );
composite.setBackground( parent.getDisplay().getSystemColor(
SWT.COLOR_DARK_CYAN ) );
composite.setLayoutData( createMainAreaFormData() );
}
private FormData createMainAreaFormData() {
FormData data = new FormData();
data.top = new FormAttachment( 0, 50 + 20 );
data.left = new FormAttachment( 0, 230 + 10 );
data.right = new FormAttachment( 100, -20 );
data.bottom = new FormAttachment( 100, -30 );
return data;
}
}
Best,
Ivan
On 5/23/2013 5:46 PM, Erwin Hogeweg wrote:
> Ivan,
>
> Thanks for the reply. It is a bit difficult to post an complete
> example here because there are quite a few classes involved.
>
> When looking for code to show here I noticed that it is likely not
> related to the FillLayout, but to the FormLayout. The code below,
> which is a shameless copy of the sample code, creates a header, a
> sidebar and a mainArea.
>
> The form shows up correctly, but it won't resize.
>
> Tested with FF-20.0 and Safari, both on Mac.
>
> Any help is highly appreciated.
>
>
> Kind Regards,
>
> Erwin
>
> private void createContent(Shell shell) {
> FormLayout layout = new FormLayout();
> shell.setLayout(layout);
> Control header = createHeader(shell);
> header.setLayoutData(createHeaderFormData());
> sidebar = createSidebar(shell, someData);
> sidebar.setLayoutData(createSidebarFormData());
> mainArea = createMainArea(shell);
> mainArea.setLayoutData(createMainAreaFormData());
> statusArea = createStatusArea(shell);
> statusArea.setLayoutData(createStatusAreaFormData());
> }
>
>
> private FormData createMainAreaFormData() {
> FormData data = new FormData();
> data.top = new FormAttachment(0, HEADER_HEIGHT + 20);
> data.left = new FormAttachment(0, 230 + 10);
> data.right = new FormAttachment(100, -20);
> data.bottom = new FormAttachment(100, -30);
> return data;
> }
>
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
| |
Re: How to Resize FillLayout in 2.0? [message #1060472 is a reply to message #1060222] |
Fri, 24 May 2013 22:47  |
Eclipse User |
|
|
|
Ivan,
Your example works for me as well...
In my EntryPoint class I implemented EntryPoint i.o. extending AbstractEntryPoint.
Haven't completely figured it out yet, but I am sure it has something to do with that. At least now I have something to build on.
Thanks again for your help.
Kind Regards,
Erwin
|
|
|
Goto Forum:
Current Time: Thu Jul 03 10:54:24 EDT 2025
Powered by FUDForum. Page generated in 0.07864 seconds
|