use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.
the class UIFormHorizontal method output.
@Override
public void output(HtmlWriter html) {
readAll();
title.output(html);
html.print("<form method=\"%s\" id=\"%s\"", this.method, this.getId());
if (this.action != null)
html.print(" action=\"%s\"", this.action);
if (this.cssClass != null)
html.print(" class=\"%s\"", this.cssClass);
if (this.enctype != null)
html.print(" enctype=\"%s\"", this.enctype);
html.println(">");
// 输出隐藏字段
for (AbstractField field : fields) {
if (field.isHidden()) {
field.output(html);
}
}
html.println("<ul>");
// 输出正常查询字段
for (AbstractField field : fields) {
if (!field.isHidden()) {
html.print("<li");
if (field.getRole() != null)
html.print(" role='%s'", field.getRole());
if (field instanceof ExpendField)
html.print(" class=\"select\"");
html.println(">");
try {
field.output(html);
} catch (Exception e) {
html.print("<label>");
html.print(e.getMessage());
html.print("</label>");
}
html.println("</li>");
}
}
// 输出可折叠字段
String hid = "hidden";
for (AbstractField field : fields) {
if (field instanceof ExpendField) {
hid = ((ExpendField) field).getHiddenId();
break;
}
}
for (Component component : this.getExpender().getComponents()) {
if (component instanceof AbstractField) {
AbstractField field = (AbstractField) component;
html.print("<li");
html.print(" role='%s'", hid);
html.print(" style=\"display: none;\"");
html.println(">");
try {
field.output(html);
} catch (Exception e) {
html.print("<label>");
html.print(e.getMessage());
html.print("</label>");
}
html.println("</li>");
}
}
html.println("</ul>");
if (buttons != null) {
for (AbstractField field : buttons.fields) {
field.output(html);
}
}
html.println("<div></div>");
html.println("</form>");
if (levelSide != null)
levelSide.output(html);
}
use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.
the class RangeField method output.
@Override
public void output(HtmlWriter html) {
Record record = dataSource != null ? dataSource.getDataSet().getCurrent() : null;
if (this.hidden) {
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() + ":");
AbstractField child = null;
for (Component component : this.getComponents()) {
if (component instanceof AbstractField) {
if (child != null)
html.print("-");
child = (AbstractField) component;
String val = child.getCSSClass_phone();
child.setCSSClass_phone("price");
child.outputInput(html, record);
child.setCSSClass_phone(val);
}
}
if (this.dialog != null) {
html.print("<span>");
html.print("<a href=\"javascript:%s('%s')\">", this.dialog, this.getId());
html.print("<img src=\"images/select-pic.png\">");
html.print("</a>");
html.print("</span>");
} else {
html.print("<span></span>");
}
}
}
use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.
the class UIPageModify method getBody.
public Component getBody() {
if (body == null) {
body = new Component();
body.setOwner(this.getDocument().getContent());
body.setId("search");
}
return body;
}
use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.
the class UIFooter method addButton.
public void addButton(String caption, String url) {
int count = 1;
for (Component obj : this.getComponents()) {
if (obj instanceof UIBottom) {
count++;
}
}
UIBottom item = addButton();
item.setCaption(caption);
item.setUrl(url);
item.setCssClass("bottomBotton");
item.setId("button" + count);
if (!getForm().getClient().isPhone()) {
if (showHotKeyName) {
item.setCaption(String.format("F%s:%s", count, item.getName()));
} else {
item.setCaption(item.getName());
}
}
}
use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.
the class UIFooter method output.
@Override
public void output(HtmlWriter html) {
if (this.getComponents().size() > MAX_MENUS)
throw new RuntimeException(String.format("底部菜单区最多只支持 %d 个菜单项", MAX_MENUS));
if (this.buttons.size() > MAX_MENUS)
throw new RuntimeException(String.format("底部菜单区最多只支持 %d 个菜单项", MAX_MENUS));
html.print("<footer role='footer'");
if (isEmpty()) {
html.print(" style='display:none'");
}
html.println(">");
if (this.operation != null) {
html.println("<section role='footerOperation'>");
this.operation.output(html);
html.println("</section>");
html.println("<section role='footerTools'>");
} else {
html.println("<section role='footerButtons'>");
}
for (Component component : this.getComponents()) {
if (component != this.operation && component instanceof UIComponent)
((UIComponent) component).output(html);
}
html.println("</section>");
HttpServletRequest request = getForm().getRequest();
if (request != null) {
if (!getForm().getClient().isPhone()) {
html.print("<div class=\"bottom-message\"");
html.print(" id=\"msg\">");
String msg = request.getParameter("msg");
if (msg != null)
html.print(msg.replaceAll("\r\n", "<br/>"));
html.println("</div>");
}
}
html.print("</footer>");
}
Aggregations