Search in sources :

Example 1 with Component

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);
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField) ExpendField(cn.cerc.jpage.fields.ExpendField) Component(cn.cerc.jpage.core.Component)

Example 2 with Component

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>");
        }
    }
}
Also used : Record(cn.cerc.jdb.core.Record) UIComponent(cn.cerc.jui.parts.UIComponent) Component(cn.cerc.jpage.core.Component)

Example 3 with Component

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;
}
Also used : Component(cn.cerc.jpage.core.Component)

Example 4 with Component

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());
        }
    }
}
Also used : Component(cn.cerc.jpage.core.Component)

Example 5 with Component

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>");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Component(cn.cerc.jpage.core.Component)

Aggregations

Component (cn.cerc.jpage.core.Component)16 HttpServletRequest (javax.servlet.http.HttpServletRequest)7 CustomHandle (cn.cerc.jbean.core.CustomHandle)6 IForm (cn.cerc.jbean.form.IForm)6 AbstractForm (cn.cerc.jmis.form.AbstractForm)6 IMenuBar (cn.cerc.jmis.page.IMenuBar)6 UrlRecord (cn.cerc.jpage.core.UrlRecord)6 RightMenus (cn.cerc.jui.parts.RightMenus)6 PrintWriter (java.io.PrintWriter)5 UIComponent (cn.cerc.jui.parts.UIComponent)3 OperaPages (cn.cerc.jpage.other.OperaPages)2 Record (cn.cerc.jdb.core.Record)1 AbstractField (cn.cerc.jpage.fields.AbstractField)1 ExpendField (cn.cerc.jpage.fields.ExpendField)1