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_;
}
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();
}
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_;
}
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%");
}
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);
}
Aggregations