package cn.cerc.ui.fields;

import cn.cerc.core.ClassConfig;
import cn.cerc.core.Record;
import cn.cerc.mis.cdn.CDN;
import cn.cerc.ui.SummerUI;
import cn.cerc.ui.core.HtmlWriter;
import cn.cerc.ui.parts.UIComponent;

public class DateField extends AbstractField {
    private static final ClassConfig config = new ClassConfig(DateField.class, SummerUI.ID);

    public DateField(UIComponent owner, String name, String field) {
        super(owner, name, 5);
        this.setField(field);
        this.setDialog("showDateDialog");
        this.setIcon(CDN.get(config.getClassProperty("icon", "")));
        this.setAlign("center");
    }

    public DateField(UIComponent owner, String name, String field, int width) {
        super(owner, name, width);
        this.setField(field);
        this.setDialog("showDateDialog");
        this.setIcon(CDN.get(config.getClassProperty("icon", "")));
        this.setAlign("center");
    }

    @Override
    public Title createTitle() {
        Title title = super.createTitle();
        title.setType("date");
        return title;
    }

    @Override
    public String getText(Record record) {
        if (record == null) {
            return null;
        }
        if (buildText != null) {
            HtmlWriter html = new HtmlWriter();
            buildText.outputText(record, html);
            return html.toString();
        }
        if (record.hasValue(getField())) {
            return record.getDate(getField()).getDate();
        } else {
            return "";
        }
    }
}

@@ -106,14 +106,23 @@
 is.c
-dn.CDN
+ore.Application
 ;%0Aim
@@ -550,32 +550,54 @@
 his.setIcon(
-CDN.get(
+Application.getStaticPath() + 
 config.getCl
@@ -612,33 +612,32 @@
 rty(%22icon%22, %22%22))
-)
 ;%0A        this.s
@@ -874,16 +874,38 @@
 con(
-CDN.get(
+Application.getStaticPath() + 
 conf
@@ -936,17 +936,16 @@
 n%22, %22%22))
-)
 ;%0A      

Update DateField.java