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.sencha.gxt.widget.core.client.box.MessageBox.java

License:sencha.com license

/**
 * Sets the message. HTML in the message is escaped.
 * Use {@link #setMessage(SafeHtml)} to display HTML.
 *
 * @param message the message/*  w  w  w. j a v  a2s .com*/
 */
public void setMessage(String message) {
    if (message == null) {
        setMessage(SafeHtmlUtils.EMPTY_SAFE_HTML);
    } else {
        setMessage(SafeHtmlUtils.fromString(message));
    }
}

From source file:com.sencha.gxt.widget.core.client.box.MultiLinePromptMessageBox.java

License:sencha.com license

/**
 * Creates a messageText box that prompts for input with a multiple line text area
 * and OK and CANCEL buttons./*w  w w. j  av a 2 s . co  m*/
 *
 * @param titleText the titleText of the messageText box
 * @param messageText the messageText that appears in the messageText box
 */
public MultiLinePromptMessageBox(String titleText, String messageText) {
    this(SafeHtmlUtils.fromString(titleText), SafeHtmlUtils.fromString(messageText));
}

From source file:com.sencha.gxt.widget.core.client.box.ProgressMessageBox.java

License:sencha.com license

/**
 * Creates a progress message box with the specified heading HTML.
 *
 * @param headingText the text to display for the message box heading.
 *//*  w  w w  .j a  va2  s .  c o  m*/
public ProgressMessageBox(String headingText) {
    this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.EMPTY_SAFE_HTML);
}

From source file:com.sencha.gxt.widget.core.client.box.ProgressMessageBox.java

License:sencha.com license

/**
 * Creates a progress message box with the specified heading and message HTML.
 *
 * @param headingText the text to display for the message box heading
 * @param messageText the text to display in the message box
 *//*from   w  ww . ja va2 s.  co  m*/
public ProgressMessageBox(String headingText, String messageText) {
    this(SafeHtmlUtils.fromString(headingText), SafeHtmlUtils.fromString(messageText));
}

From source file:com.sencha.gxt.widget.core.client.box.PromptMessageBox.java

License:sencha.com license

/**
 * Creates a messageText box that prompts for input with a single line text field
 * and OK and CANCEL buttons.//from w  w  w  .j  a va2 s.  co m
 *
 * @param titleText the titleText of the messageText box
 * @param messageText the messageText that appears in the messageText box
 */
public PromptMessageBox(String titleText, String messageText) {
    this(SafeHtmlUtils.fromString(titleText), SafeHtmlUtils.fromString(messageText));
}

From source file:com.sencha.gxt.widget.core.client.button.ButtonGroup.java

License:sencha.com license

/**
 * Sets the heading text.//from   www .j  av a 2 s . c om
 *
 * Text that contains reserved html characters will be escaped.
 *
 * @param text the text
 */
public void setHeading(String text) {
    setHeading(SafeHtmlUtils.fromString(text));
}

From source file:com.sencha.gxt.widget.core.client.ContentPanel.java

License:sencha.com license

/**
 * Sets the heading text.//from   w w w.  j  a  v  a 2s  .c  o  m
 *
 * Text that contains reserved html characters will be escaped.
 *
 * @param text the text
 */
public void setHeading(String text) {
    header.setHTML(SafeHtmlUtils.fromString(text));
}

From source file:com.sencha.gxt.widget.core.client.DatePicker.java

License:sencha.com license

/**
 * Sets the picker's start day index as returned by {@link DateTimeFormatInfo#weekdaysNarrow()}.
 *
 * @param startDay the start day index/*from   ww  w  . j av  a2  s.c  o m*/
 */
public void setStartDay(int startDay) {
    this.startDay = startDay;

    String[] dn = dateTimeInfo.getWeekdaysNarrow();

    List<SafeHtml> days = new ArrayList<SafeHtml>();
    for (int i = 0; i < 7; i++) {
        days.add(SafeHtmlUtils.fromString(dn[(i + startDay) % 7]));
    }

    appearance.onUpdateDayOfWeeks(getElement(), days);

    update(activeDate);
}

From source file:com.sencha.gxt.widget.core.client.DatePicker.java

License:sencha.com license

protected void update(DateWrapper date) {
    DateWrapper vd = activeDate;/* ww w.  ja v  a2  s .com*/
    activeDate = date;
    if (vd != null) {
        int days = date.getDaysInMonth();
        DateWrapper firstOfMonth = date.getFirstDayOfMonth();
        int startingPos = firstOfMonth.getDayInWeek() - startDay;

        if (startingPos <= startDay) {
            startingPos += 7;
        }

        // go to previous month.
        DateWrapper pm = activeDate.addMonths(-1);
        int prevStart = pm.getDaysInMonth() - startingPos;

        days += startingPos;

        DateWrapper d = new DateWrapper(pm.getFullYear(), pm.getMonth(), prevStart).resetTime();
        today = new DateWrapper().resetTime().getTime();
        long sel = value != null ? value.resetTime().getTime() : Long.MIN_VALUE;
        long min = minDate != null ? new DateWrapper(minDate).getTime() : Long.MIN_VALUE;
        long max = maxDate != null ? new DateWrapper(maxDate).getTime() : Long.MAX_VALUE;

        int i = 0;
        for (; i < startingPos; i++) {
            appearance.onHtmlChange(cells[i], SafeHtmlUtils.fromTrustedString("" + ++prevStart));
            d = d.addDays(1);
            appearance.onUpdateDateStyle(cells[i], DateState.PREVIOUS, true);
            setCellStyle(cells[i], d.asDate(), sel, min, max);

            cells[i].setTitle(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM).format(d.asDate()));
        }
        for (; i < days; i++) {
            int intDay = i - startingPos + 1;
            appearance.onHtmlChange(cells[i], SafeHtmlUtils.fromTrustedString("" + intDay));
            d = d.addDays(1);
            appearance.onUpdateDateStyle(cells[i], DateState.PREVIOUS, false);
            appearance.onUpdateDateStyle(cells[i], DateState.NEXT, false);
            appearance.onUpdateDateStyle(cells[i], DateState.ACTIVE, true);
            setCellStyle(cells[i], d.asDate(), sel, min, max);
            cells[i].setTitle(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM).format(d.asDate()));
        }
        int extraDays = 0;
        for (; i < 42; i++) {
            appearance.onHtmlChange(cells[i], SafeHtmlUtils.fromTrustedString("" + ++extraDays));
            d = d.addDays(1);
            appearance.onUpdateDateStyle(cells[i], DateState.NEXT, true);
            setCellStyle(cells[i], d.asDate(), sel, min, max);
            cells[i].setTitle(DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM).format(d.asDate()));
        }
        int month = activeDate.getMonth();

        SafeHtml t = SafeHtmlUtils
                .fromString(dateTimeInfo.getMonthsFullStandalone()[month] + " " + activeDate.getFullYear());

        appearance.onMonthButtonHtmlChange(getElement(), t);
    }

}

From source file:com.sencha.gxt.widget.core.client.form.CheckBox.java

License:sencha.com license

/**
 * The text that appears beside the checkbox (defaults to empty string).
 *
 * @param text the box label text/*from  w  w w.  j a  va 2 s  . c o  m*/
 */
public void setBoxLabel(String text) {
    getCell().setBoxLabel(getElement(), SafeHtmlUtils.fromString(text));
}