How to reset the state of a portlet? - portlet

Is it possible to reset the state of a portlet whenever user navigates to that page for the first time?

Try to redirect to clean URL.
As states are managed by URL, cleaning it would be reset the state.

Related

How can I have a separate setup process and home page in Flutter?

I am currently building an app that has a first page with two buttons: 'New users -->" and "Existing users -->". The goal is for new users to click their button and go through a setup process that ends with their home page that is saved when the app is closed. The next time a user opens the app, once they click their existing users button, I want the app to open to the home page the setup process ends at. How do I achieving this? Any help would be appreciated!
You can use GoRouter (from flutter team) plugin for handling this scenario and navigation.
https://pub.dev/packages/go_router
While initialising the router, you can provide redirect where you can handle if user should be navigated to the setup screen or home screen.
Use database / shared preference / secure storage to store whether the setup process was completed and what data was saved.
Now if you are using any framework like GetX or something you can easily navigate to the desired pages or you can use Navigator.to.... if not using a framework.
you can use something like
bool isSetupDone = // get from storage
the use this Boolean value to either alert, show/hide button/ popup message accordingly as per your usecase.

How to redirect and then reload the page in GWTP?

Ok, I am using GWTP to build my app. I have a signUp page (mydomain.com#signUp) & a profile page (mydomain.com#profile).
I want that after user signed up successfully, the app will redirect to profile page & then reload() the profile page.
So here is what I did:
if(signedUpSuccessfully){
PlaceRequest request=new PlaceRequest(NameTokens.profile);
placeManager.revealPlace(request);
Window.Location.reload();
}
However, after finished running, the app did reload but it still in the signUp page not in profile page.
So, How to let the app redirect to profile page then reload the profile page?
I don't want to use Window.open cos it could open new browser, which is very noisy.
after reload, the page will be refreshed, so it is actually just reload your whole APP. One way I can think of is redirect request to mydomain.com#profile, by calling window.location = mydomain.com#profile. GWTP should be capable of handling this.
You would better making a PlaceRequest with the 'profile' name token and handling the "refresh" logic in the onReveal lifecycle method of ProfilePresenter.
Probably you'll need to hold a singleton over you app with the user info (which you'll fill after successfully authenticating). You can inject this singleton into the ProfilePresenter and handle the presentation of the view in the onReveal method. See the security package of carstore sample for a concrete example.

How to find out browser back button click using gwt history

I m using history listener for forward and back browser button.But i m not able to find out history back button click.If any idea plz rply..urgent for me...Thank you..
Your code can use the tokens sent by History management system to determine what kind of action you want to take. Suppose you are at page1 and that page is identified by the token 'page1'. Now, you move to page2. If you click the back button, you will receive the token 'page1'. You can use this to set the state related to page1. See this Google doc for more info.

on wicket's continueToOriginalDestination() method

what is the link between backbutton and continueToOriginalDestination(). method.
how to keep url saved for continueToOriginalDestination() method while clcking browsers back button.
continueToOriginalDestination() is used when a request was (temporarily) redirected to an intercepting page, for example a login page. When a user requests a secured page but is not yet authenticated, the security framework that hooks into wicket (auth-roles, shiro, swarm/wasp) will present the user with a login page, and store the original URL. When the user has authenticated, you can call continueToOriginalDestination and Wicket will process the original request, displaying the requested secured page.
Not only security frameworks can use this, you can do it yourself by throwing a RestartResponseAtInterceptPage exception.
The back button has nothing to do with this, nor does it have any affect on the processing of the original destination page. Wicket keeps storing the original destination until a new one is set, or until continueToOriginalDestination has been called.
continueToOriginalDestination returns true when there was a page to go to, and false when the user landed on the intercept page directly (e.g. guessing the login page URL or clicking on a link pointing to the login page).

Looking for input on GWT / MVP action w/o browser history change

I am trying to develop a GWT app with the MVP pattern. So far so good except for one specific case of actions: actions that do not change the url (no browser history change).
In the GWT MVP pattern, events are sent from presenters, the an app controller catches them and update the browser history. If the history has changed then the view updates.
** MVP with history change (Works well)**
Current URL is /list
User clicks on contactdelete button.
Fire DeleteContactAction event.
App controller catches, change history to 'delete'
onValueChange is called
if (token.equals("delete"))
delete contact screen, then delete contact
Fire ContactDeletedEvent
app controller catches and change the history to list
onValueChange is called: contact list refreshes
GWT MVP pattern for dialog box w/o history changes
** Issue ** - I use a dialog box and I don't want to change the browser history, so here is the problem:
Current URL is /list
User clicks on contactdelete button.
Contact is deleted
Fire ContactDeletedEvent.
App controller catches, change history to 'list'
**onValueChange is NOT called** because url is already /list and there is no change
# problem: contact list does not refresh
Question: does anyone know a pattern to implement this in the context of MVP?
Any help / idea appreciated.
Are you using some framework (aside from GWT) that automatically does history changes?
Regular GWT/MVP doesn't require a history change to be made, and in fact usually it's up to the app to update the history itself.
If you want to update the app's state without a history change, you can use an EventBus to publish events that other elements of the app can subscribe to, to update the app's state without a history change.
Basically, you will have to create your own PlaceHistoryHandler. Your custom PlaceHistoryHandler will ignore a particular type of PlaceChangeEvent (i.e. it will not update its Historian).