All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alphasystem.docx4j.builder.wml.TrBuilder Maven / Gradle / Ivy

There is a newer version: 0.5.5
Show newest version

package com.alphasystem.docx4j.builder.wml;

import java.util.List;
import com.alphasystem.docx4j.builder.OpenXmlBuilder;
import org.docx4j.wml.CTTblPrEx;
import org.docx4j.wml.Tr;
import org.docx4j.wml.TrPr;


/**
 * Fluent API builder for org.docx4j.wml.Tr.
 * 
 */
public class TrBuilder
    extends OpenXmlBuilder
{


    /**
     * Initialize the underlying object.
     * 
     */
    public TrBuilder() {
        this(null);
    }

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public TrBuilder(Tr object) {
        super(object);
    }

    /**
     * Copies values fom src into target. Values of target will be overridden by the values from src.
     * 
     * @param src
     *     source object
     * @param target
     *     target object
     */
    public TrBuilder(Tr src, Tr target) {
        this(target);
        if (src!= null) {
            CTTblPrEx tblPrEx = src.getTblPrEx();
            if (tblPrEx!= null) {
                tblPrEx = new CTTblPrExBuilder(tblPrEx, object.getTblPrEx()).getObject();
            }
            TrPr trPr = src.getTrPr();
            if (trPr!= null) {
                trPr = new TrPrBuilder(trPr, object.getTrPr()).getObject();
            }
            List content = src.getContent();
            for (Object o: content) {
                addContent(WmlBuilderFactory.cloneObject(o));
            }
            withTblPrEx(tblPrEx).withTrPr(trPr).withRsidRPr(src.getRsidRPr()).withRsidR(src.getRsidR()).withRsidDel(src.getRsidDel()).withRsidTr(src.getRsidTr()).withParaId(src.getParaId()).withTextId(src.getTextId());
        }
    }

    protected Tr createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createTr();
    }

    public TrBuilder withTblPrEx(CTTblPrEx value) {
        if (value!= null) {
            object.setTblPrEx(value);
        }
        return this;
    }

    public TrBuilder withTrPr(TrPr value) {
        if (value!= null) {
            object.setTrPr(value);
        }
        return this;
    }

    public TrBuilder addContent(Object... value) {
        addContent(object.getContent(), value);
        return this;
    }

    public TrBuilder withRsidRPr(String value) {
        if (value!= null) {
            object.setRsidRPr(value);
        }
        return this;
    }

    public TrBuilder withRsidR(String value) {
        if (value!= null) {
            object.setRsidR(value);
        }
        return this;
    }

    public TrBuilder withRsidDel(String value) {
        if (value!= null) {
            object.setRsidDel(value);
        }
        return this;
    }

    public TrBuilder withRsidTr(String value) {
        if (value!= null) {
            object.setRsidTr(value);
        }
        return this;
    }

    public TrBuilder withParaId(String value) {
        if (value!= null) {
            object.setParaId(value);
        }
        return this;
    }

    public TrBuilder withTextId(String value) {
        if (value!= null) {
            object.setTextId(value);
        }
        return this;
    }

}