use of com.google.gwt.user.client.ui.HTML 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);
}
use of com.google.gwt.user.client.ui.HTML in project gerrit by GerritCodeReview.
the class NewAgreementScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.newAgreement());
final FlowPanel formBody = new FlowPanel();
radios = new VerticalPanel();
formBody.add(radios);
agreementGroup = new FlowPanel();
agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
agreementHtml = new HTML();
agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
agreementGroup.add(agreementHtml);
formBody.add(agreementGroup);
finalGroup = new VerticalPanel();
finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
final FlowPanel fp = new FlowPanel();
yesIAgreeBox = new NpTextBox();
yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
fp.add(yesIAgreeBox);
fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
finalGroup.add(fp);
submit = new Button(Util.C.buttonSubmitNewAgreement());
submit.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doSign();
}
});
finalGroup.add(submit);
formBody.add(finalGroup);
new OnEditEnabler(submit, yesIAgreeBox);
final FormPanel form = new FormPanel();
form.add(formBody);
add(form);
}
use of com.google.gwt.user.client.ui.HTML in project cuba by cuba-platform.
the class CubaTwinColSelectWidget method enableAddAllBtn.
protected void enableAddAllBtn() {
HTML br1 = new HTML("<span/>");
br1.setStyleName(CLASSNAME + "-deco");
buttons.add(br1);
buttons.insert(br1, buttons.getWidgetIndex(add) + 1);
addAll = new VButton();
addAll.setText(">>");
addAll.addStyleName("addAll");
addAllHandlerRegistration = addAll.addClickHandler(this);
buttons.insert(addAll, buttons.getWidgetIndex(br1) + 1);
HTML br2 = new HTML("<span/>");
br2.setStyleName(CLASSNAME + "-deco");
buttons.add(br2);
removeAll = new VButton();
removeAll.setText("<<");
removeAll.addStyleName("removeAll");
removeAllHandlerRegistration = removeAll.addClickHandler(this);
buttons.add(removeAll);
}
use of com.google.gwt.user.client.ui.HTML in project drools-wb by kiegroup.
the class VerifyFieldConstraintEditor method showTypeChoice.
private void showTypeChoice(Widget w, final VerifyField con) {
final FormStylePopup form = new FormStylePopup(TestScenarioAltedImages.INSTANCE.Wizard(), TestScenarioConstants.INSTANCE.FieldValue());
Button lit = new Button(TestScenarioConstants.INSTANCE.LiteralValue());
lit.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
con.setNature(FieldData.TYPE_LITERAL);
doTypeChosen(form);
}
});
form.addAttribute(TestScenarioConstants.INSTANCE.LiteralValue() + ":", widgets(lit, new InfoPopup(TestScenarioConstants.INSTANCE.LiteralValue(), TestScenarioConstants.INSTANCE.LiteralValTip())));
form.addRow(new HTML("<hr/>"));
form.addRow(new SmallLabel(TestScenarioConstants.INSTANCE.AdvancedOptions()));
// If we are here, then there must be a bound variable compatible with
// me
Button variable = new Button(TestScenarioConstants.INSTANCE.BoundVariable());
variable.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
con.setNature(FieldData.TYPE_VARIABLE);
doTypeChosen(form);
}
});
form.addAttribute(TestScenarioConstants.INSTANCE.AVariable(), widgets(variable, new InfoPopup(TestScenarioConstants.INSTANCE.ABoundVariable(), TestScenarioConstants.INSTANCE.BoundVariableTip())));
form.show();
}
use of com.google.gwt.user.client.ui.HTML in project pentaho-platform by pentaho.
the class DeleteFolderCommand method performOperation.
protected void performOperation(boolean feedback) {
final SolutionFolderActionEvent event = new SolutionFolderActionEvent();
event.setAction(this.getClass().getName());
final String filesList = repositoryFile.getId();
final String folderName = repositoryFile.getTitle() == null ? repositoryFile.getName() : repositoryFile.getTitle();
final HTML messageTextBox = new HTML(Messages.getString("moveToTrashQuestionFolder", escapeHtmlEntities(folderName)));
final PromptDialogBox folderDeleteWarningDialogBox = new PromptDialogBox(Messages.getString("moveToTrash"), Messages.getString("yesMoveToTrash"), Messages.getString("no"), true, true);
folderDeleteWarningDialogBox.setContent(messageTextBox);
final IDialogCallback callback = new IDialogCallback() {
public void cancelPressed() {
folderDeleteWarningDialogBox.hide();
}
public void okPressed() {
// $NON-NLS-1$
String deleteFilesURL = contextURL + "api/repo/files/delete";
RequestBuilder deleteFilesRequestBuilder = new RequestBuilder(RequestBuilder.PUT, deleteFilesURL);
deleteFilesRequestBuilder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
// $NON-NLS-1$//$NON-NLS-2$
deleteFilesRequestBuilder.setHeader("Content-Type", "text/plain");
try {
deleteFilesRequestBuilder.sendRequest(filesList, new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
@Override
public void onResponseReceived(Request request, Response response) {
if (response.getStatusCode() == 200) {
new RefreshRepositoryCommand().execute(false);
event.setMessage("Success");
FileChooserDialog.setIsDirty(Boolean.TRUE);
setBrowseRepoDirty(Boolean.TRUE);
EventBusUtil.EVENT_BUS.fireEvent(event);
} else {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
});
} catch (RequestException e) {
MessageDialogBox dialogBox = new // $NON-NLS-1$ //$NON-NLS-2$
MessageDialogBox(// $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("error"), // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("couldNotDeleteFolder"), false, false, true);
dialogBox.center();
event.setMessage(Messages.getString("couldNotDeleteFolder"));
EventBusUtil.EVENT_BUS.fireEvent(event);
}
}
};
folderDeleteWarningDialogBox.setCallback(callback);
folderDeleteWarningDialogBox.center();
}
Aggregations