flavio.donze
flavio.donze

Reputation: 8090

How to implement repsonsive design in Eclipse RAP?

The Eclipse RAP (Remote Application Platform) project provides a way to write web applications using SWT. Due to single sourcing, the written code can also be used in desktop SWT/RCP applications.

Since it is a framework for web applications I was wondering if it supports responsive design?
If so, a simple example would be great. It does not need to be RCP compatible.

I didn't find a lot on the internet, has there been any efforts towards supporting responsive design?

Upvotes: 1

Views: 661

Answers (2)

Wim Anckaert
Wim Anckaert

Reputation: 83

You can make it responsive with the use of Passe-Partout created by Tabris. This works in RAP and should be compatible with RCP.

They have made a custom layout : FluidGridLayout.

It's best you use it through the factory class com.eclipsesource.tabris.passepartout.PassePartout.

Source can be found on github: https://github.com/eclipsesource/tabris/tree/master/com.eclipsesource.tabris.passepartout

Add this plugin to your dependency or just copy the source in your project.

See the blogpost at eclipsesource for basic info: https://eclipsesource.com/products/tabris/eclipse-rap-documentation/responsive-design/

The great thing about it, is that you program it all in java.

Only issue that I now experience is with scrolling. In my case I have a workbench and my editorpart needs a scrolledcomposite, only set to V_SCROLL. I've added two resize listeners to set the new minsize of the scrolledcomposite.

  • One resize listener on the display when the entire browser resizes.
  • A second resize listener for the parent when only the editorpart resizes. (fe when a view is resized or the editorpart is maximized)

Upvotes: 1

Rüdiger Herrmann
Rüdiger Herrmann

Reputation: 20985

Due to the fact that RAP shields you from web technology, native CSS and other web-techniques won't work.

To summarize the comments, you will likely have to implement one or more custom layouts that adapt to the available space and show/hide/resize the managed controls accordingly.

You may also want to use custom controls or manipulate existing controls to adapt to the available space. in some places. For example, hide texts on toolbar buttons when space becomes rare.

RAP theming can also be leveraged to a certain extent in order to change the appearance and space of certain controls.

Further reading:

Upvotes: 2

Related Questions