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

io.legaldocml.akn.element.Td Maven / Gradle / Ivy

package io.legaldocml.akn.element;

import com.google.common.collect.ImmutableMap;
import io.legaldocml.akn.AknAttributes;
import io.legaldocml.akn.attribute.CellAttrs;
import io.legaldocml.io.CharArray;
import io.legaldocml.io.Externalizable;
import io.legaldocml.io.XmlWriter;
import io.legaldocml.io.impl.Buffers;

import java.io.IOException;
import java.util.function.BiConsumer;

import static io.legaldocml.akn.AknElements.TD;
import static io.legaldocml.akn.element.Attributes.biConsumerInteger;
import static io.legaldocml.akn.util.XmlWriterHelper.writeCellAttrs;
import static io.legaldocml.unsafe.UnsafeHelper.getFieldOffset;

/**
 * The element td is an HTML element and is used in Akoma Ntoso as in HTML, for a data cell of a table.
 *
 * 
 *   
 * 	   
 * 	     
 * 		   
 * 		     
 * 		   
 * 		 
 * 	   
 *   
 * 
* * @author Jacques Militello */ public final class Td extends Blocksopt implements CellAttrs, TrElement, SubFlowStructureElement { /** * Memory address. */ private static final long ADDRESS_TD = Buffers.address(TD); private static final ImmutableMap> ATTRIBUTES; static { ATTRIBUTES = ImmutableMap.>builder() .putAll(Blocksopt.ATTRIBUTES) .put(AknAttributes.COL_SPAN, biConsumerInteger(getFieldOffset(Td.class, "colSpan"))) .put(AknAttributes.ROW_SPAN, biConsumerInteger(getFieldOffset(Td.class, "rowSpan"))) .build(); } private Integer rowSpan; private Integer colSpan; /** * {@inheritDoc} */ public Integer getRowSpan() { return this.rowSpan; } /** * {@inheritDoc} */ public void setRowSpan(Integer rowspan) { this.rowSpan = rowspan; } /** * {@inheritDoc} */ public Integer getColSpan() { return this.colSpan; } /** * {@inheritDoc} */ public void setColSpan(Integer colspan) { this.colSpan = colspan; } /** * {@inheritDoc} */ @Override public void write(XmlWriter writer) throws IOException { writer.writeStart(ADDRESS_TD, 2); writeCellAttrs(writer, this); super.write(writer); writer.writeEnd(ADDRESS_TD, 2); } /** * {@inheritDoc} */ @Override public ImmutableMap> attributes() { return ATTRIBUTES; } /** * {@inheritDoc} */ @Override public String name() { return TD; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy