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);
}
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>");
}
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>");
}
}
Aggregations