net.sf.jett.tag.Tag Maven / Gradle / Ivy
package net.sf.jett.tag;
import java.util.Map;
import org.apache.poi.ss.usermodel.RichTextString;
import net.sf.jett.model.WorkbookContext;
/**
* A Tag
represents an XML tag that can reside in a
* Cell
. A Tag
represents special processing inside
* its own Block
of Cells
(the tag "body"). Each
* Tag
is responsible for processing its own Block
.
*
* Any concrete subclass of Tag
must have a public, no-argument
* constructor.
*
* @author Randy Gettman
*/
public interface Tag
{
/**
* Returns the name of the Tag
.
* @return The name of the Tag
.
*/
public String getName();
/**
* When a Tag
is created, the attributes are passed in via a
* (possibly empty) Map
of attribute names and values.
* @param attributes A Map
of attribute names and values.
*/
public void setAttributes(Map attributes);
/**
* Sets whether this Tag
is bodiless.
* @param bodiless true
if this tag does not have a body,
* false
if this tag does have a body.
*/
public void setBodiless(boolean bodiless);
/**
* Returns whether this Tag
is bodiless.
* @return true
if this tag does not have a body,
* false
if this tag does have a body.
*/
public boolean isBodiless();
/**
* A Tag
can retrieve its attributes by calling this method.
* @return A Map
of attribute names and attribute values.
*/
public Map getAttributes();
/**
* Sets the TagContext
to which the Tag
is
* associated.
* @param context A TagContext
.
*/
public void setContext(TagContext context);
/**
* Returns the TagContext
to which the Tag
is
* associated.
* @return The associated TagContext
.
*/
public TagContext getContext();
/**
* Sets the WorkbookContext
to which the Tag
is
* associated.
* @param context A WorkbookContext
.
*/
public void setWorkbookContext(WorkbookContext context);
/**
* Returns the WorkbookContext
to which the Tag
is
* associated.
* @return The associated WorkbookContext
.
*/
public WorkbookContext getWorkbookContext();
/**
* Sets the parent Tag
to this Tag
. The parent
* tag is the tag that encloses this tag in the template spreadsheet.
* @param parent The parent Tag
, or null
if none.
* @since 0.9.0
*/
public void setParentTag(Tag parent);
/**
* Returns the parent Tag
to this Tag
. The parent
* tag is the tag that encloses this tag in the template spreadsheet.
* @return The parent Tag
, or null
if none.
* @since 0.9.0
*/
public Tag getParentTag();
/**
* Validates all attributes and attribute values. Processes this
* Tag
.
* For 0.3.0, the methods "checkAttributes" and "process" were removed
* and replace by this method, to allow for additional logic. The methods
* still exist in BaseTag
, where they are called by a concrete
* processTag
method.
* @return true
if the Cell
containing this
* Tag
was transformed, false
if it needs to be
* transformed again. This may happen if the Block
* associated with the Tag
was removed.
* @throws net.sf.jett.exception.TagParseException If all required
* attributes are not present, if there is an unrecognized attribute or
* attribute value, or if any tag data is unacceptable in any other way.
* @since 0.3.0
*/
public boolean processTag();
}