Search in sources :

Example 1 with HtmlWriter

use of cn.cerc.jpage.core.HtmlWriter in project summer-mis by cn-cerc.

the class DoubleField method getText.

@Override
public String getText(Record dataSet) {
    if (dataSet == null)
        return null;
    if (buildText != null) {
        HtmlWriter html = new HtmlWriter();
        buildText.outputText(dataSet, html);
        return html.toString();
    }
    try {
        double val = dataSet.getDouble(field);
        DecimalFormat df = new DecimalFormat(format);
        return df.format(val);
    } catch (NumberFormatException e) {
        return "0";
    }
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter) DecimalFormat(java.text.DecimalFormat)

Example 2 with HtmlWriter

use of cn.cerc.jpage.core.HtmlWriter in project summer-mis by cn-cerc.

the class OptionField method getText.

@Override
public String getText(Record dataSet) {
    if (dataSet == null)
        return null;
    if (buildText != null) {
        HtmlWriter html = new HtmlWriter();
        buildText.outputText(dataSet, html);
        return html.toString();
    }
    return dataSet.getString(getField());
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter)

Example 3 with HtmlWriter

use of cn.cerc.jpage.core.HtmlWriter in project summer-mis by cn-cerc.

the class CheckEditor method format.

public String format(Record ds) {
    String data = ds.getString(owner.getField());
    HtmlWriter html = new HtmlWriter();
    html.print("<input");
    html.print(" id='%s'", owner.getId());
    html.print(" type='checkbox'");
    html.print(" name='%s'", owner.getField());
    html.print(" value='true'");
    html.print(" autocomplete='off'");
    html.print(" data-%s='[%s]'", owner.getField(), data);
    if (ds.getBoolean(owner.getField()))
        html.print(" checked");
    if (onUpdate != null)
        html.print(" onclick=\"tableOnChanged(this,'%s')\"", onUpdate);
    else
        html.print(" onclick='tableOnChanged(this)'");
    html.println("/>");
    return html.toString();
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter)

Example 4 with HtmlWriter

use of cn.cerc.jpage.core.HtmlWriter in project summer-mis by cn-cerc.

the class CustomField method getText.

@Override
public String getText(Record ds) {
    if (buildText == null)
        return "";
    HtmlWriter html = new HtmlWriter();
    buildText.outputText(ds, html);
    return html.toString();
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter)

Example 5 with HtmlWriter

use of cn.cerc.jpage.core.HtmlWriter in project summer-mis by cn-cerc.

the class OperaField method getText.

@Override
public String getText(Record dataSet) {
    if (buildText != null) {
        HtmlWriter html = new HtmlWriter();
        buildText.outputText(dataSet, html);
        return html.toString();
    }
    return this.value;
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter)

Aggregations

HtmlWriter (cn.cerc.jpage.core.HtmlWriter)18 Record (cn.cerc.jdb.core.Record)2 UrlRecord (cn.cerc.jpage.core.UrlRecord)2 AbstractGridLine (cn.cerc.jpage.grid.lines.AbstractGridLine)2 DecimalFormat (java.text.DecimalFormat)2 HtmlContent (cn.cerc.jpage.core.HtmlContent)1 IColumn (cn.cerc.jpage.core.IColumn)1 IField (cn.cerc.jpage.core.IField)1 AbstractField (cn.cerc.jpage.fields.AbstractField)1 DataGrid (cn.cerc.jpage.grid.DataGrid)1 MasterGridLine (cn.cerc.jpage.grid.lines.MasterGridLine)1