What is the best way to provide interaction between iframe pages? - gwt

Considering the next situation:
There are two GWT apps, and one includes another via iframe. So the issue is to expose some api functions of these apps so they can communicates with each other. For instance, child iframe GWT app can make calls api functions of its parent GWT app and vice versa.
What is the best way to implement it?

Related

What is a solid approach to applying jQuery Mobile to a ReST styled MVC application?

I have an MVC application where all endpoints are simple ReST styled MVC endpoints that return static pages, i.e /customers/${customerId}, or for a customer listing /customers?state=${state}.
I'm adding mobile support through jQuery and am trying to establish a flexible design while fitting in with the rules of jQuery-mobile.
The first problem I face is that jqm is very much an ajax style UI framework where pages are loaded into the current document, or you build them all together. Given this I find it hard to see how static URI's would fit in, i.e. if I have /customers/123 and /customers/456 they are both the same view but different content, so should I then be controlling everything through ajax?
But then what if someone accesses the site via /customers/789 instead of home and then navigating? How is this controlled if everything is done via ajax?
I would love to see a petclinic style example using spring and jqm.

Build a GWT app that can handle both classic web and mobile clients

We have a GWT application specifically designed to handle mobile clients and built with MGWT.
Now, we need to build a frontend for classical web clients, probably building it with GWT-Bootstrap and I'm wondering what's the best solution to achieve this.
How should we proceed with modules, gwt.xml configuration, client type detection, etc ...
What are your suggestions ?
Check this question for how to tell what platform the user is on.
Beyond that, GWT uses only HTML and Javascript, so unlike Flash applications, it actually works fine on mobile devices too; most events (such as clicks) are translated by the browser, so a touch becomes a click, you don't need a separate handler or anything.
Basically what I would suggest is you have a single GWT regardless of platform, and only for certain Widgets, add separate options for Mobile and Desktop, as necessary.
I don't know the architecture of your app and if you use the MVP pattern but GWTP with its Form-factors feature allows you to share almost all of your business logic (your presenters) across the different platforms. You have just to write the view depending on the platform you want to support.

GWT direct link to a part of an App

in standard "page-based" webapps, it´s quite easy to implemet direct links to several pages, f.e, an url abc.com/app/customer/4711 which directs the user directly to the page diplaying customer 4711.
Is there a way to reproduce a similar behaviour in an GWT-App?
Tnk Mica
You can use Activities and Places design pattern. It provides easy access to any "place" within the app:
https://developers.google.com/web-toolkit/doc/latest/DevGuideMvpActivitiesAndPlaces
Every once in a while this question is being asked in one form or another and I think misconception exists about what GWT is best suited for.
GWT is an amazing set of tools for creating web applications: JavaScript multi-screen user interfaces which run in modern web browsers, load as a single web page and generally don't need full page reloads or page switching for their operation.
Navigation between screens happens in response to triggered events (for example, a user pressing a button, a timer firing or server-side state changing). The data needed to be presented is acquired asynchronously via XHRs (again without web page reloading).
GWT provides an elaborate framework for all of the above - Activities & Places for navigation, as Andrei mentioned, GWT-RPC and RequestFactory for data acquisition and exchange, and much much more to make advanced and highly-structured web apps which leverage the processing power of modern machines and capabilities of modern browsers.

GWT pattern for handling mobile browsers

I am working on a GWT app that needs to serve a different layout to mobile device users. I can easily determine if a user is using a mobile browser; however, I'm not sure about the best pattern for handling them.
I am currently using the MVP pattern - would it be best to simply pass a browser-specific view to the Presenter or is there a more appropriate method?
You could set up GWT to detect the web browser used, as described in this question. Then, via Deferred Binding, let the compiler "slip" the correct view into place for the, say, mobilesafari user agent. That way, you won't have to litter your Java code with browser detection, etc.
The way I've done it is to have different GWT modules (with their own entrypoint, Gin modules, even different CssResources) and then on the myapp.html page you just have to check out what browser is requesting the content and based on it (javascript checks) the appropriate module
<script src="myapp/myapp.nocache.js"/>
or
<script src="mymobileapp/mymobileapp.nocache.js"/>
is loaded.
If you are working with GIN and an MVP framework (gwt-platform is my platform of choice) you can then reuse the code that was already written for the presenters and only implement different views.

GWT Modules and Web Pages

I am new to GWT and am going through the docs, examples, demos etc.
All the examples seem to have just one module which is loaded by a single html page contained in the sample.
What if the web app has multiple web pages/features. Can multiple web pages providing different functionality utilize the same gwt module by building the UI differently based on request params?
Or is it normal to create one module per html page (feature) in the app?
You can have a look at these two questions:
Multiple pages tutorial in Google Web Toolkit (GWT)
GWT with multiple host pages in a legacy application
...or at this site which guides you through the process, if you are new I strongly suggest to subscribe to the 5 days email course.
Usually a GWT module contains multiple 'screens', or 'views'.
In short: Yes you can have multiple different pages in a GWT app.
Full: You can do his in several ways, the easiest is to use the XML file where you can list the various URL points (the same you use to specify the RPC call back URL) to list multiple URL's and the corresponding classes (each class will need to inherit the correct classes to ensure it is a front end)
You can also simply generate different screens based on different variables in the same class, however this will complicate the code and lead to messy designs.
I think that using less number of the pages that needs full page reload to interact is better in GWT.
In generally, you can to divide logic to many tabs, screens, windows and other layouts, that can interact without page reloading.
See on the google mail )