use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class ShinyGadgetDialog method addCaptionWithCloseButton.
private void addCaptionWithCloseButton(String caption) {
final Image closeIcon = new Image(new ImageResource2x(ThemeResources.INSTANCE.closeDialog2x()));
Style closeIconStyle = closeIcon.getElement().getStyle();
closeIconStyle.setCursor(Style.Cursor.POINTER);
closeIconStyle.setMarginTop(2, Unit.PX);
FlexTable captionLayoutTable = new FlexTable();
captionLayoutTable.setWidth("100%");
captionLayoutTable.setText(0, 0, caption);
captionLayoutTable.setWidget(0, 1, closeIcon);
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.HorizontalAlignmentConstant.endOf(Direction.LTR));
HTML captionWidget = (HTML) getCaption();
captionWidget.getElement().appendChild(captionLayoutTable.getElement());
captionWidget.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast();
if (targetElement == closeIcon.getElement()) {
closeIcon.fireEvent(event);
}
}
});
closeIcon.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
performClose();
}
});
}
use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class TextEditingTargetFindReplace method ensureFindReplaceBar.
private void ensureFindReplaceBar(boolean defaultForward) {
if (findReplaceBar_ == null) {
findReplaceBar_ = new FindReplaceBar(showReplace_, defaultForward);
findReplace_ = new FindReplace(container_.getEditor(), findReplaceBar_, RStudioGinjector.INSTANCE.getGlobalDisplay(), showReplace_);
container_.insertFindReplace(findReplaceBar_);
findReplaceBar_.getCloseButton().addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hideFindReplace();
}
});
findReplaceButton_.setLeftImage(FindReplaceBar.getFindLatchedIcon());
}
}
use of com.google.gwt.event.dom.client.ClickHandler in project rstudio by rstudio.
the class TextEditingTargetFindReplace method createFindReplaceButton.
public Widget createFindReplaceButton() {
if (findReplaceBar_ == null) {
findReplaceButton_ = new ToolbarButton(FindReplaceBar.getFindIcon(), new ClickHandler() {
public void onClick(ClickEvent event) {
if (findReplaceBar_ == null)
showFindReplace(true);
else
hideFindReplace();
}
});
String title = showReplace_ ? "Find/Replace" : "Find";
findReplaceButton_.setTitle(title);
}
return findReplaceButton_;
}
use of com.google.gwt.event.dom.client.ClickHandler 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.ClickHandler 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;
}
Aggregations