use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class RmdOutputWindow method onInitialize.
@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
presenter_ = pPresenter_.get();
showRenderResult((RmdPreviewParams) params.cast());
// enable command processing in this window
pDesktopHooks_.get();
// make it fill the containing layout panel
Widget presWidget = presenter_.asWidget();
mainPanel.add(presWidget);
mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}
use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class HTMLPreviewApplicationWindow method onInitialize.
@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
Window.setTitle("RStudio: Preview HTML");
// create the presenter and activate it with the passed params
HTMLPreviewParams htmlPreviewParams = params.<HTMLPreviewParams>cast();
presenter_ = pPresenter_.get();
presenter_.onActivated(htmlPreviewParams);
// enable command processing
pDesktopHooks_.get();
// make it fill the containing layout panel
Widget presWidget = presenter_.asWidget();
mainPanel.add(presWidget);
mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}
use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class SourceSatelliteWindow method onInitialize.
@Override
protected void onInitialize(LayoutPanel mainPanel, JavaScriptObject params) {
// read the params and set up window ordinal / title
SourceWindowParams windowParams = params.cast();
String title = null;
if (windowParams != null) {
pWindowManager_.get().setSourceWindowOrdinal(windowParams.getOrdinal());
title = windowParams.getTitle();
}
if (title == null)
title = "";
else
title += " - ";
title += "RStudio Source Editor";
Window.setTitle(title);
// set up the source window
SourceWindow sourceWindow = pSourceWindow_.get();
if (windowParams != null && windowParams.getDocId() != null && windowParams.getSourcePosition() != null) {
// if this source window is being opened to pop out a particular doc,
// read that doc's ID and current position so we can restore it
sourceWindow.setInitialDoc(windowParams.getDocId(), windowParams.getSourcePosition());
}
SourceSatellitePresenter appPresenter = pPresenter_.get();
// initialize build commands (we want these to work from source windows)
BuildCommands.setBuildCommandState(RStudioGinjector.INSTANCE.getCommands(), RStudioGinjector.INSTANCE.getSession().getSessionInfo());
// menu entries aren't accessible from the source window)
if (Desktop.isDesktop() && Desktop.getFrame().isCocoa()) {
pFileMRUList_.get();
pProjectMRUList_.get();
}
// initialize working directory
if (!StringUtil.isNullOrEmpty(windowParams.getWorkingDir())) {
pEventBus_.get().fireEvent(new WorkingDirChangedEvent(windowParams.getWorkingDir()));
}
// make it fill the containing layout panel
Widget presWidget = appPresenter.asWidget();
mainPanel.add(presWidget);
mainPanel.setWidgetLeftRight(presWidget, 0, Unit.PX, 0, Unit.PX);
mainPanel.setWidgetTopBottom(presWidget, 0, Unit.PX, 0, Unit.PX);
}
use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class Source method addTab.
private EditingTarget addTab(SourceDocument doc, Integer position, int mode) {
final String defaultNamePrefix = editingTargetSource_.getDefaultNamePrefix(doc);
final EditingTarget target = editingTargetSource_.getEditingTarget(doc, fileContext_, new Provider<String>() {
public String get() {
return getNextDefaultName(defaultNamePrefix);
}
});
final Widget widget = createWidget(target);
if (position == null) {
editors_.add(target);
} else {
// we're inserting into an existing permuted tabset -- push aside
// any tabs physically to the right of this tab
editors_.add(position, target);
for (int i = 0; i < tabOrder_.size(); i++) {
int pos = tabOrder_.get(i);
if (pos >= position)
tabOrder_.set(i, pos + 1);
}
// add this tab in its "natural" position
tabOrder_.add(position, position);
}
view_.addTab(widget, target.getIcon(), target.getId(), target.getName().getValue(), // used as tooltip, if non-null
target.getTabTooltip(), position, true);
fireDocTabsChanged();
target.getName().addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
view_.renameTab(widget, target.getIcon(), event.getValue(), target.getPath());
fireDocTabsChanged();
}
});
view_.setDirty(widget, target.dirtyState().getValue());
target.dirtyState().addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(ValueChangeEvent<Boolean> event) {
view_.setDirty(widget, event.getValue());
manageCommands();
}
});
target.addEnsureVisibleHandler(new EnsureVisibleHandler() {
public void onEnsureVisible(EnsureVisibleEvent event) {
view_.selectTab(widget);
}
});
target.addCloseHandler(new CloseHandler<Void>() {
public void onClose(CloseEvent<Void> voidCloseEvent) {
view_.closeTab(widget, false);
}
});
events_.fireEvent(new SourceDocAddedEvent(doc, mode));
// multiple documents are open; if this is the second document, go check
if (editors_.size() == 2)
manageMultiTabCommands();
// if the target had an editing session active, attempt to resume it
if (doc.getCollabParams() != null)
target.beginCollabSession(doc.getCollabParams());
return target;
}
use of com.google.gwt.user.client.ui.Widget in project rstudio by rstudio.
the class FadeOutAnimation method onComplete.
@Override
protected void onComplete() {
for (Widget w : widgets_) {
Style style = w.getElement().getStyle();
style.setDisplay(Style.Display.NONE);
style.setOpacity(1.0);
}
if (callback_ != null)
callback_.execute();
}
Aggregations