use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class ModalDialog method commonInit.
private void commonInit(String caption, ThemedButton okButton, final Operation cancelOperation) {
setText(caption);
addOkButton(okButton);
ThemedButton cancelButton = addCancelButton();
if (cancelOperation != null) {
cancelButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
cancelOperation.execute();
}
});
}
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class DataTable method initToolbar.
public void initToolbar(Toolbar toolbar, boolean isPreview) {
filterButton_ = new LatchingToolbarButton("Filter", new ImageResource2x(DataViewerResources.INSTANCE.filterIcon2x()), new ClickHandler() {
public void onClick(ClickEvent event) {
boolean newFilterState = !filtered_;
// ready/table is not initialized)
if (setFilterUIVisible(newFilterState)) {
filtered_ = newFilterState;
filterButton_.setLatched(filtered_);
}
}
});
toolbar.addLeftWidget(filterButton_);
filterButton_.setVisible(!isPreview);
searchWidget_ = new SearchWidget(new SuggestOracle() {
@Override
public void requestSuggestions(Request request, Callback callback) {
// no suggestions
callback.onSuggestionsReady(request, new Response(new ArrayList<Suggestion>()));
}
});
searchWidget_.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
applySearch(getWindow(), event.getValue());
}
});
toolbar.addRightWidget(searchWidget_);
searchWidget_.setVisible(!isPreview);
if (isPreview) {
ToolbarLabel label = new ToolbarLabel("(Displaying up to 1,000 records)");
label.addStyleName(ThemeStyles.INSTANCE.toolbarInfoLabel());
toolbar.addRightWidget(label);
}
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class PresentationPane method createMainToolbar.
@Override
protected Toolbar createMainToolbar() {
boolean isTutorial = session_.getSessionInfo().getPresentationState().isTutorial();
Toolbar toolbar = new Toolbar();
slideNavigationMenu_ = new SlideNavigationToolbarMenu(toolbar);
slideNavigationMenu_.setEditButtonVisible(!isTutorial);
toolbar.addLeftSeparator();
toolbar.addLeftWidget(commands_.presentationFullscreen().createToolbarButton());
// More
if (!isTutorial) {
ToolbarPopupMenu moreMenu = new ToolbarPopupMenu();
moreMenu.addItem(commands_.clearPresentationCache().createMenuItem(false));
moreMenu.addSeparator();
moreMenu.addItem(commands_.presentationViewInBrowser().createMenuItem(false));
moreMenu.addItem(commands_.presentationSaveAsStandalone().createMenuItem(false));
ToolbarButton moreButton = new ToolbarButton("More", new ImageResource2x(StandardIcons.INSTANCE.more_actions2x()), moreMenu);
toolbar.addRightWidget(moreButton);
// Create the publish button and wire it to our HTML generator
publishButton_ = new RSConnectPublishButton(RSConnect.CONTENT_TYPE_PRES, false, null);
publishButton_.setPublishHtmlSource(new PublishHtmlSource() {
@Override
public void generatePublishHtml(final CommandWithArg<String> onCompleted) {
server_.createPresentationRPubsSource(new SimpleRequestCallback<PresentationRPubsSource>() {
@Override
public void onResponseReceived(PresentationRPubsSource source) {
onCompleted.execute(source.getSourceFilePath());
}
@Override
public void onError(ServerError error) {
display_.showErrorMessage("Error Saving Presentation", Presentation.getErrorMessage(error));
}
});
}
@Override
public String getTitle() {
return "Presentation:\n" + getPresentationTitle();
}
});
toolbar.addRightSeparator();
toolbar.addRightWidget(publishButton_);
} else {
toolbar.addRightWidget(commands_.tutorialFeedback().createToolbarButton());
}
toolbar.addRightSeparator();
toolbar.addRightWidget(refreshButton_ = commands_.refreshPresentation().createToolbarButton());
progressButton_ = new ToolbarButton(CoreResources.INSTANCE.progress_gray(), new ClickHandler() {
@Override
public void onClick(ClickEvent e) {
}
});
toolbar.addRightWidget(progressButton_);
progressButton_.setVisible(false);
return toolbar;
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class PathBreadcrumbWidget method addAnchor.
private Widget addAnchor(final FileSystemItem item, boolean browseable) {
boolean isHome = context_.isRoot(item);
String text = isHome ? "Home" : item.getName();
Widget link = null;
if (browseable || isHome) {
Anchor anchor = new Anchor(text, false);
anchor.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
anchor.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SelectionCommitEvent.fire(PathBreadcrumbWidget.this, item);
}
});
link = anchor;
} else {
link = new InlineLabel(text);
}
link.setTitle(item.getPath());
if (isHome)
link.addStyleName(RES.styles().home());
pathPanel_.add(link);
return link;
}
use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.
the class PathBreadcrumbWidget method maybeAddProjectIcon.
private void maybeAddProjectIcon() {
if (projectIconsAdded_)
return;
if (pSession_ == null || pSession_.get() == null)
return;
final FileSystemItem projDir = pSession_.get().getSessionInfo().getActiveProjectDir();
if (projDir != null) {
Image projIcon = new Image(new ImageResource2x(RES.projectImage2x()));
projIcon.addStyleName(ThemeResources.INSTANCE.themeStyles().handCursor());
projIcon.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SelectionCommitEvent.fire(PathBreadcrumbWidget.this, projDir);
}
});
projIcon.addStyleName(RES.styles().project());
projIcon.setTitle("Go to project directory");
eastFrame_.insert(projIcon, 0);
// TODO: infer from contents
double width = 42;
frame_.setWidgetSize(eastFrame_, width);
projectIconsAdded_ = true;
}
}
Aggregations