Class PercentCellConstraintsTag
- java.lang.Object
-
- org.apache.commons.jelly.TagSupport
-
- net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
-
- net.sf.jguiraffe.gui.builder.components.tags.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 oneCellConstraints
object. The constraints (as strings) are specified using theconstr
attribute. The text value of this attribute must be understandable by theCellConstraints
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 Summary
Constructors Constructor Description PercentCellConstraintsTag()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
addConstraints(PercentLayoutTag parent, CellConstraints c)
Passes the newly created constraints object to the corresponding percent layout tag.protected abstract CellConstraints
createConstraints()
Creates the constraints object for the string defined by the user.String
getConstr()
Returns the constraints as string.protected static CellConstraints.Builder
getConstraintsBuilder(org.apache.commons.jelly.JellyContext context, String name, CellAlignment defAlignment)
Returns theCellConstraints.Builder
for creatingCellConstraints
objects with the given name.protected void
process()
Executes this tag.void
setConstr(String constr)
Setter method for the constr attribute.-
Methods inherited from class net.sf.jguiraffe.gui.builder.components.tags.FormBaseTag
canProcess, canProcess, convertToClass, convertToNumberWithUnit, convertToNumberWithUnit, doTag, findContainer, getBuilderData, getBuilderData, getIfName, getResourceText, getResourceText, getUnlessName, processBeforeBody, setIfName, setUnlessName
-
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
-
-
-
-
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 thecreateConstraints()
andaddConstraints()
methods to create and initialize the constraints object.- Specified by:
process
in classFormBaseTag
- 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 theCellConstraints.Builder
for creatingCellConstraints
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 contextname
- the name of the variable which stores the builderdefAlignment
- 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 tagc
- the constraints object
-
-