Class PercentLayoutTag

  • All Implemented Interfaces:
    ConditionalTag, org.apache.commons.jelly.Tag

    public class PercentLayoutTag
    extends LayoutTag

    A specific layout tag that creates a Percent Layout manager.

    With this tag an instance of the powerful percent layout can be created and fully initialized. Configuration of the layout is done by nested tags that define cell constraints (PercentColConstraintsTag or PercentRowConstraintsTag) and cell groups (PercentColGroupTag or PercentRowGroupTag). As an alternative, cell constraints can also be specified using the attributes columns and rows (which override constraints set by nested tags). These attributes can take strings that must match the format expected by percent layout. The constraints must be defined either as string attributes or by nested tags; a mixture of both is not allowed.

    As an additional attribute the canShrink attribute can be specified. It determines the canShrink property of the PercentLayout created by this tag, i.e. the flag whether the layout can shrink below its preferred size. Default value is false.

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

      • PercentLayoutTag

        public PercentLayoutTag()
    • Method Detail

      • getColumns

        public String getColumns()
        Returns the definition of column constraints as string.
        Returns:
        the column constraints definition as string
      • setColumns

        public void setColumns​(String columns)
        Setter method of the columns attribute.
        Parameters:
        columns - the attribute value
      • getRows

        public String getRows()
        Returns the definition of row constraints as string.
        Returns:
        the row constraints definition as string
      • setRows

        public void setRows​(String rows)
        Setter method of the rows attribute.
        Parameters:
        rows - the attribute value
      • isCanShrink

        public boolean isCanShrink()
        Returns the value of the canShrink flag.
        Returns:
        the flag whether the layout can shrink below its preferred size
      • setCanShrink

        public void setCanShrink​(boolean canShrink)
        Sets method of the canShrink attribute.
        Parameters:
        canShrink - the attribute's value
      • getColGroups

        public Collection<CellGroup> getColGroups()
        Returns the collection with the column groups definition.
        Returns:
        the column groups
      • getColConstraints

        public Collection<CellConstraints> getColConstraints()
        Returns the collection with the column constraints.
        Returns:
        the column constraints
      • getRowConstraints

        public Collection<CellConstraints> getRowConstraints()
        Returns the collection with the row constraints.
        Returns:
        the row constraints
      • getRowGroups

        public Collection<CellGroup> getRowGroups()
        Returns the collection with the row groups definition.
        Returns:
        the row groups
      • addColConstraints

        public void addColConstraints​(CellConstraints c)
        Adds the specified constraints object to the list of column constraints.
        Parameters:
        c - the constraints
      • addRowConstraints

        public void addRowConstraints​(CellConstraints c)
        Adds the specified constraints object to the list of row constraints.
        Parameters:
        c - the constraints
      • addColGroup

        public void addColGroup​(CellGroup g)
        Adds the specified cell group object to the list of column groups.
        Parameters:
        g - the cell group
      • addRowGroup

        public void addRowGroup​(CellGroup g)
        Adds the specified cell group object to the list of row groups.
        Parameters:
        g - the cell group
      • getPercentLayout

        public PercentLayoutBase getPercentLayout()
        Returns the percent layout object managed by this tag.
        Returns:
        the percent layout object
      • createLayout

        protected Object createLayout​(ComponentManager manager)
                               throws FormBuilderException,
                                      org.apache.commons.jelly.MissingAttributeException
        Creates the percent layout object.
        Specified by:
        createLayout in class LayoutTag
        Parameters:
        manager - the component manager
        Returns:
        the newly created layout object
        Throws:
        org.apache.commons.jelly.MissingAttributeException - if a required attribute is missing
        FormBuilderException - if an error occurs
      • createPercentLayout

        protected PercentLayoutBase createPercentLayout()
        Creates the PercentLayoutBase object based on the data stored in this tag.
        Returns:
        the newly created layout object