All Packages Class Hierarchy This Package Previous Next Index
Class com.openly.dt.ConditionalText
com.openly.dt.EncodingDynamicTag | +----com.openly.dt.ParsingDynamicTag | +----com.openly.dt.ConditionalText
- public class ConditionalText
- extends com.openly.dt.ParsingDynamicTag
ConditionalText is a dynamic tag implementation uses argument 1 as the name of a switch parameter. It retrieves the value of the parameter, returns the second argument, as a dynamic tag (either as a DynamicTag class or Params item), if "true" or the third argument, as a dynamic tag, if "false". a String is true if not "", an Integer is true if >0 , and any other object is treated as a String. The result is interpreted as a dynamic tag, unless parameter starts with a quote character, in which case enclosing quotes are stripped and the string is returned. Conditional Text has a synonym in JSText, "if".
USAGE:
[[@if(inFrame,"target=_top",@template(noframetarget.tpl)]] means: if there is a non-empty value for inFrame in params, then replace the tag with "target=_top", otherwise insert template "noframetarget.tpl" [[@com.openly.dt.ConditionalText(for,for)]] means: if there is a non-empty value for "for" in params, then replace the tag with that value, otherwise insert nothing
- 2/8/01 fixed non-stripping of quotes when the object==null test was activated
- 6/21/01 parameter strings passed in by JSText can now have nested tags, so strings are assumed to be templates. commas now protected by quotes
- 1/10/02 the switch parameter can now be a dynamic tag
- 11/13/2002 the switch parameter can be an equality test x="1" or x=y. in the first case, params.getString("x") is called and compared to the value in quotes. In the second case params.getString("x") is compared to params.getString("y").
Check out Java and Linking related books at Openly.com!

-
ConditionalText() -

-
getValue(String, Params) -
-
main(String[]) -

ConditionalText public ConditionalText()

getValue public java.lang.String getValue(java.lang.String param, com.openly.util.Params params)
- Overrides:
- getValue in class com.openly.dt.EncodingDynamicTag
main public static void main(java.lang.String params[])
All Packages Class Hierarchy This Package Previous Next Index