Search in sources :

Example 36 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class ContactPanelShort method onInitUI.

protected void onInitUI() {
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        labelIdx = 1;
        fieldIdx = 0;
    } else {
        labelIdx = 0;
        fieldIdx = 1;
    }
    nameTxt = new NpTextBox();
    nameTxt.setVisibleLength(60);
    nameTxt.setReadOnly(!canEditFullName());
    emailPick = new ListBox();
    final Grid infoPlainText = new Grid(2, 2);
    infoPlainText.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    infoPlainText.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
    body.add(infoPlainText);
    registerNewEmail = new Button(Util.C.buttonOpenRegisterNewEmail());
    registerNewEmail.setEnabled(false);
    registerNewEmail.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doRegisterNewEmail();
        }
    });
    final FlowPanel emailLine = new FlowPanel();
    emailLine.add(emailPick);
    if (canRegisterNewEmail()) {
        emailLine.add(registerNewEmail);
    }
    int row = 0;
    if (!Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME) && Gerrit.info().auth().siteHasUsernames()) {
        infoPlainText.resizeRows(infoPlainText.getRowCount() + 1);
        row(infoPlainText, row++, Util.C.userName(), new UsernameField());
    }
    if (!canEditFullName()) {
        FlowPanel nameLine = new FlowPanel();
        nameLine.add(nameTxt);
        if (Gerrit.info().auth().editFullNameUrl() != null) {
            Button edit = new Button(Util.C.linkEditFullName());
            edit.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    Window.open(Gerrit.info().auth().editFullNameUrl(), "_blank", null);
                }
            });
            nameLine.add(edit);
        }
        Button reload = new Button(Util.C.linkReloadContact());
        reload.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                Window.Location.replace(Gerrit.loginRedirect(PageLinks.SETTINGS_CONTACT));
            }
        });
        nameLine.add(reload);
        row(infoPlainText, row++, Util.C.contactFieldFullName(), nameLine);
    } else {
        row(infoPlainText, row++, Util.C.contactFieldFullName(), nameTxt);
    }
    row(infoPlainText, row++, Util.C.contactFieldEmail(), emailLine);
    infoPlainText.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    infoPlainText.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    infoPlainText.getCellFormatter().addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
    save = new Button(Util.C.buttonSaveChanges());
    save.setEnabled(false);
    save.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doSave();
        }
    });
    emailPick.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(final ChangeEvent event) {
            final int idx = emailPick.getSelectedIndex();
            final String v = 0 <= idx ? emailPick.getValue(idx) : null;
            if (Util.C.buttonOpenRegisterNewEmail().equals(v)) {
                for (int i = 0; i < emailPick.getItemCount(); i++) {
                    if (currentEmail.equals(emailPick.getValue(i))) {
                        emailPick.setSelectedIndex(i);
                        break;
                    }
                }
                doRegisterNewEmail();
            } else {
                save.setEnabled(true);
            }
        }
    });
    onEditEnabler = new OnEditEnabler(save, nameTxt);
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) NativeString(com.google.gerrit.client.rpc.NativeString) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) Button(com.google.gwt.user.client.ui.Button) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) OnEditEnabler(com.google.gerrit.client.ui.OnEditEnabler) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 37 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gerrit by GerritCodeReview.

the class AccountGroupInfoScreen method initGroupOptions.

private void initGroupOptions() {
    final VerticalPanel groupOptionsPanel = new VerticalPanel();
    final VerticalPanel vp = new VerticalPanel();
    vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
    vp.add(new SmallHeading(AdminConstants.I.headingGroupOptions()));
    visibleToAllCheckBox = new CheckBox(AdminConstants.I.isVisibleToAll());
    vp.add(visibleToAllCheckBox);
    groupOptionsPanel.add(vp);
    saveGroupOptions = new Button(AdminConstants.I.buttonSaveGroupOptions());
    saveGroupOptions.setEnabled(false);
    saveGroupOptions.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            GroupApi.setGroupOptions(getGroupUUID(), visibleToAllCheckBox.getValue(), new GerritCallback<VoidResult>() {

                @Override
                public void onSuccess(final VoidResult result) {
                    saveGroupOptions.setEnabled(false);
                }
            });
        }
    });
    groupOptionsPanel.add(saveGroupOptions);
    add(groupOptionsPanel);
    final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
    enabler.listenTo(visibleToAllCheckBox);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) GerritCallback(com.google.gerrit.client.rpc.GerritCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) VoidResult(com.google.gerrit.client.VoidResult) Button(com.google.gwt.user.client.ui.Button) CheckBox(com.google.gwt.user.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) OnEditEnabler(com.google.gerrit.client.ui.OnEditEnabler)

Example 38 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler 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 39 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler 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)

Example 40 with ClickHandler

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

the class MinimizedModuleTabLayoutPanel method setTabs.

public void setTabs(String[] tabNames) {
    HorizontalPanel horiz = (HorizontalPanel) getExtraWidget();
    horiz.clear();
    ThemeStyles styles = ThemeResources.INSTANCE.themeStyles();
    for (int i = 0; i < tabNames.length; i++) {
        String tabName = tabNames[i];
        if (tabName == null)
            continue;
        ModuleTabLayoutPanel.ModuleTab tab = new ModuleTabLayoutPanel.ModuleTab(tabName, styles, false);
        tab.addStyleName("gwt-TabLayoutPanelTab");
        final Integer thisIndex = i;
        tab.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                event.preventDefault();
                SelectionEvent.fire(MinimizedModuleTabLayoutPanel.this, thisIndex);
            }
        });
        horiz.add(tab);
    }
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ThemeStyles(org.rstudio.core.client.theme.res.ThemeStyles)

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