net.sf.dynamicreports.report.base.style.DRFont Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dynamicreports-core Show documentation
Show all versions of dynamicreports-core Show documentation
DynamicReports is an open source Java reporting library based on
JasperReports. It allows to create dynamic report designs and it doesn't
need a visual report designer.
You can very quickly create reports and produce documents that can be
displayed, printed or exported into many popular formats such as PDF,
Excel, Word and others.
The newest version!
/*
* DynamicReports - Free Java reporting library for creating reports dynamically
*
* Copyright (C) 2010 - 2018 Ricardo Mariaca and the Dynamic Reports Contributors
*
* This file is part of DynamicReports.
*
* DynamicReports is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* DynamicReports is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with DynamicReports. If not, see .
*/
package net.sf.dynamicreports.report.base.style;
import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.definition.style.DRIFont;
import org.apache.commons.lang3.Validate;
/**
* DRFont class.
*
* @author Ricardo Mariaca
*
*/
public class DRFont implements DRIFont {
private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;
private String fontName;
private Integer fontSize;
private Boolean bold;
private Boolean italic;
private Boolean underline;
private Boolean strikeThrough;
private String pdfFontName;
private String pdfEncoding;
private Boolean pdfEmbedded;
/**
* Constructor for DRFont.
*/
public DRFont() {
}
/**
* Constructor for DRFont.
*
* @param fontName a {@link java.lang.String} object.
* @param fontSize a int.
*/
public DRFont(String fontName, int fontSize) {
this.fontName = fontName;
this.setFontSize(fontSize);
}
/**
* Constructor for DRFont.
*
* @param fontName a {@link java.lang.String} object.
* @param bold a boolean.
* @param italic a boolean.
* @param fontSize a int.
*/
public DRFont(String fontName, boolean bold, boolean italic, int fontSize) {
this.fontName = fontName;
this.bold = bold;
this.italic = italic;
this.setFontSize(fontSize);
}
/** {@inheritDoc} */
@Override
public String getFontName() {
return fontName;
}
/**
* Setter for the field fontName
.
*
* @param fontName a {@link java.lang.String} object.
*/
public void setFontName(String fontName) {
this.fontName = fontName;
}
/** {@inheritDoc} */
@Override
public Boolean getBold() {
return bold;
}
/**
* Setter for the field bold
.
*
* @param bold a {@link java.lang.Boolean} object.
*/
public void setBold(Boolean bold) {
this.bold = bold;
}
/** {@inheritDoc} */
@Override
public Boolean getItalic() {
return italic;
}
/**
* Setter for the field italic
.
*
* @param italic a {@link java.lang.Boolean} object.
*/
public void setItalic(Boolean italic) {
this.italic = italic;
}
/** {@inheritDoc} */
@Override
public Boolean getUnderline() {
return underline;
}
/**
* Setter for the field underline
.
*
* @param underline a {@link java.lang.Boolean} object.
*/
public void setUnderline(Boolean underline) {
this.underline = underline;
}
/** {@inheritDoc} */
@Override
public Boolean getStrikeThrough() {
return strikeThrough;
}
/**
* Setter for the field strikeThrough
.
*
* @param strikeThrough a {@link java.lang.Boolean} object.
*/
public void setStrikeThrough(Boolean strikeThrough) {
this.strikeThrough = strikeThrough;
}
/** {@inheritDoc} */
@Override
public Integer getFontSize() {
return fontSize;
}
/**
* Setter for the field fontSize
.
*
* @param fontSize a {@link java.lang.Integer} object.
*/
public void setFontSize(Integer fontSize) {
if (fontSize != null) {
Validate.isTrue(fontSize >= 0, "fontSize must be >= 0");
}
this.fontSize = fontSize;
}
/** {@inheritDoc} */
@Override
public String getPdfFontName() {
return pdfFontName;
}
/**
* Setter for the field pdfFontName
.
*
* @param pdfFontName a {@link java.lang.String} object.
*/
@Deprecated
public void setPdfFontName(String pdfFontName) {
this.pdfFontName = pdfFontName;
}
/** {@inheritDoc} */
@Override
public String getPdfEncoding() {
return pdfEncoding;
}
/**
* Setter for the field pdfEncoding
.
*
* @param pdfEncoding a {@link java.lang.String} object.
*/
@Deprecated
public void setPdfEncoding(String pdfEncoding) {
this.pdfEncoding = pdfEncoding;
}
/** {@inheritDoc} */
@Override
public Boolean getPdfEmbedded() {
return pdfEmbedded;
}
/**
* Setter for the field pdfEmbedded
.
*
* @param pdfEmbedded a {@link java.lang.Boolean} object.
*/
@Deprecated
public void setPdfEmbedded(Boolean pdfEmbedded) {
this.pdfEmbedded = pdfEmbedded;
}
}