Class PercentCellConstraintsTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag
    Direct Known Subclasses:
    PercentColConstraintsTag, PercentRowConstraintsTag

    public abstract class PercentCellConstraintsTag
    extends FormBaseTag

    An abstract base class for tags that define cell constraints of a percent layout.

    Sub classes of this tag handler class can appear in the body of a PercentLayoutTag tag to define constraints for rows or columns. Each of these tags fully defines one CellConstraints object. The constraints (as strings) are specified using the constr attribute. The text value of this attribute must be understandable by the CellConstraints class. This is an alternative for defining all cell constraints in a single string.

    This base class implements the major functionality. Sub classes have to deal with creating the correct constraints object and passing it to the tag defining the percent layout.

    Version:
    $Id: PercentCellConstraintsTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • PercentCellConstraintsTag

        public PercentCellConstraintsTag()
    • Method Detail

      • getConstr

        public String getConstr()
        Returns the constraints as string.
        Returns:
        the constraints
      • setConstr

        public void setConstr​(String constr)
        Setter method for the constr attribute.
        Parameters:
        constr - the attribute value
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Executes this tag. Calls the createConstraints() and addConstraints() methods to create and initialize the constraints object.
        Specified by:
        process in class FormBaseTag
        Throws:
        org.apache.commons.jelly.JellyTagException - if no parent tag can be found
      • getConstraintsBuilder

        protected static CellConstraints.Builder getConstraintsBuilder​(org.apache.commons.jelly.JellyContext context,
                                                                       String name,
                                                                       CellAlignment defAlignment)
        Returns the CellConstraints.Builder for creating CellConstraints objects with the given name. Constraints builders are stored in the Jelly context, one for each type of constraints (rows and columns). They are created on demand and then shared between all tags that need to create constraints objects. Note: As the Jelly context is confined to a single thread, this is no problem, and no synchronization is needed.
        Parameters:
        context - the Jelly context
        name - the name of the variable which stores the builder
        defAlignment - the default alignment of the builder
        Returns:
        the CellConstraints.Builder
      • createConstraints

        protected abstract CellConstraints createConstraints()
        Creates the constraints object for the string defined by the user. This method must be defined in a concrete sub class to either return a column or a row constraints object.
        Returns:
        the constraints
      • addConstraints

        protected abstract void addConstraints​(PercentLayoutTag parent,
                                               CellConstraints c)
        Passes the newly created constraints object to the corresponding percent layout tag. This method must be defined by concrete sub classes to call the correct setter method of the parent tag.
        Parameters:
        parent - the percent layout tag
        c - the constraints object