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

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


package com.alphasystem.docx4j.builder.wml;

import java.util.List;
import com.alphasystem.docx4j.builder.OpenXmlBuilder;
import org.docx4j.wml.CTTblGridChange;
import org.docx4j.wml.TblGrid;
import org.docx4j.wml.TblGridCol;


/**
 * Fluent API builder for org.docx4j.wml.TblGrid.
 * 
 */
public class TblGridBuilder
    extends OpenXmlBuilder
{


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

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public TblGridBuilder(TblGrid 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 TblGridBuilder(TblGrid src, TblGrid target) {
        this(target);
        if (src!= null) {
            CTTblGridChange tblGridChange = src.getTblGridChange();
            if (tblGridChange!= null) {
                tblGridChange = new CTTblGridChangeBuilder(tblGridChange, object.getTblGridChange()).getObject();
            }
            List gridCol = src.getGridCol();
            for (TblGridCol o: gridCol) {
                addGridCol(new com.alphasystem.docx4j.builder.wml.TblGridColBuilder(o, null).getObject());
            }
            withTblGridChange(tblGridChange);
        }
    }

    protected TblGrid createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createTblGrid();
    }

    public TblGridBuilder withTblGridChange(CTTblGridChange value) {
        if (value!= null) {
            object.setTblGridChange(value);
        }
        return this;
    }

    public TblGridBuilder addGridCol(TblGridCol... value) {
        addContent(object.getGridCol(), value);
        return this;
    }

    public TblGridBuilder addGridCol(Long... w) {
        if (hasContent(w)) {
            for (Long o: w) {
                addGridCol(new com.alphasystem.docx4j.builder.wml.TblGridColBuilder().withW(o).getObject());
            }
        }
        return this;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy