package cn.wise.sc.energy.power.plant.business.utils.poi.xwpftable;

import cn.wise.sc.energy.power.plant.business.utils.poi.styles.Style;

import javax.validation.constraints.NotNull;
import java.util.LinkedList;
import java.util.List;

/**
 * @author qilei
 * @since 2018-05-15 13:45
 */
public class ToolXWPFCell {
    /**
     * 中间的字符串随便填只要不跟真的文档重复就行了，这个字符应当不会重复的吧。
     */
    public final static ToolXWPFCell CONTINUE = new ToolXWPFCell("{{emptyCell");
    private List<ToolXwpfRun> runs;

    public ToolXWPFCell(String content) {
        runs = new LinkedList<>();
        runs.add(new ToolXwpfRun(content));
    }

    public ToolXWPFCell(String content, @NotNull Style style) {
        runs = new LinkedList<>();
        runs.add(new ToolXwpfRun(content, style));
    }

    public ToolXWPFCell(ToolXwpfRun... runs) {
        this.runs = new LinkedList<>();
        for (int i = 0; i < runs.length; i++) {
            this.runs.add(new ToolXwpfRun(runs[i].getContent(), runs[i].getStyle()));
        }
    }


    public List<ToolXwpfRun> getRuns() {
        return runs;
    }

    public void setRuns(List<ToolXwpfRun> runs) {
        this.runs = runs;
    }
}
