⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 brandingutil.java

📁 java阿里巴巴代码
💻 JAVA
字号:
/**
 * BrandingUtil.java
 * @author Alex Lee (comes from Snow's mgrsys.portal.boxin.util.BrandingUtil)
 * @version	1.0.1
 */
package tools.util;



/**
* BrandingUtil is the interface for the page branding.
* you could use it when you create a page object, all of the item 
* comes from the pagestyle.xml. so you could change your web page 
* style by edit the file pagestyle.xml.
*/
public class BrandingUtil
{
	private static String CONFIGFILE = PropertyConfig.getProperty("config.properties", "BRANDING_CONFIG");
	private static XMLProperties prop = null;

	public static String PageHeader(String title)
	{
		return PageHeader("default", title);
	}
	
	public static String PageHeader(String section, String title)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return StringUtil.replace(prop.getProperty(section + ".pageheader"), "[?]", title);
	}

	public static String MenuHeader()
	{
		return MenuHeader("default");
	}

	public static String MenuHeader(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".menuheader");
	}

	public static String PageFooter()
	{
		return PageFooter("default");
	}

	public static String PageFooter(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".pagefooter");
	}

	public static String MenuFooter()
	{
		return MenuFooter("default");
	}

	public static String MenuFooter(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".menufooter");
	}

	public static String pgc() //page background color
	{
		return pgc("default");
	}

	public static String pgc(String section) //page background color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".pgc");
	}

	public static String tbc() //table background color
	{
		return tbc("default");
	}

	public static String tbc(String section) //table background color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbc");
	}

	public static String tth()  //table title height
	{
		return tth("default");
	}
	
	public static String tth(String section)  //table title height
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tth");
	}

	public static String thh()  //table header height
	{
		return thh("default");
	}

	public static String thh(String section)  //table header height
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".thh");
	}

	public static String tch()  //table content height
	{
		return tch("default");
	}

	public static String tch(String section)  //table content height
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tch");
	}

	public static String tfh()  //table footer height
	{
		return tfh("default");
	}

	public static String tfh(String section)  //table footer height
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tfh");
	}

	public static String ttc()  //table title color
	{
		return ttc("default");
	}

	public static String ttc(String section)  //table title color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ttc");
	}

	public static String thc()  //table header color
	{
		return thc("default");
	}

	public static String thc(String section)  //table header color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".thc");
	}

	public static String tcc()  //table content color
	{
		return tcc("default");
	}

	public static String tcc(String section)  //table content color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tcc");
	}

	public static String tfc()  //table footer color
	{
		return tfc("default");
	}
	
	public static String tfc(String section)  //table footer color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tfc");
	}

	public static String tlc()  //table line color
	{
		return tlc("default");
	}

	public static String tlc(String section)  //table line color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tlc");
	}

	public static String TableLine(int colspan) 
	{
		return TableLine(colspan, "default");
	}

	public static String TableLine(int colspan, String section) 
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return StringUtil.replace(prop.getProperty(section + ".tableline"), "[?]", "" + colspan);
	}

	public static String ttf()  //table title font
	{
		return ttf("default");
	}

	public static String ttf(String section)  //table title font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ttf");
	}

	public static String ttfend()
	{
		return ttfend("default");
	}

	public static String ttfend(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ttfend");
	}

	public static String thf()  //table header font
	{
		return thf("default");
	}

	public static String thf(String section)  //table header font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".thf");
	}

	public static String thfend()
	{
		return thfend("default");
	}

	public static String thfend(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".thfend");
	}

	public static String tcf()  //table content font
	{
		return tcf("default");
	}

	public static String tcf(String section)  //table content font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tcf");
	}

	public static String tcfend()
	{
		return tcfend("default");
	}

	public static String tcfend(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tcfend");
	}

	public static String tff()  //table footer font
	{
		return tff("default");
	}
	
	public static String tff(String section)  //table footer font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tff");
	}

	public static String tffend()
	{
		return tffend("default");
	}

	public static String tffend(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tffend");
	}

	public static String hf()  //highlight font
	{
		return hf("default");
	}

	public static String hf(String section)  //highlight font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".hf");
	}

	public static String hfend()
	{
		return hfend("default");
	}

	public static String hfend(String section)
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".hfend");
	}

	public static String tbs()  //text button style
	{
		return tbs("default");
	}

	public static String tbs(String section)  //text button style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbs");
	}

	public static String tbsend()  //text button style
	{
		return tbsend("default");
	}

	public static String tbsend(String section)  //text button style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbsend");
	}

	public static String bs()  //button style
	{
		return bs("default");
	}

	public static String bs(String section)  //button style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".bs");
	}

	public static String ts()  //text style
	{
		return ts("default");
	}
	
	public static String ts1()  //text style
	{
		return ts1("default");
	}

	public static String ts(String section)  //text style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ts");
	}

	public static String ts1(String section)  //text style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ts1");
	}

	public static String tas()  //textarea style
	{
		return tas("default");
	}

	public static String tas(String section)  //textarea style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tas");
	}

	public static String ss()  //select style
	{
		return ss("default");
	}

	public static String ss(String section)  //select style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".ss");
	}

	public static String cs()  //checkbox style
	{
		return cs("default");
	}

	public static String cs(String section)  //checkbox style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".cs");
	}

	public static String rs()  //radio style
	{
		return rs("default");
	}

	public static String rs(String section)  //radio style
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".rs");
	}
	
	public static String mbc() //menu background color
	{
		return mbc("default");
	}
	
	public static String mbc(String section) //menu background color
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".mbc");
	}

	public static String mhf() //menu header font
	{
		return mhf("default");
	}

	public static String mhf(String section) //menu header font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".mhf");
	}

	public static String mhfend() //menu header font
	{
		return mhfend("default");
	}
	
	public static String mhfend(String section) //menu header font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".mhfend");
	}

	public static String mf() //menu font
	{
		return mf("default");
	}

	public static String mf(String section) //menu font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".mf");
	}

	public static String mfend() //menu font
	{
		return mfend("default");
	}

	public static String mfend(String section) //menu font
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".mfend");
	}

	public static int linenum() //Lines of Page
	{
		return linenum("default");
	}

	public static int linenum(String section) //Lines of Page
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return StringUtil.StringToInt(prop.getProperty(section + ".linenum"));
	}
	
	public static String tbp1() //tab backgroud picture 1
	{
		return tbp1("default");
	}

	public static String tbp1(String section) //tab backgroud picture 1
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbp1");
	}

	public static String tbp2() //tab backgroud picture 2
	{
		return tbp2("default");
	}

	public static String tbp2(String section) //tab backgroud picture 2
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbp2");
	}

	public static String tbp3() //tab backgroud picture 3
	{
		return tbp3("default");
	}

	public static String tbp3(String section) //tab backgroud picture 3
	{
		if (prop == null)
			prop = new XMLProperties(BrandingUtil.CONFIGFILE);

		return prop.getProperty(section + ".tbp3");
	}

	public static void main(String[] argv)
	{
		System.out.println(BrandingUtil.TableLine(8));
		System.out.println(BrandingUtil.ts());
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -