Skip to content

Commit

Permalink
restore async loading with progress to vcs satellite mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Nov 14, 2011
1 parent 0345628 commit 251af3e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 30 deletions.
65 changes: 38 additions & 27 deletions src/gwt/src/org/rstudio/studio/client/RStudio.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,21 @@ public void onModuleLoad()
{
Debug.injectDebug();

// vcs mode short circuits all other loading progress/logic
// (including pre-loading ace)
if ("vcs".equals(Window.Location.getParameter("mode")))
{
ensureStylesInjected();

RStudioGinjector.INSTANCE.getVCSApplication().go(
RootLayoutPanel.get());
}

// standard loading sequence
else
Document.get().getBody().getStyle().setBackgroundColor("#e1e2e5");

BrowserFence fence = GWT.create(BrowserFence.class);
fence.go(new Command()
{
Document.get().getBody().getStyle().setBackgroundColor("#e1e2e5");

BrowserFence fence = GWT.create(BrowserFence.class);
fence.go(new Command()
public void execute()
{
public void execute()
{
Command dismissProgressAnimation = showProgress();
delayLoad(dismissProgressAnimation);
}
});
}
Command dismissProgressAnimation = showProgress();

if ("vcs".equals(Window.Location.getParameter("mode")))
delayLoadVCSApplication(dismissProgressAnimation);
else
delayLoadApplication(dismissProgressAnimation);
}
});
}

private Command showProgress()
Expand All @@ -119,8 +109,8 @@ public void execute()
}
};
}

private void delayLoad(final Command dismissProgressAnimation)
private void delayLoadApplication(final Command dismissProgressAnimation)
{
GWT.runAsync(new RunAsyncCallback()
{
Expand All @@ -137,16 +127,37 @@ public void onSuccess()
public void execute()
{
ensureStylesInjected();

RStudioGinjector.INSTANCE.getApplication().go(
RootLayoutPanel.get(),
dismissProgressAnimation);;
dismissProgressAnimation);
}
});
}
});
}


private void delayLoadVCSApplication(final Command dismissProgressAnimation)
{
GWT.runAsync(new RunAsyncCallback()
{
public void onFailure(Throwable reason)
{
dismissProgressAnimation.execute();
Window.alert("Error: " + reason.getMessage());
}

public void onSuccess()
{
ensureStylesInjected();

RStudioGinjector.INSTANCE.getVCSApplication().go(
RootLayoutPanel.get(),
dismissProgressAnimation);
}
});
}

private void ensureStylesInjected()
{
ThemeResources.INSTANCE.themeStyles().ensureInjected();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

// TODO: make sure gwt url is passed to the popup window

// TODO: restore some loading progress / async loading (but no ace)

// TODO: when trying to do a refresh of commit list it hangs
// forever (perhaps something to do with console process management?).
// but then when you save it comes back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.rstudio.studio.client.common.satellite.Satellite;

import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
Expand All @@ -23,7 +24,8 @@ public VCSApplication(VCSApplicationView view,
uncaughtExHandler_ = uncaughtExHandler;
}

public void go(RootLayoutPanel rootPanel)
public void go(RootLayoutPanel rootPanel,
final Command dismissLoadingProgress)
{
// indicate that we are a satellite window
satellite_.initialize();
Expand All @@ -40,6 +42,9 @@ public void go(RootLayoutPanel rootPanel)

// show the view
view_.show();

// dismiss loading progress
dismissLoadingProgress.execute();
}


Expand Down

0 comments on commit 251af3e

Please sign in to comment.