📄 mprinttableformat.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 Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.print;
import java.awt.*;
import java.math.*;
import java.sql.*;
import java.util.*;
import org.compiere.model.*;
import java.util.logging.*;
import org.compiere.util.*;
/**
* Table Print Format
*
* @author Jorg Janke
* @version $Id: MPrintTableFormat.java,v 1.14 2005/11/13 23:40:21 jjanke Exp $
*/
public class MPrintTableFormat extends X_AD_PrintTableFormat
{
/**
* Standard Constructor
* @param ctx context
* @param AD_PrintTableFormat_ID table format
*/
public MPrintTableFormat (Properties ctx, int AD_PrintTableFormat_ID, String trxName)
{
super (ctx, AD_PrintTableFormat_ID, trxName);
if (AD_PrintTableFormat_ID == 0)
{
// setName (null);
setIsDefault (false);
setIsPaintHeaderLines (true); // Y
setIsPaintBoundaryLines (false);
setIsPaintHLines (false);
setIsPaintVLines (false);
setIsPrintFunctionSymbols (true);
}
} // MPrintTableFormat
/**
* Load Constructor
* @param ctx context
* @param rs result set
*/
public MPrintTableFormat (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MPrintTableFormat
/*************************************************************************/
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; // |
//
/**************************************************************************
* 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;
} // setStandard_Font
/**
* Get Stndard Font
* @return stndard font
*/
public Font getStandard_Font()
{
return standard_Font;
} // getStandard_Font
/**************************************************************************
* Get Table Header Font
* @return table header font or Bold standard font
*/
public Font getHeader_Font()
{
if (header_Font != null)
return header_Font;
int i = getHdr_PrintFont_ID();
if (i != 0)
header_Font = MPrintFont.get(i).getFont();
if (header_Font == null)
header_Font = new Font (standard_Font.getName(), Font.BOLD, standard_Font.getSize());
return header_Font;
} // getHeader_Font
/**
* Get Header Foreground
* @return color or blue black
*/
public Color getHeaderFG_Color()
{
if (headerFG_Color != null)
return headerFG_Color;
int i = getHdrTextFG_PrintColor_ID();
if (i != 0)
headerFG_Color = MPrintColor.get(getCtx(), i).getColor();
if (headerFG_Color == null)
headerFG_Color = MPrintColor.blackBlue;
return headerFG_Color;
} // getHeaderFG_Color
/**
* Get Header BG Color
* @return color or cyan
*/
public Color getHeaderBG_Color()
{
if (headerBG_Color != null)
return headerBG_Color;
int i = getHdrTextBG_PrintColor_ID();
if (i != 0)
headerBG_Color = MPrintColor.get(getCtx(), i).getColor();
if (headerBG_Color == null)
headerBG_Color = Color.cyan;
return headerBG_Color;
} // getHeaderBG_Color
/**
* Get Header Line Color
* @return color or blue black
*/
public Color getHeaderLine_Color()
{
if (hdrLine_Color != null)
return hdrLine_Color;
int i = getHdrLine_PrintColor_ID();
if (i != 0)
hdrLine_Color = MPrintColor.get(getCtx(), i).getColor();
if (hdrLine_Color == null)
hdrLine_Color = MPrintColor.blackBlue;
return hdrLine_Color;
} // getHeaderLine_Color
/**
* Get Header Stroke
* @return Header Stroke (default solid 2pt)
*/
public Stroke getHeader_Stroke()
{
if (header_Stroke == null)
{
float width = getHdrStroke().floatValue();
if (getHdrStrokeType() == null || HDRSTROKETYPE_SolidLine.equals(getHdrStrokeType()))
header_Stroke = new BasicStroke(width); // -
//
else if (HDRSTROKETYPE_DashedLine.equals(getHdrStrokeType()))
header_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL,
1.0f, getPatternDashed(width), 0.0f); // - -
else if (HDRSTROKETYPE_DottedLine.equals(getHdrStrokeType()))
header_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL,
1.0f, getPatternDotted(width), 0.0f); // . . .
else if (HDRSTROKETYPE_Dash_DottedLine.equals(getHdrStrokeType()))
header_Stroke = new BasicStroke(width, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL,
1.0f, getPatternDash_Dotted(width), 0.0f); // - . -
// default / fallback
if (header_Stroke == null)
header_Stroke = new BasicStroke(width); // -
}
return header_Stroke;
} // getHeader_Stroke
/**
* Get Header Stroke for horizontal Lines
* @return stroke in pt (default 2)
*/
public BigDecimal getHdrStroke()
{
BigDecimal retValue = super.getHdrStroke();
if (retValue == null || Env.ZERO.compareTo(retValue) <= 0)
retValue = new BigDecimal (2.0);
return retValue;
} // getHdrStroke
/**************************************************************************
* Get Function Font
* @return function font or BoldItalic standard font
*/
public Font getFunct_Font()
{
if (funct_Font != null)
return funct_Font;
int i = getFunct_PrintFont_ID();
if (i != 0)
funct_Font = MPrintFont.get(i).getFont();
if (funct_Font == null)
funct_Font = new Font (standard_Font.getName(), Font.BOLD|Font.ITALIC, standard_Font.getSize());
return funct_Font;
} // getFunct_Font
/**
* Get Function BG Color
* @return color or white
*/
public Color getFunctBG_Color()
{
if (functBG_Color != null)
return functBG_Color;
int i = getFunctBG_PrintColor_ID();
if (i != 0)
functBG_Color = MPrintColor.get(getCtx(), i).getColor();
if (functBG_Color == null)
functBG_Color = Color.white;
return functBG_Color;
} // getFunctBG_Color
/**
* Get Function FG Color
* @return color or green dark
*/
public Color getFunctFG_Color()
{
if (functFG_Color != null)
return functFG_Color;
int i = getFunctFG_PrintColor_ID();
if (i != 0)
functFG_Color = MPrintColor.get(getCtx(), i).getColor();
if (functFG_Color == null)
functFG_Color = MPrintColor.darkGreen;
return functFG_Color;
} // getFunctFG_Color
/**************************************************************************
* Get Parameter Font
* @return Italic standard font
*/
public Font getParameter_Font()
{
if (parameter_Font == null)
parameter_Font = new Font (standard_Font.getName(), Font.ITALIC, standard_Font.getSize());
return parameter_Font;
} // getParameter_Font
/**
* Get Parameter Color
* @return dark gray
*/
public Color getParameter_Color()
{
if (parameter_Color == null)
parameter_Color = Color.darkGray;
return parameter_Color;
} // getParameter_Color
/**************************************************************************
* Get Top Page Header Font
* @return Bold standard font
*/
public Font getPageHeader_Font()
{
if (pageHeader_Font == null)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -