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

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

There is a newer version: 0.5.5
Show newest version

package com.alphasystem.docx4j.builder.wml;

import com.alphasystem.docx4j.builder.OpenXmlBuilder;
import org.docx4j.wml.TblWidth;
import org.docx4j.wml.TcMar;


/**
 * Fluent API builder for org.docx4j.wml.TcMar.
 * 
 */
public class TcMarBuilder
    extends OpenXmlBuilder
{


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

    /**
     * Initialize the builder with given object.
     * 
     * @param object
     *     the given object
     */
    public TcMarBuilder(TcMar 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 TcMarBuilder(TcMar src, TcMar target) {
        this(target);
        if (src!= null) {
            TblWidth top = src.getTop();
            if (top!= null) {
                top = new com.alphasystem.docx4j.builder.wml.TblWidthBuilder(top, object.getTop()).getObject();
            }
            TblWidth left = src.getLeft();
            if (left!= null) {
                left = new com.alphasystem.docx4j.builder.wml.TblWidthBuilder(left, object.getLeft()).getObject();
            }
            TblWidth bottom = src.getBottom();
            if (bottom!= null) {
                bottom = new com.alphasystem.docx4j.builder.wml.TblWidthBuilder(bottom, object.getBottom()).getObject();
            }
            TblWidth right = src.getRight();
            if (right!= null) {
                right = new com.alphasystem.docx4j.builder.wml.TblWidthBuilder(right, object.getRight()).getObject();
            }
            withTop(top).withLeft(left).withBottom(bottom).withRight(right);
        }
    }

    protected TcMar createObject() {
        return WmlBuilderFactory.OBJECT_FACTORY.createTcMar();
    }

    public TcMarBuilder withTop(TblWidth value) {
        if (value!= null) {
            object.setTop(value);
        }
        return this;
    }

    public TcMarBuilder withLeft(TblWidth value) {
        if (value!= null) {
            object.setLeft(value);
        }
        return this;
    }

    public TcMarBuilder withBottom(TblWidth value) {
        if (value!= null) {
            object.setBottom(value);
        }
        return this;
    }

    public TcMarBuilder withRight(TblWidth value) {
        if (value!= null) {
            object.setRight(value);
        }
        return this;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy