Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

With Tapestry's If component you can only test one condition at a time. In order to distinguish multiple cases, you'd have to write complex nested if/else constructs in your page template and have a checker method for each test inside your page class. Wiki Markup{float:right|background=#eee|padding=0 1em} *JumpStart Demo:* [If, Not, Negate, Switch, Else, Unless|http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/ifnotnegateswitchelseunless] {float}

 

Div
stylewidth: 20em; float:right
Panel
borderColor#eee
titleBGColor#eee
titleJumpStart Demo

 If, Not, Negate, Switch, Else, Unless

In cases where you have to distinguish multiple cases, the Delegate component comes in. It delegates rendering to some other component, for example a Block. For each case you have, you basically wrap the content inside a Block that doesn't get rendered by default. You then place a Delegate component on your page and point it to a method inside your page class that will decide which of your Blocks should be rendered.

...