forked from fanruan/finekit
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.9 KiB
84 lines
1.9 KiB
6 years ago
|
package com.fanruan.api.report.form.describer;
|
||
|
|
||
|
import com.fanruan.api.util.StringKit;
|
||
|
import com.fr.data.act.Describer;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.stable.StringUtils;
|
||
|
import com.fr.stable.script.CalculatorProvider;
|
||
|
import com.fr.stable.web.Repository;
|
||
|
import com.fr.stable.xml.XMLPrintWriter;
|
||
|
import com.fr.stable.xml.XMLable;
|
||
|
import com.fr.stable.xml.XMLableReader;
|
||
|
|
||
|
/**
|
||
|
* @author richie
|
||
|
* @version 10.0
|
||
|
* Created by richie on 2019-09-10
|
||
|
*/
|
||
|
public class TextDescriber implements Describer, XMLable {
|
||
|
|
||
|
public static final String XML_TAG = "TextDescriber";
|
||
|
|
||
|
private boolean allowBlank = true;
|
||
|
private String errorMessage;
|
||
|
private int fontSize = 12;
|
||
|
|
||
|
public TextDescriber() {
|
||
|
|
||
|
}
|
||
|
|
||
|
public TextDescriber(boolean allowBlank) {
|
||
|
this.allowBlank = allowBlank;
|
||
|
}
|
||
|
|
||
|
public boolean isAllowBlank() {
|
||
|
return this.allowBlank;
|
||
|
}
|
||
|
|
||
|
public void setAllowBlank(boolean allowBlank) {
|
||
|
this.allowBlank = allowBlank;
|
||
|
}
|
||
|
|
||
|
public int getFontSize() {
|
||
|
return this.fontSize;
|
||
|
}
|
||
|
|
||
|
public void setFontSize(int size) {
|
||
|
this.fontSize = size;
|
||
|
}
|
||
|
|
||
|
public String getErrorMessage() {
|
||
|
return errorMessage == null ? StringUtils.EMPTY : errorMessage;
|
||
|
}
|
||
|
|
||
|
public void setErrorMessage(String errorMessage) {
|
||
|
this.errorMessage = errorMessage;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void readXML(XMLableReader xmLableReader) {
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void writeXML(XMLPrintWriter xmlPrintWriter) {
|
||
|
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Object clone() throws CloneNotSupportedException {
|
||
|
return super.clone();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void mixinJSON(Repository repo, CalculatorProvider c, JSONObject jo) {
|
||
|
if (!allowBlank) {
|
||
|
jo.put("allowBlank", true);
|
||
|
}
|
||
|
if (StringKit.isNotEmpty(errorMessage)) {
|
||
|
jo.put("errorMessage", errorMessage);
|
||
|
}
|
||
|
jo.put("fontSize", this.fontSize);
|
||
|
}
|
||
|
}
|