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

📄 mprinttableformat.java

📁 Java写的ERP系统
💻 JAVA
字号:
/******************************************************************************
 * The contents of this file are subject to the   Compiere License  Version 1.1
 * ("License"); You may not use this file except in compliance with the License
 * You may obtain a copy of the License at http://www.compiere.org/license.html
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Original Code is                  Compiere  ERP & CRM  Business Solution
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc.
 * Portions created by Jorg Janke are Copyright (C) 1999-2002 Jorg Janke, parts
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
 * Contributor(s): ______________________________________.
 *****************************************************************************/
package org.compiere.print;

import java.awt.*;
import java.util.*;

import org.compiere.model.*;
import org.compiere.util.*;

/**
 *	Table Print Format
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: MPrintTableFormat.java,v 1.5 2002/09/16 04:03:12 jjanke Exp $
 */
public class MPrintTableFormat extends PO
{
	/**
	 *	Create Print Table Format
	 *
	 *  @param ctx context
	 *  @param AD_PrintTableFormat_ID table format
	 */
	private MPrintTableFormat (Properties ctx, int AD_PrintTableFormat_ID)
	{
		super (ctx, AD_PrintTableFormat_ID);
		Log.trace(Log.l4_Data, "MPrintTableFormat ID=" + AD_PrintTableFormat_ID);
		if (AD_PrintTableFormat_ID == 0)
		{
		}
	}	//	MPrintTableFormat

	/**
	 *  Initialize and return PO_Info
	 *  @param ctx context
	 *  @return POInfo
	 */
	protected POInfo initPO (java.util.Properties ctx)
	{
		int AD_Table_ID = 523;
		return POInfo.getPOInfo (ctx, AD_Table_ID);
	}	//	initPO

	/*************************************************************************/

	private Font 	standard_Font = new Font(null);

	private Font 	pageHeader_Font;
	private Font 	pageFooter_Font;
	private Color 	pageHeaderFG_Color;
	private Color 	pageHeaderBG_Color;
	private Color 	pageFooterFG_Color;
	private Color 	pageFooterBG_Color;

	private Font	parameter_Font;
	private Color	parameter_Color;

	private Font 	header_Font;
	private Color 	headerFG_Color;
	private Color 	headerBG_Color;
	private Color 	hdrLine_Color;
	private Stroke 	header_Stroke;		//	-

	private Font 	funct_Font;
	private Color 	functFG_Color;
	private Color 	functBG_Color;

	private Color 	lineH_Color;
	private Color 	lineV_Color;
	private Stroke 	lineH_Stroke;	//	-
	private Stroke 	lineV_Stroke = new BasicStroke(0.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f,
		new float[]{2.0f, 2.0f}, 0.0f);	//	|
	//
	private boolean 	paintBoundaryLines = true;
	private boolean 	paintVLines = true;
	private boolean 	paintHLines = true;
	private boolean 	printFunctionSymbols = true;

	/*************************************************************************/

	/**
	 * 	Get Name
	 * 	@return Name
	 */
	public String getName()
	{
		return (String)getValue("Name");
	}

	/**
	 * 	Get Description
	 * 	@return description
	 */
	public String getDescription()
	{
		return (String)getValue("Description");
	}

	/*************************************************************************/

	/**
	 * 	Set Standard Font to derive other fonts if not defined
	 * 	@param standard_Font standard font
	 */
	public void setStandard_Font(Font standard_Font)
	{
		if (standard_Font != null)
			this.standard_Font = standard_Font;
	}

	/**
	 * 	Get Stndard Font
	 * 	@return stndard font
	 */
	public Font getStandard_Font()
	{
		return standard_Font;
	}

	/**
	 * 	Get Table Header Font
	 * 	@return table header font or Bold standard font
	 */
	public Font getHeader_Font()
	{
		if (header_Font != null)
			return header_Font;
		Integer ii = (Integer)getValue("Hdr_PrintFont_ID");
		if (ii != null && ii.intValue() != 0)
			header_Font = MPrintFont.get(ii.intValue()).getFont();
		if (header_Font == null)
			header_Font = new Font (standard_Font.getName(), Font.BOLD, standard_Font.getSize());
		return header_Font;
	}

	/**
	 * 	Get Function Font
	 * 	@return function font or BoldItalic standard font
	 */
	public Font getFunct_Font()
	{
		if (funct_Font != null)
			return funct_Font;
		Integer ii = (Integer)getValue("Funct_PrintFont_ID");
		if (ii != null && ii.intValue() != 0)
			funct_Font = MPrintFont.get(ii.intValue()).getFont();
		if (funct_Font == null)
			funct_Font = new Font (standard_Font.getName(), Font.BOLD|Font.ITALIC, standard_Font.getSize());
		return funct_Font;
	}


	public Font getPageHeader_Font()
	{
		if (pageHeader_Font == null)
			pageHeader_Font = new Font (standard_Font.getName(), Font.BOLD, standard_Font.getSize());
		return pageHeader_Font;
	}
	public Font getParameter_Font()
	{
		if (parameter_Font == null)
			parameter_Font = new Font (standard_Font.getName(), Font.ITALIC, standard_Font.getSize());
		return parameter_Font;
	}
	public Font getPageFooter_Font()
	{
		if (pageFooter_Font == null)
			pageFooter_Font = new Font (standard_Font.getName(), Font.PLAIN, standard_Font.getSize()-2);
		return pageFooter_Font;
	}


	/**
	 * 	Get Header Foreground
	 * 	@return color or standard
	 */
	public Color getHeaderFG_Color()
	{
		if (headerFG_Color != null)
			return headerFG_Color;
		Integer ii = (Integer)getValue("HdrTextFG_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			headerFG_Color = MPrintColor.get(ii.intValue()).getColor();
		if (headerFG_Color == null)
			headerFG_Color = MPrintColor.blackBlue;
		return headerFG_Color;
	}

	/**
	 *  Get Header BG Color
	 *  @return color or standard
	 */
	public Color getHeaderBG_Color()
	{
		if (headerBG_Color != null)
			return headerBG_Color;
		Integer ii = (Integer)getValue("HdrTextBG_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			headerBG_Color = MPrintColor.get(ii.intValue()).getColor();
		if (headerBG_Color == null)
			headerBG_Color = Color.cyan;
		return headerBG_Color;
	}

	/**
	 *  Get Header Line Color
	 *  @return color or standard
	 */
	public Color getHeaderLine_Color()
	{
		if (hdrLine_Color != null)
			return hdrLine_Color;
		Integer ii = (Integer)getValue("HdrLine_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			hdrLine_Color = MPrintColor.get(ii.intValue()).getColor();
		if (hdrLine_Color == null)
			hdrLine_Color = MPrintColor.blackBlue;
		return hdrLine_Color;
	}

	/**
	 *  Get Function BG Color
	 *  @return color or standard
	 */
	public Color getFunctBG_Color()
	{
		if (functBG_Color != null)
			return functBG_Color;
		Integer ii = (Integer)getValue("FunctBG_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			functBG_Color = MPrintColor.get(ii.intValue()).getColor();
		if (functBG_Color == null)
			functBG_Color = Color.white;
		return functBG_Color;
	}

	/**
	 *  Get Function FG Color
	 *  @return color or standard
	 */
	public Color getFunctFG_Color()
	{
		if (functFG_Color != null)
			return functFG_Color;
		Integer ii = (Integer)getValue("FunctFG_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			functFG_Color = MPrintColor.get(ii.intValue()).getColor();
		if (functFG_Color == null)
			functFG_Color = MPrintColor.darkGreen;
		return functFG_Color;
	}


	public Color getPageHeaderFG_Color()
	{
		if (pageHeaderFG_Color == null)
			pageHeaderFG_Color = MPrintColor.blackBlue;
		return pageHeaderFG_Color;
	}
	public Color getPageHeaderBG_Color()
	{
		if (pageHeaderBG_Color == null)
			pageHeaderBG_Color = Color.white;
		return pageHeaderBG_Color;
	}
	public Color getPageFooterFG_Color()
	{
		if (pageFooterFG_Color == null)
			pageFooterFG_Color = MPrintColor.blackBlue;
		return pageFooterFG_Color;
	}
	public Color getPageFooterBG_Color()
	{
		if (pageFooterBG_Color == null)
			pageFooterBG_Color = Color.white;
		return pageFooterBG_Color;
	}
	public Color getParameter_Color()
	{
		if (parameter_Color == null)
			parameter_Color = Color.darkGray;
		return parameter_Color;
	}


	/**
	 *  Get Line Color
	 *  @return color or standard
	 */
	public Color getHLine_Color()
	{
		if (lineH_Color != null)
			return lineH_Color;
		Integer ii = (Integer)getValue("Line_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			lineH_Color = MPrintColor.get(ii.intValue()).getColor();
		if (lineH_Color == null)
			lineH_Color = Color.lightGray;
		return lineH_Color;
	}
	/**
	 *  Get Line Color
	 *  @return color or standard
	 */
	public Color getVLine_Color()
	{
		if (lineV_Color != null)
			return lineV_Color;
		Integer ii = (Integer)getValue("Line_PrintColor_ID");
		if (ii != null && ii.intValue() != 0)
			lineV_Color = MPrintColor.get(ii.intValue()).getColor();
		if (lineV_Color == null)
			lineV_Color = Color.lightGray;
		return lineV_Color;
	}



	public Stroke getHLine_Stroke()
	{
		if (lineH_Stroke == null)
			lineH_Stroke = new BasicStroke(1.0f);	//	-
		return lineH_Stroke;
	}
	public Stroke getVLine_Stroke()
	{
		if (lineV_Stroke == null)
			lineV_Stroke = new BasicStroke(0.5f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f,
				new float[]{2.0f, 2.0f}, 0.0f);
		return lineV_Stroke;
	}
	public Stroke getHeader_Stroke()
	{
		if (header_Stroke == null)
			header_Stroke = new BasicStroke(2.0f);		//	-
		return header_Stroke;
	}


	/**
	 * 	Paint Boundary Lines
	 * 	@return boundary printed
	 */
	public boolean isPaintBoundaryLines()
	{
		Boolean bb = (Boolean)getValue("IsPaintBoundaryLines");
		if (bb != null)
			return bb.booleanValue();
		return paintBoundaryLines;
	}

	/**
	 * 	Print Vertical Lines
	 *  @return vertical printed
	 */
	public boolean isPaintVLines()
	{
		Boolean bb = (Boolean)getValue("IsPaintVLines");
		if (bb != null)
			return bb.booleanValue();
		return paintVLines;
	}

	/**
	 * 	Print Horizonatal Lines
	 *  @return horizontal printed
	 */
	public boolean isPaintHLines()
	{
		Boolean bb = (Boolean)getValue("IsPaintHLines");
		if (bb != null)
			return bb.booleanValue();
		return paintHLines;
	}

	/**
	 * 	Print Function Symbols
	 *  @return symbols printed
	 */
	public boolean isPrintFunctionSymbols()
	{
		Boolean bb = (Boolean)getValue("IsPrintFunctionSymbols");
		if (bb != null)
			return bb.booleanValue();
		return printFunctionSymbols;
	}

	/*************************************************************************/

	/**
	 * 	Get Table Format
	 * 	@param AD_PrintTableFormat_ID table format
	 *  @param standard_font standard font
	 * 	@return Table Format
	 */
	static public MPrintTableFormat get (int AD_PrintTableFormat_ID, Font standard_font)
	{
		MPrintTableFormat tf = new MPrintTableFormat(Env.getCtx(), AD_PrintTableFormat_ID);
		tf.setStandard_Font(standard_font);
		return tf;
	}	//	get

	/**
	 * 	Get Table Format
	 * 	@param AD_PrintTableFormat_ID table format
	 *  @param AD_PrintFont_ID standard font
	 * 	@return Table Format
	 */
	static public MPrintTableFormat get (int AD_PrintTableFormat_ID, int AD_PrintFont_ID)
	{
		return get (AD_PrintTableFormat_ID, MPrintFont.get (AD_PrintFont_ID).getFont());
	}	//	get


}	//	MPrintTableForamt

⌨️ 快捷键说明

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