Search in sources :

Example 56 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project rstudio by rstudio.

the class NewProjectWizardPage method createWidget.

@Override
protected Widget createWidget() {
    flowPanel_ = new FlowPanel();
    flowPanel_.setWidth("100%");
    onAddWidgets();
    return flowPanel_;
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 57 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project rstudio by rstudio.

the class RmdTemplateOptionsWidget method addFormatOptions.

private void addFormatOptions(RmdTemplateFormat format) {
    if (format.getNotes().length() > 0 && allowFormatChange_) {
        labelFormatNotes_.setText(format.getNotes());
        labelFormatNotes_.setVisible(true);
    } else {
        labelFormatNotes_.setVisible(false);
    }
    optionWidgets_ = new ArrayList<RmdFormatOption>();
    JsArrayString options = format.getOptions();
    for (int i = 0; i < options.length(); i++) {
        RmdFormatOption optionWidget;
        RmdTemplateFormatOption option = findOption(format.getName(), options.get(i));
        if (option == null)
            continue;
        String initialValue = option.getDefaultValue();
        // check to see whether a value for this format and option were
        // specified in the front matter
        String frontMatterValue = getFrontMatterDefault(format.getName(), option.getName());
        if (frontMatterValue != null)
            initialValue = frontMatterValue;
        optionWidget = createWidgetForOption(option, initialValue);
        if (optionWidget == null)
            continue;
        optionWidget.asWidget().addStyleName(style.optionWidget());
        FlowPanel panel = null;
        String category = option.getCategory();
        if (tabs_.containsKey(category)) {
            panel = tabs_.get(category);
        } else {
            ScrollPanel scrollPanel = new ScrollPanel();
            panel = new FlowPanel();
            scrollPanel.add(panel);
            optionsTabs_.add(scrollPanel, new Label(category));
            tabs_.put(category, panel);
        }
        panel.add(optionWidget);
        optionWidgets_.add(optionWidget);
    }
    // we need to center the tabs and overlay them on the top edge of the
    // content; to do this, it is necessary to nuke a couple of the inline
    // styles used by the default GWT tab panel. 
    Element tabOuter = (Element) optionsTabs_.getElement().getChild(1);
    tabOuter.getStyle().setOverflow(Overflow.VISIBLE);
    Element tabInner = (Element) tabOuter.getFirstChild();
    tabInner.getStyle().clearWidth();
}
Also used : RmdTemplateFormatOption(org.rstudio.studio.client.rmarkdown.model.RmdTemplateFormatOption) Element(com.google.gwt.dom.client.Element) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Label(com.google.gwt.user.client.ui.Label) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 58 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project rstudio by rstudio.

the class PlotsPane method createMainWidget.

@Override
protected Widget createMainWidget() {
    panel_ = new LayoutPanel();
    panel_.setSize("100%", "100%");
    frame_ = new ImageFrame();
    frame_.setStyleName("rstudio-HelpFrame");
    frame_.setMarginWidth(0);
    frame_.setMarginHeight(0);
    frame_.setUrl("about:blank");
    frame_.setSize("100%", "100%");
    ElementIds.assignElementId(frame_.getElement(), ElementIds.PLOT_IMAGE_FRAME);
    panel_.add(frame_);
    panel_.setWidgetTopBottom(frame_, 0, Unit.PX, 0, Unit.PX);
    panel_.setWidgetLeftRight(frame_, 0, Unit.PX, 0, Unit.PX);
    // Stops mouse events from being routed to the iframe, which would
    // interfere with dragging the workbench pane sizer. also provide
    // a widget container where adornments can be added on top fo the
    // plots panel (e.g. manipulator button)
    plotsSurface_ = new FlowPanel();
    plotsSurface_.setSize("100%", "100%");
    panel_.add(plotsSurface_);
    panel_.setWidgetTopBottom(plotsSurface_, 0, Unit.PX, 0, Unit.PX);
    panel_.setWidgetLeftRight(plotsSurface_, 0, Unit.PX, 0, Unit.PX);
    // return the panel
    return panel_;
}
Also used : ImageFrame(org.rstudio.core.client.widget.ImageFrame) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) LayoutPanel(com.google.gwt.user.client.ui.LayoutPanel)

Example 59 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.

the class Screen method onInitUI.

protected void onInitUI() {
    final FlowPanel me = (FlowPanel) getWidget();
    me.add(header = new Grid(1, Cols.values().length));
    me.add(body);
    headerText = new InlineLabel();
    if (titleWidget == null) {
        titleWidget = headerText;
    }
    FlowPanel title = new FlowPanel();
    title.add(titleWidget);
    title.setStyleName(Gerrit.RESOURCES.css().screenHeader());
    header.setWidget(0, Cols.Title.ordinal(), title);
    header.setStyleName(Gerrit.RESOURCES.css().screenHeader());
    header.getCellFormatter().setHorizontalAlignment(0, Cols.FarEast.ordinal(), HasHorizontalAlignment.ALIGN_RIGHT);
    // force FarEast all the way to the right
    header.getCellFormatter().setWidth(0, Cols.FarEast.ordinal(), "100%");
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 60 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gerrit by GerritCodeReview.

the class ContactPanelShort method doRegisterNewEmail.

private void doRegisterNewEmail() {
    if (!canRegisterNewEmail()) {
        return;
    }
    final AutoCenterDialogBox box = new AutoCenterDialogBox(true, true);
    final VerticalPanel body = new VerticalPanel();
    final NpTextBox inEmail = new NpTextBox();
    inEmail.setVisibleLength(60);
    final Button register = new Button(Util.C.buttonSendRegisterNewEmail());
    final Button cancel = new Button(Util.C.buttonCancel());
    final FormPanel form = new FormPanel();
    form.addSubmitHandler(new FormPanel.SubmitHandler() {

        @Override
        public void onSubmit(final SubmitEvent event) {
            event.cancel();
            final String addr = inEmail.getText().trim();
            if (!addr.contains("@")) {
                new ErrorDialog(Util.C.invalidUserEmail()).center();
                return;
            }
            inEmail.setEnabled(false);
            register.setEnabled(false);
            AccountApi.registerEmail("self", addr, new GerritCallback<EmailInfo>() {

                @Override
                public void onSuccess(EmailInfo result) {
                    box.hide();
                    if (Gerrit.info().auth().isDev()) {
                        currentEmail = addr;
                        if (emailPick.getItemCount() == 0) {
                            AccountInfo me = Gerrit.getUserAccount();
                            me.email(addr);
                            onSaveSuccess(me);
                        } else {
                            save.setEnabled(true);
                        }
                        updateEmailList();
                    }
                }

                @Override
                public void onFailure(final Throwable caught) {
                    inEmail.setEnabled(true);
                    register.setEnabled(true);
                    if (caught.getMessage().startsWith(EmailException.MESSAGE)) {
                        final ErrorDialog d = new ErrorDialog(caught.getMessage().substring(EmailException.MESSAGE.length()));
                        d.setText(Util.C.errorDialogTitleRegisterNewEmail());
                        d.center();
                    } else {
                        super.onFailure(caught);
                    }
                }
            });
        }
    });
    form.setWidget(body);
    register.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            form.submit();
        }
    });
    cancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            box.hide();
        }
    });
    final FlowPanel buttons = new FlowPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().patchSetActions());
    buttons.add(register);
    buttons.add(cancel);
    if (!Gerrit.info().auth().isDev()) {
        body.add(new HTML(Util.C.descRegisterNewEmail()));
    }
    body.add(inEmail);
    body.add(buttons);
    box.setText(Util.C.titleRegisterNewEmail());
    box.setWidget(form);
    box.center();
    inEmail.setFocus(true);
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ErrorDialog(com.google.gerrit.client.ErrorDialog) HTML(com.google.gwt.user.client.ui.HTML) NativeString(com.google.gerrit.client.rpc.NativeString) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox) SubmitEvent(com.google.gwt.user.client.ui.FormPanel.SubmitEvent) GerritCallback(com.google.gerrit.client.rpc.GerritCallback) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) AutoCenterDialogBox(com.google.gwtexpui.user.client.AutoCenterDialogBox) FormPanel(com.google.gwt.user.client.ui.FormPanel) Button(com.google.gwt.user.client.ui.Button) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)81 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)18 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 Button (com.google.gwt.user.client.ui.Button)14 Label (com.google.gwt.user.client.ui.Label)12 Grid (com.google.gwt.user.client.ui.Grid)10 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)7 SmallHeading (com.google.gerrit.client.ui.SmallHeading)6 Element (com.google.gwt.dom.client.Element)6 CheckBox (com.google.gwt.user.client.ui.CheckBox)6 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)6 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)6 Widget (com.google.gwt.user.client.ui.Widget)6 Test (org.junit.Test)6 ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)5 HTML (com.google.gwt.user.client.ui.HTML)5 Image (com.google.gwt.user.client.ui.Image)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 List (java.util.List)4