Search in sources :

Example 51 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class DoubleField method format.

@Override
public String format(Object value) {
    if (!(value instanceof Record))
        return value.toString();
    Record ds = (Record) value;
    if (this.isReadonly()) {
        if (buildUrl != null) {
            HtmlWriter html = new HtmlWriter();
            UrlRecord url = new UrlRecord();
            buildUrl.buildUrl(ds, url);
            if (!"".equals(url.getUrl())) {
                html.print("<a href=\"%s\"", url.getUrl());
                if (url.getTitle() != null) {
                    html.print(" title=\"%s\"", url.getTitle());
                }
                if (url.getTarget() != null) {
                    html.print(" target=\"%s\"", url.getTarget());
                }
                html.println(">%s</a>", getText(ds));
            } else
                html.println(getText(ds));
            return html.toString();
        } else
            return getText(ds);
    }
    if (!(this.getOwner() instanceof AbstractGridLine))
        return getText(ds);
    return getEditor().format(ds);
}
Also used : HtmlWriter(cn.cerc.jpage.core.HtmlWriter) Record(cn.cerc.jdb.core.Record) UrlRecord(cn.cerc.jpage.core.UrlRecord) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractGridLine(cn.cerc.jpage.grid.lines.AbstractGridLine)

Example 52 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class OptionField method output.

@Override
public void output(HtmlWriter html) {
    Record record = dataSource != null ? dataSource.getDataSet().getCurrent() : null;
    String current = this.getText(record);
    html.println("<label for=\"%s\">%s</label>", this.getId(), this.getName() + ":");
    html.print("<select id=\"%s\" name=\"%s\"", this.getId(), this.getId());
    if (this.size > 0) {
        html.print(" size=\"%s\"", this.getSize());
    }
    if (this.isReadonly()) {
        html.print(" disabled");
    }
    if (this.getCssStyle() != null) {
        html.print(" style=\"%s\"", this.getCssStyle());
    }
    html.print(">");
    for (String key : items.keySet()) {
        String value = items.get(key);
        html.print("<option value=\"%s\"", key);
        if (key.equals(current))
            html.print(" selected");
        html.print(">");
        html.println(String.format("%s</option>", value));
    }
    html.println("</select>");
    if (this.isShowStar()) {
        html.print("<font>*</font>");
    }
    html.print("<span></span>");
}
Also used : Record(cn.cerc.jdb.core.Record)

Example 53 with Record

use of cn.cerc.jdb.core.Record in project summer-mis by cn-cerc.

the class CodeNameField method output.

@Override
public void output(HtmlWriter html) {
    Record record = dataSource != null ? dataSource.getDataSet().getCurrent() : null;
    if (this.isHidden()) {
        html.print("<input");
        html.print(" type=\"hidden\"");
        html.print(" name=\"%s\"", this.getId());
        html.print(" id=\"%s\"", this.getId());
        String value = this.getText(record);
        if (value != null)
            html.print(" value=\"%s\"", value);
        html.println("/>");
    } else {
        html.println("<label for=\"%s\">%s</label>", this.getId(), this.getName() + ":");
        html.print("<input");
        html.print(" type=\"hidden\"");
        html.print(" name=\"%s\"", this.getId());
        html.print(" id=\"%s\"", this.getId());
        String codeValue = this.getText(record);
        if (codeValue != null)
            html.print(" value=\"%s\"", codeValue);
        html.println("/>");
        html.print("<input");
        html.print(" type=\"text\"");
        html.print(" name=\"%s\"", getNameField());
        html.print(" id=\"%s\"", getNameField());
        String nameValue = null;
        if (record != null) {
            nameValue = record.getString(getNameField());
            if (nameValue != null)
                html.print(" value=\"%s\"", nameValue);
        }
        if (this.isReadonly())
            html.print(" readonly=\"readonly\"");
        if (this.isAutofocus())
            html.print(" autofocus");
        if (this.isRequired())
            html.print(" required");
        if (this.getPlaceholder() != null)
            html.print(" placeholder=\"%s\"", this.getPlaceholder());
        html.println("/>");
        html.print("<span>");
        if (this.getDialog() != null && this.getDialog().isOpen()) {
            html.print("<a href=\"%s\">", getUrl(this.getDialog()));
            html.print("<img src=\"images/searchIocn.png\">");
            html.print("</a>");
        }
        html.print("</span>");
    }
}
Also used : Record(cn.cerc.jdb.core.Record)

Aggregations

Record (cn.cerc.jdb.core.Record)53 SqlQuery (cn.cerc.jdb.mysql.SqlQuery)15 LocalService (cn.cerc.jbean.client.LocalService)9 Webfunc (cn.cerc.jbean.core.Webfunc)4 DataSet (cn.cerc.jdb.core.DataSet)4 Ignore (org.junit.Ignore)4 Test (org.junit.Test)4 MemoryBuffer (cn.cerc.jbean.other.MemoryBuffer)3 StubHandle (cn.cerc.jbean.rds.StubHandle)3 IMemcache (cn.cerc.jdb.cache.IMemcache)3 MessageRecord (cn.cerc.jmis.message.MessageRecord)3 UrlRecord (cn.cerc.jpage.core.UrlRecord)3 Label (jxl.write.Label)3 CustomHandle (cn.cerc.jbean.core.CustomHandle)2 IService (cn.cerc.jbean.core.IService)2 IStatus (cn.cerc.jbean.core.IStatus)2 UserNotFindException (cn.cerc.jbean.other.UserNotFindException)2 QueueQuery (cn.cerc.jdb.queue.QueueQuery)2 Column (cn.cerc.jexport.excel.Column)2 JPushRecord (cn.cerc.jmis.message.JPushRecord)2