Search in sources :

Example 26 with ClickEvent

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();
            }
        });
    }
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 27 with ClickEvent

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);
    }
}
Also used : LatchingToolbarButton(org.rstudio.core.client.widget.LatchingToolbarButton) SearchWidget(org.rstudio.core.client.widget.SearchWidget) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) SuggestOracle(com.google.gwt.user.client.ui.SuggestOracle)

Example 28 with ClickEvent

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;
}
Also used : ServerError(org.rstudio.studio.client.server.ServerError) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) SimpleRequestCallback(org.rstudio.studio.client.common.SimpleRequestCallback) ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ToolbarPopupMenu(org.rstudio.core.client.widget.ToolbarPopupMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) RSConnectPublishButton(org.rstudio.studio.client.rsconnect.ui.RSConnectPublishButton) PublishHtmlSource(org.rstudio.studio.client.rsconnect.model.PublishHtmlSource) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) SlideNavigationToolbarMenu(org.rstudio.studio.client.common.presentation.SlideNavigationToolbarMenu) PresentationRPubsSource(org.rstudio.studio.client.workbench.views.presentation.model.PresentationRPubsSource) Toolbar(org.rstudio.core.client.widget.Toolbar)

Example 29 with ClickEvent

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;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 30 with ClickEvent

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;
    }
}
Also used : FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Aggregations

ClickEvent (com.google.gwt.event.dom.client.ClickEvent)316 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)314 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)161 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)135 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)124 ArrayList (java.util.ArrayList)117 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)105 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)76 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)40 PerunError (cz.metacentrum.perun.webgui.model.PerunError)36 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)32 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)32 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)31 HashMap (java.util.HashMap)31 Button (com.google.gwt.user.client.ui.Button)30 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)25 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)23 ListBoxWithObjects (cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects)20 Map (java.util.Map)20 User (cz.metacentrum.perun.webgui.model.User)19