IDEMPIERE-724 Zk: Make iDempiere theme more easily customizable - Added theme preference for trademark text for standard report footer. Peer review.

This commit is contained in:
Heng Sin Low 2013-06-26 12:52:07 +08:00
parent 2e522a9329
commit 1e2ea6386d
6 changed files with 15 additions and 18 deletions

View File

@ -34,7 +34,6 @@ import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.compiere.Adempiere;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DisplayType; import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -337,7 +336,7 @@ public abstract class AbstractExcelExporter
header.setRight(HSSFHeader.page()+ " / "+HSSFHeader.numPages()); header.setRight(HSSFHeader.page()+ " / "+HSSFHeader.numPages());
// Sheet Footer // Sheet Footer
HSSFFooter footer = sheet.getFooter(); HSSFFooter footer = sheet.getFooter();
footer.setLeft(Adempiere.ADEMPIERE_R); footer.setLeft(Env.getStandardReportFooterTrademarkText());
footer.setCenter(Env.getHeader(getCtx(), 0)); footer.setCenter(Env.getHeader(getCtx(), 0));
Timestamp now = new Timestamp(System.currentTimeMillis()); Timestamp now = new Timestamp(System.currentTimeMillis());
footer.setRight(DisplayType.getDateFormat(DisplayType.DateTime, getLanguage()).format(now)); footer.setRight(DisplayType.getDateFormat(DisplayType.DateTime, getLanguage()).format(now));

View File

@ -92,7 +92,7 @@ public final class Adempiere
/** Subtitle */ /** Subtitle */
static public final String SUB_TITLE = "Smart Suite ERP, CRM and SCM"; static public final String SUB_TITLE = "Smart Suite ERP, CRM and SCM";
static public String ADEMPIERE_R = "iDempiere\u00AE"; static public final String ADEMPIERE_R = "iDempiere\u00AE";
static public final String COPYRIGHT = "\u00A9 1999-2013 iDempiere\u00AE"; static public final String COPYRIGHT = "\u00A9 1999-2013 iDempiere\u00AE";
static private String s_ImplementationVersion = null; static private String s_ImplementationVersion = null;

View File

@ -46,7 +46,6 @@ import javax.print.Doc;
import javax.print.DocFlavor; import javax.print.DocFlavor;
import javax.print.attribute.DocAttributeSet; import javax.print.attribute.DocAttributeSet;
import org.compiere.Adempiere;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MQuery; import org.compiere.model.MQuery;
import org.compiere.model.MTable; import org.compiere.model.MTable;
@ -961,7 +960,7 @@ public class LayoutEngine implements Pageable, Printable, Doc
font = tf.getPageFooter_Font(); font = tf.getPageFooter_Font();
color = tf.getPageFooterFG_Color(); color = tf.getPageFooterFG_Color();
// //
element = new StringElement(Adempiere.ADEMPIERE_R, font, color, null, true); element = new StringElement(Env.getStandardReportFooterTrademarkText(), font, color, null, true);
/** You can use the following to customize reports for your product name */ /** You can use the following to customize reports for your product name */
// element = new StringElement(Adempiere.NAME, font, color, null, true); // element = new StringElement(Adempiere.NAME, font, color, null, true);
element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft); element.layout (m_footer.width, 0, true, MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft);

View File

@ -49,6 +49,7 @@ import org.adempiere.base.Core;
import org.adempiere.base.IResourceFinder; import org.adempiere.base.IResourceFinder;
import org.adempiere.util.IProcessUI; import org.adempiere.util.IProcessUI;
import org.adempiere.util.ServerContextProvider; import org.adempiere.util.ServerContextProvider;
import org.compiere.Adempiere;
import org.compiere.db.CConnection; import org.compiere.db.CConnection;
import org.compiere.model.GridWindowVO; import org.compiere.model.GridWindowVO;
import org.compiere.model.I_AD_Window; import org.compiere.model.I_AD_Window;
@ -73,6 +74,8 @@ import org.compiere.process.SvrProcess;
*/ */
public final class Env public final class Env
{ {
public static final String STANDARD_REPORT_FOOTER_TRADEMARK_TEXT = "#STANDARD_REPORT_FOOTER_TRADEMARK_TEXT";
public static final String AD_ROLE_ID = "#AD_Role_ID"; public static final String AD_ROLE_ID = "#AD_Role_ID";
public static final String AD_USER_ID = "#AD_User_ID"; public static final String AD_USER_ID = "#AD_User_ID";
@ -1772,6 +1775,14 @@ public final class Env
return (ProcessInfo) ctx.get(SvrProcess.PROCESS_INFO_CTX_KEY); return (ProcessInfo) ctx.get(SvrProcess.PROCESS_INFO_CTX_KEY);
} }
/**
* @return trademark text for standard report footer
*/
public static String getStandardReportFooterTrademarkText() {
String s = Env.getContext(Env.getCtx(), STANDARD_REPORT_FOOTER_TRADEMARK_TEXT);
return Util.isEmpty(s) ? Adempiere.ADEMPIERE_R : s;
}
/************************************************************************** /**************************************************************************
* Static Variables * Static Variables
*/ */

View File

@ -41,7 +41,6 @@ import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.util.BrowserToken; import org.adempiere.webui.util.BrowserToken;
import org.adempiere.webui.util.UserPreference; import org.adempiere.webui.util.UserPreference;
import org.compiere.Adempiere;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MSession; import org.compiere.model.MSession;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
@ -133,8 +132,6 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
{ {
this.getPage().setTitle(ThemeManager.getBrowserTitle()); this.getPage().setTitle(ThemeManager.getBrowserTitle());
Adempiere.ADEMPIERE_R = ThemeManager.getStandardReportFooterTrademarkText();
SessionManager.setSessionApplication(this); SessionManager.setSessionApplication(this);
Session session = Executions.getCurrent().getDesktop().getSession(); Session session = Executions.getCurrent().getDesktop().getSession();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -16,7 +16,6 @@ package org.adempiere.webui.theme;
import java.io.IOException; import java.io.IOException;
import org.adempiere.webui.AdempiereWebUI; import org.adempiere.webui.AdempiereWebUI;
import org.compiere.Adempiere;
import org.compiere.model.MClientInfo; import org.compiere.model.MClientInfo;
import org.compiere.model.MImage; import org.compiere.model.MImage;
import org.compiere.model.MSysConfig; import org.compiere.model.MSysConfig;
@ -144,13 +143,5 @@ public final class ThemeManager {
} else { } else {
return null; return null;
} }
} }
/**
* @return trademark text for standard report footer
*/
public static String getStandardReportFooterTrademarkText() {
String s = Env.getContext(Env.getCtx(), "#ZK_STANDARD_REPORT_FOOTER_TRADEMARK_TEXT");
return Util.isEmpty(s) ? Adempiere.ADEMPIERE_R : s;
}
} }