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

📄 mprintformatitem.java

📁 Java写的ERP系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
 * 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.util.*;
import java.sql.*;

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

/**
 *	Print Format Item Model
 *
 * 	@author 	Jorg Janke
 * 	@version 	$Id: MPrintFormatItem.java,v 1.24 2003/04/29 09:31:05 jpedersen Exp $
 */
public class MPrintFormatItem extends PO
{
	/**
	 *	Constructor
	 *  @param ctx context
	 *  @param AD_PrintFormatItem_ID AD_PrintFormatItem_ID
	 */
	public MPrintFormatItem (Properties ctx, int AD_PrintFormatItem_ID)
	{
		super (ctx, AD_PrintFormatItem_ID);
		//	Default Setting
		if (AD_PrintFormatItem_ID == 0)
		{
			setFieldAlignmentType(FIELD_ALIGN_DEFAULT);
			setLineAlignmentType(LINE_ALIGN_NONE);
			setPrintFormatType(FORMATTYPE_TEXT);
			setPrintAreaType(AREA_CONTENT);
			//
			setRelativePosition(true);
			setNextLine(false);
			setNextPage(false);
			setSetNLPosition(false);
			setXspace(0);
			setYspace(0);
			setXposition(0);
			setYposition(0);
			setMaxWidth(0);
			setFixedWidth(false);
			setHeightOneLine(false);
			setMaxHeight(0);
			//
			setOrderBy(false);
			setSortNo(0);
			setGroupBy(false);
			setPageBreak(false);
			setSummarized(false);
			setAveraged(false);
			setCounted(false);
			setImageIsAttached(false);
			setSuppressNull(false);
		}
	}	//	MPrintFormatItem

	/**
	 *	Constructor
	 *  @param ctx context
	 *  @param rs ResultSet
	 */
	public MPrintFormatItem (Properties ctx, ResultSet rs)
	{
		super (ctx, rs);
	}	//	MPrintFormatItem


	/**	Locally cached column name			*/
	private String 		m_columnName = null;
	/** Locally cached label translations			*/
	private HashMap		m_translationLabel;
	/** Locally cached suffix translations			*/
	private HashMap		m_translationSuffix;

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

	static public final String	FIELD_ALIGN_DEFAULT	= "D";
	static public final String	FIELD_ALIGN_LEADING = "L";
	static public final String	FIELD_ALIGN_TRAILING = "T";
	static public final String	FIELD_ALIGN_BLOCK = "B";
	static public final String	FIELD_ALIGN_CENTER = "C";
	//
	static public final String	LINE_ALIGN_NONE ="X";
	static public final String	LINE_ALIGN_LEADING ="L";
	static public final String	LINE_ALIGN_CENTER = "C";
	static public final String	LINE_ALIGN_TRAILING = "T";
	//
	static public final String	FORMATTYPE_FIELD = "F";
	static public final String	FORMATTYPE_TEXT = "T";
	static public final String	FORMATTYPE_PRINTFORMAT = "P";
	static public final String	FORMATTYPE_IMAGE = "I";
	//
	static public final String	AREA_CONTENT = "C";
	static public final String	AREA_HEADER = "H";
	static public final String	AREA_FOOTER = "F";

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

	/**
	 * 	Set Name
	 * 	@param name name
	 */
	public void setName (String name)
	{
		setValue("Name", name);
	}
	public String getName()
	{
		return (String)getValue("Name");
	}

	/**
	 * 	Set (base language) Print Name
	 * 	@param printName print name
	 */
	public void setPrintName (String printName)
	{
		setValue("PrintName", printName);
	}	//	setPrintName
	/**
	 *	Get (base language) Print Name
	 *  @return print name
	 */
	private String getPrintName()
	{
		return (String)getValue("PrintName");
	}	//	getPrintName

	/**
	 *	Get print name with language
	 * 	@param language language - ignored if IsMultiLingualDocument not 'Y'
	 * 	@return print name
	 */
	public String getPrintName (Language language)
	{
		if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem"))
			return getPrintName();
		loadTranslations();
		String retValue = (String)m_translationLabel.get(language.getAD_Language());
		if (retValue == null || retValue.length() == 0)
			return getPrintName();
		return retValue;
	}	//	getPrintName

	/**
	 * 	Load Translations
	 */
	private void loadTranslations()
	{
		if (m_translationLabel == null)
		{
			m_translationLabel = new HashMap();
			m_translationSuffix = new HashMap();
			String sql = "SELECT AD_Language, PrintName, PrintNameSuffix FROM AD_PrintFormatItem_Trl WHERE AD_PrintFormatItem_ID=?";
			try
			{
				PreparedStatement pstmt = DB.prepareStatement(sql);
				pstmt.setInt(1, getID());
				ResultSet rs = pstmt.executeQuery();
				while (rs.next())
				{
					m_translationLabel.put (rs.getString (1), rs.getString (2));
					m_translationSuffix.put (rs.getString (1), rs.getString (3));
				}
				rs.close();
				pstmt.close();
			}
			catch (SQLException e)
			{
				Log.error("MPrintFormatItem.loadTranslations", e);
			}
		}
	}	//	loadTranslations

	/**
	 * 	Set (base language) Print Name Suffix
	 * 	@param printNameSuffix print name suffix
	 */
	public void setPrintNameSuffix (String printNameSuffix)
	{
		setValue("PrintNameSuffix", printNameSuffix);
	}	//	setPrintNameSuffix
	/**
	 *	Get (base language) Print Name Suffix
	 *  @return print name suffix
	 */
	private String getPrintNameSuffix()
	{
		return (String)getValue("PrintNameSuffix");
	}	//	getPrintName

	/**
	 *	Get print name suffix with language
	 * 	@param language language - ignored if IsMultiLingualDocument not 'Y'
	 * 	@return print name suffix
	 */
	public String getPrintNameSuffix (Language language)
	{
		if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem"))
			return getPrintNameSuffix();
		loadTranslations();
		String retValue = (String)m_translationSuffix.get(language.getAD_Language());
		if (retValue == null || retValue.length() == 0)
			return getPrintNameSuffix();
		return retValue;
	}	//	getPrintNameSuffix


	/**
	 * 	Set Area
	 * 	@param printAreaType Area
	 */
	public void setPrintAreaType (String printAreaType)
	{
		setValue("PrintAreaType", printAreaType);
	}
	public String getPrintAreaType()
	{
		return (String)getValue("PrintAreaType");
	}
	public boolean isHeader()
	{
		return getPrintAreaType().equals(AREA_HEADER);
	}
	public boolean isContent()
	{
		return getPrintAreaType().equals(AREA_CONTENT);
	}
	public boolean isFooter()
	{
		return getPrintAreaType().equals(AREA_FOOTER);
	}

	/**
	 * 	Set Format Type
	 * 	@param printFormatType format Type
	 */
	public void setPrintFormatType (String printFormatType)
	{
		setValue("PrintFormatType", printFormatType);
	}
	public String getPrintFormatType()
	{
		return (String)getValue("PrintFormatType");
	}
	public boolean isTypeField()
	{
		return getPrintFormatType().equals(FORMATTYPE_FIELD);
	}
	public boolean isTypeText()
	{
		return getPrintFormatType().equals(FORMATTYPE_TEXT);
	}
	public boolean isTypePrintFormat()
	{
		return getPrintFormatType().equals(FORMATTYPE_PRINTFORMAT);
	}
	public boolean isTypeImage()
	{
		return getPrintFormatType().equals(FORMATTYPE_IMAGE);
	}

	/**
	 * 	Set Field Alignment
	 * 	@param fieldAlignmentType field alignment
	 */
	public void setFieldAlignmentType (String fieldAlignmentType)
	{
		setValue("FieldAlignmentType", fieldAlignmentType);
	}
	public String getFieldAlignmentType()
	{
		return (String)getValue("FieldAlignmentType");
	}
	public boolean isFieldCenter()
	{
		return getFieldAlignmentType().equals(FIELD_ALIGN_CENTER);
	}
	public boolean isFieldAlignLeading()
	{
		return getFieldAlignmentType().equals(FIELD_ALIGN_LEADING);
	}
	public boolean isFieldAlignTrailing()
	{
		return getFieldAlignmentType().equals(FIELD_ALIGN_TRAILING);
	}
	public boolean isFieldAlignBlock()
	{
		return getFieldAlignmentType().equals(FIELD_ALIGN_BLOCK);
	}
	public boolean isFieldAlignDefault()
	{
		return getFieldAlignmentType().equals(FIELD_ALIGN_DEFAULT);
	}

	/**
	 *	Set Line Alignment
	 * 	@param lineAlignmentType line alignment
	 */
	public void setLineAlignmentType (String lineAlignmentType)
	{
		setValue("LineAlignmentType", lineAlignmentType);
	}
	public String getLineAlignmentType()
	{
		return (String)getValue("LineAlignmentType");
	}
	public boolean isLineAlignCenter()
	{
		return getLineAlignmentType().equals(LINE_ALIGN_CENTER);
	}
	public boolean isLineAlignLeading()
	{
		return getLineAlignmentType().equals(LINE_ALIGN_LEADING);
	}
	public boolean isLineAlignTrailing()
	{
		return getLineAlignmentType().equals(LINE_ALIGN_TRAILING);
	}

	/**
	 * 	Set Printed
	 * 	@param printed printed
	 */
	public void setPrinted (boolean printed)
	{
		setValue("IsPrinted", new Boolean(printed));
	}
	public boolean isPrinted()
	{
		return ((Boolean)getValue("IsPrinted")).booleanValue();
	}

	/**
	 * 	Set Relative Position
	 * 	@param relativePosition relative position
	 */
	public void setRelativePosition (boolean relativePosition)
	{
		setValue("IsRelativePosition", new Boolean(relativePosition));
	}
	public boolean isRelativePosition()
	{
		return ((Boolean)getValue("IsRelativePosition")).booleanValue();
	}

	/**
	 * 	Set Next Line
	 * 	@param nextLine next line
	 */
	public void setNextLine (boolean nextLine)
	{
		setValue("IsNextLine", new Boolean(nextLine));
	}
	public boolean isNextLine()
	{
		return ((Boolean)getValue("IsNextLine")).booleanValue();
	}

	/**
	 * 	Set Next Page
	 * 	@param nextPage next page
	 */
	public void setNextPage (boolean nextPage)
	{
		setValue("IsNextPage", new Boolean(nextPage));
	}
	public boolean isNextPage()
	{
		return ((Boolean)getValue("IsNextPage")).booleanValue();
	}

	/**
	 * 	Set Next Line Position
	 * 	@param setNLPosition set Next Line Position
	 */
	public void setSetNLPosition (boolean setNLPosition)
	{
		setValue("IsSetNLPosition", new Boolean(setNLPosition));
	}
	public boolean isSetNLPosition()
	{
		return ((Boolean)getValue("IsSetNLPosition")).booleanValue();
	}

	/**
	 * 	Set Supress Print if field/column is null
	 * 	@param supressNull supress null values
	 */
	public void setSuppressNull (boolean supressNull)
	{
		setValue("IsSuppressNull", new Boolean(supressNull));
	}
	public boolean isSuppressNull()
	{
		return ((Boolean)getValue("IsSuppressNull")).booleanValue();
	}

	/**
	 * 	Set Fixed Width
	 * 	@param fixedWidth Fixed Width
	 */
	public void setFixedWidth (boolean fixedWidth)
	{
		setValue("IsFixedWidth", new Boolean(fixedWidth));
	}
	public boolean isFixedWidth()
	{
		return ((Boolean)getValue("IsFixedWidth")).booleanValue();
	}

	/**
	 * 	Set One Line
	 * 	@param heightOneLine one line
	 */
	public void setHeightOneLine (boolean heightOneLine)
	{
		setValue("IsHeightOneLine", new Boolean(heightOneLine));
	}
	public boolean isHeightOneLine()
	{

⌨️ 快捷键说明

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