how reset all contents of page without reloading page in GWT - gwt

I have tabpanel in my application. i just want to refresh all the contents of the tab whenever i navigate through different tabs. Currently i am using Window.Location.Reload for the same. But is there any other way out for the same?

Add a TabListener to the TabPanel using the method addTabListener(TabListener listener). You will be notified when a tab is selected. You can put your logic of refresh in that method.

Related

How to reload a particular tab in bottom navigation bar flutter?

I have a bottom navigation bar with 5 tabs, In each tab I have a button that navigates to another separate screen using Navigation.pushNamed()(page 2); and from (page 2) I pop the screen, now the tab from where I navigated from need to be reloaded. because i store some data (page 2) and stored in sqflite i need to display the data in one of the tabs. Is it possible to reload a particular tab of a bottom navigation bar?
I tried using Navigator.pop(context,true) that also didnt work. Can some one help me with this, thanks in advance.
this is done by the provider. I'm new to flutter as well but this guy explained it very well!
Flutter by default does not save state (and disposes the widgets). If you want to save the state of a tab, you can use a PageStorageBucket. It is really well described in this tutorial:
https://medium.com/#lucassaltoncardinali/keeping-state-with-the-bottom-navigation-bar-in-flutter-69e4168878e1

Web-site with two Composite per page. Due to bad design?

I'm creating a web-site using GWT for the first time. The aplication has two Composite class, one of them is a menu and the other one is where I show de info about the specific menu that has been clicked. I'm using MVP, the class History and the interface ChangeValueHandler to switch among different pages.
I have one pair presenter-view for each Composite. The app begins well creating the menu and the section info. When you click in the menu it works fine showing the information and the token browser is changed. The thing is that if you load a page(eg: myapp.com#register) without loading the home page, it doesn't show you the menu. It loads the Composite section info, but not the Composite menu (the Composite menu is load with myapp.com#home).
I think it's because of a bad design of the application, but I don't know how to do that in other way. If the app only had one Composite it wouldn't be a problem, but when there are 2 or more Composite per page I don't know how to manage the whole thing to work properly.
It's difficult to tell what exactly is wrong, because of the lack of code. So I'm guessing. You should design to act on the PlaceChangeEvent instead of the ValueChangeEvent. That means a menu click should fire the place change and then the application will handle this event. That way you unbind the menu actions from your content pages. And think more of each page as a separate entity. Also take a look at the GWT Activity mechanism and how it helps having a main page that is always the same and on that main page a content area that changes depending on the page actually shown.
You should include your menu in each page instead of creating it once in the home page and then keeping it on screen. I assume you create the menu and add it to the DOM via
RootPanel.get().add(myMenuWidget);
If you are using UIBinder it should be pretty straightforward to include the menu in each page, just a matter of adding the corresponding tag in each .ui.xml file of your pages.

Using back button doesn't clear old content

I'm using gwtp and I have some troubles with the browsers back button.
My DefaultPlace is a login page (root content). If the the login is correct, it directs you to a welcome page (MainPagePresenter) with a menu bar. This menu bar is always visible when going through its items. Clicking on an item reveals specific content (setInSlot) . When you use the back button it changes the token name to the token used before but you still see the old content.
My question is: How do I get back to the content which was shown before?
You shoud use the GWTP presenter lifecycle. When you use back button, the previous presenter is revealed. You should override onReveal() and onHide() to clean or save the presenter and view state.
If you want clean a presenter when the place changed, you should override onHide() and in the body you can clean the view before the place change.

Refreshing the webview in iPhone app

In the home page of my iphone application i am calling a web page, users can do some actions(comment,like etc) from other tabs of my app-After that,when the come back to home page the web page must be refreshed(eg:- comment/like count must be incresed)
If user do the refreshing of home page(scroll up from top) the page is getting refreshed,but the client wanted to refresh it automatically
So i have loaded the web page in viewDidAppear method,
Now problem is-whenever user come back to home page it gets refreshed and showing from the top(if user go to detail from some link at bottom and come back,webpage shows the top)
how to prevent this,or is there any better idea for automatic refreshing ?
Perhaps a better way would be to use javascript to download the updates in the background, then update your content appropriately. UIWebView has a method –stringByEvaluatingJavaScriptFromString: which can be used to run javascript code. You could supply the method call to perform the refresh in your -viewDidLoad method.
Another option could be to download the HTML in the background, and compare it too what is displayed, if different, swap. That way content is only refreshed when needed. Although that still gives you the problem of content moving to the top.

Ajax Control Toolkit - Use client-side button to activate tab

I'm using the TabContainer/TabPanel components of the Ajax Control Toolkit.
I'd like to hide the tabs themselves and use a button elsewhere on the page to activate (bring to the front) one of the tabs without posting back to the server.
I can show and hide the tabs by grabbing their clientIDs and manually setting the visibility and display styles.
But is there a javascript function I can call to do this and perform whatever magic happens behind the scenes when I click an actual tab?
Example:
var tab = $find(“tabContainer’s ClientID”);
tab.set_activeTabIndex(1); // active the second tab panel
tab.getFirstTab().set_enabled(false); // disable the first panel