Search in sources :

Example 21 with ClickEvent

use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.

the class WebApplicationHeader method initCommandsPanel.

private void initCommandsPanel(final SessionInfo sessionInfo) {
    // add username 
    if (sessionInfo.getShowIdentity()) {
        ToolbarLabel usernameLabel = new ToolbarLabel();
        usernameLabel.getElement().getStyle().setMarginRight(2, Unit.PX);
        if (!BrowseCap.isFirefox())
            usernameLabel.getElement().getStyle().setMarginTop(2, Unit.PX);
        String userIdentity = sessionInfo.getUserIdentity();
        usernameLabel.setTitle(userIdentity);
        userIdentity = userIdentity.split("@")[0];
        usernameLabel.setText(userIdentity);
        headerBarCommandsPanel_.add(usernameLabel);
        ToolbarButton signOutButton = new ToolbarButton(new ImageResource2x(RESOURCES.signOut2x()), new ClickHandler() {

            public void onClick(ClickEvent event) {
                eventBus_.fireEvent(new LogoutRequestedEvent());
            }
        });
        signOutButton.setTitle("Sign out");
        headerBarCommandsPanel_.add(signOutButton);
        headerBarCommandsPanel_.add(signOutSeparator_ = createCommandSeparator());
    }
    overlay_.addCommands(this);
    headerBarCommandsPanel_.add(commands_.quitSession().createToolbarButton());
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) LogoutRequestedEvent(org.rstudio.studio.client.application.events.LogoutRequestedEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ToolbarLabel(org.rstudio.core.client.widget.ToolbarLabel) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ImageResource2x(org.rstudio.core.client.resources.ImageResource2x)

Example 22 with ClickEvent

use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.

the class CompilePanel method connectToolbar.

public void connectToolbar(Toolbar toolbar) {
    Commands commands = RStudioGinjector.INSTANCE.getCommands();
    ImageResource stopImage = commands.interruptR().getImageResource();
    stopButton_ = new ToolbarButton(stopImage, null);
    stopButton_.setVisible(false);
    toolbar.addRightWidget(stopButton_);
    showOutputButton_ = new LeftRightToggleButton("Output", "Issues", false);
    showOutputButton_.setVisible(false);
    showOutputButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showOutputButton_.setVisible(false);
            showErrorsButton_.setVisible(true);
            panel_.setWidget(outputDisplay_.asWidget());
            outputDisplay_.scrollToBottom();
        }
    });
    toolbar.addRightWidget(showOutputButton_);
    showErrorsButton_ = new LeftRightToggleButton("Output", "Issues", true);
    showErrorsButton_.setVisible(false);
    showErrorsButton_.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            showOutputButton_.setVisible(true);
            showErrorsButton_.setVisible(false);
            panel_.setWidget(errorList_);
        }
    });
    toolbar.addRightWidget(showErrorsButton_);
}
Also used : ToolbarButton(org.rstudio.core.client.widget.ToolbarButton) ImageResource(com.google.gwt.resources.client.ImageResource) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Commands(org.rstudio.studio.client.workbench.commands.Commands) LeftRightToggleButton(org.rstudio.core.client.widget.LeftRightToggleButton)

Example 23 with ClickEvent

use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.

the class SavePlotAsPdfDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    ExportPlotResources.Styles styles = ExportPlotResources.INSTANCE.styles();
    Grid grid = new Grid(7, 2);
    grid.setStylePrimaryName(styles.savePdfMainWidget());
    // paper size
    grid.setWidget(0, 0, new Label("PDF Size:"));
    // paper size label
    paperSizeEditor_ = new PaperSizeEditor();
    grid.setWidget(0, 1, paperSizeEditor_);
    // orientation
    grid.setWidget(1, 0, new Label("Orientation:"));
    HorizontalPanel orientationPanel = new HorizontalPanel();
    orientationPanel.setSpacing(kComponentSpacing);
    VerticalPanel orientationGroupPanel = new VerticalPanel();
    final String kOrientationGroup = new String("Orientation");
    portraitRadioButton_ = new RadioButton(kOrientationGroup, "Portrait");
    orientationGroupPanel.add(portraitRadioButton_);
    landscapeRadioButton_ = new RadioButton(kOrientationGroup, "Landscape");
    orientationGroupPanel.add(landscapeRadioButton_);
    orientationPanel.add(orientationGroupPanel);
    grid.setWidget(1, 1, orientationPanel);
    boolean haveCairoPdf = sessionInfo_.isCairoPdfAvailable();
    if (haveCairoPdf)
        grid.setWidget(2, 0, new Label("Options:"));
    HorizontalPanel cairoPdfPanel = new HorizontalPanel();
    String label = "Use cairo_pdf device";
    if (BrowseCap.isMacintoshDesktop())
        label = label + " (requires X11)";
    chkCairoPdf_ = new CheckBox(label);
    chkCairoPdf_.getElement().getStyle().setMarginLeft(kComponentSpacing, Unit.PX);
    cairoPdfPanel.add(chkCairoPdf_);
    chkCairoPdf_.setValue(haveCairoPdf && options_.getCairoPdf());
    if (haveCairoPdf)
        grid.setWidget(2, 1, cairoPdfPanel);
    grid.setWidget(3, 0, new HTML(" "));
    ThemedButton directoryButton = new ThemedButton("Directory...");
    directoryButton.setStylePrimaryName(styles.directoryButton());
    directoryButton.getElement().getStyle().setMarginLeft(-2, Unit.PX);
    grid.setWidget(4, 0, directoryButton);
    directoryButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            fileDialogs_.chooseFolder("Choose Directory", fileSystemContext_, FileSystemItem.createDir(directoryLabel_.getTitle().trim()), new ProgressOperationWithInput<FileSystemItem>() {

                public void execute(FileSystemItem input, ProgressIndicator indicator) {
                    if (input == null)
                        return;
                    indicator.onCompleted();
                    // update default
                    ExportPlotUtils.setDefaultSaveDirectory(input);
                    // set display
                    setDirectory(input);
                }
            });
        }
    });
    directoryLabel_ = new Label();
    setDirectory(defaultDirectory_);
    directoryLabel_.setStylePrimaryName(styles.savePdfDirectoryLabel());
    grid.setWidget(4, 1, directoryLabel_);
    Label fileNameLabel = new Label("File name:");
    fileNameLabel.setStylePrimaryName(styles.savePdfFileNameLabel());
    grid.setWidget(5, 0, fileNameLabel);
    fileNameTextBox_ = new TextBox();
    fileNameTextBox_.setText(defaultPlotName_);
    fileNameTextBox_.setStylePrimaryName(styles.savePdfFileNameTextBox());
    grid.setWidget(5, 1, fileNameTextBox_);
    // view after size
    viewAfterSaveCheckBox_ = new CheckBox("View plot after saving");
    viewAfterSaveCheckBox_.setStylePrimaryName(styles.savePdfViewAfterCheckbox());
    viewAfterSaveCheckBox_.setValue(options_.getViewAfterSave());
    grid.setWidget(6, 1, viewAfterSaveCheckBox_);
    // set default value
    if (options_.getPortrait())
        portraitRadioButton_.setValue(true);
    else
        landscapeRadioButton_.setValue(true);
    // return the widget
    return grid;
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Label(com.google.gwt.user.client.ui.Label) HTML(com.google.gwt.user.client.ui.HTML) RadioButton(com.google.gwt.user.client.ui.RadioButton) TextBox(com.google.gwt.user.client.ui.TextBox) ProgressOperationWithInput(org.rstudio.core.client.widget.ProgressOperationWithInput) ThemedButton(org.rstudio.core.client.widget.ThemedButton) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) FileSystemItem(org.rstudio.core.client.files.FileSystemItem) ExportPlotResources(org.rstudio.studio.client.workbench.exportplot.ExportPlotResources) CheckBox(com.google.gwt.user.client.ui.CheckBox) ProgressIndicator(org.rstudio.core.client.widget.ProgressIndicator) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 24 with ClickEvent

use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.

the class ShowContentDialog method addButtons.

protected void addButtons() {
    ThemedButton closeButton = new ThemedButton("Close", new ClickHandler() {

        public void onClick(ClickEvent event) {
            closeDialog();
        }
    });
    addOkButton(closeButton);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 25 with ClickEvent

use of com.google.gwt.event.dom.client.ClickEvent in project rstudio by rstudio.

the class MessageDialog method addButton.

public ThemedButton addButton(String label, final Operation operation, boolean isDefault, boolean isCancel) {
    ThemedButton button = new ThemedButton(label, new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (operation != null)
                operation.execute();
            closeDialog();
        }
    });
    addButton(button, isDefault, isCancel);
    return button;
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

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