Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant.

Prototype

public static SafeHtml fromSafeConstant(String s) 

Source Link

Document

Returns a SafeHtml constructed from a safe string, i.e., without escaping the string.

Usage

From source file:nl.sense_os.commonsense.login.client.forgotpassword.ForgotPasswordActivity.java

License:Open Source License

private void onForgotRequestSuccess() {
    successDialog = new DialogBox();
    successDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>Requested password reset</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("You will receive an email with a link to reset your password.");
    content.setPresenter(this);

    successDialog.setWidget(content);// w w  w.  ja  v a2  s.c  o m
    successDialog.center();
}

From source file:nl.sense_os.commonsense.login.client.forgotpassword.ForgotPasswordActivity.java

License:Open Source License

private void onUserNotFound() {
    errorDialog = new DialogBox();
    errorDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>User not found</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("We could not find a user in CommonSense with that username or email address.");
    content.setPresenter(this);

    errorDialog.setWidget(content);/* w ww  . j a v a2 s. co m*/
    errorDialog.center();
}

From source file:nl.sense_os.commonsense.login.client.login.LoginActivity.java

License:Open Source License

private void onAuthenticationFailure() {

    // enable view
    view.setBusy(false);/*from w  w w.jav  a 2  s.  c  om*/

    // show alert
    alertDialog = new DialogBox();
    alertDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>Login failed</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("Login failed! Invalid username or password.");
    content.setPresenter(this);

    alertDialog.setWidget(content);
    alertDialog.center();
    content.setFocus(true);
}

From source file:nl.sense_os.commonsense.login.client.login.LoginActivity.java

License:Open Source License

private void onLoginFailure(int code, Throwable error) {

    // enable view
    view.setBusy(false);/* ww  w . j  ava 2s . c  o  m*/

    // show alert
    alertDialog = new DialogBox();
    alertDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>Login failed</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("Login failed! Error: " + code + " (" + error.getMessage() + ")");
    content.setPresenter(this);

    alertDialog.setWidget(content);
    alertDialog.center();
}

From source file:nl.sense_os.commonsense.login.client.newpassword.NewPasswordActivity.java

License:Open Source License

private void onPasswordResetFailure(int code, Throwable error) {

    alertDialog = new DialogBox();
    alertDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>Request failed</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("Your password was not changed. Error: " + code + " (" + error.getMessage()
            + "). Please try to reset your password again.");
    content.setPresenter(this);

    alertDialog.setWidget(content);//from   w w  w .  j  av a 2 s.c om
    alertDialog.center();
}

From source file:nl.sense_os.commonsense.login.client.newpassword.NewPasswordActivity.java

License:Open Source License

private void onPasswordResetSuccess(String text) {

    alertDialog = new DialogBox();
    alertDialog.setHTML(SafeHtmlUtils.fromSafeConstant("<b>Password changed</b>"));

    AlertDialogContent content = new AlertDialogContent();
    content.setMessage("Your password was succesfully changed. You can now log in.");
    content.setPresenter(this);

    alertDialog.setWidget(content);// w ww.java  2 s.com
    alertDialog.center();
}

From source file:nz.org.winters.appspot.acrareporter.client.ui.MappingList.java

License:Apache License

private void initTableColumns(final SelectionModel<MappingFileInfo> selectionModel,
        ListHandler<MappingFileInfo> sortHandler2) {
    // selection check
    Column<MappingFileInfo, Boolean> checkColumn = new Column<MappingFileInfo, Boolean>(
            new CheckboxCell(true, false)) {
        @Override/* www. j a  va  2 s . c o m*/
        public Boolean getValue(MappingFileInfo object) {
            // Get the value from the selection model.
            return selectionModel.isSelected(object);
        }
    };
    dataGrid.addColumn(checkColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    dataGrid.setColumnWidth(checkColumn, 40, Unit.PX);

    // Date
    Column<MappingFileInfo, String> uploadDateColumn = new Column<MappingFileInfo, String>(new TextCell()) {
        @Override
        public String getValue(MappingFileInfo object) {
            if (object.uploadDate != null) {
                return object.uploadDate.toString();
            } else {
                return "Unknown Date";
            }
        }
    };
    uploadDateColumn.setSortable(true);
    sortHandler.setComparator(uploadDateColumn, new Comparator<MappingFileInfo>() {
        @Override
        public int compare(MappingFileInfo o1, MappingFileInfo o2) {
            if (o1.uploadDate != null && o2.uploadDate != null)
                return o1.uploadDate.compareTo(o2.uploadDate);
            else
                return 0;
        }
    });
    dataGrid.addColumn(uploadDateColumn, constants.mappingListGridDate());
    dataGrid.setColumnWidth(uploadDateColumn, 200, Unit.PX);

    Column<MappingFileInfo, String> versionColumn = new Column<MappingFileInfo, String>(new TextCell()) {
        @Override
        public String getValue(MappingFileInfo object) { // 2012-12-02T18:07:33.000-06:00
            return object.version;
        }
    };
    versionColumn.setSortable(true);
    sortHandler.setComparator(versionColumn, new Comparator<MappingFileInfo>() {
        @Override
        public int compare(MappingFileInfo o1, MappingFileInfo o2) {
            return o1.version.compareTo(o2.version);
        }
    });
    dataGrid.addColumn(versionColumn, constants.mappingListGridVersion());
    dataGrid.setColumnWidth(versionColumn, 100, Unit.PX);

}

From source file:org.activityinfo.ui.client.component.form.FormDialog.java

License:Open Source License

public void setDialogTitle(String h3, String h4) {
    String html = "<h3>" + h3 + "</h3><br/><h4>" + h4 + "</h4>";
    dialog.setDialogTitle(SafeHtmlUtils.fromSafeConstant(html).asString());
}

From source file:org.cloudcoder.app.client.view.BestScoreBarCell.java

License:Open Source License

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, E value, SafeHtmlBuilder sb) {
    if (value == null) {
        // Data not available, or student did not attempt this problem
        appendNoInfoBar(sb);//from   w  w w . j  a  v  a2s .c  o  m
        return;
    }

    // If we don't know the total number of test cases, don't display anything
    SubmissionReceipt receipt = value.getReceipt();
    if (receipt == null || receipt.getNumTestsAttempted() == 0) {
        appendNoInfoBar(sb);
        return;
    }

    int numTests = receipt.getNumTestsAttempted();
    int numPassed = receipt.getNumTestsPassed();

    StringBuilder buf = new StringBuilder();
    buf.append("<div class=\"cc-barOuter\"><div class=\"cc-barInner\" style=\"width: ");
    int pct = (numPassed * 10000) / (numTests * 100);
    buf.append(pct);
    buf.append("%\"></div></div>");

    String s = buf.toString();

    sb.append(SafeHtmlUtils.fromSafeConstant(s));
}

From source file:org.cloudcoder.app.client.view.BestScoreBarCell.java

License:Open Source License

private void appendNoInfoBar(SafeHtmlBuilder sb) {
    sb.append(SafeHtmlUtils.fromSafeConstant("<div class=\"cc-barNoInfo\"></div>"));
}