Search in sources :

Example 41 with ClickHandler

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();
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Element(com.google.gwt.dom.client.Element) FlexTable(com.google.gwt.user.client.ui.FlexTable) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x) Style(com.google.gwt.dom.client.Style) HTML(com.google.gwt.user.client.ui.HTML) Image(com.google.gwt.user.client.ui.Image) EventTarget(com.google.gwt.dom.client.EventTarget)

Example 42 with ClickHandler

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());
    }
}
Also used : FindReplace(org.rstudio.studio.client.workbench.views.source.editors.text.findreplace.FindReplace) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FindReplaceBar(org.rstudio.studio.client.workbench.views.source.editors.text.findreplace.FindReplaceBar)

Example 43 with ClickHandler

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

Example 44 with ClickHandler

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);
    }
}
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 45 with ClickHandler

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;
}
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)

Aggregations

ClickHandler (com.google.gwt.event.dom.client.ClickHandler)448 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)442 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)168 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)143 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)129 ArrayList (java.util.ArrayList)125 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)110 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)79 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)49 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)48 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)41 PerunError (cz.metacentrum.perun.webgui.model.PerunError)38 Button (com.google.gwt.user.client.ui.Button)35 HashMap (java.util.HashMap)34 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)33 Button (org.gwtbootstrap3.client.ui.Button)33 HTML (com.google.gwt.user.client.ui.HTML)31 Image (com.google.gwt.user.client.ui.Image)29 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)28 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)26