Skip to content
Snippets Groups Projects
Commit 2abe036b authored by kaloyane's avatar kaloyane
Browse files

[LMS-1719] Never ask user to refresh openBIS. We rely on smart caching (see...

[LMS-1719] Never ask user to refresh openBIS. We rely on smart caching (see previous commit). Additionally, we auto-reload openBIS when running in embedded/simple mode, so that users won't have to deal with annoying popups.

SVN: 20686
parent 520a0a5c
No related branches found
No related tags found
No related merge requests found
...@@ -230,7 +230,7 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> ...@@ -230,7 +230,7 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
} }
if (caught instanceof InvalidSessionException) if (caught instanceof InvalidSessionException)
{ {
showSessionTerminated(msg); handleSessionTerminated(msg);
} else } else
{ {
callbackListener.onFailureOf(viewContext, this, msg, caught); callbackListener.onFailureOf(viewContext, this, msg, caught);
...@@ -253,6 +253,25 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> ...@@ -253,6 +253,25 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
} }
} }
private void refreshPageInBrowser()
{
if (viewContext != null)
{
viewContext.getPageController().reload(true);
}
}
private void handleSessionTerminated(String msg)
{
if (viewContext.isSimpleOrEmbeddedMode())
{
refreshPageInBrowser();
} else
{
showSessionTerminated(msg);
}
}
private void showSessionTerminated(String msg) private void showSessionTerminated(String msg)
{ {
Dialog dialog = new Dialog(); Dialog dialog = new Dialog();
...@@ -269,10 +288,9 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T> ...@@ -269,10 +288,9 @@ public abstract class AbstractAsyncCallback<T> implements AsyncCallback<T>
@Override @Override
public void windowHide(WindowEvent we) public void windowHide(WindowEvent we)
{ {
if (viewContext != null && reloadWhenSessionTerminated) if (reloadWhenSessionTerminated)
{ {
final IPageController pageController = viewContext.getPageController(); refreshPageInBrowser();
pageController.reload(true);
} }
} }
}); });
......
...@@ -96,14 +96,16 @@ public class Client implements EntryPoint, ValueChangeHandler<String> ...@@ -96,14 +96,16 @@ public class Client implements EntryPoint, ValueChangeHandler<String>
// //
// IPageController // IPageController
// //
public final void reload(final boolean logout) public final void reload(final boolean logout)
{ {
if (logout) if (logout)
{ {
initializeControllers(openUrlController); // refresh the entire page
Window.Location.reload();
} else
{
onModuleLoad();
} }
onModuleLoad();
} }
}; };
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
package ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action; package ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action;
import com.google.gwt.user.client.History; import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext; import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
...@@ -42,6 +41,6 @@ final class LogoutCallback extends AbstractAsyncCallback<Void> ...@@ -42,6 +41,6 @@ final class LogoutCallback extends AbstractAsyncCallback<Void>
{ {
History.newItem(""); // clears history token in URL History.newItem(""); // clears history token in URL
GWTUtils.removeConfirmExitMessage(); GWTUtils.removeConfirmExitMessage();
Window.Location.reload(); viewContext.getPageController().reload(true);
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment