package com.co.lane.print;
import java.io.Serializable;
/**
* 配置文件Item对象,如下的配置文件项目
*
* <pre>
* <Item>
* <ID>BA4D8E36-C8F3-4D91-9169-789EAABA182C</ID>
* <Title></Title>
* <Type>DataBase</Type>
* <Field>Width</Field>
* <Row></Row>
* <Column></Column>
* <Width>250</Width>
* <Alignment></Alignment>
* </Item>
* </pre>
*
* @author Xuyd
*/
public class ConfigDataItem implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
/**
* 打印类型:文字
*/
public static final String PRINTTYPE_TEXT = "Text";
/**
* 打印类型:DB值
*/
public static final String PRINTTYPE_DATABASE = "DataBase";
/**
* 打印类型:线
*/
public static final String PRINTTYPE_LINE = "Line";
/**
* 打印类型:横线
*/
public static final String PRINT_LINE_H = "横线";
/**
* 打印类型:竖线
*/
public static final String PRINT_LINE_V = "竖线";
/**
* 对齐方式:Left
*/
public static final String ALIGNMENT_LEFT = "Far";
/**
* 对齐方式:Center
*/
public static final String ALIGNMENT_CENTER = "Center";
/**
* 对齐方式:Right
*/
public static final String ALIGNMENT_RIGHT = "Near";
/**
* 字段标识符
*/
public static final String FIELD_IDENTIFIER = "@";
/**
* 项目Id
*/
private String ID = null;
/**
* 打印标题(type=Line的时候,Title=【横线/竖线】区分打印横线还是竖线)
*/
private String Title = null;
/**
* 打印类型(Text:项目名称[title],DataBase:项目值[field],Line:线)
*/
private String Type = PRINTTYPE_TEXT;
/**
* 打印的数据库值
*/
private String Field = null;
/**
* 打印位置:Row表示X坐标(毫米)
*/
private double Row = 0.0;
/**
* 打印位置:Column表示Y坐标(毫米)
*/
private double Column = 0.0;
/**
* 表示输出宽度(毫米),打印固定文字或者线的时候用到 e.g:<br>
* type=Line,title=横线 的时候:表示线的宽度<br>
* type=Line,title=竖线 的时候:表示线的高度<br>
*/
private double Width = 0.0;
/**
* 对齐方式:Center
*/
private String Alignment = ALIGNMENT_LEFT;
/**
* 判断当前项目是Text类型
*
* @return
*/
public boolean isText() {
return PRINTTYPE_TEXT.equals(Type);
}
/**
* 判断当前项目是Line类型
*
* @return
*/
public boolean isLine() {
return PRINTTYPE_LINE.equals(Type);
}
/**
* 判断当前项目是Line类型:横线
*
* @return
*/
public boolean isLineH() {
return PRINT_LINE_H.equals(Title);
}
/**
* 判断当前项目是Line类型:竖线
*
* @return
*/
public boolean isLineV() {
return PRINT_LINE_V.equals(Title);
}
/**
* 判断当前项目是DB类型
*
* @return
*/
public boolean isDataBase() {
return PRINTTYPE_DATABASE.equals(Type)
&& (Field != null)
&& (Field.startsWith(FIELD_IDENTIFIER));
}
/**
* 判断当前项目是左对齐
*
* @return
*/
public boolean isAlignLeft() {
return ALIGNMENT_LEFT.equals(Alignment);
}
/**
* 判断当前项目是居中对齐
*
* @return
*/
public boolean isAlignCenter() {
return ALIGNMENT_CENTER.equals(Alignment);
}
/**
* 判断当前项目是右对齐
*
* @return
*/
public boolean isAlignRight() {
return ALIGNMENT_RIGHT.equals(Alignment);
}
// =======================SETTER GETTER =======================
/**
* @return the iD
*/
public String getID() {
return ID;
}
/**
* @param iD
* the iD to set
*/
public void setID(String iD) {
ID = iD;
}
/**
* @return the title
*/
public String getTitle() {
return Title;
}
/**
* @param title
* the title to set
*/
public void setTitle(String title) {
Title = title;
}
/**
* @return the type
*/
public String getType() {
return Type;
}
/**
* @param type
* the type to set
*/
public void setType(String type) {
Type = type;
}
/**
* @return the field
*/
public String getField() {
return Field;
}
/**
* @param field
* the field to set
*/
public void setField(String field) {
Field = field;
}
/**
* @return the row
*/
public double getRow() {
return Row;
}
/**
* @param row
* the row to set
*/
public void setRow(double row) {
Row = row;
}
/**
* @return the column
*/
public double getColumn() {
return Column;
}
/**
* @param column
* the column to set
*/
public void setColumn(double column) {
Column = column;
}
/**
* @return the width
*/
public double getWidth() {
return Width;
}
/**
* @param width
* the width to set
*/
public void setWidth(double width) {
Width = width;
}
/**
* @return the alignment
*/
public String getAlignment() {
return Alignment;
}
/**
* @param alignment
* the alignment to set
*/
public void setAlignment(String alignment) {
Alignment = alignment;
}
}