Search in sources :

Example 11 with Component

use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.

the class UIPageSearch method execute.

@Override
public void execute() throws ServletException, IOException {
    HttpServletRequest request = getRequest();
    // 添加分页控制
    Component operaPages = null;
    if (pages != null) {
        this.put("pages", pages);
        operaPages = new OperaPages(this.getToolBar(), this.getForm(), pages);
        this.put("_operaPages_", operaPages);
    }
    IForm form = this.getForm();
    CustomHandle sess = (CustomHandle) form.getHandle().getProperty(null);
    if (sess.logon()) {
        List<UrlRecord> rightMenus = getHeader().getRightMenus();
        RightMenus menus = Application.getBean("RightMenus", RightMenus.class);
        menus.setHandle(form.getHandle());
        for (IMenuBar item : menus.getItems()) item.enrollMenu(form, rightMenus);
    } else {
        getHeader().getHomePage().setSite(Application.getAppConfig().getFormWelcome());
    }
    // 系统通知消息
    Component content = this.getContent();
    if (form instanceof AbstractForm) {
        this.getHeader().initHeader();
        request.setAttribute(content.getId(), content);
        for (Component component : content.getComponents()) {
            request.setAttribute(component.getId(), component);
        }
    }
    // 开始输出
    PrintWriter out = getResponse().getWriter();
    out.println("<!DOCTYPE html>");
    out.println("<html>");
    out.println("<head>");
    out.printf("<title>%s</title>\n", this.getForm().getTitle());
    out.println("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
    out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9; IE=8; IE=7;\"/>");
    out.println("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\"/>");
    out.println(this.getCssHtml());
    out.println(getScriptHtml());
    out.println("<script>");
    out.println("var Application = new TApplication();");
    out.printf("Application.device = '%s';\n", form.getClient().getDevice());
    out.printf("Application.bottom = '%s';\n", this.getFooter().getId());
    String msg = form.getParam("message", "");
    msg = msg == null ? "" : msg.replaceAll("\r\n", "<br/>");
    out.printf("Application.message = '%s';\n", msg.replace("'", "\\'"));
    out.printf("Application.searchFormId = '%s';\n", this.searchWaitingId);
    out.println("$(document).ready(function() {");
    out.println("Application.init();");
    out.println("});");
    out.println("</script>");
    out.println("</head>");
    outBody(out);
    out.println("</html>");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) OperaPages(cn.cerc.jpage.other.OperaPages) IMenuBar(cn.cerc.jmis.page.IMenuBar) IForm(cn.cerc.jbean.form.IForm) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractForm(cn.cerc.jmis.form.AbstractForm) Component(cn.cerc.jpage.core.Component) UIComponent(cn.cerc.jui.parts.UIComponent) CustomHandle(cn.cerc.jbean.core.CustomHandle) RightMenus(cn.cerc.jui.parts.RightMenus) PrintWriter(java.io.PrintWriter)

Example 12 with Component

use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.

the class RangeField method updateField.

@Override
public void updateField() {
    AbstractField child = null;
    for (Component component : this.getComponents()) {
        if (component instanceof AbstractField) {
            child = (AbstractField) component;
            child.updateField();
        }
    }
}
Also used : UIComponent(cn.cerc.jui.parts.UIComponent) Component(cn.cerc.jpage.core.Component)

Example 13 with Component

use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.

the class UIHeader method addButton.

public void addButton(String caption, String url, String iconUrl) {
    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 (iconUrl == null || "".equals(iconUrl)) {
            iconUrl = String.format("images/icon%s.png", count);
        }
        item.setCaption(String.format("<img src='%s'/>%s", iconUrl, item.getName()));
    }
}
Also used : Component(cn.cerc.jpage.core.Component)

Example 14 with Component

use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.

the class UIPageBill method execute.

@Override
public void execute() throws ServletException, IOException {
    HttpServletRequest request = getRequest();
    IForm form = this.getForm();
    CustomHandle sess = (CustomHandle) form.getHandle().getProperty(null);
    if (sess.logon()) {
        List<UrlRecord> rightMenus = getHeader().getRightMenus();
        RightMenus menus = Application.getBean("RightMenus", RightMenus.class);
        menus.setHandle(form.getHandle());
        for (IMenuBar item : menus.getItems()) item.enrollMenu(form, rightMenus);
    } else {
        getHeader().getHomePage().setSite(Application.getAppConfig().getFormWelcome());
    }
    // 系统通知消息
    Component content = this.getContent();
    if (form instanceof AbstractForm) {
        this.getHeader().initHeader();
        request.setAttribute(content.getId(), content);
        for (Component component : content.getComponents()) {
            request.setAttribute(component.getId(), component);
        }
    }
    // 开始输出
    PrintWriter out = getResponse().getWriter();
    out.println("<!DOCTYPE html>");
    out.println("<html>");
    out.println("<head>");
    out.printf("<title>%s</title>\n", this.getForm().getTitle());
    out.printf("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n");
    out.println("<meta http-equiv=\"X-UA-Compatible\" content=\"IE=9; IE=8; IE=7;\"/>");
    out.printf("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0\"/>\n");
    out.print(this.getCssHtml());
    out.print(getScriptHtml());
    out.println("<script>");
    out.println("var Application = new TApplication();");
    out.printf("Application.device = '%s';\n", form.getClient().getDevice());
    out.printf("Application.bottom = '%s';\n", getFooter().getId());
    String msg = form.getParam("message", "");
    msg = msg == null ? "" : msg.replaceAll("\r\n", "<br/>");
    out.printf("Application.message = '%s';\n", msg);
    out.printf("Application.searchFormId = '%s';\n", this.searchWaitingId);
    out.println("$(document).ready(function() {");
    out.println("Application.init();");
    out.println("});");
    out.println("</script>");
    out.println("</head>");
    outBody(out);
    out.println("</html>");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IMenuBar(cn.cerc.jmis.page.IMenuBar) IForm(cn.cerc.jbean.form.IForm) UrlRecord(cn.cerc.jpage.core.UrlRecord) AbstractForm(cn.cerc.jmis.form.AbstractForm) CustomHandle(cn.cerc.jbean.core.CustomHandle) Component(cn.cerc.jpage.core.Component) RightMenus(cn.cerc.jui.parts.RightMenus) PrintWriter(java.io.PrintWriter)

Example 15 with Component

use of cn.cerc.jpage.core.Component in project summer-mis by cn-cerc.

the class UIPagePhone method getBody.

// 请使用:getDocument().getContext()
@Deprecated
public Component getBody() {
    if (body == null) {
        body = new Component();
        body.setOwner(this.getContent());
        body.setId("search");
    }
    return body;
}
Also used : 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