Skip to content

Commit

Permalink
Scroll Compile PDF output to bottom on tab activation
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Feb 23, 2012
1 parent b44feca commit af8e4ce
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ private void scrollToBottomAsync()
scrollToBottomCommand_.nudge();
}

public void scrollToBottom()
{
scrollPanel_.scrollToBottom();
}

private boolean initialized_ = false;
@Override
protected void onLoad()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,12 @@ public boolean isEffectivelyVisible()
return DomUtils.isEffectivelyVisible(getElement());
}

@Override
public void scrollToBottom()
{
outputWidget_.scrollToBottom();
}

@Override
public void compileCompleted()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.rstudio.studio.client.workbench.views.output.compilepdf;

import com.google.gwt.core.client.JsArray;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
Expand Down Expand Up @@ -65,6 +66,7 @@ public interface Display extends WorkbenchView, HasEnsureHiddenHandlers
HasSelectionCommitHandlers<CodeNavigationTarget> errorList();
boolean isErrorPanelShowing();
boolean isEffectivelyVisible();
void scrollToBottom();
}

@Inject
Expand Down Expand Up @@ -206,7 +208,21 @@ else if (event.getStatus() == CompilePdfStatusEvent.COMPLETED)
compileCompleted();
}
}


@Override
public void onSelected()
{
super.onSelected();
Scheduler.get().scheduleDeferred(new Command()
{
@Override
public void execute()
{
view_.scrollToBottom();
}
});
}

private void compileStarted(String targetFile)
{
targetFile_ = FileSystemItem.createFile(targetFile);
Expand Down

0 comments on commit af8e4ce

Please sign in to comment.