Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 11:39 Go to next message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
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 #1060189 is a reply to message #1060166] Thu, 23 May 2013 12:51 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1816
Registered: July 2009
Senior Member
Hi Erwin,
just did a small test with RAP 2.0 - maximized Shell with FillLayout and
child Composite. Resizing of the browser does a resize of the child
Composite. I don't see any problem. Could you provide some lines of code
to demonstrate the issue?
Best,
Ivan

On 5/23/2013 2:39 PM, Erwin Hogeweg wrote:
> 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

--
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 #1060217 is a reply to message #1060189] Thu, 23 May 2013 14:46 Go to previous messageGo to next message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
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 15:11 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1816
Registered: July 2009
Senior Member
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 #1060363 is a reply to message #1060217] Fri, 24 May 2013 09:55 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

Hi Erwin,

if you forget the main loop in a snippet running in SWT mode, you get
exactly this behavior. Unlikely that this is the problem in your case,
it's just something to double-check...

Ralf

--
Ralf Sternberg

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] Sat, 25 May 2013 02:47 Go to previous message
Erwin Hogeweg is currently offline Erwin Hogeweg
Messages: 32
Registered: July 2009
Member
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
Previous Topic:[ANN] RAP 2.1 RC1 is available
Next Topic:What is the correct way to resize a TableView?
Goto Forum:
  


Current Time: Fri Sep 19 04:02:15 GMT 2014

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

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