Heng Sin Low 2009-11-17 09:04:11 +00:00
parent b05a179277
commit be0aa87d66
10 changed files with 70 additions and 11 deletions

View File

@ -19,19 +19,20 @@ import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.window.LoginWindow;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zhtml.Text;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.UiException;
import org.zkoss.zk.ui.metainfo.PageDefinition;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.East;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.South;
import org.zkoss.zkex.zul.West;
import org.zkoss.zul.Div;
import org.zkoss.zul.Vbox;
import org.zkoss.zul.Window;
/**
*
@ -45,6 +46,7 @@ public class WLogin extends AbstractUIPart
private IWebClient app;
private Borderlayout layout;
private Window browserWarningWindow;
public WLogin(IWebClient app)
{
@ -81,10 +83,16 @@ public class WLogin extends AbstractUIPart
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 to access the application.";
String script = "alert('" + msg + "')";
AuScript aus = new AuScript(null, script);
Clients.response(aus);
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();
Div div = new Div();
div.setStyle("font-size: 9pt");
div.appendChild(new Text(msg));
browserWarningWindow.appendChild(div);
browserWarningWindow.setPosition("top,right");
browserWarningWindow.setWidth("550px");
browserWarningWindow.setPage(page);
browserWarningWindow.doOverlapped();
}
try {
@ -166,6 +174,8 @@ public class WLogin extends AbstractUIPart
public void detach() {
layout.detach();
layout = null;
if (browserWarningWindow != null)
browserWarningWindow.detach();
}
public Component getComponent() {

View File

@ -598,6 +598,25 @@ public final class AEnv
return supported;
}
/**
* @return true if user agent is internet explorer
*/
public static boolean isInternetExplorer()
{
Execution execution = Executions.getCurrent();
if (execution == null)
return false;
Object n = execution.getNativeRequest();
if (n instanceof ServletRequest) {
String userAgent = Servlets.getUserAgent((ServletRequest) n);
if (userAgent.indexOf("MSIE ") >= 0) {
return true;
}
}
return false;
}
/**
*
* @param parent

View File

@ -91,8 +91,8 @@ public class MenuPanel extends Panel implements EventListener
menuTree.setMultiple(false);
menuTree.setId("mnuMain");
menuTree.setWidth("100%");
// menuTree.setHeight("96%");
menuTree.setVflex(true);
menuTree.setFixedLayout(false);
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
menuTree.setStyle("border: none");
@ -143,7 +143,7 @@ public class MenuPanel extends Panel implements EventListener
private void generateMenu(Treechildren treeChildren, MTreeNode mNode)
{
Enumeration nodeEnum = mNode.children();
Enumeration<?> nodeEnum = mNode.children();
while(nodeEnum.hasMoreElements())
{

View File

@ -19,6 +19,7 @@ package org.adempiere.webui.panel;
import java.util.TreeMap;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.AutoComplete;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel;
@ -92,16 +93,28 @@ public class TreeSearchPanel extends Panel implements EventListener, TreeDataLis
lblSearch.setValue(Msg.getMsg(Env.getCtx(),"TreeSearch").replaceAll("&", "") + ":");
lblSearch.setTooltiptext(Msg.getMsg(Env.getCtx(),"TreeSearchText"));
div.appendChild(lblSearch);
div.setStyle("display: inline-block; height: 20px; margin-bottom: 10px; vertical-align: middle");
String divStyle = "height: 20px; vertical-align: middle;";
if (!AEnv.isInternetExplorer())
{
divStyle += "margin-bottom: 10px; display: inline-block;";
}
div.setStyle(divStyle);
cmbSearch = new AutoComplete();
cmbSearch.setAutodrop(true);
cmbSearch.addEventListener(Events.ON_CHANGE, this);
if (AEnv.isInternetExplorer())
{
cmbSearch.setWidth("200px");
}
this.appendChild(div);
this.appendChild(cmbSearch);
if (!AEnv.isInternetExplorer())
{
this.setStyle("height: 20px;");
}
}
private void addTreeItem(Treeitem treeItem)
{

View File

@ -59,4 +59,5 @@ public interface ITheme {
//stylesheet url
public static final String THEME_STYLESHEET = "/css/theme.css.dsp";
public static final String THEME_STYLESHEET_BY_BROWSER = "/css/theme*.css.dsp*";
}

View File

@ -58,6 +58,13 @@ public final class ThemeManager {
return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_STYLESHEET;
}
/**
* @return url of theme stylesheet by browser
*/
public static String getStyleSheetByBrowser() {
return ITheme.THEME_PATH_PREFIX + getTheme() + ITheme.THEME_STYLESHEET_BY_BROWSER;
}
/**
* @return title text for the browser window
*/

View File

@ -21,6 +21,7 @@ package org.zkoss.zkmax.zul.render;
import java.io.IOException;
import java.io.Writer;
import org.adempiere.webui.apps.AEnv;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
@ -46,7 +47,7 @@ public class Combobox2Default implements ComponentRenderer {
final String zcls = self.getZclass();
final Execution exec = Executions.getCurrent();
String tableStyle = "display:inline-block";
String tableStyle = AEnv.isInternetExplorer() ? "display:inline" : "display:inline-block";
String inputAttrs = self.getInnerAttrs();
if (inputAttrs.indexOf("style") >= 0) {
inputAttrs = inputAttrs.substring(0, inputAttrs.indexOf("style"));

View File

@ -6,6 +6,7 @@ Copyright (C) 2007 Ashley G Ramdass.
<?init zscript="theme.zs" ?>
<?link rel="icon" type="image/png" href="${browserIcon}"?>
<?link rel="stylesheet" type="text/css" href="${themeStyleSheet}"?>
<?link rel="stylesheet" type="text/css" href="${themeStyleSheetByBrowser}"?>
<?link rel="stylesheet" type="text/css" href="css/PAPanel.css"?>
<zk>
<window use="org.adempiere.webui.AdempiereWebUI"/>

View File

@ -1,3 +1,4 @@
import org.adempiere.webui.theme.ThemeManager;
var themeStyleSheet = ThemeManager.getStyleSheet();
var themeStyleSheetByBrowser = ThemeManager.getStyleSheetByBrowser();
var browserIcon = ThemeManager.getBrowserIcon();

View File

@ -0,0 +1,6 @@
<%@ page contentType="text/css;charset=UTF-8" %>
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>
.login-box-body {
padding-bottom: 20px;
}