use of com.google.gwt.user.client.ui.FormPanel in project gerrit by GerritCodeReview.
the class RegisterScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.welcomeToGerritCodeReview());
final FlowPanel formBody = new FlowPanel();
final FlowPanel contactGroup = new FlowPanel();
contactGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
contactGroup.add(new SmallHeading(Util.C.welcomeReviewContact()));
final HTML whereFrom = new HTML(Util.C.welcomeContactFrom());
whereFrom.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
contactGroup.add(whereFrom);
contactGroup.add(new ContactPanelShort() {
@Override
protected void display(AccountInfo account) {
super.display(account);
if ("".equals(nameTxt.getText())) {
// No name? Encourage the user to provide us something.
//
nameTxt.setFocus(true);
save.setEnabled(true);
}
}
});
formBody.add(contactGroup);
if (Gerrit.getUserAccount().username() == null && Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME)) {
final FlowPanel fp = new FlowPanel();
fp.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
fp.add(new SmallHeading(Util.C.welcomeUsernameHeading()));
final Grid userInfo = new Grid(1, 2);
final CellFormatter fmt = userInfo.getCellFormatter();
userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
fp.add(userInfo);
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().bottomheader());
UsernameField field = new UsernameField();
if (LocaleInfo.getCurrentLocale().isRTL()) {
userInfo.setText(0, 1, Util.C.userName());
userInfo.setWidget(0, 0, field);
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().header());
} else {
userInfo.setText(0, 0, Util.C.userName());
userInfo.setWidget(0, 1, field);
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
}
formBody.add(fp);
}
if (Gerrit.info().hasSshd()) {
final FlowPanel sshKeyGroup = new FlowPanel();
sshKeyGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
sshKeyGroup.add(new SmallHeading(Util.C.welcomeSshKeyHeading()));
final HTML whySshKey = new HTML(Util.C.welcomeSshKeyText());
whySshKey.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
sshKeyGroup.add(whySshKey);
sshKeyGroup.add(new SshPanel() {
{
setKeyTableVisible(false);
}
});
formBody.add(sshKeyGroup);
}
final FlowPanel choices = new FlowPanel();
choices.setStyleName(Gerrit.RESOURCES.css().registerScreenNextLinks());
if (Gerrit.info().auth().useContributorAgreements()) {
final FlowPanel agreementGroup = new FlowPanel();
agreementGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
agreementGroup.add(new SmallHeading(Util.C.welcomeAgreementHeading()));
final HTML whyAgreement = new HTML(Util.C.welcomeAgreementText());
whyAgreement.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
agreementGroup.add(whyAgreement);
choices.add(new InlineHyperlink(Util.C.newAgreement(), PageLinks.SETTINGS_NEW_AGREEMENT));
choices.add(new InlineHyperlink(Util.C.welcomeAgreementLater(), nextToken));
formBody.add(agreementGroup);
} else {
choices.add(new InlineHyperlink(Util.C.welcomeContinue(), nextToken));
}
formBody.add(choices);
final FormPanel form = new FormPanel();
form.add(formBody);
add(form);
}
use of com.google.gwt.user.client.ui.FormPanel in project rstudio by rstudio.
the class RemoteServerAuth method safeCleanupPreviousUpdateCredentials.
private void safeCleanupPreviousUpdateCredentials() {
try {
for (int i = 0; i < previousUpdateCredentialsForms_.size(); i++) {
FormPanel formPanel = previousUpdateCredentialsForms_.get(i);
RootPanel.get().remove(formPanel);
}
previousUpdateCredentialsForms_.clear();
} catch (Throwable e) {
}
}
use of com.google.gwt.user.client.ui.FormPanel in project rstudio by rstudio.
the class RemoteServerAuth method updateCredentials.
public void updateCredentials(final ServerRequestCallback<Integer> requestCallback) {
// safely cleanup any previously active update credentials forms
safeCleanupPreviousUpdateCredentials();
// create a hidden form panel to submit the update credentials to
// (we do this so GWT manages the trickiness associated with
// managing and reading the contents of a hidden iframe)
final FormPanel updateCredentialsForm = new FormPanel();
updateCredentialsForm.setMethod(FormPanel.METHOD_GET);
updateCredentialsForm.setEncoding(FormPanel.ENCODING_URLENCODED);
// form url
String url = remoteServer_.getApplicationURL("auth-update-credentials");
updateCredentialsForm.setAction(url);
// request log entry (fake up a json rpc method call to conform
// to the data format expected by RequestLog
String requestId = Integer.toString(Random.nextInt());
String requestData = createRequestData();
final RequestLogEntry logEntry = RequestLog.log(requestId, requestData);
// form submit complete handler
updateCredentialsForm.addSubmitCompleteHandler(new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
// parse the results
String results = event.getResults();
RpcResponse response = RpcResponse.parse(event.getResults());
if (response != null) {
logEntry.logResponse(ResponseType.Normal, results);
// check for error
RpcError rpcError = response.getError();
if (rpcError != null) {
if (rpcError.getCode() == RpcError.METHOD_NOT_FOUND) {
requestCallback.onResponseReceived(new Integer(CREDENTIALS_UPDATE_UNSUPPORTED));
} else {
requestCallback.onError(new RemoteServerError(rpcError));
}
} else // must be a valid response
{
Bool authenticated = response.getResult();
if (authenticated.getValue()) {
requestCallback.onResponseReceived(new Integer(CREDENTIALS_UPDATE_SUCCESS));
} else {
requestCallback.onResponseReceived(new Integer(CREDENTIALS_UPDATE_FAILURE));
}
}
} else // error parsing results
{
logEntry.logResponse(ResponseType.Error, results);
// form message
String msg = "Error parsing results: " + (results != null ? results : "(null)");
// we don't expect this so debug log to flag our attention
Debug.log("UPDATE CREDENTIALS: " + msg);
// return the error
RpcError rpcError = RpcError.create(RpcError.PARSE_ERROR, msg);
requestCallback.onError(new RemoteServerError(rpcError));
}
// remove the hidden form (from both last-ditch list and DOM)
previousUpdateCredentialsForms_.remove(updateCredentialsForm);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
RootPanel.get().remove(updateCredentialsForm);
}
});
}
});
// add the (hidden) form panel to the document and last ditch list
RootPanel.get().add(updateCredentialsForm, -1000, -1000);
previousUpdateCredentialsForms_.add(updateCredentialsForm);
// submit the form
updateCredentialsForm.submit();
}
use of com.google.gwt.user.client.ui.FormPanel in project data-access by pentaho.
the class GwtDatasourceEditorEntryPoint method showAnalysisImportDialog.
public void showAnalysisImportDialog(final DialogListener listener) {
final DialogListener<AnalysisImportDialogModel> importDialoglistener = new DialogListener<AnalysisImportDialogModel>() {
public void onDialogCancel() {
final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
final FormPanel analysisDataFormPanel = controller.getFormPanel();
controller.removeHiddenPanels();
controller.buildAndSetParameters();
analysisDataFormPanel.removeFromParent();
RootPanel.get().add(analysisDataFormPanel);
}
public void onDialogAccept(final AnalysisImportDialogModel importDialogModel) {
final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
final FormPanel analysisDataFormPanel = controller.getFormPanel();
controller.removeHiddenPanels();
controller.buildAndSetParameters();
analysisDataFormPanel.removeFromParent();
RootPanel.get().add(analysisDataFormPanel);
analysisDataFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {
@Override
public void onSubmitComplete(SubmitCompleteEvent event) {
String results = event.getResults();
String message = controller.convertToNLSMessage(results, controller.getFileName());
if (!SUCCESS_3.equals(results)) {
if (OVERWRITE_8.equals(results) || OVERWRITE__CATALOG_7.equals(results)) {
overwriteFileDialog(analysisDataFormPanel, message, controller);
} else {
listener.onDialogError(message);
}
} else {
analysisDataFormPanel.removeFromParent();
listener.onDialogAccept(null);
}
}
});
analysisDataFormPanel.submit();
}
public void onDialogReady() {
}
@Override
public void onDialogError(String errorMessage) {
listener.onDialogError(errorMessage);
}
};
final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {
public void asyncConstructorDone(GwtImportDialog dialog) {
dialog.showAnalysisImportDialog(importDialoglistener);
}
};
if (importDialog == null) {
importDialog = new GwtImportDialog(constructorListener);
} else {
importDialog.showAnalysisImportDialog(importDialoglistener);
}
}
use of com.google.gwt.user.client.ui.FormPanel in project data-access by pentaho.
the class AnalysisImportDialogController method createWorkingForm.
private void createWorkingForm() {
if (formPanel == null) {
formPanel = new FormPanel();
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setAction(MONDRIAN_POSTANALYSIS_URL);
formPanel.getElement().getStyle().setProperty("position", "absolute");
formPanel.getElement().getStyle().setProperty("visibility", "hidden");
formPanel.getElement().getStyle().setProperty("overflow", "hidden");
formPanel.getElement().getStyle().setProperty("clip", "rect(0px,0px,0px,0px)");
mainFormPanel = new FlowPanel();
formPanel.add(mainFormPanel);
analysisFileUpload = new FileUpload();
analysisFileUpload.setName("uploadAnalysis");
analysisFileUpload.getElement().setId("analysisFileUpload");
analysisFileUpload.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
schemaNameLabel.setValue(((FileUpload) event.getSource()).getFilename());
importDialogModel.setUploadedFile(((FileUpload) event.getSource()).getFilename());
acceptButton.setDisabled(!isValid());
}
});
mainFormPanel.add(analysisFileUpload);
VerticalPanel vp = (VerticalPanel) hiddenArea.getManagedObject();
vp.add(formPanel);
// addSubmitHandler(); moved to GwtDataSourceEditorEntryPoint
}
}
Aggregations