- refactoring
- added support for ZK_BROWSER_ICON
- restore eclipse webtool setting in .project
This commit is contained in:
Heng Sin Low 2009-05-18 04:46:04 +00:00
parent df50c6a77b
commit f28005bb5b
8 changed files with 108 additions and 22 deletions

View File

@ -12,7 +12,9 @@
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.sysdeo.eclipse.tomcat.tomcatnature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
</natures>
</projectDescription>

View File

@ -27,6 +27,7 @@ import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.desktop.DefaultDesktop;
import org.adempiere.webui.desktop.IDesktop;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.UserPreference;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
@ -88,7 +89,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
public void onCreate()
{
this.getPage().setTitle(MSysConfig.getValue("ZK_BROWSER_TITLE", APP_NAME));
this.getPage().setTitle(ThemeManager.getBrowserTitle());
Properties ctx = Env.getCtx();
langSession = Env.getContext(ctx, Env.LANGUAGE);

View File

@ -16,10 +16,11 @@ package org.adempiere.webui;
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.compiere.model.MSysConfig;
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.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
@ -49,8 +50,6 @@ public class WLogin extends AbstractUIPart
protected Component doCreatePart(Component parent)
{
String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
layout = new Borderlayout();
if (parent != null)
layout.setParent(parent);
@ -77,36 +76,72 @@ public class WLogin extends AbstractUIPart
loginWindow.setParent(vb);
try {
String right = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_RIGHT_PANEL_ZUL;
String right = ThemeManager.getLoginRightPanel();
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(right);
East east = new East();
east.setSclass(ITheme.LOGIN_EAST_PANEL_CLASS);
addContent(east, pageDefintion);
} catch (Exception e) {}
} 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 = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_LEFT_PANEL_ZUL;
String left = ThemeManager.getLoginLeftPanel();
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(left);
West west = new West();
west.setSclass(ITheme.LOGIN_WEST_PANEL_CLASS);
addContent(west, pageDefintion);
} catch (Exception e){}
} 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 = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_TOP_PANEL_ZUL;
String top = ThemeManager.getLoginTopPanel();
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(top);
North north = new North();
north.setSclass(ITheme.LOGIN_NORTH_PANEL_CLASS);
addContent(north, pageDefintion);
} catch (Exception e) {}
} 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 = ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_BOTTOM_PANEL_ZUL;
String bottom = ThemeManager.getLoginBottomPanel();
PageDefinition pageDefintion = Executions.getCurrent().getPageDefinition(bottom);
South south = new South();
south.setSclass(ITheme.LOGIN_SOUTH_PANEL_CLASS);
addContent(south, pageDefintion);
} catch (Exception e) {}
} 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;
}

View File

@ -55,4 +55,5 @@ public interface ITheme {
//logo
public static final String LOGIN_LOGO_IMAGE = "/images/login-logo.png";
public static final String HEADER_LOGO_IMAGE = "/images/header-logo.png";
public static final String BROWSER_ICON_IMAGE= "/images/icon.png";
}

View File

@ -13,6 +13,7 @@
*****************************************************************************/
package org.adempiere.webui.theme;
import org.adempiere.webui.AdempiereWebUI;
import org.compiere.model.MSysConfig;
/**
@ -49,4 +50,52 @@ public final class ThemeManager {
public static String getTheme() {
return MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
}
/**
* @return title text for the browser window
*/
public static String getBrowserTitle() {
return MSysConfig.getValue("ZK_BROWSER_TITLE", AdempiereWebUI.APP_NAME);
}
/**
* @return url for right panel
*/
public static String getLoginRightPanel() {
String theme = getTheme();
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_RIGHT_PANEL_ZUL;
}
/**
* @return url for left panel
*/
public static String getLoginLeftPanel() {
String theme = getTheme();
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_LEFT_PANEL_ZUL;
}
/**
* @return url for top panel
*/
public static String getLoginTopPanel() {
String theme = getTheme();
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_TOP_PANEL_ZUL;
}
/**
* @return url for bottom panel
*/
public static String getLoginBottomPanel() {
String theme = getTheme();
return ITheme.THEME_PATH_PREFIX + theme + ITheme.LOGIN_BOTTOM_PANEL_ZUL;
}
/**
* @return url for browser icon
*/
public static String getBrowserIcon() {
String theme = getTheme();
String def = ITheme.THEME_PATH_PREFIX + theme + ITheme.BROWSER_ICON_IMAGE;
return MSysConfig.getValue("ZK_BROWSER_ICON", def);
}
}

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.theme.ITheme;
import org.adempiere.webui.theme.ThemeManager;
import org.compiere.Adempiere;
import org.compiere.model.MSysConfig;
import org.compiere.model.MUser;
@ -78,7 +79,7 @@ public class AboutWindow extends Window implements EventListener {
this.setWidth("500px");
this.setHeight("450px");
this.setPosition("center");
this.setTitle(MSysConfig.getValue("ZK_BROWSER_TITLE", "Adempiere"));
this.setTitle(ThemeManager.getBrowserTitle());
this.setClosable(true);
this.setSizable(true);
@ -303,13 +304,8 @@ public class AboutWindow extends Window implements EventListener {
vbox.setAlign("center");
vbox.setPack("center");
vbox.setParent(tabPanel);
String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", null);
if (logoURL == null || logoURL.trim().length() == 0)
{
String theme = MSysConfig.getValue(ITheme.ZK_THEME, ITheme.ZK_THEME_DEFAULT);
logoURL = ITheme.THEME_PATH_PREFIX + theme + ITheme.HEADER_LOGO_IMAGE;
}
Image image = new Image(logoURL);
Image image = new Image(ThemeManager.getSmallLogo());
image.setParent(vbox);
Text text = new Text(Adempiere.getSubtitle());

View File

@ -4,7 +4,7 @@ Copyright (C) 2007 Ashley G Ramdass.
-->
<?page style="height:100%"?>
<?init zscript="theme.zs" ?>
<?link rel="icon" type="image/png" href="/theme/${theme}/images/icon.png"?>
<?link rel="icon" type="image/png" href="${browserIcon}"?>
<?link rel="stylesheet" type="text/css" href="/theme/${theme}/css/theme.css.dsp"?>
<zk>
<window use="org.adempiere.webui.AdempiereWebUI"/>

View File

@ -1,2 +1,4 @@
import org.compiere.model.MSysConfig;
import org.adempiere.webui.theme.ThemeManager;
var theme = MSysConfig.getValue("ZK_THEME", "default");
var browserIcon = ThemeManager.getBrowserIcon();