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

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

Introduction

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

Prototype

public static SafeHtml fromString(String s) 

Source Link

Document

Returns a SafeHtml containing the escaped string.

Usage

From source file:com.gsr.myschool.back.client.web.application.dossierdetails.InscriptionDetailView.java

License:Apache License

@Override
public void setCandidat(CandidatProxy candidat) {
    candidatPanel.clear();/* w ww .j  a v  a 2s. c  om*/

    SafeHtml safeFirstName = SafeHtmlUtils.fromString(Objects.firstNonNull(candidat.getFirstname(), ""));
    SafeHtml safeLastName = SafeHtmlUtils.fromString(Objects.firstNonNull(candidat.getLastname(), ""));
    SafeHtml safeBirthLocation = SafeHtmlUtils
            .fromString(Objects.firstNonNull(candidat.getBirthLocation(), ""));

    SafeHtml safeBirthDate;
    if (candidat.getBirthDate() == null) {
        safeBirthDate = SafeHtmlUtils.fromString("");
    } else {
        safeBirthDate = SafeHtmlUtils.fromString(dateFormat.format(candidat.getBirthDate()));
    }

    candidatPanel.add(rowLabelValueFactory.createValueLabel("Nom : ", safeLastName));
    candidatPanel.add(rowLabelValueFactory.createValueLabel("Prnom : ", safeFirstName));
    candidatPanel.add(rowLabelValueFactory.createValueLabel("Date de naissance : ", safeBirthDate));
    candidatPanel.add(rowLabelValueFactory.createValueLabel("Lieu de naissance : ", safeBirthLocation));

    if (candidat.getNationality() != null) {
        SafeHtml safeNationality = SafeHtmlUtils.fromString(candidat.getNationality().getLabel());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("Nationnalit : ", safeNationality));
    }

    if (!Strings.isNullOrEmpty(candidat.getPhone())) {
        SafeHtml safeTel = SafeHtmlUtils.fromString(candidat.getPhone());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("Tlphone : ", safeTel));
    }

    if (!Strings.isNullOrEmpty(candidat.getCin())) {
        SafeHtml safeCin = SafeHtmlUtils.fromString(candidat.getCin());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("CIN : ", safeCin));
    }

    if (!Strings.isNullOrEmpty(candidat.getCne())) {
        SafeHtml safeCne = SafeHtmlUtils.fromString(candidat.getCne());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("CNE/INE : ", safeCne));
    }

    if (!Strings.isNullOrEmpty(candidat.getEmail())) {
        SafeHtml safeEmail = SafeHtmlUtils.fromString(candidat.getEmail());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("Email : ", safeEmail));
    }

    if (candidat.getBacSerie() != null) {
        SafeHtml safeBacSerie = SafeHtmlUtils.fromString(candidat.getBacSerie().getLabel());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("Srie du baccalaurat : ", safeBacSerie));
    }

    if (candidat.getBacYear() != null) {
        SafeHtml safeBacYear = SafeHtmlUtils.fromString(candidat.getBacYear().getLabel());
        candidatPanel.add(rowLabelValueFactory.createValueLabel("Anne du baccalaurat : ", safeBacYear));
    }
}

From source file:com.gsr.myschool.back.client.web.application.dossierdetails.InscriptionDetailView.java

License:Apache License

@Override
public void setScolariteActuelle(ScolariteActuelleProxy scolariteActuelle) {
    scolariteActuellePanel.clear();// www  .j a  v a 2  s .  co  m

    if (scolariteActuelle != null) {
        if (scolariteActuelle.getEtablissement() != null) {
            SafeHtml safeEtablissement = SafeHtmlUtils
                    .fromString(scolariteActuelle.getEtablissement().getNom());
            scolariteActuellePanel
                    .add(rowLabelValueFactory.createValueLabel("Etablissement actuel : ", safeEtablissement));
        }

        if (scolariteActuelle.getEtablissement() != null) {
            SafeHtml safeType = SafeHtmlUtils
                    .fromString(scolariteActuelle.getEtablissement().getType().toString());
            scolariteActuellePanel
                    .add(rowLabelValueFactory.createValueLabel("Type etablissement actuel : ", safeType));
        }

        if (scolariteActuelle.getFiliere() != null) {
            SafeHtml safeFiliere = SafeHtmlUtils.fromString(scolariteActuelle.getFiliere().getNom());
            scolariteActuellePanel
                    .add(rowLabelValueFactory.createValueLabel("Formation actuelle : ", safeFiliere));
        }

        if (scolariteActuelle.getNiveauEtude() != null) {
            SafeHtml safeNiveauEtude = SafeHtmlUtils.fromString(scolariteActuelle.getNiveauEtude().getNom());
            scolariteActuellePanel
                    .add(rowLabelValueFactory.createValueLabel("Niveau actuel : ", safeNiveauEtude));
        }
    }
}

From source file:com.gsr.myschool.back.client.web.application.dossierdetails.InscriptionDetailView.java

License:Apache License

private void setupParentType(HTMLPanel container, InfoParentProxy infoParent) {
    container.clear();/*from   w w w  .  ja v  a 2s . c om*/

    SafeHtml safeNom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getNom(), ""));
    SafeHtml safePrenom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getPrenom(), ""));
    SafeHtml safeTelDom = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getTelDom(), ""));
    SafeHtml safeEmail = SafeHtmlUtils.fromString(Objects.firstNonNull(infoParent.getEmail(), ""));
    SafeHtml safeBirthLocation = SafeHtmlUtils
            .fromString(Objects.firstNonNull(infoParent.getBirthLocation(), ""));

    SafeHtml safeBirthDate;
    if (infoParent.getBirthDate() == null) {
        safeBirthDate = SafeHtmlUtils.fromString("");
    } else {
        safeBirthDate = SafeHtmlUtils.fromString(dateFormat.format(infoParent.getBirthDate()));
    }

    container.add(rowLabelValueFactory.createHeader(infoParent.getParentType().toString()));
    container.add(rowLabelValueFactory.createValueLabel("Nom : ", safeNom));
    container.add(rowLabelValueFactory.createValueLabel("Prnom : ", safePrenom));
    container.add(rowLabelValueFactory.createValueLabel("Date de naissance : ", safeBirthDate));
    container.add(rowLabelValueFactory.createValueLabel("Lieu de naissance : ", safeBirthLocation));

    if (infoParent.getNationality() != null) {
        SafeHtml safeNationality = SafeHtmlUtils.fromString(infoParent.getNationality().getLabel());
        container.add(rowLabelValueFactory.createValueLabel("Nationnalit : ", safeNationality));
    }

    if (infoParent.getParentType() == ParentType.TUTEUR) {
        SafeHtml safeCivilite = SafeHtmlUtils.fromString(infoParent.getCivilite().toString());
        container.add(rowLabelValueFactory.createValueLabel("Civilit : ", safeCivilite));

        if (!Strings.isNullOrEmpty(infoParent.getLientParente())) {
            SafeHtml safelienParent = SafeHtmlUtils.fromString(infoParent.getLientParente());
            container.add(rowLabelValueFactory.createValueLabel("Lien de parent : ", safelienParent));
        }
    }

    container.add(rowLabelValueFactory.createValueLabel("Email : ", safeEmail));
    container.add(rowLabelValueFactory.createValueLabel("Tlphone domicile : ", safeTelDom));

    if (!Strings.isNullOrEmpty(infoParent.getTelGsm())) {
        SafeHtml safeTelGsm = SafeHtmlUtils.fromString(infoParent.getTelGsm());
        container.add(rowLabelValueFactory.createValueLabel("Tlphone GSM : ", safeTelGsm));
    }

    if (!Strings.isNullOrEmpty(infoParent.getTelBureau())) {
        SafeHtml safeTelBureau = SafeHtmlUtils.fromString(infoParent.getTelBureau());
        container.add(rowLabelValueFactory.createValueLabel("Tlphone Bureau : ", safeTelBureau));
    }

    if (!Strings.isNullOrEmpty(infoParent.getFonction())) {
        SafeHtml safeFonction = SafeHtmlUtils.fromString(infoParent.getFonction());
        container.add(rowLabelValueFactory.createValueLabel("Fonction : ", safeFonction));
    }

    if (!Strings.isNullOrEmpty(infoParent.getInstitution())) {
        SafeHtml safeInstitution = SafeHtmlUtils.fromString(infoParent.getInstitution());
        container.add(rowLabelValueFactory.createValueLabel("Institution : ", safeInstitution));
    }

    if (!Strings.isNullOrEmpty(infoParent.getAddress())) {
        SafeHtml safeAdresse = SafeHtmlUtils.fromString(infoParent.getAddress());
        container.add(rowLabelValueFactory.createValueLabel("Adresse : ", safeAdresse));
    }

    if (infoParent.getParentGsr()) {
        SafeHtml safe = SafeHtmlUtils.fromString("oui");
        container.add(rowLabelValueFactory.createValueLabel("Ancien du GSR : ", safe));
    }

    if (!Strings.isNullOrEmpty(infoParent.getPromotionGsr())) {
        SafeHtml safe = SafeHtmlUtils.fromString(infoParent.getPromotionGsr().toString());
        container.add(rowLabelValueFactory.createValueLabel("Promotion : ", safe));
    }

    if (!Strings.isNullOrEmpty(infoParent.getFormationGsr())) {
        SafeHtml safe = SafeHtmlUtils.fromString(infoParent.getFormationGsr());
        container.add(rowLabelValueFactory.createValueLabel("Formation : ", safe));
    }
}

From source file:com.gwt2go.dev.client.ui.widget.celltree.CellTreeNodeSafeHtmlRenderer.java

License:Apache License

@Override
public SafeHtml render(GotoPlacesModel object) {
    return (object == null) ? SafeHtmlUtils.EMPTY_SAFE_HTML : SafeHtmlUtils.fromString(object.getName());
}

From source file:com.gwt2go.dev.client.ui.widget.celltree.CellTreeNodeSafeHtmlRenderer.java

License:Apache License

@Override
public void render(GotoPlacesModel object, SafeHtmlBuilder builder) {
    builder.append(SafeHtmlUtils.fromString(object.getName()));
}

From source file:com.jitlogic.zico.client.views.traces.MethodDetailCell.java

License:Open Source License

@Override
public void render(Context context, TraceRecordInfo tr, SafeHtmlBuilder sb) {
    if (tr.getAttributes() != null) {
        sb.appendHtmlConstant("<table border=\"0\" cellspacing=\"2\"><tbody>");
        for (KeyValuePair e : tr.getAttributes()) {
            sb.appendHtmlConstant("<tr><td align=\"right\" class=\"" + methodAttributeKey + "\"><b>");
            sb.append(SafeHtmlUtils.fromString(e.getKey()));
            sb.appendHtmlConstant("</b></td><td><div class=\"" + methodAttributeVal + "\">");
            sb.append(SafeHtmlUtils.fromString(e.getValue() != null ? e.getValue().toString() : ""));
            sb.appendHtmlConstant("</div></td></tr>");
        }/*from ww  w.  java  2s .c  o  m*/
        sb.appendHtmlConstant("</tbody></table>");
    }
    if (tr.getExceptionInfo() != null) {
        SymbolicExceptionInfo e = tr.getExceptionInfo();
        sb.appendHtmlConstant("<div class=\"" + methodErrorClassName + "\">");
        sb.append(SafeHtmlUtils.fromString("Caught: " + e.getExClass()));
        sb.appendHtmlConstant("</div>");
        sb.appendHtmlConstant("<div class=\"" + methodErrorMessage + "\">");
        sb.append(SafeHtmlUtils.fromString("" + e.getMessage()));
        sb.appendHtmlConstant("</b></div>");
        int i = 0;
        for (String s : e.getStackTrace()) {
            sb.appendHtmlConstant("<div class=\"" + methodErrorStack + "\">");
            sb.append(SafeHtmlUtils.fromString("" + s));
            sb.appendHtmlConstant("</div>");
            i++;
            if (i > 5) {
                sb.appendHtmlConstant("<div class=\"" + methodErrorMessage + "\">");
                sb.append(
                        SafeHtmlUtils.fromString("...  (double click on this method to see full stack trace)"));
                sb.appendHtmlConstant("</div>");
                break;
            }
        }
    }
}

From source file:com.jitlogic.zico.client.views.traces.TraceDetailCell.java

License:Open Source License

@Override
public void render(Context context, TraceInfo ti, SafeHtmlBuilder sb) {
    if (ti.getAttributes() != null) {
        sb.appendHtmlConstant("<table border=\"0\" cellspacing=\"2\"><tbody>");
        for (KeyValuePair e : ti.getAttributes()) {
            sb.appendHtmlConstant("<tr><td align=\"right\" style=\"color:blue; font-size: small;\"><b>");
            sb.append(SafeHtmlUtils.fromString(e.getKey()));
            sb.appendHtmlConstant(/*from  w w  w. j a v  a2s  . c o  m*/
                    "</b></td><td><div style=\"text-wrap: unrestricted; white-space: pre; word-wrap: break-word; font-size: small;\">");
            sb.append(SafeHtmlUtils.fromString(e.getValue() != null ? e.getValue().toString() : ""));
            sb.appendHtmlConstant("</div></td></tr>");
        }
        sb.appendHtmlConstant("</tbody></table>");
    }
    if (ti.getExceptionInfo() != null) {
        SymbolicExceptionInfo e = ti.getExceptionInfo();
        sb.appendHtmlConstant("<div><span style=\"color: red;\">");
        sb.append(SafeHtmlUtils.fromString("Caught: " + e.getExClass()));
        sb.appendHtmlConstant("</span></div><div><b>");
        sb.append(SafeHtmlUtils.fromString("" + e.getMessage()));
        sb.appendHtmlConstant("</b></div>");
        int i = 0;
        for (String s : e.getStackTrace()) {
            sb.appendHtmlConstant("<div>");
            sb.append(SafeHtmlUtils.fromString("" + s));
            sb.appendHtmlConstant("</div>");
            i++;
            if (i > 5) {
                sb.appendHtmlConstant("<div>");
                sb.append(SafeHtmlUtils
                        .fromString("...      (open trace attributes window to see full stack trace)"));
                sb.appendHtmlConstant("</div>");
                break;
            }

        }
    }
}

From source file:com.jitlogic.zico.client.widgets.NanoTimeRenderingCell.java

License:Open Source License

@Override
public void render(Context context, Long time, SafeHtmlBuilder sb) {
    sb.appendHtmlConstant("<span>");
    sb.append(SafeHtmlUtils.fromString(ClientUtil.formatDuration(time)));
    sb.appendHtmlConstant("</span>");
}

From source file:com.msco.mil.client.com.sencha.gxt.desktopapp.client.spreadsheet.Worksheet.java

License:sencha.com license

public void renameColumns(int newCellIndex) {
    int newColumnIndex = newCellIndex - 1;
    String oldColumnName = getColumnProvider().getColumn(newCellIndex).getHeader().asString();
    int oldColumnIndex = SpreadsheetUtilities.getColumnIndex(oldColumnName);
    int rowCount = getRowCount();
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        Row row = getListStore().get(rowIndex);
        adjustCellReferences(Operation.SAVE, Location.COLUMN, oldColumnIndex, row);
    }/* ww  w.  ja va  2s .c  o m*/
    adjustCellReferences(Operation.DELETE, Location.COLUMN, oldColumnIndex);
    adjustCellReferences(Operation.INSERT, Location.COLUMN, newColumnIndex);
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        Row row = getListStore().get(rowIndex);
        adjustCellReferences(Operation.RESTORE, Location.COLUMN, newColumnIndex, row);
    }
    int columnCount = getColumnCount();
    for (int columnIndex = Math.min(oldColumnIndex, newColumnIndex); columnIndex < columnCount; columnIndex++) {
        String columnName = SpreadsheetUtilities.getColumnName(columnIndex);
        getColumnProvider().setColumnHeader(columnIndex + 1, SafeHtmlUtils.fromString(columnName));
    }
}

From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.dnd.GridDndExample.java

License:sencha.com license

private ColumnModel<StockProxy> createColumnList(StockProperties props) {
    ColumnConfig<StockProxy, String> cc1 = new ColumnConfig<StockProxy, String>(props.nameProp());
    cc1.setHeader(SafeHtmlUtils.fromString("Stock Name"));

    List<ColumnConfig<StockProxy, ?>> l = new ArrayList<ColumnConfig<StockProxy, ?>>();
    l.add(cc1);/*from   ww w  . j  a  va 2  s  .co  m*/
    return new ColumnModel<StockProxy>(l);
}