2

Im currently writing mobile interfaces for my GWT app. Im just doing so using the standard GWT libraries. I was wondering if there is a way to tell panels/widgets to align in a landscape mode. The functionality i'm looking for is for the user to interact with the app with the phone sideways, just so I can make use of a screen thats wider than it is tall!

I actually don't really care about orientation changes. For my purposes I just want my app to be used only landscape mode. As such if the user was to load it up and hold the phone portrait, the app would appear sideways. All I really need is a way for my main widget container to be in landscape orientation. The actual change between portrait and landscape should make no difference to my interface.

Does anyone know how to do this? Im no expert with GWT/css but it seems like something that would hopefully be straightforward!

Cheers!

SteveCallender
  • 211
  • 1
  • 2
  • 9

2 Answers2

1

Yes it is simple enought and GWT team has put up a sample example. You can download and extract their sample mobilewebapp from here.

You can browse through the relvant code @ WindowBasedOrientationHelper.java

WindowBasedOrientationHelper implements the OrientationHelper.

Note: GWT provides for the concept of Orientation using height and width calculations and applies it to Tablet and Mobile.

Edit - To enforce a orientation change for GWT app in non browser mode - mgwt - Orientation change programatically

Community
  • 1
  • 1
appbootup
  • 9,537
  • 3
  • 33
  • 65
  • WindowBasedOrientationHelper.java link broken :( 404 not found – Suresh Atta Feb 12 '13 at 06:24
  • Updated the link. Its moved to another package. – appbootup Feb 12 '13 at 06:45
  • Thank you.Nice implemented class for mobile layout modes . – Suresh Atta Feb 12 '13 at 07:19
  • Hey, thanks for the response. However, im not sure that this is quite what i'm after. I actually don't really care about orientation changes. For my purposes I just want my app to be used only landscape mode. As such if the user was to load it up and hold the phone portrait, the app would appear sideways. All I really need is a way for my main widget container to be in landscape orientation. The actual change between portrait and landscape should make no difference to my interface. Is this possible? Many thanks. – SteveCallender Feb 12 '13 at 11:59
  • It would make sense to Edit your Question to mention the same. – appbootup Feb 12 '13 at 12:02
  • In browser no. There is a existing answer for this as PhoneGap+MGWT app http://stackoverflow.com/questions/13655279/mgwt-orientation-change-programatically – appbootup Feb 12 '13 at 14:01
0

Yes .

We can change set the mode of the panels Weather its Portrait or Landscape by using the

OrientationHelper

There you can find methods like isPortrait() ..etc...

Cheers :)

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307