How to keep view state on navigation in GWT - gwt

I'm developing app for my home server. It's dashboard with several pages such as cloud, admin, mediacenter. On each page I have an iframe where appropriate app is displayed, for cloud it's owncloud, for admin is webmin etc. What I want is to keep page state when I navigate to another, I mean when I'm doing sth in cloud page and I navigate to another page and after that I navigating back to cloud, I would like to see the same state as I when I leaved, how can I archieve it? I'm also using GWTP framework.

Related

Should a PWA be a SPA too?

I was wondering that because my app does have an initial journey that is totally diferente from the behaviour of the app.
I would like to separate this initial journey into a different "HTML" due data transfer and load time. Even not using the same framework (Angular2) as the rest of the app.
But this way the app is not a SPA anymore.
Does this harms the "Connectivity independent" or "App-like" PWA principles?
Obs. We are trying this because our researches shows direct relation between user engagement and speed of the loading time of initial tour.
Following the single-page app pattern for your web app means that you'll have a smooth transition to handling navigations cache-first in your progressive web app, using an App Shell approach.
Following the App Shell pattern isn't the only way to build a progressive web app, but if you take a different approach, you'll need to put more thought into how you cache your HTML, and you might have a harder time using a service worker to respond to navigation in a cache-first manner. Some of these considerations are outlined in this "High-performance service worker loading" article.
If your web app is currently a hybrid of a SPA along with a few static pages, then you can take that into account when you respond to navigation requests in your service worker by examining the incoming URL. Assuming there's a well-known prefix or other way of identifying whether a given URL corresponds to the SPA portion of your web app or the basic HTML portion, you can respond differently inside your fetch handler:
// Not shown: install and activate handlers to keep app-shell.html
// cached and up to date.
self.addEventListener('fetch', event => {
if (event.request.mode === 'navigate' && event.request.url.includes('/spa'))
event.respondWith(caches.match('app-shell.html'));
return;
}
// Either do nothing, and your non-/spa URLs will go against the network,
// or use a runtime caching strategy to handle your non-/spa URLs.
});
Updated on 2018-06-21: For an additional perspective, you can read "Beyond SPAs: alternative architectures for your PWA"
The short answer is PWA need not be SPA.
If we look at the documentation website of Web Firm Framework you can see it is not an SPA but it is a PWA. If we refresh the page while offline it works. We can also do "Add to home screen" in mobile chrome to add it as an app which brings App-like experience.
So to get an App-like experience your home page and some of its links must be able to be cached.

One Facebook app multiple users

I'm thinking of a facebook app that fetches a website's content (already developed with my own web builder) and display in a custom facebook fan page format. Clients already using the Web builder will only have to add the App to their fan page and they have their website's content already plugged into facebook.
The problem I'm having is knowing how exactly to automate this process. I can't seem to find the "Add app to page" menu when you click the Gear Icon, and the link below gives an approach I can't be explaining to every client (video further down in the link)
http://onlinewealthpartner.com/add-facebook-application-fan-page/
My head might swirling from everything I've read so far, but I'm just easing into the facebook app development. Help/insight would be much appreciated.
If I understand, your central problem is to make it as user-friendly as possible for your users to add your app to their fan pages?
Bottom line is they would need to visit the link mentioned in your tutorial:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&display=popup&next=YOUR_URL
However, since you're the one creating the Facebook Tab Application, then you would already have and could supply to your users the "app_id" and "next" parameters, so all they would need to do is click on the custom link you provide. You could even give them a button in your web builder. Your users would just click a button, go to this link, and pick their fan page in a drop down menu.

How to change Wicket behaviour on Page Expired

We have a wicket application for our main website. Lately we have implemented a mobile version of the site. The mobile version is special in that it is deployed inside a native app wrapper to some mobile devices and not connected to the rest of the page through links because it is not supposed to be normally visible to web users.
The mobile page makes use of ajax and is therefore prone to receive "Page expired" errors for example when we restart the application on the server.
Since that page is not connected to the rest of the application through links I do not want our standard "Page expired" behaviour. Is it possible to override or intercept this behaviour for the pages belonging to the mobile part of the site? For example I could like to be able to configure the pages to simply reload on a "Page expired" error.
Yes,
getApplicationSettings().setPageExpiredErrorPage(YourPage.class)
YourPage.class can then for instance be your HomePage or another Page that depending on it being a request from a mobile device does something else.
If you would like to reload the Page the user was one then it becomes a bit less trivial. Reloading the Page is not possible since you are not on the page anymore. You could have a look at IRequestCycleListener and overriding onException and handle PageExpiredException yourself but it is a dangerous road you travel if you simply reload your Page. Navigating to the home (or other) page seems more logical. I assume you are not restarting your server 100 times per day...

GWT - Refresh page Issues when I clicked on Broswers Refresh/reload button

When I am login in GWT Application, it will open my dashboard but when I am click on browsers refresh/reload button it will call entry point of my application and it will load my login page.
So how can I stop this issue.
How can I stay at same page when I am click on Browsers refresh button?
You can save user info in session after logging in and check it in your entry point class before calling login form/method and than decide to show login form or not.
But I think, the better way is not to write login logic by hands, but to integrate spring-security to your gwt application. It will do all logic by itself, you need only to create login page (you can write login page not in gwt) and make it work with gwt.
Spend week if needed to understand how it works and you will have no problems in future.

Do I need to create a new Facebook app for each app tab on a page?

I recently made an app so i could have an iframe tab on my page. i want to add another tab with an iframe. Can this be done with the same app?
Can i determine which tab a request came from? Its going to be different content under each tab.
I want to keep it the same app so users will not have to grant permissions for a second app.
No, you can only define one tab per app. You can configure that tab to display different content for different pages, but you cannot install more than one tab to a page using the same app. You'll have to create multiple apps, but you should be able to point them at the same codebase and determine which app is requesting content to serve the proper tab.
Regarding permissions, I'd work it so that you don't do any authentication from the tab itself but instead you link them to the same installation endpoint.