| java.lang.Object org.apache.velocity.tools.generic.AlternatorTool
AlternatorTool | public class AlternatorTool (Code) | | Simple tool to provide easy in-template instantiation of
Alternator s from varying "list" types.
Example Use:
toolbox.xml...
<tool>
<key>alternator</key>
<scope>application</scope>
<class>org.apache.velocity.tools.generic.AlternatorTool</class>
<parameter name="auto-alternate" value="true"/>
</tool>
template...
#set( $color = $alternator.auto('red', 'blue') )
## use manual alternation for this one
#set( $style = $alternator.manual(['hip','fly','groovy']) )
#foreach( $i in [1..5] )
Number $i is $color and $style. I dig $style.next numbers.
#end *
output...
Number 1 is red and hip. I dig hip numbers.
Number 2 is blue and fly. I dig fly numbers.
Number 3 is red and groovy. I dig groovy numbers.
Number 4 is blue and hip. I dig hip numbers.
Number 5 is red and fly. I dig fly numbers.
since: Velocity Tools 1.2 version: $Revision: 484710 $ $Date: 2006-12-08 11:40:42 -0800 (Fri, 08 Dec 2006) $ |
AUTO_ALTERNATE_DEFAULT_KEY | final public static String AUTO_ALTERNATE_DEFAULT_KEY(Code) | | since: VelocityTools 1.3 |
auto | public Alternator auto(List list)(Code) | | Make an automatic
Alternator from values in the specified List.
a new, automatic Alternator with the values in the List or null if the List is null . since: VelocityTools 1.3 |
auto | public Alternator auto(Object[] array)(Code) | | Make an automatic
Alternator from the specified object array.
a new, automatic Alternator with the values in the array or null if the array is null . since: VelocityTools 1.3 |
auto | public Alternator auto(Object o1, Object o2)(Code) | | Make an automatic
Alternator from a list containing the two
specified objects.
Parameters: o1 - The first of two objects for alternation between.Must be non-null . Parameters: o2 - The second of two objects for alternation between.Must be non-null . The new Alternator, or null if an argumentwas null . since: VelocityTools 1.3 |
configure | public void configure(Map params)(Code) | | Looks for a default auto-alternate value in the given params,
if not, set the default to true.
since: VelocityTools 1.3 |
getAutoAlternateDefault | public boolean getAutoAlternateDefault()(Code) | | Returns true if the default for auto-alternating is true.
since: VelocityTools 1.3 |
manual | public Alternator manual(List list)(Code) | | Make a manual
Alternator from values in the specified List.
a new, manual Alternator with the values in the List or null if the List is null . since: VelocityTools 1.3 |
manual | public Alternator manual(Object[] array)(Code) | | Make a manual
Alternator from the specified object array.
a new, manual Alternator with the values in the array or null if the array is null . since: VelocityTools 1.3 |
manual | public Alternator manual(Object o1, Object o2)(Code) | | Make a manual
Alternator from a list containing the two
specified objects.
Parameters: o1 - The first of two objects for alternation between.Must be non-null . Parameters: o2 - The second of two objects for alternation between.Must be non-null . The new Alternator, or null if an argumentwas null . since: VelocityTools 1.3 |
setAutoAlternateDefault | protected void setAutoAlternateDefault(boolean bool)(Code) | | Sets the default for auto-alternating.
since: VelocityTools 1.3 |
|
|