Search in sources :

Example 1 with PageDefinition

use of org.zkoss.zk.ui.metainfo.PageDefinition in project adempiere by adempiere.

the class WLogin method doCreatePart.

protected Component doCreatePart(Component parent) {
    layout = new Borderlayout();
    if (parent != null)
        layout.setParent(parent);
    else
        layout.setPage(page);
    ThemeUtils.addSclass("ad-wlogin-layout", layout);
    Center center = new Center();
    center.setParent(layout);
    center.setHflex("true");
    center.setVflex("true");
    center.setAutoscroll(true);
    ThemeUtils.addSclass("ad-wlogin-layout-center", center);
    Vbox vb = new Vbox();
    vb.setParent(center);
    vb.setPack("center");
    vb.setAlign("center");
    vb.setWidth("100%");
    vb.setHeight("100%");
    LoginWindow loginWindow = new LoginWindow(app);
    loginWindow.setParent(vb);
    if (!AEnv.isBrowserSupported()) {
        //TODO: localization
        String msg = "You might experience slow performance and user interface anomalies using your current browser to access the application. We recommend the use of Firefox, Google Chrome or Apple Safari.";
        browserWarningWindow = new Window();
        ThemeUtils.addSclass("ad-wlogin-browser-not-supported", browserWarningWindow);
        Div div = new Div();
        div.appendChild(new Text(msg));
        browserWarningWindow.setPosition("top,right");
        browserWarningWindow.appendChild(div);
        browserWarningWindow.setPage(page);
        browserWarningWindow.doOverlapped();
    }
    try {
        String right = ThemeUtils.getLoginRightPanel();
        PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(right);
        East east = new East();
        ThemeUtils.addSclass("ad-wlogin-east-panel", east);
        addContent(east, pageDefintion);
    } catch (Exception e) {
        //ignore page not found exception
        if (e instanceof UiException) {
            if (!(e.getMessage() != null && e.getMessage().startsWith("Page not found"))) {
                e.printStackTrace();
            }
        } else {
            e.printStackTrace();
        }
    }
    try {
        String left = ThemeUtils.getLoginLeftPanel();
        PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(left);
        West west = new West();
        ThemeUtils.addSclass("ad-wlogin-west-panel", west);
        addContent(west, pageDefintion);
    } catch (Exception e) {
        //ignore page not found exception
        if (e instanceof UiException) {
            if (!(e.getMessage() != null && e.getMessage().startsWith("Page not found"))) {
                e.printStackTrace();
            }
        } else {
            e.printStackTrace();
        }
    }
    try {
        String top = ThemeUtils.getLoginTopPanel();
        PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(top);
        North north = new North();
        ThemeUtils.addSclass("ad-wlogin-north-panel", north);
        addContent(north, pageDefintion);
    } catch (Exception e) {
        //ignore page not found exception
        if (e instanceof UiException) {
            if (!(e.getMessage() != null && e.getMessage().startsWith("Page not found"))) {
                e.printStackTrace();
            }
        } else {
            e.printStackTrace();
        }
    }
    try {
        String bottom = ThemeUtils.getLoginBottomPanel();
        PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(bottom);
        South south = new South();
        ThemeUtils.addSclass("ad-wlogin-south-panel", south);
        addContent(south, pageDefintion);
    } catch (Exception e) {
        //ignore page not found exception
        if (e instanceof UiException) {
            if (!(e.getMessage() != null && e.getMessage().startsWith("Page not found"))) {
                e.printStackTrace();
            }
        } else {
            e.printStackTrace();
        }
    }
    return layout;
}
Also used : LoginWindow(org.adempiere.webui.window.LoginWindow) Window(org.zkoss.zul.Window) PageDefinition(org.zkoss.zk.ui.metainfo.PageDefinition) Center(org.zkoss.zul.Center) LoginWindow(org.adempiere.webui.window.LoginWindow) West(org.zkoss.zul.West) South(org.zkoss.zul.South) Text(org.zkoss.zhtml.Text) Borderlayout(org.zkoss.zul.Borderlayout) UiException(org.zkoss.zk.ui.UiException) UiException(org.zkoss.zk.ui.UiException) Div(org.zkoss.zul.Div) North(org.zkoss.zul.North) Vbox(org.zkoss.zul.Vbox) East(org.zkoss.zul.East)

Aggregations

LoginWindow (org.adempiere.webui.window.LoginWindow)1 Text (org.zkoss.zhtml.Text)1 UiException (org.zkoss.zk.ui.UiException)1 PageDefinition (org.zkoss.zk.ui.metainfo.PageDefinition)1 Borderlayout (org.zkoss.zul.Borderlayout)1 Center (org.zkoss.zul.Center)1 Div (org.zkoss.zul.Div)1 East (org.zkoss.zul.East)1 North (org.zkoss.zul.North)1 South (org.zkoss.zul.South)1 Vbox (org.zkoss.zul.Vbox)1 West (org.zkoss.zul.West)1 Window (org.zkoss.zul.Window)1